From 3f3c84ec79d4cafffdd3901029a8cb6a93e82fbc Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 14:34:19 -0700 Subject: [PATCH 1/9] chore: remove RN --- .../analytics-react-native/.gitattributes | 3 - packages/analytics-react-native/.gitignore | 61 -- packages/analytics-react-native/CHANGELOG.md | 396 -------- packages/analytics-react-native/README.md | 174 ---- .../async-storage.ts | 2 - .../amplitude-react-native.podspec | 21 - .../android/build.gradle | 81 -- .../android/gradle.properties | 3 - .../android/src/main/AndroidManifest.xml | 4 - .../android/src/main/AndroidManifestNew.xml | 7 - .../reactnative/AmplitudeReactNativeModule.kt | 45 - .../AmplitudeReactNativePackage.java | 28 - .../reactnative/AndroidContextProvider.kt | 426 --------- .../amplitude/reactnative/AndroidLogger.kt | 56 -- .../java/com/amplitude/reactnative/Utils.kt | 34 - .../analytics-react-native/babel.config.js | 3 - .../AmplitudeReactNative-Bridging-Header.h | 1 - .../ios/AmplitudeReactNative.m | 7 - .../ios/AmplitudeReactNative.swift | 36 - .../project.pbxproj | 293 ------ .../ios/AppleContextProvider.swift | 231 ----- .../analytics-react-native/jest.config.js | 22 - packages/analytics-react-native/package.json | 94 -- packages/analytics-react-native/src/config.ts | 300 ------ .../src/cookie-migration/index.ts | 49 - packages/analytics-react-native/src/index.ts | 28 - .../src/plugins/context.ts | 104 -- .../src/react-native-client.ts | 413 -------- .../src/storage/local-storage.ts | 68 -- .../src/typings/browser-snippet.d.ts | 7 - .../src/typings/ua-parser.d.ts | 4 - .../src/utils/platform.ts | 9 - .../analytics-react-native/src/version.ts | 1 - .../test/config.test.ts | 380 -------- .../test/cookie-migration/index.test.ts | 114 --- .../test/helpers/constants.ts | 1 - .../test/helpers/default.ts | 48 - .../analytics-react-native/test/index.test.ts | 49 - .../async-storage.js | 1 - .../test/mock/setup-mobile.ts | 38 - .../test/mock/setup-web.ts | 19 - .../test/plugins/context.test.ts | 196 ---- .../test/react-native-client.test.ts | 889 ------------------ .../test/storage/local-storage.test.ts | 63 -- .../tsconfig.build.json | 4 - packages/analytics-react-native/tsconfig.json | 19 - 46 files changed, 4832 deletions(-) delete mode 100644 packages/analytics-react-native/.gitattributes delete mode 100644 packages/analytics-react-native/.gitignore delete mode 100644 packages/analytics-react-native/CHANGELOG.md delete mode 100644 packages/analytics-react-native/README.md delete mode 100644 packages/analytics-react-native/__mocks__/@react-native-async-storage/async-storage.ts delete mode 100644 packages/analytics-react-native/amplitude-react-native.podspec delete mode 100644 packages/analytics-react-native/android/build.gradle delete mode 100644 packages/analytics-react-native/android/gradle.properties delete mode 100644 packages/analytics-react-native/android/src/main/AndroidManifest.xml delete mode 100644 packages/analytics-react-native/android/src/main/AndroidManifestNew.xml delete mode 100644 packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.kt delete mode 100644 packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativePackage.java delete mode 100644 packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AndroidContextProvider.kt delete mode 100644 packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AndroidLogger.kt delete mode 100644 packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/Utils.kt delete mode 100644 packages/analytics-react-native/babel.config.js delete mode 100644 packages/analytics-react-native/ios/AmplitudeReactNative-Bridging-Header.h delete mode 100644 packages/analytics-react-native/ios/AmplitudeReactNative.m delete mode 100644 packages/analytics-react-native/ios/AmplitudeReactNative.swift delete mode 100644 packages/analytics-react-native/ios/AmplitudeReactNative.xcodeproj/project.pbxproj delete mode 100644 packages/analytics-react-native/ios/AppleContextProvider.swift delete mode 100644 packages/analytics-react-native/jest.config.js delete mode 100644 packages/analytics-react-native/package.json delete mode 100644 packages/analytics-react-native/src/config.ts delete mode 100644 packages/analytics-react-native/src/cookie-migration/index.ts delete mode 100644 packages/analytics-react-native/src/index.ts delete mode 100644 packages/analytics-react-native/src/plugins/context.ts delete mode 100644 packages/analytics-react-native/src/react-native-client.ts delete mode 100644 packages/analytics-react-native/src/storage/local-storage.ts delete mode 100644 packages/analytics-react-native/src/typings/browser-snippet.d.ts delete mode 100644 packages/analytics-react-native/src/typings/ua-parser.d.ts delete mode 100644 packages/analytics-react-native/src/utils/platform.ts delete mode 100644 packages/analytics-react-native/src/version.ts delete mode 100644 packages/analytics-react-native/test/config.test.ts delete mode 100644 packages/analytics-react-native/test/cookie-migration/index.test.ts delete mode 100644 packages/analytics-react-native/test/helpers/constants.ts delete mode 100644 packages/analytics-react-native/test/helpers/default.ts delete mode 100644 packages/analytics-react-native/test/index.test.ts delete mode 100644 packages/analytics-react-native/test/mock/@react-native-async-storage/async-storage.js delete mode 100644 packages/analytics-react-native/test/mock/setup-mobile.ts delete mode 100644 packages/analytics-react-native/test/mock/setup-web.ts delete mode 100644 packages/analytics-react-native/test/plugins/context.test.ts delete mode 100644 packages/analytics-react-native/test/react-native-client.test.ts delete mode 100644 packages/analytics-react-native/test/storage/local-storage.test.ts delete mode 100644 packages/analytics-react-native/tsconfig.build.json delete mode 100644 packages/analytics-react-native/tsconfig.json diff --git a/packages/analytics-react-native/.gitattributes b/packages/analytics-react-native/.gitattributes deleted file mode 100644 index 030ef1448..000000000 --- a/packages/analytics-react-native/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -*.pbxproj -text -# specific for windows script files -*.bat text eol=crlf \ No newline at end of file diff --git a/packages/analytics-react-native/.gitignore b/packages/analytics-react-native/.gitignore deleted file mode 100644 index 1a4e43769..000000000 --- a/packages/analytics-react-native/.gitignore +++ /dev/null @@ -1,61 +0,0 @@ -# OSX -# -.DS_Store - -# XDE -.expo/ - -# VSCode -.vscode/ -jsconfig.json - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IJ -# -.idea -.gradle -local.properties -android.iml -**/*/.project - -# Cocoapods -# -ios/Pods - -# node.js -# -node_modules/ -npm-debug.log -yarn-debug.log -yarn-error.log - -# BUCK -buck-out/ -\.buckd/ -android/app/libs -android/keystores/debug.keystore - -# Expo -.expo/* - -# generated by bob -lib/ diff --git a/packages/analytics-react-native/CHANGELOG.md b/packages/analytics-react-native/CHANGELOG.md deleted file mode 100644 index a047a52d6..000000000 --- a/packages/analytics-react-native/CHANGELOG.md +++ /dev/null @@ -1,396 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.6...@amplitude/analytics-react-native@1.1.7) (2023-05-04) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.5...@amplitude/analytics-react-native@1.1.6) (2023-04-27) - -### Bug Fixes - -- add connector event listener after plugins and queued functions - ([#378](https://github.com/amplitude/Amplitude-TypeScript/issues/378)) - ([a2fc8b6](https://github.com/amplitude/Amplitude-TypeScript/commit/a2fc8b6a7ec87dd8eab6538c1e9929c57804b899)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.4...@amplitude/analytics-react-native@1.1.5) (2023-04-27) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.3...@amplitude/analytics-react-native@1.1.4) (2023-04-25) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.2...@amplitude/analytics-react-native@1.1.3) (2023-04-06) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.1...@amplitude/analytics-react-native@1.1.2) (2023-03-31) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.1-beta.0...@amplitude/analytics-react-native@1.1.1) (2023-03-03) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.1-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.0...@amplitude/analytics-react-native@1.1.1-beta.0) (2023-03-03) - -### Bug Fixes - -- push user id and device id changes to analytics connector - ([#342](https://github.com/amplitude/Amplitude-TypeScript/issues/342)) - ([3214b08](https://github.com/amplitude/Amplitude-TypeScript/commit/3214b0836eb03e39b5753b1e6be30e1c2f5770ca)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.1.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.0-beta.1...@amplitude/analytics-react-native@1.1.0) (2023-02-27) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.1.0-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.1.0-beta.0...@amplitude/analytics-react-native@1.1.0-beta.1) (2023-02-24) - -### Bug Fixes - -- improper cookie usage ([#330](https://github.com/amplitude/Amplitude-TypeScript/issues/330)) - ([e670091](https://github.com/amplitude/Amplitude-TypeScript/commit/e670091e59014bb35bd9b3ec2a7192f259393575)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.1.0-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.0.1...@amplitude/analytics-react-native@1.1.0-beta.0) (2023-02-24) - -### Features - -- pass amplitude instance to plugin.setup for enhanced plugin capabilities - ([#328](https://github.com/amplitude/Amplitude-TypeScript/issues/328)) - ([91eeaa0](https://github.com/amplitude/Amplitude-TypeScript/commit/91eeaa0d6bff6bde39538bb54548a938df784462)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.0.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@1.0.0...@amplitude/analytics-react-native@1.0.1) (2023-02-09) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.0.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.8.0...@amplitude/analytics-react-native@1.0.0) (2023-02-02) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.8.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.8.0-beta.0...@amplitude/analytics-react-native@0.8.0) (2023-01-31) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.8.0-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.7.2...@amplitude/analytics-react-native@0.8.0-beta.0) (2023-01-26) - -### Bug Fixes - -- updates required kotlin version for react native SDK - ([9184714](https://github.com/amplitude/Amplitude-TypeScript/commit/9184714ed0173a468fda86429b734d9ef26d6f16)) - -### Features - -- allow opt out of deleting legacy sdk cookies - ([c6a82fb](https://github.com/amplitude/Amplitude-TypeScript/commit/c6a82fb52e1301e427116891d1f31208bcfc6548)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.7.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.7.1...@amplitude/analytics-react-native@0.7.2) (2023-01-11) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.7.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.7.0...@amplitude/analytics-react-native@0.7.1) (2022-12-21) - -### Bug Fixes - -- upgrade dependencies to resolve dependabot vulnerability alerts - ([#299](https://github.com/amplitude/Amplitude-TypeScript/issues/299)) - ([7dd1cd1](https://github.com/amplitude/Amplitude-TypeScript/commit/7dd1cd1b23a71981a4ad90b4b30cc9b7d28c4412)) - -### Reverts - -- Revert "Updated dependencies" - ([7ca9964](https://github.com/amplitude/Amplitude-TypeScript/commit/7ca9964781e4b900c6c027bdddf2ae1e7428ba18)) - -# [0.7.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.6.1...@amplitude/analytics-react-native@0.7.0) (2022-11-28) - -### Features - -- persisted event identifiers (React Native) ([#280](https://github.com/amplitude/Amplitude-TypeScript/issues/280)) - ([bd35e73](https://github.com/amplitude/Amplitude-TypeScript/commit/bd35e73a0a08db6609938d27f00f54cbf77ff6c1)) - -## [0.6.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.6.0...@amplitude/analytics-react-native@0.6.1) (2022-11-16) - -### Bug Fixes - -- exclude '**mocks**' from typescript declarations - ([#277](https://github.com/amplitude/Amplitude-TypeScript/issues/277)) - ([b6ed565](https://github.com/amplitude/Amplitude-TypeScript/commit/b6ed565928943e3c25fb584b7cd71a0f6d734603)) -- set React Native default session timeout to 5 minutes (same for other mobile devices) - ([#278](https://github.com/amplitude/Amplitude-TypeScript/issues/278)) - ([a456471](https://github.com/amplitude/Amplitude-TypeScript/commit/a4564719ccd0628690427f198a8ca83d60ceb1ac)) - -# [0.6.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.5.1...@amplitude/analytics-react-native@0.6.0) (2022-11-15) - -### Features - -- auto-tracking session events ([#263](https://github.com/amplitude/Amplitude-TypeScript/issues/263)) - ([75347c6](https://github.com/amplitude/Amplitude-TypeScript/commit/75347c61984832a6ade3ca9e6abe1bbd0faa6cde)) - -## [0.5.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.5.0...@amplitude/analytics-react-native@0.5.1) (2022-11-01) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# [0.5.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.11...@amplitude/analytics-react-native@0.5.0) (2022-11-01) - -### Features - -- enhance logger with debug information ([#254](https://github.com/amplitude/Amplitude-TypeScript/issues/254)) - ([5c6175e](https://github.com/amplitude/Amplitude-TypeScript/commit/5c6175e9372cbeea264ddb34c6cc68148063d4f7)) - -## [0.4.11](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.10...@amplitude/analytics-react-native@0.4.11) (2022-10-26) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.10](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.10-beta.1...@amplitude/analytics-react-native@0.4.10) (2022-10-25) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.10-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.10-beta.0...@amplitude/analytics-react-native@0.4.10-beta.1) (2022-10-25) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.10-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.9...@amplitude/analytics-react-native@0.4.10-beta.0) (2022-10-25) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.9](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.8...@amplitude/analytics-react-native@0.4.9) (2022-10-25) - -### Bug Fixes - -- add safe check for global scope before loading SDK - ([#252](https://github.com/amplitude/Amplitude-TypeScript/issues/252)) - ([a3f4f6f](https://github.com/amplitude/Amplitude-TypeScript/commit/a3f4f6f7b11abd9cdbdf064e31e32d5fc3e92031)) -- invoke pre-init track fns after attribution ([#253](https://github.com/amplitude/Amplitude-TypeScript/issues/253)) - ([b8996d7](https://github.com/amplitude/Amplitude-TypeScript/commit/b8996d793f74d388c1a96e0cde5c0ac060c1e565)) - -## [0.4.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.7...@amplitude/analytics-react-native@0.4.8) (2022-10-14) - -### Bug Fixes - -- update userId/deviceId in identify call if eventOptions contains userId/deviceId - ([#244](https://github.com/amplitude/Amplitude-TypeScript/issues/244)) - ([578cbe2](https://github.com/amplitude/Amplitude-TypeScript/commit/578cbe218de84d7fdd4930f75820beda6f85ce6d)) - -## [0.4.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.6...@amplitude/analytics-react-native@0.4.7) (2022-10-04) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.5...@amplitude/analytics-react-native@0.4.6) (2022-09-30) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.4...@amplitude/analytics-react-native@0.4.5) (2022-09-30) - -### Bug Fixes - -- cover the case when apiKey is missing in the runtime - ([#240](https://github.com/amplitude/Amplitude-TypeScript/issues/240)) - ([308bbe8](https://github.com/amplitude/Amplitude-TypeScript/commit/308bbe8337cbab366a0ca255f2d665101f4781a0)) - -## [0.4.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.4-beta.1...@amplitude/analytics-react-native@0.4.4) (2022-09-28) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.4-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.4-beta.0...@amplitude/analytics-react-native@0.4.4-beta.1) (2022-09-27) - -### Bug Fixes - -- define correct dependencies for @amplitude/analytics-connector - ([#234](https://github.com/amplitude/Amplitude-TypeScript/issues/234)) - ([41c1351](https://github.com/amplitude/Amplitude-TypeScript/commit/41c1351e441b890b016ba123c4ed5747a4c33adb)) - -## [0.4.4-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.3...@amplitude/analytics-react-native@0.4.4-beta.0) (2022-09-26) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.2...@amplitude/analytics-react-native@0.4.3) (2022-09-26) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.1...@amplitude/analytics-react-native@0.4.2) (2022-09-22) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.4.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.4.0...@amplitude/analytics-react-native@0.4.1) (2022-09-16) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -# [0.4.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.3.3...@amplitude/analytics-react-native@0.4.0) (2022-09-08) - -### Features - -- add ingestion_metadata field ([#212](https://github.com/amplitude/Amplitude-TypeScript/issues/212)) - ([ebe8448](https://github.com/amplitude/Amplitude-TypeScript/commit/ebe8448b23609134f846e18da2e769158ca30bf1)) - -## [0.3.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.3.2...@amplitude/analytics-react-native@0.3.3) (2022-08-31) - -**Note:** Version bump only for package @amplitude/analytics-react-native - -## [0.3.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.3.1...@amplitude/analytics-react-native@0.3.2) (2022-08-29) - -### Bug Fixes - -- add conditional check for window.location.search - ([#198](https://github.com/amplitude/Amplitude-TypeScript/issues/198)) - ([e61b4db](https://github.com/amplitude/Amplitude-TypeScript/commit/e61b4db25e2e7677a3dcb2c8e71f26bcac9a9fd5)) - -## [0.3.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.3.0...@amplitude/analytics-react-native@0.3.1) (2022-08-23) - -### Bug Fixes - -- pass options to testStorage ([#201](https://github.com/amplitude/Amplitude-TypeScript/issues/201)) - ([6e22eb0](https://github.com/amplitude/Amplitude-TypeScript/commit/6e22eb0c101c743b15bb49d9491082fd1fe1d90e)) - -# [0.3.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.2.4...@amplitude/analytics-react-native@0.3.0) (2022-08-18) - -### Bug Fixes - -- handle parsing malformed urls for web attribution - ([#192](https://github.com/amplitude/Amplitude-TypeScript/issues/192)) - ([cd254d6](https://github.com/amplitude/Amplitude-TypeScript/commit/cd254d6319d8bc7d92affc263ec12c9c39f82fb2)) -- prevent concurrent init calls ([#191](https://github.com/amplitude/Amplitude-TypeScript/issues/191)) - ([efda076](https://github.com/amplitude/Amplitude-TypeScript/commit/efda0760f4f1e92e47a3150985e18efcc3b108d9)) -- removes unused tracking options ([#193](https://github.com/amplitude/Amplitude-TypeScript/issues/193)) - ([2b57a8e](https://github.com/amplitude/Amplitude-TypeScript/commit/2b57a8e07971312b40c8287e2daddcfb2b55a832)) - -### Features - -- adds create instance api ([#188](https://github.com/amplitude/Amplitude-TypeScript/issues/188)) - ([050c1d9](https://github.com/amplitude/Amplitude-TypeScript/commit/050c1d96cedbc9e68aedf6fd55e85d2d3dc2fee4)) - -## [0.2.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.2.3...@amplitude/analytics-react-native@0.2.4) (2022-08-16) - -### Bug Fixes - -- enable adid by default - ([a24dfe0](https://github.com/amplitude/Amplitude-TypeScript/commit/a24dfe05291fd51da50f531990f68ed27dcca7c8)) - -## [0.2.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.2.2...@amplitude/analytics-react-native@0.2.3) (2022-08-13) - -### Bug Fixes - -- correct platform and add adid ([#184](https://github.com/amplitude/Amplitude-TypeScript/issues/184)) - ([7134a43](https://github.com/amplitude/Amplitude-TypeScript/commit/7134a4398844516f3d868daf82df9cf2e19d3c39)) - -## [0.2.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.2.1...@amplitude/analytics-react-native@0.2.2) (2022-08-12) - -### Bug Fixes - -- add callable queue when init is pending ([#181](https://github.com/amplitude/Amplitude-TypeScript/issues/181)) - ([d8fc361](https://github.com/amplitude/Amplitude-TypeScript/commit/d8fc36195b96e2c10ccc5106027beaa7e970e0c0)) - -## [0.2.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.2.0...@amplitude/analytics-react-native@0.2.1) (2022-08-02) - -### Bug Fixes - -- implement integration with experiment sdk for browser - ([#156](https://github.com/amplitude/Amplitude-TypeScript/issues/156)) - ([075ba84](https://github.com/amplitude/Amplitude-TypeScript/commit/075ba84bb4d05fb6a256272d19c03cb692cb0c28)) - -# [0.2.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.1.1...@amplitude/analytics-react-native@0.2.0) (2022-07-29) - -### Features - -- add reset method for resetting userId and deviceId - ([#157](https://github.com/amplitude/Amplitude-TypeScript/issues/157)) - ([8bfc864](https://github.com/amplitude/Amplitude-TypeScript/commit/8bfc864b15dd7e427556a50bc3de6b43b2485189)) - -## [0.1.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-react-native@0.1.0...@amplitude/analytics-react-native@0.1.1) (2022-07-22) - -### Bug Fixes - -- missing tracked events before init issue ([#144](https://github.com/amplitude/Amplitude-TypeScript/issues/144)) - ([60d0f68](https://github.com/amplitude/Amplitude-TypeScript/commit/60d0f6848087f7b8fc3c870d55489a238e841b26)) -- removes saveEvents config ([#147](https://github.com/amplitude/Amplitude-TypeScript/issues/147)) - ([6fde736](https://github.com/amplitude/Amplitude-TypeScript/commit/6fde736ca8a865462522082a8085673756dbcc7d)) -- update default flush config for node ([#152](https://github.com/amplitude/Amplitude-TypeScript/issues/152)) - ([2445dff](https://github.com/amplitude/Amplitude-TypeScript/commit/2445dff0842e7e0a2b7ee767ab926b5a93348214)) - -# 0.1.0 (2022-07-15) - -### Features - -- react-native with web support ([#126](https://github.com/amplitude/Amplitude-TypeScript/issues/126)) - ([5384130](https://github.com/amplitude/Amplitude-TypeScript/commit/5384130904d19b4b6cf4b43826efa2b373b47b85)) diff --git a/packages/analytics-react-native/README.md b/packages/analytics-react-native/README.md deleted file mode 100644 index 8b3c66b3b..000000000 --- a/packages/analytics-react-native/README.md +++ /dev/null @@ -1,174 +0,0 @@ -

- - - -
-

- -# @amplitude/analytics-react-native - -Official Amplitude SDK for React Native (Beta) - -# Installation and Quick Start - -Please visit our :100:[Developer Center](https://www.docs.developers.amplitude.com/data/sdks/typescript-react-native/) for instructions on installing and using our the SDK. - -## Installation - -To get started with using Amplitude React Native SDK, install the package to your project via NPM. In addition, this package relies on `@react-native-async-storage/async-storage`, which must also be installed. - -```sh -# npm -npm install @amplitude/analytics-react-native -npm install @react-native-async-storage/async-storage - -# yarn -yarn add @amplitude/analytics-react-native -yarn add @react-native-async-storage/async-storage -``` - -## Usage - -### Initializing SDK - -Initialization is necessary before any instrumentation is done. The API key for your Amplitude project is required. - -```typescript -amplitude.init(API_KEY); -``` - -### Set UserId - -Sets an `userId` (usually called after user logs in). -```typescript -import { setUserId } from '@amplitude/analytics-react-native'; - -setUserId('xxxxx'); -``` - - -### Tracking an Event - -Events represent how users interact with your application. For example, “Button Clicked” may be an action you want to note. - -```typescript -import { track } from '@amplitude/analytics-react-native'; - -// Track a basic event -track('Button Clicked'); - -// Track events with additional properties -const eventProperties = { - selectedColors: ['red', 'blue'], -}; -track('Button Clicked', eventProperties); -``` - -### User Properties - -User properties help you understand your users at the time they performed some action within your app such as their device details, their preferences, or language. - -```typescript -import { Identify, identify } from '@amplitude/analytics-react-native'; - -const event = new Identify(); - -// sets the value of a user property -event.set('key1', 'value1'); - -// sets the value of a user property only once -event.setOnce('key1', 'value1'); - -// increments a user property by some numerical value. -event.add('value1', 10); - -// pre inserts a value or values to a user property -event.preInsert('ab-tests', 'new-user-test'); - -// post inserts a value or values to a user property -event.postInsert('ab-tests', 'new-user-test'); - -// removes a value or values to a user property -event.remove('ab-tests', 'new-user-test') - -// sends identify event -identify(event); -``` - -### prepend/append - -* append will append a value or values to a user property array. -* prepend will prepend a value or values to a user property. - -### User Groups - -```typescript -import { setGroup } from '@amplitude/analytics-react-native'; - -// set group with single group name -setGroup('orgId', '15'); - -// set group with multiple group names -setGroup('sport', ['soccer', 'tennis']); -``` - -### Group Identify - -This feature is only available to Growth and Enterprise customers who have purchased the [Accounts add-on](https://amplitude.zendesk.com/hc/en-us/articles/115001765532). - -Use the Group Identify API to set or update properties of particular groups. However, these updates will only affect events going forward. - -```typescript -import { Identify, groupIdentify } from '@amplitude/analytics-react-native'; - -const groupType = 'plan'; -const groupName = 'enterprise'; -const identity = new Identify() -identity.set('key1', 'value1'); - -groupIdentify(groupType, groupName, identity); -``` - -### Track Revenue - -Revenue instances will store each revenue transaction and allow you to define several special revenue properties (such as 'revenueType', 'productIdentifier', etc.) that are used in Amplitude's Event Segmentation and Revenue LTV charts. These Revenue instance objects are then passed into `revenue` to send as revenue events to Amplitude. This allows us to automatically display data relevant to revenue in the platform. You can use this to track both in-app and non-in-app purchases. - -```typescript -import { Revenue, revenue } from '@amplitude/analytics-react-native'; - -const event = new Revenue() - .setProductId('com.company.productId') - .setPrice(3.99) - .setQuantity(3); - -revenue(event); -``` - -### Callback - -All asynchronous API are optionally awaitable through a specific Promise interface. This also serves as callback interface. - -```typescript -// Using async/await -const results = await track('Button Clicked').promise; -result.event; // {...} (The final event object sent to Amplitude) -result.code; // 200 (The HTTP response status code of the request. -result.message; // "Event tracked successfully" (The response message) - -// Using promises -track('Button Clicked').promise.then((result) => { - result.event; // {...} (The final event object sent to Amplitude) - result.code; // 200 (The HTTP response status code of the request. - result.message; // "Event tracked successfully" (The response message) -}); -``` - -### User Log out - -This updates user ID and device ID. After calling `reset()` the succeeding events now belong to a new user identity. - -```typescript -import { reset } from '@amplitude/analytics-react-native'; - -reset(); -``` diff --git a/packages/analytics-react-native/__mocks__/@react-native-async-storage/async-storage.ts b/packages/analytics-react-native/__mocks__/@react-native-async-storage/async-storage.ts deleted file mode 100644 index b7779faa3..000000000 --- a/packages/analytics-react-native/__mocks__/@react-native-async-storage/async-storage.ts +++ /dev/null @@ -1,2 +0,0 @@ -import AsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'; -export default AsyncStorage; diff --git a/packages/analytics-react-native/amplitude-react-native.podspec b/packages/analytics-react-native/amplitude-react-native.podspec deleted file mode 100644 index b61bac981..000000000 --- a/packages/analytics-react-native/amplitude-react-native.podspec +++ /dev/null @@ -1,21 +0,0 @@ -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "package.json"))) - -Pod::Spec.new do |s| - s.name = "amplitude-react-native" - s.version = package["version"] - s.summary = package["description"] - s.homepage = package["homepage"] - s.license = package["license"] - s.authors = package["author"] - - s.swift_version = "5.0" - - s.platforms = { :ios => "10.0", :tvos => "10.0" } - s.source = { :git => "https://github.com/amplitude/Amplitude-TypeScript.git", :tag => "#{s.version}" } - - s.source_files = "ios/**/*.{h,m,mm,swift}" - - s.dependency "React-Core" -end diff --git a/packages/analytics-react-native/android/build.gradle b/packages/analytics-react-native/android/build.gradle deleted file mode 100644 index b13750b59..000000000 --- a/packages/analytics-react-native/android/build.gradle +++ /dev/null @@ -1,81 +0,0 @@ -buildscript { - ext.kotlinVersion = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : "1.5.30" - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - } -} - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -def safeExtGet(prop, fallback) { - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback -} - -def isSupportNamespace() { - def apgParsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') - def agpMajorVersion = apgParsed[0].toInteger() - def agpMinorVersion = apgParsed[1].toInteger() - - /** - * Namespace is added in AGP 7.3 and is required starting from AGP 8.x. - * See: https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes#namespace-dsl - */ - return (agpMajorVersion == 7 && agpMinorVersion >= 3) || agpMajorVersion >= 8 -} - -android { - if (isSupportNamespace()) { - namespace "com.amplitude.reactnative" - - sourceSets { - main { - manifest.srcFile "src/main/AndroidManifestNew.xml" - } - } - } - - compileSdkVersion safeExtGet('compileSdkVersion', 29) - buildToolsVersion safeExtGet('buildToolsVersion', '29.0.2') - defaultConfig { - minSdkVersion safeExtGet('minSdkVersion', 16) - targetSdkVersion safeExtGet('targetSdkVersion', 29) - versionCode 1 - versionName "1.0" - - } - - buildTypes { - release { - minifyEnabled false - } - } - lintOptions { - disable 'GradleCompatible' - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -repositories { - mavenLocal() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url("$rootDir/../node_modules/react-native/android") - } - google() - jcenter() -} - -dependencies { - //noinspection GradleDynamicVersion - implementation "com.facebook.react:react-native:+" // From node_modules -} diff --git a/packages/analytics-react-native/android/gradle.properties b/packages/analytics-react-native/android/gradle.properties deleted file mode 100644 index 0695addab..000000000 --- a/packages/analytics-react-native/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -android.useAndroidX=true -android.enableJetifier=true -kotlin.code.style=official diff --git a/packages/analytics-react-native/android/src/main/AndroidManifest.xml b/packages/analytics-react-native/android/src/main/AndroidManifest.xml deleted file mode 100644 index b96ee3824..000000000 --- a/packages/analytics-react-native/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/packages/analytics-react-native/android/src/main/AndroidManifestNew.xml b/packages/analytics-react-native/android/src/main/AndroidManifestNew.xml deleted file mode 100644 index 3f64a9936..000000000 --- a/packages/analytics-react-native/android/src/main/AndroidManifestNew.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.kt b/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.kt deleted file mode 100644 index e8fb30c16..000000000 --- a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativeModule.kt +++ /dev/null @@ -1,45 +0,0 @@ -package com.amplitude.reactnative - -import com.facebook.react.bridge.Promise -import com.facebook.react.module.annotations.ReactModule -import com.facebook.react.bridge.ReactApplicationContext -import com.facebook.react.bridge.ReactContextBaseJavaModule -import com.facebook.react.bridge.ReactMethod -import com.facebook.react.bridge.ReadableMap -import com.facebook.react.bridge.WritableNativeMap - -const val MODULE_NAME = "AmplitudeReactNative" - -@ReactModule(name = MODULE_NAME) -class AmplitudeReactNativeModule(private val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) { - - private var androidContextProvider: AndroidContextProvider? = null - - override fun getName(): String { - return MODULE_NAME - } - - @ReactMethod - private fun getApplicationContext(options: ReadableMap, promise: Promise) { - val trackAdid = if (options.hasKey("adid")) options.getBoolean("adid") else false - if (androidContextProvider == null) { - androidContextProvider = AndroidContextProvider(reactContext.applicationContext, false, trackAdid) - } - - promise.resolve(WritableNativeMap().apply { - putString("version", androidContextProvider!!.versionName) - putString("platform", androidContextProvider!!.platform) - putString("language", androidContextProvider!!.language) - putString("osName", androidContextProvider!!.osName) - putString("osVersion", androidContextProvider!!.osVersion) - putString("deviceBrand", androidContextProvider!!.brand) - putString("deviceManufacturer", androidContextProvider!!.manufacturer) - putString("deviceModel", androidContextProvider!!.model) - putString("carrier", androidContextProvider!!.carrier) - if (trackAdid) { - putString("adid", androidContextProvider!!.advertisingId) - } - putString("appSetId", androidContextProvider!!.appSetId) - }) - } -} diff --git a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativePackage.java b/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativePackage.java deleted file mode 100644 index 65671bf66..000000000 --- a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AmplitudeReactNativePackage.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.amplitude.reactnative; - -import androidx.annotation.NonNull; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class AmplitudeReactNativePackage implements ReactPackage { - @NonNull - @Override - public List createNativeModules(@NonNull ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - modules.add(new AmplitudeReactNativeModule(reactContext)); - return modules; - } - - @NonNull - @Override - public List createViewManagers(@NonNull ReactApplicationContext reactContext) { - return Collections.emptyList(); - } -} diff --git a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AndroidContextProvider.kt b/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AndroidContextProvider.kt deleted file mode 100644 index 11297ad8a..000000000 --- a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AndroidContextProvider.kt +++ /dev/null @@ -1,426 +0,0 @@ -package com.amplitude.reactnative - -import android.content.Context -import android.content.pm.PackageInfo -import android.content.pm.PackageManager -import android.content.res.Resources -import android.location.Geocoder -import android.location.Location -import android.location.LocationManager -import android.os.Build -import android.provider.Settings.Secure -import android.telephony.TelephonyManager -import java.io.IOException -import java.lang.Exception -import java.lang.IllegalArgumentException -import java.lang.IllegalStateException -import java.lang.NullPointerException -import java.lang.reflect.InvocationTargetException -import java.util.Locale -import java.util.UUID -import kotlin.collections.ArrayList - -class AndroidContextProvider(private val context: Context, locationListening: Boolean, shouldTrackAdid: Boolean) { - var isLocationListening = true - var shouldTrackAdid = true - private var cachedInfo: CachedInfo? = null - private get() { - if (field == null) { - field = CachedInfo() - } - return field - } - - /** - * Internal class serves as a cache - */ - inner class CachedInfo { - var advertisingId: String? - val country: String? - val versionName: String? - val osName: String - val platform: String - val osVersion: String - val brand: String - val manufacturer: String - val model: String - val carrier: String? - val language: String - var limitAdTrackingEnabled: Boolean = true - val gpsEnabled: Boolean - var appSetId: String - - init { - advertisingId = fetchAdvertisingId() - versionName = fetchVersionName() - osName = OS_NAME - platform = PLATFORM - osVersion = fetchOsVersion() - brand = fetchBrand() - manufacturer = fetchManufacturer() - model = fetchModel() - carrier = fetchCarrier() - country = fetchCountry() - language = fetchLanguage() - gpsEnabled = checkGPSEnabled() - appSetId = fetchAppSetId() - } - - /** - * Internal methods for getting raw information - */ - private fun fetchVersionName(): String? { - val packageInfo: PackageInfo - try { - packageInfo = context.packageManager.getPackageInfo(context.packageName, 0) - return packageInfo.versionName - } catch (e: PackageManager.NameNotFoundException) { - } catch (e: Exception) { - } - return null - } - - private fun fetchOsVersion(): String { - return Build.VERSION.RELEASE - } - - private fun fetchBrand(): String { - return Build.BRAND - } - - private fun fetchManufacturer(): String { - return Build.MANUFACTURER - } - - private fun fetchModel(): String { - return Build.MODEL - } - - private fun fetchCarrier(): String? { - try { - val manager = context - .getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager - return manager.networkOperatorName - } catch (e: Exception) { - // Failed to get network operator name from network - } - return null - } - - private fun fetchCountry(): String? { - // This should not be called on the main thread. - - // Prioritize reverse geocode, but until we have a result from that, - // we try to grab the country from the network, and finally the locale - var country = countryFromLocation - if (!country.isNullOrEmpty()) { - return country - } - country = countryFromNetwork - return if (!country.isNullOrEmpty()) { - country - } else countryFromLocale - } // Customized Android System without Google Play Service Installed// sometimes the location manager is unavailable// Bad lat / lon values can cause Geocoder to throw IllegalArgumentExceptions// failed to fetch geocoder// Failed to reverse geocode location - - // Failed to reverse geocode location - private val countryFromLocation: String? - private get() { - if (!isLocationListening) { - return null - } - val recent = mostRecentLocation - if (recent != null) { - try { - if (Geocoder.isPresent()) { - val geocoder = geocoder - val addresses = geocoder.getFromLocation( - recent.latitude, - recent.longitude, 1 - ) - if (addresses != null) { - for (address in addresses) { - if (address != null) { - return address.countryCode - } - } - } - } - } catch (e: IOException) { - // Failed to reverse geocode location - } catch (e: NullPointerException) { - // Failed to reverse geocode location - } catch (e: NoSuchMethodError) { - // failed to fetch geocoder - } catch (e: IllegalArgumentException) { - // Bad lat / lon values can cause Geocoder to throw IllegalArgumentExceptions - } catch (e: IllegalStateException) { - // sometimes the location manager is unavailable - } catch (e: SecurityException) { - // Customized Android System without Google Play Service Installed - } - } - return null - } - - // Failed to get country from network - private val countryFromNetwork: String? - private get() { - try { - val manager = context - .getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager - if (manager.phoneType != TelephonyManager.PHONE_TYPE_CDMA) { - val country = manager.networkCountryIso - if (country != null) { - return country.toUpperCase(Locale.US) - } - } - } catch (e: Exception) { - // Failed to get country from network - } - return null - } - - private val locale: Locale - private get() { - val configuration = Resources.getSystem().configuration - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - val localeList = configuration.locales - if (localeList.isEmpty) { - return Locale.getDefault() - } else { - return localeList.get(0) - } - } else { - return configuration.locale - } - } - - private val countryFromLocale: String - private get() = locale.country - - private fun fetchLanguage(): String { - return locale.language - } - - private fun fetchAdvertisingId(): String? { - if (!shouldTrackAdid) { - return null - } - - // This should not be called on the main thread. - return if ("Amazon" == fetchManufacturer()) { - fetchAndCacheAmazonAdvertisingId - } else { - fetchAndCacheGoogleAdvertisingId - } - } - - private fun fetchAppSetId(): String { - try { - val AppSet = Class - .forName("com.google.android.gms.appset.AppSet") - val getClient = AppSet.getMethod("getClient", Context::class.java) - val appSetIdClient = getClient.invoke(null, context) - val getAppSetIdInfo = appSetIdClient.javaClass.getMethod("getAppSetIdInfo") - val taskWithAppSetInfo = getAppSetIdInfo.invoke(appSetIdClient) - val Tasks = Class.forName("com.google.android.gms.tasks.Tasks") - val await = - Tasks.getMethod("await", Class.forName("com.google.android.gms.tasks.Task")) - val appSetInfo = await.invoke(null, taskWithAppSetInfo) - val getId = appSetInfo.javaClass.getMethod("getId") - appSetId = getId.invoke(appSetInfo) as String - } catch (e: ClassNotFoundException) { - LogcatLogger.logger - .warn("Google Play Services SDK not found for app set id!") - } catch (e: InvocationTargetException) { - LogcatLogger.logger.warn("Google Play Services not available for app set id") - } catch (e: Exception) { - LogcatLogger.logger.error( - "Encountered an error connecting to Google Play Services for app set id" - ) - } - return appSetId - } - - private val fetchAndCacheAmazonAdvertisingId: String? - private get() { - val cr = context.contentResolver - limitAdTrackingEnabled = Secure.getInt(cr, SETTING_LIMIT_AD_TRACKING, 0) == 1 - advertisingId = Secure.getString(cr, SETTING_ADVERTISING_ID) - return advertisingId - } - private val fetchAndCacheGoogleAdvertisingId: String? - private get() { - try { - val AdvertisingIdClient = Class - .forName("com.google.android.gms.ads.identifier.AdvertisingIdClient") - val getAdvertisingInfo = AdvertisingIdClient.getMethod( - "getAdvertisingIdInfo", - Context::class.java - ) - val advertisingInfo = getAdvertisingInfo.invoke(null, context) - val isLimitAdTrackingEnabled = advertisingInfo.javaClass.getMethod( - "isLimitAdTrackingEnabled" - ) - val limitAdTrackingEnabled = isLimitAdTrackingEnabled - .invoke(advertisingInfo) as Boolean - this.limitAdTrackingEnabled = - limitAdTrackingEnabled != null && limitAdTrackingEnabled - val getId = advertisingInfo.javaClass.getMethod("getId") - advertisingId = getId.invoke(advertisingInfo) as String - } catch (e: ClassNotFoundException) { - LogcatLogger.logger - .warn("Google Play Services SDK not found for advertising id!") - } catch (e: InvocationTargetException) { - LogcatLogger.logger - .warn("Google Play Services not available for advertising id") - } catch (e: Exception) { - LogcatLogger.logger.error( - "Encountered an error connecting to Google Play Services for advertising id" - ) - } - return advertisingId - } - - private fun checkGPSEnabled(): Boolean { - // This should not be called on the main thread. - try { - val GPSUtil = Class - .forName("com.google.android.gms.common.GooglePlayServicesUtil") - val getGPSAvailable = GPSUtil.getMethod( - "isGooglePlayServicesAvailable", - Context::class.java - ) - val status = getGPSAvailable.invoke(null, context) as Int - // status 0 corresponds to com.google.android.gms.common.ConnectionResult.SUCCESS; - return status != null && status == 0 - } catch (e: NoClassDefFoundError) { - LogcatLogger.logger.warn("Google Play Services Util not found!") - } catch (e: ClassNotFoundException) { - LogcatLogger.logger.warn("Google Play Services Util not found!") - } catch (e: NoSuchMethodException) { - LogcatLogger.logger.warn("Google Play Services not available") - } catch (e: InvocationTargetException) { - LogcatLogger.logger.warn("Google Play Services not available") - } catch (e: IllegalAccessException) { - LogcatLogger.logger.warn("Google Play Services not available") - } catch (e: Exception) { - LogcatLogger.logger.warn( - "Error when checking for Google Play Services: $e" - ) - } - return false - } - } - - fun prefetch() { - cachedInfo - } - - fun isGooglePlayServicesEnabled(): Boolean { - return cachedInfo!!.gpsEnabled - } - - fun isLimitAdTrackingEnabled(): Boolean { - return cachedInfo!!.limitAdTrackingEnabled - } - - val versionName: String? - get() = cachedInfo!!.versionName - val osName: String - get() = cachedInfo!!.osName - val platform: String - get() = cachedInfo!!.platform - val osVersion: String - get() = cachedInfo!!.osVersion - val brand: String - get() = cachedInfo!!.brand - val manufacturer: String - get() = cachedInfo!!.manufacturer - val model: String - get() = cachedInfo!!.model - val carrier: String? - get() = cachedInfo!!.carrier - val country: String? - get() = cachedInfo!!.country - val language: String - get() = cachedInfo!!.language - val advertisingId: String? - get() = cachedInfo!!.advertisingId - val appSetId: String - get() = cachedInfo!!.appSetId // other causes// failed to get providers list - // Don't crash if the device does not have location services. - - // It's possible that the location service is running out of process - // and the remote getProviders call fails. Handle null provider lists. - val mostRecentLocation: Location? - get() { - if (!isLocationListening) { - return null - } - if (!Utils.checkLocationPermissionAllowed(context)) { - return null - } - val locationManager = context - .getSystemService(Context.LOCATION_SERVICE) as LocationManager - ?: return null - - // Don't crash if the device does not have location services. - - // It's possible that the location service is running out of process - // and the remote getProviders call fails. Handle null provider lists. - var providers: List? = null - try { - providers = locationManager.getProviders(true) - } catch (e: SecurityException) { - // failed to get providers list - } catch (e: Exception) { - // other causes - } - if (providers == null) { - return null - } - val locations: MutableList = ArrayList() - for (provider in providers) { - var location: Location? = null - try { - location = locationManager.getLastKnownLocation(provider!!) - } catch (e: SecurityException) { - LogcatLogger.logger.warn("Failed to get most recent location") - } catch (e: Exception) { - LogcatLogger.logger.warn("Failed to get most recent location") - } - if (location != null) { - locations.add(location) - } - } - var maximumTimestamp: Long = -1 - var bestLocation: Location? = null - for (location in locations) { - if (location.time > maximumTimestamp) { - maximumTimestamp = location.time - bestLocation = location - } - } - return bestLocation - } - - // @VisibleForTesting - protected val geocoder: Geocoder - protected get() = Geocoder(context, Locale.ENGLISH) - - companion object { - const val OS_NAME = "android" - const val PLATFORM = "Android" - const val SETTING_LIMIT_AD_TRACKING = "limit_ad_tracking" - const val SETTING_ADVERTISING_ID = "advertising_id" - fun generateUUID(): String { - return UUID.randomUUID().toString() - } - } - - init { - isLocationListening = locationListening - this.shouldTrackAdid = shouldTrackAdid - } -} diff --git a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AndroidLogger.kt b/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AndroidLogger.kt deleted file mode 100644 index 0c0e57148..000000000 --- a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/AndroidLogger.kt +++ /dev/null @@ -1,56 +0,0 @@ -package com.amplitude.reactnative - -import android.util.Log - -interface Logger { - enum class LogMode(i: Int) { - DEBUG(1), - INFO(2), - WARN(3), - ERROR(4), - OFF(5) - } - - var logMode: LogMode - - fun debug(message: String) - - fun error(message: String) - - fun info(message: String) - - fun warn(message: String) -} - -class LogcatLogger() : Logger { - override var logMode: Logger.LogMode = Logger.LogMode.INFO - private val tag = "Amplitude" - - override fun debug(message: String) { - if (logMode <= Logger.LogMode.DEBUG) { - Log.d(tag, message) - } - } - - override fun error(message: String) { - if (logMode <= Logger.LogMode.ERROR) { - Log.e(tag, message) - } - } - - override fun info(message: String) { - if (logMode <= Logger.LogMode.INFO) { - Log.i(tag, message) - } - } - - override fun warn(message: String) { - if (logMode <= Logger.LogMode.WARN) { - Log.w(tag, message) - } - } - - companion object { - val logger = LogcatLogger() - } -} diff --git a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/Utils.kt b/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/Utils.kt deleted file mode 100644 index 39a37b5d6..000000000 --- a/packages/analytics-react-native/android/src/main/java/com/amplitude/reactnative/Utils.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.amplitude.reactnative - -import android.Manifest -import android.app.Activity -import android.content.Context -import android.content.pm.PackageManager -import android.os.Build - -object Utils { - - fun checkLocationPermissionAllowed(context: Context?): Boolean { - return checkPermissionAllowed(context, Manifest.permission.ACCESS_COARSE_LOCATION) || - checkPermissionAllowed(context, Manifest.permission.ACCESS_FINE_LOCATION) - } - - fun checkPermissionAllowed(context: Context?, permission: String?): Boolean { - // ANDROID 6.0 AND UP! - return if (Build.VERSION.SDK_INT >= 23) { - var hasPermission = false - try { - // Invoke checkSelfPermission method from Android 6 (API 23 and UP) - val methodCheckPermission = - Activity::class.java.getMethod("checkSelfPermission", String::class.java) - val resultObj = methodCheckPermission.invoke(context, permission) - val result = resultObj.toString().toInt() - hasPermission = result == PackageManager.PERMISSION_GRANTED - } catch (ex: Exception) { - } - hasPermission - } else { - true - } - } -} diff --git a/packages/analytics-react-native/babel.config.js b/packages/analytics-react-native/babel.config.js deleted file mode 100644 index f842b77fc..000000000 --- a/packages/analytics-react-native/babel.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - presets: ['module:metro-react-native-babel-preset'], -}; diff --git a/packages/analytics-react-native/ios/AmplitudeReactNative-Bridging-Header.h b/packages/analytics-react-native/ios/AmplitudeReactNative-Bridging-Header.h deleted file mode 100644 index 5fff35c15..000000000 --- a/packages/analytics-react-native/ios/AmplitudeReactNative-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import diff --git a/packages/analytics-react-native/ios/AmplitudeReactNative.m b/packages/analytics-react-native/ios/AmplitudeReactNative.m deleted file mode 100644 index 8f3aa47f2..000000000 --- a/packages/analytics-react-native/ios/AmplitudeReactNative.m +++ /dev/null @@ -1,7 +0,0 @@ -#import - -@interface RCT_EXTERN_MODULE(AmplitudeReactNative, NSObject) - -RCT_EXTERN_METHOD(getApplicationContext: (NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) - -@end diff --git a/packages/analytics-react-native/ios/AmplitudeReactNative.swift b/packages/analytics-react-native/ios/AmplitudeReactNative.swift deleted file mode 100644 index 282a9aba4..000000000 --- a/packages/analytics-react-native/ios/AmplitudeReactNative.swift +++ /dev/null @@ -1,36 +0,0 @@ -import Foundation -import React - -@objc(AmplitudeReactNative) -class ReactNative: NSObject { - - @objc - static func requiresMainQueueSetup() -> Bool { - return false - } - - @objc - func getApplicationContext( - _ options: NSDictionary, - resolver resolve: RCTPromiseResolveBlock, - rejecter reject: RCTPromiseRejectBlock - ) -> Void { - let trackingOptions = options as! [String: Bool] - let trackIdfv = trackingOptions["idfv"] ?? false - let appleContextProvider = AppleContextProvider(trackIdfv: trackIdfv) - - var applicationContext: [String: String?] = [ - "version": appleContextProvider.version, - "platform": appleContextProvider.platform, - "language": appleContextProvider.language, - "osName": appleContextProvider.osName, - "osVersion": appleContextProvider.osVersion, - "deviceManufacturer": appleContextProvider.deviceManufacturer, - "deviceModel": appleContextProvider.deviceModel, - ] - if (trackIdfv) { - applicationContext["idfv"] = appleContextProvider.idfv - } - resolve(applicationContext) - } -} diff --git a/packages/analytics-react-native/ios/AmplitudeReactNative.xcodeproj/project.pbxproj b/packages/analytics-react-native/ios/AmplitudeReactNative.xcodeproj/project.pbxproj deleted file mode 100644 index c71844bce..000000000 --- a/packages/analytics-react-native/ios/AmplitudeReactNative.xcodeproj/project.pbxproj +++ /dev/null @@ -1,293 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - - 5E555C0D2413F4C50049A1A2 /* AmplitudeReactNative.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* AmplitudeReactNative.m */; }; - F4FF95D7245B92E800C19C63 /* AmplitudeReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* AmplitudeReactNative.swift */; }; - -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 58B511D91A9E6C8500147676 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 134814201AA4EA6300B7C361 /* libAmplitudeReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAmplitudeReactNative.a; sourceTree = BUILT_PRODUCTS_DIR; }; - - B3E7B5891CC2AC0600A0062D /* AmplitudeReactNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AmplitudeReactNative.m; sourceTree = ""; }; - F4FF95D5245B92E700C19C63 /* AmplitudeReactNative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AmplitudeReactNative-Bridging-Header.h"; sourceTree = ""; }; - F4FF95D6245B92E800C19C63 /* AmplitudeReactNative.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmplitudeReactNative.swift; sourceTree = ""; }; - -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 58B511D81A9E6C8500147676 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 134814211AA4EA7D00B7C361 /* Products */ = { - isa = PBXGroup; - children = ( - 134814201AA4EA6300B7C361 /* libAmplitudeReactNative.a */, - ); - name = Products; - sourceTree = ""; - }; - 58B511D21A9E6C8500147676 = { - isa = PBXGroup; - children = ( - - F4FF95D6245B92E800C19C63 /* AmplitudeReactNative.swift */, - B3E7B5891CC2AC0600A0062D /* AmplitudeReactNative.m */, - F4FF95D5245B92E700C19C63 /* AmplitudeReactNative-Bridging-Header.h */, - - 134814211AA4EA7D00B7C361 /* Products */, - ); - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 58B511DA1A9E6C8500147676 /* ReactNative */ = { - isa = PBXNativeTarget; - buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNative" */; - buildPhases = ( - 58B511D71A9E6C8500147676 /* Sources */, - 58B511D81A9E6C8500147676 /* Frameworks */, - 58B511D91A9E6C8500147676 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ReactNative; - productName = RCTDataManager; - productReference = 134814201AA4EA6300B7C361 /* libAmplitudeReactNative.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 58B511D31A9E6C8500147676 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0920; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 58B511DA1A9E6C8500147676 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ReactNative" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - ); - mainGroup = 58B511D21A9E6C8500147676; - productRefGroup = 58B511D21A9E6C8500147676; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 58B511DA1A9E6C8500147676 /* ReactNative */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 58B511D71A9E6C8500147676 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - - F4FF95D7245B92E800C19C63 /* AmplitudeReactNative.swift in Sources */, - B3E7B58A1CC2AC0600A0062D /* AmplitudeReactNative.m in Sources */, - - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 58B511ED1A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 58B511EE1A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 58B511F01A9E6C8500147676 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../../../React/**", - "$(SRCROOT)/../../react-native/React/**", - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = ReactNative; - SKIP_INSTALL = YES; - - SWIFT_OBJC_BRIDGING_HEADER = "AmplitudeReactNative-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - - }; - name = Debug; - }; - 58B511F11A9E6C8500147676 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/../../../React/**", - "$(SRCROOT)/../../react-native/React/**", - ); - LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = ReactNative; - SKIP_INSTALL = YES; - - SWIFT_OBJC_BRIDGING_HEADER = "AmplitudeReactNative-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ReactNative" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511ED1A9E6C8500147676 /* Debug */, - 58B511EE1A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNative" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 58B511F01A9E6C8500147676 /* Debug */, - 58B511F11A9E6C8500147676 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 58B511D31A9E6C8500147676 /* Project object */; -} diff --git a/packages/analytics-react-native/ios/AppleContextProvider.swift b/packages/analytics-react-native/ios/AppleContextProvider.swift deleted file mode 100644 index 31ca43706..000000000 --- a/packages/analytics-react-native/ios/AppleContextProvider.swift +++ /dev/null @@ -1,231 +0,0 @@ -import Foundation - -@objc public class AppleContextProvider : NSObject { - - public let version: String? = AppleContextProvider.getVersion() - public let language: String? = AppleContextProvider.getLanguage() - public let platform: String = AppleContextProvider.getPlatform() - public let osName: String = AppleContextProvider.getOsName() - public let osVersion: String = AppleContextProvider.getOsVersion() - public let deviceManufacturer: String = AppleContextProvider.getDeviceManufacturer() - public let deviceModel: String = AppleContextProvider.getDeviceModel() - public var idfv: String? = nil - - init(trackIdfv: Bool) { - super.init() - if (trackIdfv) { - fetchIdfv() - } - } - - private static func getVersion() -> String? { - return Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - } - - private static func getLanguage() -> String? { - return Locale(identifier: "en_US").localizedString(forLanguageCode: Locale.preferredLanguages[0]) - } - - private static func getPlatform() -> String { - return "iOS" - } - - private static func getOsName() -> String { - return "ios" - } - - private static func getOsVersion() -> String { - let systemVersion = ProcessInfo.processInfo.operatingSystemVersion - return "\(systemVersion.majorVersion).\(systemVersion.minorVersion).\(systemVersion.patchVersion)" - } - - private static func getDeviceManufacturer() -> String { - return "Apple" - } - - private static func getPlatformString() -> String { - var sysinfo = utsname() - uname(&sysinfo) // ignore return value - return String(bytes: Data(bytes: &sysinfo.machine, count: Int(_SYS_NAMELEN)), encoding: .ascii)!.trimmingCharacters(in: .controlCharacters) - } - - private func fetchIdfv() { - self.idfv = UIDevice.current.identifierForVendor?.uuidString - } - - private static func getDeviceModel() -> String { - let platform = getPlatformString() - // == iPhone == - // iPhone 1 - if (platform == "iPhone1,1") { return "iPhone 1" } - // iPhone 3 - if (platform == "iPhone1,2") { return "iPhone 3G" } - if (platform == "iPhone2,1") { return "iPhone 3GS" } - // iPhone 4 - if (platform == "iPhone3,1") { return "iPhone 4" } - if (platform == "iPhone3,2") { return "iPhone 4" } - if (platform == "iPhone3,3") { return "iPhone 4" } - if (platform == "iPhone4,1") { return "iPhone 4S" } - // iPhone 5 - if (platform == "iPhone5,1") { return "iPhone 5" } - if (platform == "iPhone5,2") { return "iPhone 5" } - if (platform == "iPhone5,3") { return "iPhone 5c" } - if (platform == "iPhone5,4") { return "iPhone 5c" } - if (platform == "iPhone6,1") { return "iPhone 5s" } - if (platform == "iPhone6,2") { return "iPhone 5s" } - // iPhone 6 - if (platform == "iPhone7,1") { return "iPhone 6 Plus" } - if (platform == "iPhone7,2") { return "iPhone 6" } - if (platform == "iPhone8,1") { return "iPhone 6s" } - if (platform == "iPhone8,2") { return "iPhone 6s Plus" } - - // iPhone 7 - if (platform == "iPhone9,1") { return "iPhone 7" } - if (platform == "iPhone9,2") { return "iPhone 7 Plus" } - if (platform == "iPhone9,3") { return "iPhone 7" } - if (platform == "iPhone9,4") { return "iPhone 7 Plus" } - // iPhone 8 - if (platform == "iPhone10,1") { return "iPhone 8" } - if (platform == "iPhone10,4") { return "iPhone 8" } - if (platform == "iPhone10,2") { return "iPhone 8 Plus" } - if (platform == "iPhone10,5") { return "iPhone 8 Plus" } - - // iPhone X - if (platform == "iPhone10,3") { return "iPhone X" } - if (platform == "iPhone10,6") { return "iPhone X" } - - // iPhone XS - if (platform == "iPhone11,2") { return "iPhone XS" } - if (platform == "iPhone11,6") { return "iPhone XS Max" } - - // iPhone XR - if (platform == "iPhone11,8") { return "iPhone XR" } - - // iPhone 11 - if (platform == "iPhone12,1") { return "iPhone 11" } - if (platform == "iPhone12,3") { return "iPhone 11 Pro" } - if (platform == "iPhone12,5") { return "iPhone 11 Pro Max" } - - // iPhone SE - if (platform == "iPhone8,4") { return "iPhone SE" } - if (platform == "iPhone12,8") { return "iPhone SE 2" } - - // == iPod == - if (platform == "iPod1,1") { return "iPod Touch 1G" } - if (platform == "iPod2,1") { return "iPod Touch 2G" } - if (platform == "iPod3,1") { return "iPod Touch 3G" } - if (platform == "iPod4,1") { return "iPod Touch 4G" } - if (platform == "iPod5,1") { return "iPod Touch 5G" } - if (platform == "iPod7,1") { return "iPod Touch 6G" } - if (platform == "iPod9,1") { return "iPod Touch 7G" } - - // == iPad == - // iPad 1 - if (platform == "iPad1,1") { return "iPad 1" } - // iPad 2 - if (platform == "iPad2,1") { return "iPad 2" } - if (platform == "iPad2,2") { return "iPad 2" } - if (platform == "iPad2,3") { return "iPad 2" } - if (platform == "iPad2,4") { return "iPad 2" } - // iPad 3 - if (platform == "iPad3,1") { return "iPad 3" } - if (platform == "iPad3,2") { return "iPad 3" } - if (platform == "iPad3,3") { return "iPad 3" } - // iPad 4 - if (platform == "iPad3,4") { return "iPad 4" } - if (platform == "iPad3,5") { return "iPad 4" } - if (platform == "iPad3,6") { return "iPad 4" } - // iPad Air - if (platform == "iPad4,1") { return "iPad Air" } - if (platform == "iPad4,2") { return "iPad Air" } - if (platform == "iPad4,3") { return "iPad Air" } - // iPad Air 2 - if (platform == "iPad5,3") { return "iPad Air 2" } - if (platform == "iPad5,4") { return "iPad Air 2" } - // iPad 5 - if (platform == "iPad6,11") { return "iPad 5" } - if (platform == "iPad6,12") { return "iPad 5" } - // iPad 6 - if (platform == "iPad7,5") { return "iPad 6" } - if (platform == "iPad7,6") { return "iPad 6" } - // iPad Air 3 - if (platform == "iPad11,3") { return "iPad Air 3" } - if (platform == "iPad11,4") { return "iPad Air 3" } - // iPad 7 - if (platform == "iPad7,11") { return "iPad 6" } - if (platform == "iPad7,12") { return "iPad 6" } - - // iPad Pro - if (platform == "iPad6,7") { return "iPad Pro" } - if (platform == "iPad6,8") { return "iPad Pro" } - if (platform == "iPad6,3") { return "iPad Pro" } - if (platform == "iPad6,4") { return "iPad Pro" } - if (platform == "iPad7,1") { return "iPad Pro" } - if (platform == "iPad7,2") { return "iPad Pro" } - if (platform == "iPad7,3") { return "iPad Pro" } - if (platform == "iPad7,4") { return "iPad Pro" } - if (platform == "iPad8,1") { return "iPad Pro" } - if (platform == "iPad8,2") { return "iPad Pro" } - if (platform == "iPad8,3") { return "iPad Pro" } - if (platform == "iPad8,4") { return "iPad Pro" } - if (platform == "iPad8,5") { return "iPad Pro" } - if (platform == "iPad8,6") { return "iPad Pro" } - if (platform == "iPad8,7") { return "iPad Pro" } - if (platform == "iPad8,8") { return "iPad Pro" } - - // iPad Mini - if (platform == "iPad2,5") { return "iPad Mini" } - if (platform == "iPad2,6") { return "iPad Mini" } - if (platform == "iPad2,7") { return "iPad Mini" } - // iPad Mini 2 - if (platform == "iPad4,4") { return "iPad Mini 2" } - if (platform == "iPad4,5") { return "iPad Mini 2" } - if (platform == "iPad4,6") { return "iPad Mini 2" } - // iPad Mini 3 - if (platform == "iPad4,7") { return "iPad Mini 3" } - if (platform == "iPad4,8") { return "iPad Mini 3" } - if (platform == "iPad4,9") { return "iPad Mini 3" } - // iPad Mini 4 - if (platform == "iPad5,1") { return "iPad Mini 4" } - if (platform == "iPad5,2") { return "iPad Mini 4" } - // iPad Mini 5 - if (platform == "iPad11,1") { return "iPad Mini 5" } - if (platform == "iPad11,2") { return "iPad Mini 5" } - - // == Apple Watch == - if (platform == "Watch1,1") { return "Apple Watch 38mm" } - if (platform == "Watch1,2") { return "Apple Watch 42mm" } - if (platform == "Watch2,3") { return "Apple Watch Series 2 38mm" } - if (platform == "Watch2,4") { return "Apple Watch Series 2 42mm" } - if (platform == "Watch2,6") { return "Apple Watch Series 1 38mm" } - if (platform == "Watch2,7") { return "Apple Watch Series 1 42mm" } - if (platform == "Watch3,1") { return "Apple Watch Series 3 38mm Cellular" } - if (platform == "Watch3,2") { return "Apple Watch Series 3 42mm Cellular" } - if (platform == "Watch3,3") { return "Apple Watch Series 3 38mm" } - if (platform == "Watch3,4") { return "Apple Watch Series 3 42mm" } - if (platform == "Watch4,1") { return "Apple Watch Series 4 40mm" } - if (platform == "Watch4,2") { return "Apple Watch Series 4 44mm" } - if (platform == "Watch4,3") { return "Apple Watch Series 4 40mm Cellular" } - if (platform == "Watch4,4") { return "Apple Watch Series 4 44mm Cellular" } - if (platform == "Watch5,1") { return "Apple Watch Series 5 40mm" } - if (platform == "Watch5,2") { return "Apple Watch Series 5 44mm" } - if (platform == "Watch5,3") { return "Apple Watch Series 5 40mm Cellular" } - if (platform == "Watch5,4") { return "Apple Watch Series 5 44mm Cellular" } - if (platform == "Watch6,1") { return "Apple Watch Series 6 40mm" } - if (platform == "Watch6,2") { return "Apple Watch Series 6 44mm" } - if (platform == "Watch6,3") { return "Apple Watch Series 6 40mm Cellular" } - if (platform == "Watch6,4") { return "Apple Watch Series 6 44mm Cellular" } - - // == Others == - if (platform == "i386") { return "Simulator" } - if (platform == "x86_64") { return "Simulator" } - if (platform.hasPrefix("MacBookAir")) { return "MacBook Air" } - if (platform.hasPrefix("MacBookPro")) { return "MacBook Pro" } - if (platform.hasPrefix("MacBook")) { return "MacBook" } - if (platform.hasPrefix("MacPro")) { return "Mac Pro" } - if (platform.hasPrefix("Macmini")) { return "Mac Mini" } - if (platform.hasPrefix("iMac")) { return "iMac" } - if (platform.hasPrefix("Xserve")) { return "Xserve" } - return platform - } -} diff --git a/packages/analytics-react-native/jest.config.js b/packages/analytics-react-native/jest.config.js deleted file mode 100644 index dc5c87f24..000000000 --- a/packages/analytics-react-native/jest.config.js +++ /dev/null @@ -1,22 +0,0 @@ -const baseConfig = require('../../jest.config.js'); -const package = require('./package'); - -module.exports = { - ...baseConfig, - displayName: package.name, - rootDir: '.', - preset: 'react-native', - testEnvironment: 'jsdom', - modulePathIgnorePatterns: [ - "/lib/" - ], - // TODO: get full coverage - coverageThreshold: { - global: { - branches: 90, - functions: 90, - lines: 90, - statements: 90, - } - }, -}; diff --git a/packages/analytics-react-native/package.json b/packages/analytics-react-native/package.json deleted file mode 100644 index b6c7f17af..000000000 --- a/packages/analytics-react-native/package.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "name": "@amplitude/analytics-react-native", - "version": "2.0.0-beta.0", - "description": "Official React Native SDK", - "keywords": [ - "analytics", - "amplitude", - "react-native", - "ios", - "android" - ], - "author": "Amplitude Inc", - "homepage": "https://github.com/amplitude/Amplitude-TypeScript", - "license": "MIT", - "main": "lib/commonjs/index", - "module": "lib/module/index", - "types": "lib/typescript/index.d.ts", - "react-native": "src/index", - "private": true, - "publishConfig": { - "tag": "beta" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/amplitude/Amplitude-TypeScript.git" - }, - "scripts": { - "build": "bob build", - "clean": "rimraf node_modules lib coverage", - "fix": "yarn fix:eslint & yarn fix:prettier", - "fix:eslint": "eslint '{src,test}/**/*.ts' --fix", - "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"", - "lint": "yarn lint:eslint & yarn lint:prettier", - "lint:eslint": "eslint '{src,test}/**/*.ts'", - "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"", - "test": "yarn test:web && yarn test:mobile", - "test:web": "jest --setupFiles './test/mock/setup-web.ts'", - "test:mobile": "jest --setupFiles './test/mock/setup-mobile.ts'", - "typecheck": "tsc -p ./tsconfig.json", - "version": "yarn version-file && yarn build", - "version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts", - "typescript": "tsc --noEmit", - "example": "yarn --cwd example", - "pods": "cd example && pod-install --quiet" - }, - "source": "src/index", - "files": [ - "src", - "lib", - "android", - "ios", - "amplitude-react-native.podspec", - "!android/build", - "!ios/build", - "!**/test" - ], - "bugs": { - "url": "https://github.com/amplitude/Amplitude-TypeScript/issues" - }, - "dependencies": { - "@amplitude/analytics-client-common": "^2.0.0", - "@amplitude/analytics-core": "^2.10.1", - "@amplitude/analytics-types": "^2.0.0", - "@amplitude/ua-parser-js": "^0.7.31", - "@react-native-async-storage/async-storage": "^1.17.11", - "tslib": "^2.4.1" - }, - "devDependencies": { - "@types/react": "^18.0.26", - "@types/react-native": "0.70.8", - "@types/ua-parser-js": "^0.7.36", - "react": "18.2.0", - "react-native": "0.70.6", - "react-native-builder-bob": "^0.20.3" - }, - "peerDependencies": { - "react": "*", - "react-native": "*" - }, - "react-native-builder-bob": { - "source": "src", - "output": "lib", - "targets": [ - "commonjs", - "module", - [ - "typescript", - { - "project": "tsconfig.build.json" - } - ] - ] - } -} diff --git a/packages/analytics-react-native/src/config.ts b/packages/analytics-react-native/src/config.ts deleted file mode 100644 index 5546bd09f..000000000 --- a/packages/analytics-react-native/src/config.ts +++ /dev/null @@ -1,300 +0,0 @@ -import { - Event, - ReactNativeOptions, - ReactNativeConfig as IReactNativeConfig, - Storage, - ReactNativeTrackingOptions, - UserSession, -} from '@amplitude/analytics-types'; -import { Config, MemoryStorage, UUID } from '@amplitude/analytics-core'; -import { CookieStorage, getCookieName, getQueryParams, FetchTransport } from '@amplitude/analytics-client-common'; - -import { LocalStorage } from './storage/local-storage'; - -export const getDefaultConfig = () => { - const cookieStorage = new MemoryStorage(); - const trackingOptions: Required = { - adid: true, - carrier: true, - deviceManufacturer: true, - deviceModel: true, - ipAddress: true, - language: true, - osName: true, - osVersion: true, - platform: true, - appSetId: true, - idfv: true, - }; - return { - cookieExpiration: 365, - cookieSameSite: 'Lax', - cookieSecure: false, - cookieStorage, - cookieUpgrade: true, - disableCookies: false, - domain: '', - sessionTimeout: 5 * 60 * 1000, - storageProvider: new MemoryStorage(), - trackingSessionEvents: false, - trackingOptions, - transportProvider: new FetchTransport(), - }; -}; - -export class ReactNativeConfig extends Config implements IReactNativeConfig { - appVersion?: string; - cookieExpiration: number; - cookieSameSite: string; - cookieSecure: boolean; - cookieStorage: Storage; - cookieUpgrade: boolean; - disableCookies: boolean; - domain: string; - partnerId?: string; - sessionTimeout: number; - trackingSessionEvents: boolean; - trackingOptions: ReactNativeTrackingOptions; - - // NOTE: These protected properties are used to cache values from async storage - protected _deviceId?: string; - protected _lastEventId?: number; - protected _lastEventTime?: number; - protected _optOut = false; - protected _sessionId?: number; - protected _userId?: string; - - constructor(apiKey: string, options?: ReactNativeOptions) { - const defaultConfig = getDefaultConfig(); - super({ - flushIntervalMillis: 1000, - flushMaxRetries: 5, - flushQueueSize: 30, - transportProvider: defaultConfig.transportProvider, - ...options, - apiKey, - }); - - // NOTE: Define `cookieStorage` first to persist user session - // user session properties expect `cookieStorage` to be defined - this.cookieStorage = options?.cookieStorage ?? defaultConfig.cookieStorage; - this.deviceId = options?.deviceId; - this.lastEventTime = options?.lastEventTime; - this.optOut = Boolean(options?.optOut); - this.sessionId = options?.sessionId; - this.userId = options?.userId; - - this.appVersion = options?.appVersion; - this.cookieExpiration = options?.cookieExpiration ?? defaultConfig.cookieExpiration; - this.cookieSameSite = options?.cookieSameSite ?? defaultConfig.cookieSameSite; - this.cookieSecure = options?.cookieSecure ?? defaultConfig.cookieSecure; - this.cookieUpgrade = options?.cookieUpgrade ?? defaultConfig.cookieUpgrade; - this.disableCookies = options?.disableCookies ?? defaultConfig.disableCookies; - this.domain = options?.domain ?? defaultConfig.domain; - this.partnerId = options?.partnerId; - this.sessionTimeout = options?.sessionTimeout ?? defaultConfig.sessionTimeout; - this.trackingOptions = options?.trackingOptions ?? defaultConfig.trackingOptions; - this.trackingSessionEvents = options?.trackingSessionEvents ?? defaultConfig.trackingSessionEvents; - } - - get deviceId() { - return this._deviceId; - } - - set deviceId(deviceId: string | undefined) { - if (this._deviceId !== deviceId) { - this._deviceId = deviceId; - this.updateStorage(); - } - } - - get userId() { - return this._userId; - } - - set userId(userId: string | undefined) { - if (this._userId !== userId) { - this._userId = userId; - this.updateStorage(); - } - } - - get sessionId() { - return this._sessionId; - } - - set sessionId(sessionId: number | undefined) { - if (this._sessionId !== sessionId) { - this._sessionId = sessionId; - this.updateStorage(); - } - } - - get optOut() { - return this._optOut; - } - - set optOut(optOut: boolean) { - if (this._optOut !== optOut) { - this._optOut = optOut; - this.updateStorage(); - } - } - - get lastEventTime() { - return this._lastEventTime; - } - - set lastEventTime(lastEventTime: number | undefined) { - if (this._lastEventTime !== lastEventTime) { - this._lastEventTime = lastEventTime; - this.updateStorage(); - } - } - - get lastEventId() { - return this._lastEventId; - } - - set lastEventId(lastEventId: number | undefined) { - if (this._lastEventId !== lastEventId) { - this._lastEventId = lastEventId; - this.updateStorage(); - } - } - - private updateStorage() { - const cache = { - deviceId: this._deviceId, - userId: this._userId, - sessionId: this._sessionId, - optOut: this._optOut, - lastEventTime: this._lastEventTime, - lastEventId: this._lastEventId, - }; - void this.cookieStorage?.set(getCookieName(this.apiKey), cache); - } -} - -export const useReactNativeConfig = async ( - apiKey: string, - options?: ReactNativeOptions, -): Promise => { - const defaultConfig = getDefaultConfig(); - - // create cookie storage - const domain = options?.disableCookies ? '' : options?.domain ?? (await getTopLevelDomain()); - const cookieStorage = await createCookieStorage({ ...options, domain }); - const previousCookies = await cookieStorage.get(getCookieName(apiKey)); - const queryParams = getQueryParams(); - - // reconcile user session - const deviceId = options?.deviceId ?? queryParams.deviceId ?? previousCookies?.deviceId ?? UUID(); - const lastEventTime = options?.lastEventTime ?? previousCookies?.lastEventTime; - const optOut = options?.optOut ?? Boolean(previousCookies?.optOut); - const sessionId = options?.sessionId ?? previousCookies?.sessionId; - const userId = options?.userId ?? previousCookies?.userId; - - const config = new ReactNativeConfig(apiKey, { - ...options, - cookieStorage, - deviceId, - domain, - lastEventTime, - optOut, - sessionId, - storageProvider: await createEventsStorage(options), - trackingOptions: { - ...defaultConfig.trackingOptions, - ...options?.trackingOptions, - }, - transportProvider: options?.transportProvider ?? new FetchTransport(), - userId, - }); - - config.lastEventId = previousCookies?.lastEventId; - - config.loggerProvider?.log( - `Init: storage=${cookieStorage.constructor.name} restoredSessionId = ${ - previousCookies?.sessionId ?? 'undefined' - }, optionsSessionId = ${options?.sessionId ?? 'undefined'}`, - ); - - return config; -}; - -export const createCookieStorage = async ( - overrides?: ReactNativeOptions, - baseConfig = getDefaultConfig(), -): Promise> => { - const options = { ...baseConfig, ...overrides }; - const cookieStorage = overrides?.cookieStorage as Storage; - if (!cookieStorage || !(await cookieStorage.isEnabled())) { - return createFlexibleStorage(options); - } - return cookieStorage; -}; - -const createFlexibleStorage = async (options: ReactNativeOptions): Promise> => { - let storage: Storage = new CookieStorage({ - domain: options.domain, - expirationDays: options.cookieExpiration, - sameSite: options.cookieSameSite, - secure: options.cookieSecure, - }); - if (options.disableCookies || !(await storage.isEnabled())) { - storage = new LocalStorage(); - if (!(await storage.isEnabled())) { - storage = new MemoryStorage(); - } - } - return storage; -}; - -export const createEventsStorage = async (overrides?: ReactNativeOptions): Promise | undefined> => { - const hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, 'storageProvider'); - // If storageProperty is explicitly undefined like `{ storageProperty: undefined }` - // then storageProvider is undefined - // If storageProvider is implicitly undefined like `{ }` - // then storageProvider is LocalStorage - // Otherwise storageProvider is overriden - if (!hasStorageProviderProperty || overrides.storageProvider) { - for (const storage of [overrides?.storageProvider, new LocalStorage()]) { - if (storage && (await storage.isEnabled())) { - return storage; - } - } - } - return undefined; -}; - -export const getTopLevelDomain = async (url?: string) => { - if ( - !(await new CookieStorage().isEnabled()) || - (!url && (typeof location === 'undefined' || !location.hostname)) - ) { - return ''; - } - - const host = url ?? location.hostname; - const parts = host.split('.'); - const levels = []; - const storageKey = 'AMP_TLDTEST'; - - for (let i = parts.length - 2; i >= 0; --i) { - levels.push(parts.slice(i).join('.')); - } - for (let i = 0; i < levels.length; i++) { - const domain = levels[i]; - const options = { domain: '.' + domain }; - const storage = new CookieStorage(options); - await storage.set(storageKey, 1); - const value = await storage.get(storageKey); - if (value) { - await storage.remove(storageKey); - return '.' + domain; - } - } - - return ''; -}; diff --git a/packages/analytics-react-native/src/cookie-migration/index.ts b/packages/analytics-react-native/src/cookie-migration/index.ts deleted file mode 100644 index 5ae197924..000000000 --- a/packages/analytics-react-native/src/cookie-migration/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ReactNativeOptions, UserSession } from '@amplitude/analytics-types'; -import { getOldCookieName } from '@amplitude/analytics-client-common'; -import { createCookieStorage, getDefaultConfig, getTopLevelDomain } from '../config'; - -export const parseOldCookies = async (apiKey: string, options?: ReactNativeOptions): Promise => { - const storage = await createCookieStorage({ - ...options, - domain: options?.disableCookies ? '' : options?.domain ?? (await getTopLevelDomain()), - }); - const oldCookieName = getOldCookieName(apiKey); - const cookies = await storage.getRaw(oldCookieName); - - if (!cookies) { - return { - optOut: false, - }; - } - - if (options?.cookieUpgrade ?? getDefaultConfig().cookieUpgrade) { - await storage.remove(oldCookieName); - } - const [deviceId, userId, optOut, sessionId, lastEventTime] = cookies.split('.'); - return { - deviceId, - userId: decode(userId), - sessionId: parseTime(sessionId), - lastEventTime: parseTime(lastEventTime), - optOut: Boolean(optOut), - }; -}; - -export const parseTime = (num: string) => { - const integer = parseInt(num, 32); - if (isNaN(integer)) { - return undefined; - } - return integer; -}; - -export const decode = (value?: string): string | undefined => { - if (!atob || !escape || !value) { - return undefined; - } - try { - return decodeURIComponent(escape(atob(value))); - } catch { - return undefined; - } -}; diff --git a/packages/analytics-react-native/src/index.ts b/packages/analytics-react-native/src/index.ts deleted file mode 100644 index 3acbf6ca1..000000000 --- a/packages/analytics-react-native/src/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-disable @typescript-eslint/unbound-method */ -import client from './react-native-client'; -export { createInstance } from './react-native-client'; -export const { - add, - flush, - getDeviceId, - getSessionId, - getUserId, - groupIdentify, - identify, - init, - logEvent, - remove, - reset, - revenue, - setDeviceId, - setGroup, - setOptOut, - setSessionId, - setUserId, - track, -} = client; -export { Revenue, Identify } from '@amplitude/analytics-core'; -// Hack - react-native apps have trouble with: -// export * as Types from '@amplitude/analytics-types -import * as Types from '@amplitude/analytics-types'; -export { Types }; diff --git a/packages/analytics-react-native/src/plugins/context.ts b/packages/analytics-react-native/src/plugins/context.ts deleted file mode 100644 index 80f449297..000000000 --- a/packages/analytics-react-native/src/plugins/context.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { BeforePlugin, ReactNativeConfig, Event, ReactNativeTrackingOptions } from '@amplitude/analytics-types'; -import UAParser from '@amplitude/ua-parser-js'; -import { UUID } from '@amplitude/analytics-core'; -import { getLanguage } from '@amplitude/analytics-client-common'; -import { VERSION } from '../version'; -import { NativeModules } from 'react-native'; - -const BROWSER_PLATFORM = 'Web'; -const IP_ADDRESS = '$remote'; - -type NativeContext = { - version: string; - platform: string; - language: string; - osName: string; - osVersion: string; - deviceBrand: string; - deviceManufacturer: string; - deviceModel: string; - carrier: string; - adid: string; - appSetId: string; - idfv: string; -}; - -export interface AmplitudeReactNative { - getApplicationContext(options: ReactNativeTrackingOptions): Promise; -} - -export class Context implements BeforePlugin { - name = '@amplitude/plugin-context-react-native'; - type = 'before' as const; - - // this.config is defined in setup() which will always be called first - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - config: ReactNativeConfig; - uaResult: UAParser.IResult; - nativeModule: AmplitudeReactNative | undefined = NativeModules.AmplitudeReactNative as - | AmplitudeReactNative - | undefined; - library = `amplitude-react-native-ts/${VERSION}`; - - constructor() { - let agent: string | undefined; - /* istanbul ignore else */ - if (typeof navigator !== 'undefined') { - agent = navigator.userAgent; - } - this.uaResult = new UAParser(agent).getResult(); - } - - setup(config: ReactNativeConfig): Promise { - this.config = config; - return Promise.resolve(undefined); - } - - async execute(context: Event): Promise { - const time = new Date().getTime(); - const nativeContext = await this.nativeModule?.getApplicationContext(this.config.trackingOptions); - const appVersion = nativeContext?.version || this.config.appVersion; - const platform = nativeContext?.platform || BROWSER_PLATFORM; - const osName = nativeContext?.osName || this.uaResult.browser.name; - const osVersion = nativeContext?.osVersion || this.uaResult.browser.version; - const deviceVendor = nativeContext?.deviceManufacturer || this.uaResult.device.vendor; - const deviceModel = nativeContext?.deviceModel || this.uaResult.device.model || this.uaResult.os.name; - const language = nativeContext?.language || getLanguage(); - const carrier = nativeContext?.carrier; - const adid = nativeContext?.adid; - const appSetId = nativeContext?.appSetId; - const idfv = nativeContext?.idfv; - - const event: Event = { - user_id: this.config.userId, - device_id: this.config.deviceId, - session_id: this.config.sessionId, - time, - ...(this.config.appVersion && { app_version: appVersion }), - ...(this.config.trackingOptions.platform && { platform: platform }), - ...(this.config.trackingOptions.osName && { os_name: osName }), - ...(this.config.trackingOptions.osVersion && { os_version: osVersion }), - ...(this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }), - ...(this.config.trackingOptions.deviceModel && { device_model: deviceModel }), - ...(this.config.trackingOptions.language && { language: language }), - ...(this.config.trackingOptions.carrier && { carrier: carrier }), - ...(this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }), - ...(this.config.trackingOptions.adid && { adid: adid }), - ...(this.config.trackingOptions.appSetId && { android_app_set_id: appSetId }), - ...(this.config.trackingOptions.idfv && { idfv: idfv }), - insert_id: UUID(), - partner_id: this.config.partnerId, - plan: this.config.plan, - ...(this.config.ingestionMetadata && { - ingestion_metadata: { - source_name: this.config.ingestionMetadata.sourceName, - source_version: this.config.ingestionMetadata.sourceVersion, - }, - }), - ...context, - library: this.library, - }; - return event; - } -} diff --git a/packages/analytics-react-native/src/react-native-client.ts b/packages/analytics-react-native/src/react-native-client.ts deleted file mode 100644 index 8eb79b95b..000000000 --- a/packages/analytics-react-native/src/react-native-client.ts +++ /dev/null @@ -1,413 +0,0 @@ -import { AppState, AppStateStatus, NativeEventSubscription } from 'react-native'; -import { - AmplitudeCore, - Destination, - UUID, - returnWrapper, - debugWrapper, - getClientLogConfig, - getClientStates, -} from '@amplitude/analytics-core'; -import { - CampaignTracker, - IdentityEventSender, - getAnalyticsConnector, - setConnectorDeviceId, - setConnectorUserId, -} from '@amplitude/analytics-client-common'; -import { - ReactNativeConfig, - Campaign, - ReactNativeOptions, - ReactNativeClient, - Identify as IIdentify, - EventOptions, - Event, - Result, -} from '@amplitude/analytics-types'; -import { Context } from './plugins/context'; -import { useReactNativeConfig, createCookieStorage } from './config'; -import { parseOldCookies } from './cookie-migration'; -import { isNative } from './utils/platform'; -import { ReactNativeAttributionOptions } from '@amplitude/analytics-types/lib/esm/config'; - -const START_SESSION_EVENT = 'session_start'; -const END_SESSION_EVENT = 'session_end'; - -export class AmplitudeReactNative extends AmplitudeCore { - appState: AppStateStatus = 'background'; - private appStateChangeHandler: NativeEventSubscription | undefined; - explicitSessionId: number | undefined; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - config: ReactNativeConfig; - - init(apiKey = '', userId?: string, options?: ReactNativeOptions) { - return returnWrapper(this._init({ ...options, userId, apiKey })); - } - protected async _init(options: ReactNativeOptions & { apiKey: string }) { - // Step 0: Block concurrent initialization - if (this.initializing) { - return; - } - this.initializing = true; - this.explicitSessionId = options.sessionId; - - // Step 1: Read cookies stored by old SDK - const oldCookies = await parseOldCookies(options.apiKey, options); - - // Step 2: Create react native config - const reactNativeOptions = await useReactNativeConfig(options.apiKey, { - ...options, - deviceId: oldCookies.deviceId ?? options.deviceId, - sessionId: oldCookies.sessionId, - optOut: options.optOut ?? oldCookies.optOut, - lastEventTime: oldCookies.lastEventTime, - userId: options.userId || oldCookies.userId, - }); - await super._init(reactNativeOptions); - - // Set up the analytics connector to integrate with the experiment SDK. - // Send events from the experiment SDK and forward identifies to the - // identity store. - const connector = getAnalyticsConnector(); - connector.identityStore.setIdentity({ - userId: this.config.userId, - deviceId: this.config.deviceId, - }); - - // Step 3: Install plugins - // Do not track any events before this - await this.add(new Destination()).promise; - await this.add(new Context()).promise; - await this.add(new IdentityEventSender()).promise; - - // Step 4: Manage session - this.appState = AppState.currentState; - const isNewSession = this.startNewSessionIfNeeded(); - this.config.loggerProvider?.log( - `Init: startNewSessionIfNeeded = ${isNewSession ? 'yes' : 'no'}, sessionId = ${ - this.getSessionId() ?? 'undefined' - }`, - ); - this.appStateChangeHandler = AppState.addEventListener('change', this.handleAppStateChange); - - this.initializing = false; - - // Step 5: Track attributions - await this.runAttributionStrategy(options.attribution, isNewSession); - - // Step 6: Run queued functions - await this.runQueuedFunctions('dispatchQ'); - - // Step 7: Add the event receiver after running remaining queued functions. - connector.eventBridge.setEventReceiver((event) => { - void this.track(event.eventType, event.eventProperties); - }); - } - - shutdown() { - this.appStateChangeHandler?.remove(); - } - - async runAttributionStrategy(attributionConfig?: ReactNativeAttributionOptions, isNewSession = false) { - if (isNative()) { - return; - } - const track = (...args: Parameters) => this.track(...args).promise; - const onNewCampaign = this.setSessionId.bind(this, this.currentTimeMillis()); - - const storage = await createCookieStorage(this.config); - const campaignTracker = new CampaignTracker(this.config.apiKey, { - ...attributionConfig, - storage, - track, - onNewCampaign, - }); - - await campaignTracker.send(isNewSession); - } - - getUserId() { - return this.config?.userId; - } - - setUserId(userId: string | undefined) { - if (!this.config) { - this.q.push(this.setUserId.bind(this, userId)); - return; - } - this.config.userId = userId; - setConnectorUserId(userId); - } - - getDeviceId() { - return this.config?.deviceId; - } - - setDeviceId(deviceId: string) { - if (!this.config) { - this.q.push(this.setDeviceId.bind(this, deviceId)); - return; - } - this.config.deviceId = deviceId; - setConnectorDeviceId(deviceId); - } - - identify(identify: IIdentify, eventOptions?: EventOptions) { - if (eventOptions?.user_id) { - this.setUserId(eventOptions.user_id); - } - if (eventOptions?.device_id) { - this.setDeviceId(eventOptions.device_id); - } - return super.identify(identify, eventOptions); - } - - reset() { - this.setUserId(undefined); - this.setDeviceId(UUID()); - } - - getSessionId() { - return this.config?.sessionId; - } - - setSessionId(sessionId: number) { - if (!this.config) { - this.q.push(this.setSessionId.bind(this, sessionId)); - return; - } - - this.explicitSessionId = sessionId; - void this.setSessionIdInternal(sessionId, this.currentTimeMillis()); - } - - extendSession() { - if (!this.config) { - this.q.push(this.extendSession.bind(this)); - return; - } - this.config.lastEventTime = this.currentTimeMillis(); - } - - private setSessionIdInternal(sessionId: number, eventTime: number) { - const previousSessionId = this.config.sessionId; - if (previousSessionId === sessionId) { - return; - } - - this.config.sessionId = sessionId; - - if (this.config.trackingSessionEvents) { - this.config.loggerProvider?.log(`SESSION_END event: previousSessionId = ${previousSessionId ?? 'undefined'}`); - - if (previousSessionId !== undefined) { - const sessionEndEvent: Event = { - event_type: END_SESSION_EVENT, - time: this.config.lastEventTime !== undefined ? this.config.lastEventTime + 1 : sessionId, // increment lastEventTime to sort events properly in UI - session_end should be the last event in a session - session_id: previousSessionId, - }; - void this.track(sessionEndEvent); - } - - this.config.loggerProvider?.log(`SESSION_START event: sessionId = ${sessionId}`); - const sessionStartEvent: Event = { - event_type: START_SESSION_EVENT, - time: eventTime, - session_id: sessionId, - }; - void this.track(sessionStartEvent); - } - - this.config.lastEventTime = eventTime; - } - - async process(event: Event): Promise { - if (!this.config.optOut) { - const eventTime = event.time ?? this.currentTimeMillis(); - if (event.time === undefined) { - event = { ...event, time: eventTime }; - } - - if (event.event_type != START_SESSION_EVENT && event.event_type != END_SESSION_EVENT) { - if (this.appState !== 'active') { - this.startNewSessionIfNeeded(eventTime); - } - } - this.config.lastEventTime = eventTime; - - if (event.session_id == undefined) { - event.session_id = this.getSessionId(); - } - - if (event.event_id === undefined) { - const eventId = (this.config.lastEventId ?? -1) + 1; - event = { ...event, event_id: eventId }; - this.config.lastEventId = eventId; - } - } - - return super.process(event); - } - - currentTimeMillis() { - return Date.now(); - } - - private startNewSessionIfNeeded(eventTime?: number): boolean { - eventTime = eventTime ?? this.currentTimeMillis(); - const sessionId = this.explicitSessionId ?? eventTime; - - if ( - this.inSession() && - (this.explicitSessionId === this.config.sessionId || - (this.explicitSessionId === undefined && this.isWithinMinTimeBetweenSessions(sessionId))) - ) { - this.config.lastEventTime = eventTime; - return false; - } - - this.setSessionIdInternal(sessionId, eventTime); - return true; - } - - private isWithinMinTimeBetweenSessions(eventTime: number) { - return eventTime - (this.config.lastEventTime ?? 0) < this.config.sessionTimeout; - } - - private inSession() { - return this.config.sessionId != undefined; - } - - private readonly handleAppStateChange = (nextAppState: AppStateStatus) => { - const currentAppState = this.appState; - this.appState = nextAppState; - if (currentAppState !== nextAppState && nextAppState === 'active') { - this.config.loggerProvider?.log('App Activated'); - this.startNewSessionIfNeeded(); - } - }; -} - -export const createInstance = (): ReactNativeClient => { - const client = new AmplitudeReactNative(); - return { - init: debugWrapper( - client.init.bind(client), - 'init', - getClientLogConfig(client), - getClientStates(client, ['config']), - ), - add: debugWrapper( - client.add.bind(client), - 'add', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.plugins']), - ), - remove: debugWrapper( - client.remove.bind(client), - 'remove', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.plugins']), - ), - track: debugWrapper( - client.track.bind(client), - 'track', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - logEvent: debugWrapper( - client.logEvent.bind(client), - 'logEvent', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - identify: debugWrapper( - client.identify.bind(client), - 'identify', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - groupIdentify: debugWrapper( - client.groupIdentify.bind(client), - 'groupIdentify', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - setGroup: debugWrapper( - client.setGroup.bind(client), - 'setGroup', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - revenue: debugWrapper( - client.revenue.bind(client), - 'revenue', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - flush: debugWrapper( - client.flush.bind(client), - 'flush', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - getUserId: debugWrapper( - client.getUserId.bind(client), - 'getUserId', - getClientLogConfig(client), - getClientStates(client, ['config', 'config.userId']), - ), - setUserId: debugWrapper( - client.setUserId.bind(client), - 'setUserId', - getClientLogConfig(client), - getClientStates(client, ['config', 'config.userId']), - ), - getDeviceId: debugWrapper( - client.getDeviceId.bind(client), - 'getDeviceId', - getClientLogConfig(client), - getClientStates(client, ['config', 'config.deviceId']), - ), - setDeviceId: debugWrapper( - client.setDeviceId.bind(client), - 'setDeviceId', - getClientLogConfig(client), - getClientStates(client, ['config', 'config.deviceId']), - ), - reset: debugWrapper( - client.reset.bind(client), - 'reset', - getClientLogConfig(client), - getClientStates(client, ['config', 'config.userId', 'config.deviceId']), - ), - getSessionId: debugWrapper( - client.getSessionId.bind(client), - 'getSessionId', - getClientLogConfig(client), - getClientStates(client, ['config']), - ), - setSessionId: debugWrapper( - client.setSessionId.bind(client), - 'setSessionId', - getClientLogConfig(client), - getClientStates(client, ['config']), - ), - extendSession: debugWrapper( - client.extendSession.bind(client), - 'extendSession', - getClientLogConfig(client), - getClientStates(client, ['config']), - ), - setOptOut: debugWrapper( - client.setOptOut.bind(client), - 'setOptOut', - getClientLogConfig(client), - getClientStates(client, ['config']), - ), - }; -}; - -export default createInstance(); diff --git a/packages/analytics-react-native/src/storage/local-storage.ts b/packages/analytics-react-native/src/storage/local-storage.ts deleted file mode 100644 index 84f3af62d..000000000 --- a/packages/analytics-react-native/src/storage/local-storage.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { getGlobalScope } from '@amplitude/analytics-client-common'; -import { Storage } from '@amplitude/analytics-types'; -import AsyncStorage from '@react-native-async-storage/async-storage'; - -export class LocalStorage implements Storage { - async isEnabled(): Promise { - /* istanbul ignore if */ - if (!getGlobalScope()) { - return false; - } - - const random = String(Date.now()); - const testStorage = new LocalStorage(); - const testKey = 'AMP_TEST'; - try { - await testStorage.set(testKey, random); - const value = await testStorage.get(testKey); - return value === random; - } catch { - /* istanbul ignore next */ - return false; - } finally { - await testStorage.remove(testKey); - } - } - - async get(key: string): Promise { - try { - const value = await this.getRaw(key); - if (!value) { - return undefined; - } - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return JSON.parse(value); - } catch { - /* istanbul ignore next */ - return undefined; - } - } - - async getRaw(key: string): Promise { - return (await AsyncStorage.getItem(key)) || undefined; - } - - async set(key: string, value: T): Promise { - try { - await AsyncStorage.setItem(key, JSON.stringify(value)); - } catch { - // - } - } - - async remove(key: string): Promise { - try { - await AsyncStorage.removeItem(key); - } catch { - // - } - } - - async reset(): Promise { - try { - await AsyncStorage.clear(); - } catch { - // - } - } -} diff --git a/packages/analytics-react-native/src/typings/browser-snippet.d.ts b/packages/analytics-react-native/src/typings/browser-snippet.d.ts deleted file mode 100644 index eb763ec2b..000000000 --- a/packages/analytics-react-native/src/typings/browser-snippet.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { InstanceProxy } from '@amplitude/analytics-types'; - -declare global { - // globalThis only includes `var` declarations - // eslint-disable-next-line no-var - var amplitude: InstanceProxy & { invoked: boolean }; -} diff --git a/packages/analytics-react-native/src/typings/ua-parser.d.ts b/packages/analytics-react-native/src/typings/ua-parser.d.ts deleted file mode 100644 index bac2f15e9..000000000 --- a/packages/analytics-react-native/src/typings/ua-parser.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '@amplitude/ua-parser-js' { - import UAParser from 'ua-parser-js'; - export = UAParser; -} diff --git a/packages/analytics-react-native/src/utils/platform.ts b/packages/analytics-react-native/src/utils/platform.ts deleted file mode 100644 index e76691706..000000000 --- a/packages/analytics-react-native/src/utils/platform.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Platform } from 'react-native'; - -export const isWeb = (): boolean => { - return Platform.OS === 'web'; -}; - -export const isNative = (): boolean => { - return !isWeb(); -}; diff --git a/packages/analytics-react-native/src/version.ts b/packages/analytics-react-native/src/version.ts deleted file mode 100644 index d6aa24e7e..000000000 --- a/packages/analytics-react-native/src/version.ts +++ /dev/null @@ -1 +0,0 @@ -export const VERSION = '1.1.7'; diff --git a/packages/analytics-react-native/test/config.test.ts b/packages/analytics-react-native/test/config.test.ts deleted file mode 100644 index 5e50ff351..000000000 --- a/packages/analytics-react-native/test/config.test.ts +++ /dev/null @@ -1,380 +0,0 @@ -import * as Config from '../src/config'; -import * as LocalStorageModule from '../src/storage/local-storage'; -import * as core from '@amplitude/analytics-core'; -import { LogLevel, Storage, UserSession } from '@amplitude/analytics-types'; -import * as BrowserUtils from '@amplitude/analytics-client-common'; -import { getCookieName, FetchTransport } from '@amplitude/analytics-client-common'; -import { isWeb } from '../src/utils/platform'; -import { uuidPattern } from './helpers/constants'; - -describe('config', () => { - const someUUID: string = expect.stringMatching(uuidPattern) as string; - const someStorage: core.MemoryStorage = expect.any( - core.MemoryStorage, - ) as core.MemoryStorage; - - const API_KEY = 'apiKey'; - - describe('BrowserConfig', () => { - test('should create overwrite config', async () => { - const cookieStorage = new core.MemoryStorage(); - const logger = new core.Logger(); - logger.enable(LogLevel.Warn); - const config = new Config.ReactNativeConfig(''); - expect(config).toEqual({ - apiKey: '', - appVersion: undefined, - cookieStorage, - cookieExpiration: 365, - cookieSameSite: 'Lax', - cookieSecure: false, - cookieUpgrade: true, - disableCookies: false, - domain: '', - flushIntervalMillis: 1000, - flushMaxRetries: 5, - flushQueueSize: 30, - instanceName: '$default_instance', - loggerProvider: logger, - logLevel: LogLevel.Warn, - minIdLength: undefined, - offline: false, - _optOut: false, - partnerId: undefined, - plan: undefined, - ingestionMetadata: undefined, - serverUrl: 'https://api2.amplitude.com/2/httpapi', - serverZone: 'US', - sessionTimeout: 300000, - trackingOptions: { - adid: true, - carrier: true, - deviceManufacturer: true, - deviceModel: true, - ipAddress: true, - language: true, - osName: true, - osVersion: true, - platform: true, - appSetId: true, - idfv: true, - }, - transportProvider: new FetchTransport(), - useBatch: false, - trackingSessionEvents: false, - }); - }); - }); - - describe('useBrowserConfig', () => { - test('should create default config', async () => { - jest.spyOn(Config, 'createCookieStorage').mockResolvedValueOnce(new core.MemoryStorage()); - jest.spyOn(Config, 'createEventsStorage').mockResolvedValueOnce(new core.MemoryStorage()); - const logger = new core.Logger(); - logger.enable(LogLevel.Warn); - const config = await Config.useReactNativeConfig(API_KEY, undefined); - expect(config).toEqual({ - apiKey: API_KEY, - appVersion: undefined, - cookieStorage: someStorage, - cookieExpiration: 365, - cookieSameSite: 'Lax', - cookieSecure: false, - cookieUpgrade: true, - _deviceId: someUUID, - disableCookies: false, - domain: '', - flushIntervalMillis: 1000, - flushMaxRetries: 5, - flushQueueSize: 30, - instanceName: '$default_instance', - loggerProvider: logger, - logLevel: LogLevel.Warn, - minIdLength: undefined, - offline: false, - _optOut: false, - partnerId: undefined, - plan: undefined, - ingestionMetadata: undefined, - serverUrl: 'https://api2.amplitude.com/2/httpapi', - serverZone: 'US', - sessionTimeout: 300000, - storageProvider: new core.MemoryStorage(), - trackingOptions: { - adid: true, - carrier: true, - deviceManufacturer: true, - deviceModel: true, - ipAddress: true, - language: true, - osName: true, - osVersion: true, - platform: true, - appSetId: true, - idfv: true, - }, - transportProvider: new FetchTransport(), - useBatch: false, - trackingSessionEvents: false, - }); - }); - - test('should create using cookies/overwrite', async () => { - const cookieStorage = new core.MemoryStorage(); - await cookieStorage.set(getCookieName(API_KEY), { - deviceId: 'deviceIdFromCookies', - lastEventTime: 1, - sessionId: -1, - userId: 'userIdFromCookies', - optOut: false, - lastEventId: 2, - }); - jest.spyOn(Config, 'createCookieStorage').mockResolvedValueOnce(cookieStorage); - jest.spyOn(Config, 'createEventsStorage').mockResolvedValueOnce(new core.MemoryStorage()); - const logger = new core.Logger(); - logger.enable(LogLevel.Warn); - const config = await Config.useReactNativeConfig(API_KEY, { - partnerId: 'partnerId', - plan: { - version: '0', - }, - ingestionMetadata: { - sourceName: 'ampli', - sourceVersion: '2.0.0', - }, - sessionTimeout: 1, - cookieUpgrade: false, - disableCookies: true, - offline: true, - }); - expect(config).toEqual({ - apiKey: API_KEY, - appVersion: undefined, - cookieStorage, - cookieExpiration: 365, - cookieSameSite: 'Lax', - cookieSecure: false, - cookieUpgrade: false, - _deviceId: 'deviceIdFromCookies', - disableCookies: true, - domain: '', - flushIntervalMillis: 1000, - flushMaxRetries: 5, - flushQueueSize: 30, - instanceName: '$default_instance', - _lastEventId: 2, - _lastEventTime: 1, - loggerProvider: logger, - logLevel: LogLevel.Warn, - minIdLength: undefined, - offline: true, - _optOut: false, - partnerId: 'partnerId', - plan: { - version: '0', - }, - ingestionMetadata: { - sourceName: 'ampli', - sourceVersion: '2.0.0', - }, - serverUrl: 'https://api2.amplitude.com/2/httpapi', - serverZone: 'US', - _sessionId: -1, - sessionTimeout: 1, - storageProvider: new core.MemoryStorage(), - trackingSessionEvents: false, - trackingOptions: { - adid: true, - carrier: true, - deviceManufacturer: true, - deviceModel: true, - ipAddress: true, - language: true, - osName: true, - osVersion: true, - platform: true, - appSetId: true, - idfv: true, - }, - transportProvider: new FetchTransport(), - useBatch: false, - _userId: 'userIdFromCookies', - }); - }); - }); - - describe('createCookieStorage', () => { - test('should return custom', async () => { - const cookieStorage = { - options: {}, - isEnabled: async () => true, - get: async () => ({ - optOut: false, - }), - set: async () => undefined, - remove: async () => undefined, - reset: async () => undefined, - getRaw: async () => undefined, - }; - const storage = await Config.createCookieStorage({ - cookieStorage, - }); - expect(storage).toBe(cookieStorage); - }); - - /* - * Tested function is only available on web. - */ - if (isWeb()) { - test('should return cookies', async () => { - const storage = await Config.createCookieStorage(); - expect(storage).toBeInstanceOf(BrowserUtils.CookieStorage); - }); - } - - test('should use return storage', async () => { - const storage = await Config.createCookieStorage({ disableCookies: true }); - expect(storage).toBeInstanceOf(LocalStorageModule.LocalStorage); - }); - - test('should use memory', async () => { - const cookiesConstructor = jest.spyOn(BrowserUtils, 'CookieStorage').mockReturnValueOnce({ - options: {}, - isEnabled: async () => false, - get: async () => '', - getRaw: async () => '', - set: async () => undefined, - remove: async () => undefined, - reset: async () => undefined, - }); - const localStorageConstructor = jest.spyOn(LocalStorageModule, 'LocalStorage').mockReturnValueOnce({ - isEnabled: async () => false, - get: async () => '', - set: async () => undefined, - remove: async () => undefined, - reset: async () => undefined, - getRaw: async () => undefined, - }); - const storage = await Config.createCookieStorage(); - expect(storage).toBeInstanceOf(core.MemoryStorage); - expect(cookiesConstructor).toHaveBeenCalledTimes(1); - expect(localStorageConstructor).toHaveBeenCalledTimes(1); - }); - }); - - describe('createEventsStorage', () => { - test('should return custom', async () => { - const storageProvider = { - isEnabled: async () => true, - get: async () => [], - set: async () => undefined, - remove: async () => undefined, - reset: async () => undefined, - getRaw: async () => undefined, - }; - const storage = await Config.createEventsStorage({ - storageProvider, - }); - expect(storage).toBe(storageProvider); - }); - - test('should use return storage', async () => { - const storage = await Config.createEventsStorage(); - expect(storage).toBeInstanceOf(LocalStorageModule.LocalStorage); - }); - - test('should return undefined storage', async () => { - const storage = await Config.createEventsStorage({ - storageProvider: undefined, - }); - expect(storage).toBe(undefined); - }); - }); - - describe('getTopLevelDomain', () => { - test('should return empty string for localhost', async () => { - // jest env hostname is localhost - const domain = await Config.getTopLevelDomain(); - expect(domain).toBe(''); - }); - - test('should return empty string if no access to cookies', async () => { - const testCookieStorage: Storage = { - isEnabled: () => Promise.resolve(false), - get: jest.fn().mockResolvedValueOnce(Promise.resolve(1)), - getRaw: jest.fn().mockResolvedValueOnce(Promise.resolve(1)), - set: jest.fn().mockResolvedValueOnce(Promise.resolve(undefined)), - remove: jest.fn().mockResolvedValueOnce(Promise.resolve(undefined)), - reset: jest.fn().mockResolvedValueOnce(Promise.resolve(undefined)), - }; - jest.spyOn(BrowserUtils, 'CookieStorage').mockReturnValueOnce({ - ...testCookieStorage, - options: {}, - }); - const domain = await Config.getTopLevelDomain(); - expect(domain).toBe(''); - }); - - test('should return top level domain', async () => { - const testCookieStorage: Storage = { - isEnabled: () => Promise.resolve(true), - get: jest.fn().mockResolvedValueOnce(Promise.resolve(1)), - getRaw: jest.fn().mockResolvedValueOnce(Promise.resolve(1)), - set: jest.fn().mockResolvedValueOnce(Promise.resolve(undefined)), - remove: jest.fn().mockResolvedValueOnce(Promise.resolve(undefined)), - reset: jest.fn().mockResolvedValueOnce(Promise.resolve(undefined)), - }; - const actualCookieStorage: Storage = { - isEnabled: () => Promise.resolve(true), - get: jest.fn().mockResolvedValueOnce(Promise.resolve(undefined)).mockResolvedValueOnce(Promise.resolve(1)), - getRaw: jest.fn().mockResolvedValueOnce(Promise.resolve(undefined)).mockResolvedValueOnce(Promise.resolve(1)), - set: jest.fn().mockResolvedValue(Promise.resolve(undefined)), - remove: jest.fn().mockResolvedValue(Promise.resolve(undefined)), - reset: jest.fn().mockResolvedValue(Promise.resolve(undefined)), - }; - jest - .spyOn(BrowserUtils, 'CookieStorage') - .mockReturnValueOnce({ - ...testCookieStorage, - options: {}, - }) - .mockReturnValue({ - ...actualCookieStorage, - options: {}, - }); - expect(await Config.getTopLevelDomain('www.legislation.gov.uk')).toBe('.legislation.gov.uk'); - }); - - test('should not throw an error when location is an empty object', async () => { - const originalLocation = window.location; - - Object.defineProperty(window, 'location', { - value: {} as Location, - configurable: true, - }); - - expect(await Config.getTopLevelDomain()).toBe(''); - - Object.defineProperty(window, 'location', { - value: originalLocation, - configurable: true, - }); - }); - - test('should return empty string when location is undefined', async () => { - const originalLocation = window.location; - - Object.defineProperty(window, 'location', { - value: undefined, - configurable: true, - }); - - expect(await Config.getTopLevelDomain()).toBe(''); - - Object.defineProperty(window, 'location', { - value: originalLocation, - configurable: true, - }); - }); - }); -}); diff --git a/packages/analytics-react-native/test/cookie-migration/index.test.ts b/packages/analytics-react-native/test/cookie-migration/index.test.ts deleted file mode 100644 index 5c7f7829c..000000000 --- a/packages/analytics-react-native/test/cookie-migration/index.test.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { CookieStorage, getOldCookieName } from '@amplitude/analytics-client-common'; -import { Storage } from '@amplitude/analytics-types'; -import { decode, parseOldCookies, parseTime } from '../../src/cookie-migration'; -import * as LocalStorageModule from '../../src/storage/local-storage'; -import { isWeb } from '../../src/utils/platform'; - -describe('cookie-migration', () => { - const API_KEY = 'asdfasdf'; - afterEach(() => { - // clean up cookies - document.cookie = `${getOldCookieName(API_KEY)}=null; expires=-1`; - }); - - describe('parseOldCookies', () => { - test('should return default values', async () => { - const cookies = await parseOldCookies(API_KEY, { disableCookies: true }); - expect(cookies).toEqual({ - optOut: false, - }); - }); - - test('should handle non-persistent storage', async () => { - jest.spyOn(LocalStorageModule, 'LocalStorage').mockReturnValueOnce({ - isEnabled: async () => false, - get: async () => ({}), - getRaw: async () => '', - set: async () => undefined, - remove: async () => undefined, - reset: async () => undefined, - }); - const cookies = await parseOldCookies(API_KEY, { disableCookies: true }); - expect(cookies).toEqual({ - optOut: false, - }); - }); - - /* - * Tested function is only available on web. - */ - if (isWeb()) { - test('should remove old cookies', async () => { - const timestamp = 1650949309508; - const time = timestamp.toString(32); - const userId = 'userId'; - const encodedUserId = btoa(unescape(encodeURIComponent(userId))); - const oldCookieName = getOldCookieName(API_KEY); - document.cookie = `${oldCookieName}=deviceId.${encodedUserId}..${time}.${time}`; - const cookies = await parseOldCookies(API_KEY, { - cookieUpgrade: true, - }); - expect(cookies).toEqual({ - deviceId: 'deviceId', - userId: 'userId', - sessionId: timestamp, - lastEventTime: timestamp, - optOut: false, - }); - - const storage: Storage = new CookieStorage(); - const cookies2 = await storage.getRaw(oldCookieName); - expect(cookies2).toBeUndefined(); - }); - - test('should keep old cookies', async () => { - const timestamp = 1650949309508; - const time = timestamp.toString(32); - const userId = 'userId'; - const encodedUserId = btoa(unescape(encodeURIComponent(userId))); - const oldCookieName = getOldCookieName(API_KEY); - document.cookie = `${oldCookieName}=deviceId.${encodedUserId}..${time}.${time}`; - const cookies = await parseOldCookies(API_KEY, { - cookieUpgrade: false, - }); - expect(cookies).toEqual({ - deviceId: 'deviceId', - userId: 'userId', - sessionId: timestamp, - lastEventTime: timestamp, - optOut: false, - }); - - const storage: Storage = new CookieStorage(); - const cookies2 = await storage.getRaw(oldCookieName); - expect(cookies2).toBe(`deviceId.${encodedUserId}..${time}.${time}`); - }); - } - }); - - describe('parseTime', () => { - test('should parse time', () => { - const timestamp = Date.now(); - const base32 = timestamp.toString(32); - expect(parseTime(base32)).toBe(timestamp); - }); - - test('should handle invalid values', () => { - expect(parseTime('')).toBe(undefined); - }); - }); - - describe('decode', () => { - test('should decode value', () => { - expect(decode('YXNkZg==')).toBe('asdf'); - }); - - test('should handle incorrecty encoded value', () => { - expect(decode('asdf')).toBe(undefined); - }); - - test('should handle undefined input', () => { - expect(decode(undefined)).toBe(undefined); - }); - }); -}); diff --git a/packages/analytics-react-native/test/helpers/constants.ts b/packages/analytics-react-native/test/helpers/constants.ts deleted file mode 100644 index 01c97a94b..000000000 --- a/packages/analytics-react-native/test/helpers/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const uuidPattern = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/; diff --git a/packages/analytics-react-native/test/helpers/default.ts b/packages/analytics-react-native/test/helpers/default.ts deleted file mode 100644 index 6ebf51175..000000000 --- a/packages/analytics-react-native/test/helpers/default.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { MemoryStorage } from '@amplitude/analytics-core'; -import { ReactNativeConfig as IReactNativeConfig, ReactNativeOptions, UserSession } from '@amplitude/analytics-types'; - -import { ReactNativeConfig } from '../../src/config'; - -export const useDefaultConfig = (overrides?: ReactNativeOptions) => - new ReactNativeConfig(API_KEY, { ...DEFAULT_OPTIONS, ...overrides }); - -export const API_KEY = 'apiKey'; - -export const USER_ID = 'userId'; - -const cookieStorage = new MemoryStorage(); - -export const DEFAULT_OPTIONS: Partial = { - apiKey: API_KEY, - cookieStorage, - cookieExpiration: 365, - cookieSameSite: 'Lax', - cookieSecure: false, - disableCookies: false, - domain: '', - storageProvider: { - isEnabled: async () => true, - get: async () => undefined, - set: async () => undefined, - remove: async () => undefined, - reset: async () => undefined, - getRaw: async () => undefined, - }, - trackingOptions: { - adid: true, - carrier: true, - deviceManufacturer: true, - deviceModel: true, - ipAddress: true, - language: true, - osName: true, - osVersion: true, - platform: true, - appSetId: true, - idfv: true, - }, - transportProvider: { - send: () => Promise.resolve(null), - }, - sessionTimeout: 5 * 60 * 1000, -}; diff --git a/packages/analytics-react-native/test/index.test.ts b/packages/analytics-react-native/test/index.test.ts deleted file mode 100644 index c2700f634..000000000 --- a/packages/analytics-react-native/test/index.test.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - add, - createInstance, - flush, - getDeviceId, - getSessionId, - getUserId, - groupIdentify, - Identify, - identify, - init, - logEvent, - remove, - reset, - Revenue, - revenue, - setDeviceId, - setGroup, - setOptOut, - setSessionId, - setUserId, - track, -} from '../src/index'; - -describe('index', () => { - test('should expose apis', () => { - expect(typeof add).toBe('function'); - expect(typeof createInstance).toBe('function'); - expect(typeof flush).toBe('function'); - expect(typeof groupIdentify).toBe('function'); - expect(typeof getDeviceId).toBe('function'); - expect(typeof getSessionId).toBe('function'); - expect(typeof getUserId).toBe('function'); - expect(typeof Identify).toBe('function'); - expect(typeof identify).toBe('function'); - expect(typeof init).toBe('function'); - expect(typeof logEvent).toBe('function'); - expect(typeof remove).toBe('function'); - expect(typeof reset).toBe('function'); - expect(typeof Revenue).toBe('function'); - expect(typeof revenue).toBe('function'); - expect(typeof setDeviceId).toBe('function'); - expect(typeof setGroup).toBe('function'); - expect(typeof setOptOut).toBe('function'); - expect(typeof setSessionId).toBe('function'); - expect(typeof setUserId).toBe('function'); - expect(typeof track).toBe('function'); - }); -}); diff --git a/packages/analytics-react-native/test/mock/@react-native-async-storage/async-storage.js b/packages/analytics-react-native/test/mock/@react-native-async-storage/async-storage.js deleted file mode 100644 index 155d8650a..000000000 --- a/packages/analytics-react-native/test/mock/@react-native-async-storage/async-storage.js +++ /dev/null @@ -1 +0,0 @@ -export default from '@react-native-community/async-storage/jest/async-storage-mock'; diff --git a/packages/analytics-react-native/test/mock/setup-mobile.ts b/packages/analytics-react-native/test/mock/setup-mobile.ts deleted file mode 100644 index d3c7d1cdf..000000000 --- a/packages/analytics-react-native/test/mock/setup-mobile.ts +++ /dev/null @@ -1,38 +0,0 @@ -import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'; -import { NativeModules } from 'react-native'; -import { Platform } from 'react-native'; - -/* - * Set the platform OS to mobile. - */ -Platform.OS = 'ios'; - -/* - * Mock AsyncStorage - */ -jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage); - -/* - * Mock navigator. This is what the navigator looks like on mobile - */ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment, no-restricted-globals -// @ts-ignore -window['navigator'] = { product: 'ReactNative' }; - -/* - * Mock Native Module - */ -NativeModules.AmplitudeReactNative = { - getApplicationContext: async (): Promise> => { - return { - version: '1.0.0', - platform: 'iOS', - os: 'react-native-tests', - language: 'react-native-tests', - device_brand: 'react-native-tests', - device_manufacturer: 'react-native-tests', - device_model: 'react-native-tests', - carrier: 'react-native-tests', - }; - }, -}; diff --git a/packages/analytics-react-native/test/mock/setup-web.ts b/packages/analytics-react-native/test/mock/setup-web.ts deleted file mode 100644 index db92f50b1..000000000 --- a/packages/analytics-react-native/test/mock/setup-web.ts +++ /dev/null @@ -1,19 +0,0 @@ -import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'; -import { Platform } from 'react-native'; - -/* - * Set the platform OS to mobile. - */ -Platform.OS = 'web'; - -/* - * Mock AsyncStorage - */ -jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage); - -/* - * Mock navigator. This is what the navigator looks like on mobile - */ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -// window['navigator'] = { product: "ReactNative" } diff --git a/packages/analytics-react-native/test/plugins/context.test.ts b/packages/analytics-react-native/test/plugins/context.test.ts deleted file mode 100644 index 65e6ae06b..000000000 --- a/packages/analytics-react-native/test/plugins/context.test.ts +++ /dev/null @@ -1,196 +0,0 @@ -import { Context } from '../../src/plugins/context'; -import { useDefaultConfig } from '../helpers/default'; -import { isWeb } from '../../src/utils/platform'; - -describe('context', () => { - describe('setup', () => { - test('should setup plugin', async () => { - const context = new Context(); - const config = useDefaultConfig(); - config.appVersion = '1.0.0'; - await context.setup(config); - expect(context.config.appVersion).toEqual('1.0.0'); - expect(context.uaResult).toBeDefined(); - }); - - test('should setup plugin without app version', async () => { - const context = new Context(); - const config = useDefaultConfig(); - await context.setup(config); - expect(context.config.appVersion).toBeUndefined(); - expect(context.uaResult).toBeDefined(); - }); - }); - - describe('execute', () => { - test('should execute plugin', async () => { - const context = new Context(); - const config = useDefaultConfig({ - deviceId: 'deviceId', - sessionId: 1, - userId: 'user@amplitude.com', - }); - config.appVersion = '1.0.0'; - await context.setup(config); - - const event = { - event_type: 'event_type', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.app_version).toEqual('1.0.0'); - expect(firstContextEvent.event_type).toEqual('event_type'); - expect(firstContextEvent.insert_id).toBeDefined(); - /* - * Platform dependent on mobile/web - */ - expect(firstContextEvent.platform).toEqual(isWeb() ? 'Web' : 'iOS'); - expect(firstContextEvent.os_name).toBeDefined(); - expect(firstContextEvent.os_version).toBeDefined(); - expect(firstContextEvent.language).toBeDefined(); - expect(firstContextEvent.ip).toEqual('$remote'); - expect(firstContextEvent.device_id).toEqual('deviceId'); - expect(firstContextEvent.session_id).toEqual(1); - expect(firstContextEvent.user_id).toEqual('user@amplitude.com'); - - const secondContextEvent = await context.execute(event); - expect(secondContextEvent.insert_id).toBeDefined(); - expect(secondContextEvent.insert_id).not.toEqual(firstContextEvent.insert_id); - }); - - test('should not return the properties when the tracking options are false', async () => { - const context = new Context(); - const config = useDefaultConfig({ - deviceId: 'deviceId', - sessionId: 1, - trackingOptions: { - adid: false, - carrier: false, - deviceManufacturer: false, - deviceModel: false, - ipAddress: false, - language: false, - osName: false, - osVersion: false, - platform: false, - appSetId: false, - idfv: false, - }, - userId: 'user@amplitude.com', - }); - config.appVersion = '1.0.0'; - await context.setup(config); - - const event = { - event_type: 'event_type', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.app_version).toEqual('1.0.0'); - expect(firstContextEvent.event_type).toEqual('event_type'); - expect(firstContextEvent.insert_id).toBeDefined(); - - // tracking options should not be included - expect(firstContextEvent.platform).toBeUndefined(); - expect(firstContextEvent.os_name).toBeUndefined(); - expect(firstContextEvent.os_version).toBeUndefined(); - expect(firstContextEvent.language).toBeUndefined(); - expect(firstContextEvent.ip).toBeUndefined(); - expect(firstContextEvent.adid).toBeUndefined(); - expect(firstContextEvent.android_app_set_id).toBeUndefined(); - expect(firstContextEvent.idfv).toBeUndefined(); - expect(firstContextEvent.device_id).toEqual('deviceId'); - expect(firstContextEvent.session_id).toEqual(1); - expect(firstContextEvent.user_id).toEqual('user@amplitude.com'); - - const secondContextEvent = await context.execute(event); - expect(secondContextEvent.insert_id).toBeDefined(); - expect(secondContextEvent.insert_id).not.toEqual(firstContextEvent.insert_id); - }); - - test('should be overwritten by the context', async () => { - const context = new Context(); - const config = useDefaultConfig({ - deviceId: 'deviceId', - sessionId: 1, - userId: 'user@amplitude.com', - }); - config.appVersion = '1.0.0'; - await context.setup(config); - - const event = { - event_type: 'event_type', - device_id: 'new deviceId', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.app_version).toEqual('1.0.0'); - expect(firstContextEvent.event_type).toEqual('event_type'); - expect(firstContextEvent.insert_id).toBeDefined(); - expect(firstContextEvent.device_id).toEqual('new deviceId'); - - const secondContextEvent = await context.execute(event); - expect(secondContextEvent.insert_id).toBeDefined(); - expect(secondContextEvent.insert_id).not.toEqual(firstContextEvent.insert_id); - }); - - describe('ingestionMetadata config', () => { - test('should include ingestion metadata', async () => { - const sourceName = 'ampli'; - const sourceVersion = '2.0.0'; - const context = new Context(); - const config = useDefaultConfig({ - ingestionMetadata: { - sourceName, - sourceVersion, - }, - userId: 'user@amplitude.com', - }); - await context.setup(config); - - const event = { - event_type: 'event_type', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.event_type).toEqual('event_type'); - expect(firstContextEvent.ingestion_metadata?.source_name).toEqual(sourceName); - expect(firstContextEvent.ingestion_metadata?.source_version).toEqual(sourceVersion); - }); - - test('sourceName should be optional', async () => { - const sourceVersion = '2.0.0'; - const context = new Context(); - const config = useDefaultConfig({ - ingestionMetadata: { - sourceVersion, - }, - userId: 'user@amplitude.com', - }); - await context.setup(config); - - const event = { - event_type: 'event_type', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.ingestion_metadata?.source_name).toBeUndefined(); - expect(firstContextEvent.ingestion_metadata?.source_version).toEqual(sourceVersion); - }); - - test('sourceVersion should be optional', async () => { - const sourceName = 'ampli'; - const context = new Context(); - const config = useDefaultConfig({ - ingestionMetadata: { - sourceName, - }, - userId: 'user@amplitude.com', - }); - await context.setup(config); - - const event = { - event_type: 'event_type', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.ingestion_metadata?.source_name).toEqual(sourceName); - expect(firstContextEvent.ingestion_metadata?.source_version).toBeUndefined(); - }); - }); - }); -}); diff --git a/packages/analytics-react-native/test/react-native-client.test.ts b/packages/analytics-react-native/test/react-native-client.test.ts deleted file mode 100644 index 28d074f4c..000000000 --- a/packages/analytics-react-native/test/react-native-client.test.ts +++ /dev/null @@ -1,889 +0,0 @@ -import { AmplitudeReactNative } from '../src/react-native-client'; -import * as core from '@amplitude/analytics-core'; -import * as CookieMigration from '../src/cookie-migration'; -import { Status, UserSession, Event } from '@amplitude/analytics-types'; -import { isWeb } from '../src/utils/platform'; -import AsyncStorage from '@react-native-async-storage/async-storage'; -import { getAnalyticsConnector } from '@amplitude/analytics-client-common'; -import * as Config from '../src/config'; -import { getCookieName as getStorageKey } from '@amplitude/analytics-client-common/src'; - -describe('react-native-client', () => { - const API_KEY = 'API_KEY'; - const USER_ID = 'USER_ID'; - const DEVICE_ID = 'DEVICE_ID'; - const attributionConfig = { - attribution: { - disabled: true, - }, - }; - - afterEach(async () => { - // clean up cookies - // due to jest env, cookies are always preset and needs to be cleaned up - document.cookie = 'AMP_API_KEY=null; expires=-1'; - if (!isWeb()) { - await AsyncStorage.clear(); - } - }); - - describe('init', () => { - test('should initialize client', async () => { - const parseOldCookies = jest.spyOn(CookieMigration, 'parseOldCookies').mockResolvedValueOnce({ - optOut: false, - }); - const client = new AmplitudeReactNative(); - await client.init(API_KEY, USER_ID, { - ...attributionConfig, - }).promise; - expect(parseOldCookies).toHaveBeenCalledTimes(1); - }); - - test('should initialize without error when apiKey is undefined', async () => { - const parseOldCookies = jest.spyOn(CookieMigration, 'parseOldCookies').mockResolvedValueOnce({ - optOut: false, - }); - const client = new AmplitudeReactNative(); - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - await client.init(undefined as any, USER_ID, { - ...attributionConfig, - }).promise; - expect(parseOldCookies).toHaveBeenCalledTimes(1); - }); - - test('should read from old cookies config', async () => { - const parseOldCookies = jest.spyOn(CookieMigration, 'parseOldCookies').mockResolvedValueOnce({ - optOut: false, - deviceId: DEVICE_ID, - sessionId: 1, - lastEventTime: Date.now() - 1000, - }); - const cookieStorage = new core.MemoryStorage(); - const client = new AmplitudeReactNative(); - await client.init(API_KEY, USER_ID, { - optOut: false, - cookieStorage, - ...attributionConfig, - }).promise; - expect(client.getDeviceId()).toBe(DEVICE_ID); - expect(client.getSessionId()).toBe(1); - expect(parseOldCookies).toHaveBeenCalledTimes(1); - }); - - test('should call prevent concurrent init executions', async () => { - const parseOldCookies = jest.spyOn(CookieMigration, 'parseOldCookies').mockResolvedValueOnce({ - optOut: false, - }); - const useNodeConfig = jest.spyOn(Config, 'useReactNativeConfig'); - const client = new AmplitudeReactNative(); - await Promise.all([ - client.init(API_KEY, USER_ID, { - ...attributionConfig, - }), - client.init(API_KEY, USER_ID, { - ...attributionConfig, - }), - client.init(API_KEY, USER_ID, { - ...attributionConfig, - }), - ]); - // NOTE: `parseOldCookies` and `useNodeConfig` are only called once despite multiple init calls - expect(parseOldCookies).toHaveBeenCalledTimes(1); - expect(useNodeConfig).toHaveBeenCalledTimes(1); - }); - - test('should read from new cookies config', async () => { - const parseOldCookies = jest.spyOn(CookieMigration, 'parseOldCookies').mockResolvedValueOnce({ - optOut: false, - }); - const cookieStorage = new core.MemoryStorage(); - jest.spyOn(cookieStorage, 'set').mockResolvedValue(); - jest.spyOn(cookieStorage, 'get').mockResolvedValue({ - sessionId: 1, - deviceId: DEVICE_ID, - optOut: false, - }); - const client = new AmplitudeReactNative(); - await client.init(API_KEY, USER_ID, { - optOut: true, - cookieStorage, - ...attributionConfig, - }).promise; - expect(client.getDeviceId()).toBe(DEVICE_ID); - expect(client.getSessionId()).not.toBe(1); - expect(parseOldCookies).toHaveBeenCalledTimes(1); - }); - - test('should track attributions', async () => { - const parseOldCookies = jest.spyOn(CookieMigration, 'parseOldCookies').mockResolvedValueOnce({ - optOut: false, - }); - const client = new AmplitudeReactNative(); - const runAttributionStrategy = jest - .spyOn(client, 'runAttributionStrategy') - .mockReturnValueOnce(Promise.resolve(undefined)); - await client.init(API_KEY, USER_ID).promise; - expect(parseOldCookies).toHaveBeenCalledTimes(1); - expect(runAttributionStrategy).toHaveBeenCalledTimes(1); - }); - - test('should track attributions with config', async () => { - const parseOldCookies = jest.spyOn(CookieMigration, 'parseOldCookies').mockResolvedValueOnce({ - optOut: false, - }); - const client = new AmplitudeReactNative(); - const runAttributionStrategy = jest - .spyOn(client, 'runAttributionStrategy') - .mockReturnValueOnce(Promise.resolve(undefined)); - await client.init(API_KEY, USER_ID, { - attribution: { - excludeReferrers: [], - initialEmptyValue: '', - }, - }).promise; - expect(parseOldCookies).toHaveBeenCalledTimes(1); - expect(runAttributionStrategy).toHaveBeenCalledTimes(1); - }); - - test('should set user id and device id in analytics connector', async () => { - const cookieStorage = new core.MemoryStorage(); - jest.spyOn(cookieStorage, 'set').mockResolvedValue(); - jest.spyOn(cookieStorage, 'get').mockResolvedValueOnce(undefined).mockResolvedValue({ - sessionId: 1, - deviceId: DEVICE_ID, - optOut: false, - }); - const client = new AmplitudeReactNative(); - await client.init(API_KEY, USER_ID, { - optOut: true, - cookieStorage, - ...attributionConfig, - }).promise; - expect(client.getDeviceId()).toBe(DEVICE_ID); - expect(client.getUserId()).toBe(USER_ID); - const identity = getAnalyticsConnector().identityStore.getIdentity(); - expect(identity.deviceId).toBe(DEVICE_ID); - expect(identity.userId).toBe(USER_ID); - }); - - test('should set up event bridge and track events', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, USER_ID, { - optOut: false, - ...attributionConfig, - }).promise; - const track = jest.spyOn(client, 'track').mockReturnValueOnce({ - promise: Promise.resolve({ - code: 200, - message: '', - event: { - event_type: 'event_type', - }, - }), - }); - getAnalyticsConnector().eventBridge.logEvent({ - eventType: 'event_type', - eventProperties: { - k: 'v', - }, - }); - expect(track).toHaveBeenCalledTimes(1); - }); - }); - - if (isWeb()) { - describe('trackCampaign', () => { - test('should track campaign', async () => { - const client = new AmplitudeReactNative(); - const track = jest.spyOn(client, 'track').mockReturnValueOnce({ - promise: Promise.resolve({ - code: 200, - message: '', - event: { - event_type: 'event_type', - }, - }), - }); - await client.init(API_KEY, USER_ID, { - attribution: { - disabled: false, - }, - }).promise; - const result = await client.runAttributionStrategy(); - expect(result).toBe(undefined); - expect(track).toHaveBeenCalledTimes(1); - }); - }); - } - - describe('getUserId', () => { - test('should get user id', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, USER_ID, { - ...attributionConfig, - }).promise; - expect(client.getUserId()).toBe(USER_ID); - }); - - test('should handle undefined config', async () => { - const client = new AmplitudeReactNative(); - expect(client.getUserId()).toBe(undefined); - }); - }); - - describe('setUserId', () => { - test('should set user id', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - ...attributionConfig, - }).promise; - expect(client.getUserId()).toBe(undefined); - client.setUserId(USER_ID); - expect(client.getUserId()).toBe(USER_ID); - }); - - test('should defer set user id', () => { - return new Promise((resolve) => { - const client = new AmplitudeReactNative(); - void client - .init(API_KEY, undefined, { - ...attributionConfig, - }) - .promise.then(() => { - expect(client.getUserId()).toBe('user@amplitude.com'); - resolve(); - }); - client.setUserId('user@amplitude.com'); - }); - }); - }); - - describe('getDeviceId', () => { - test('should get device id', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - deviceId: DEVICE_ID, - ...attributionConfig, - }).promise; - expect(client.getDeviceId()).toBe(DEVICE_ID); - }); - - test('should handle undefined config', async () => { - const client = new AmplitudeReactNative(); - expect(client.getDeviceId()).toBe(undefined); - }); - }); - - describe('setDeviceId', () => { - test('should set device id config', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - ...attributionConfig, - }).promise; - client.setDeviceId(DEVICE_ID); - expect(client.getDeviceId()).toBe(DEVICE_ID); - }); - - test('should defer set device id', () => { - return new Promise((resolve) => { - const client = new AmplitudeReactNative(); - void client - .init(API_KEY, undefined, { - ...attributionConfig, - }) - .promise.then(() => { - expect(client.getDeviceId()).toBe('asdfg'); - resolve(); - }); - client.setDeviceId('asdfg'); - }); - }); - }); - - describe('reset', () => { - test('should reset user id and generate new device id config', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - ...attributionConfig, - }).promise; - client.setUserId(USER_ID); - client.setDeviceId(DEVICE_ID); - expect(client.getUserId()).toBe(USER_ID); - expect(client.getDeviceId()).toBe(DEVICE_ID); - client.reset(); - expect(client.getUserId()).toBe(undefined); - expect(client.getDeviceId()).not.toBe(DEVICE_ID); - }); - }); - - describe('getSessionId', () => { - test('should get session id', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - sessionId: 1, - ...attributionConfig, - }).promise; - expect(client.getSessionId()).toBe(1); - }); - - test('should handle undefined config', async () => { - const client = new AmplitudeReactNative(); - expect(client.getSessionId()).toBe(undefined); - }); - }); - - describe('setSessionId', () => { - test('should set session id', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - ...attributionConfig, - }).promise; - client.setSessionId(1); - expect(client.getSessionId()).toBe(1); - }); - - test('should defer set session id', () => { - return new Promise((resolve) => { - const client = new AmplitudeReactNative(); - void client - .init(API_KEY, undefined, { - ...attributionConfig, - }) - .promise.then(() => { - expect(client.getSessionId()).toBe(1); - resolve(); - }); - client.setSessionId(1); - }); - }); - }); - - describe('setOptOut', () => { - test('should set opt out', async () => { - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - ...attributionConfig, - }).promise; - client.setOptOut(true); - expect(client.config.optOut).toBe(true); - }); - }); - - describe('identify', () => { - test('should track identify', async () => { - const send = jest.fn().mockReturnValueOnce({ - status: Status.Success, - statusCode: 200, - body: { - eventsIngested: 1, - payloadSizeBytes: 1, - serverUploadTime: 1, - }, - }); - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - transportProvider: { - send, - }, - ...attributionConfig, - }).promise; - const identifyObject = new core.Identify(); - const result = await client.identify(identifyObject, { user_id: '123', device_id: '123' }).promise; - expect(result.code).toEqual(200); - expect(send).toHaveBeenCalledTimes(1); - }); - }); - - describe('groupIdentify', () => { - test('should track group identify', async () => { - const send = jest.fn().mockReturnValueOnce({ - status: Status.Success, - statusCode: 200, - body: { - eventsIngested: 1, - payloadSizeBytes: 1, - serverUploadTime: 1, - }, - }); - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - transportProvider: { - send, - }, - ...attributionConfig, - }).promise; - const identifyObject = new core.Identify(); - const result = await client.groupIdentify('g', '1', identifyObject).promise; - expect(result.code).toEqual(200); - expect(send).toHaveBeenCalledTimes(1); - }); - }); - - describe('revenue', () => { - test('should track revenue', async () => { - const send = jest.fn().mockReturnValueOnce({ - status: Status.Success, - statusCode: 200, - body: { - eventsIngested: 1, - payloadSizeBytes: 1, - serverUploadTime: 1, - }, - }); - const client = new AmplitudeReactNative(); - await client.init(API_KEY, undefined, { - transportProvider: { - send, - }, - ...attributionConfig, - }).promise; - const revenueObject = new core.Revenue(); - const result = await client.revenue(revenueObject).promise; - expect(result.code).toEqual(200); - expect(send).toHaveBeenCalledTimes(1); - }); - }); - - describe('session management', () => { - class AmplitudeReactNativeTest extends AmplitudeReactNative { - currentTime: number; - - constructor(currentTime: number) { - super(); - this.currentTime = currentTime; - } - - currentTimeMillis(): number { - return this.currentTime; - } - - setActive(currentTime: number) { - this.currentTime = currentTime; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - this.handleAppStateChange('active'); - } - - setBackground() { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - this.handleAppStateChange('background'); - } - } - - const sendResponse = { - status: Status.Success, - statusCode: 200, - body: { - eventsIngested: 1, - payloadSizeBytes: 1, - serverUploadTime: 1, - }, - }; - - const clientOptions = ( - send: any, - cookieStorage: core.MemoryStorage, - trackingSessionEvents: boolean, - sessionId?: number, - ) => ({ - transportProvider: { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - send, - }, - cookieStorage, - sessionTimeout: 100, - sessionId, - trackingSessionEvents, - ...attributionConfig, - }); - - test('session restore', async () => { - const send = jest.fn().mockReturnValue(sendResponse); - const cookieStorage = new core.MemoryStorage(); - - const client1 = new AmplitudeReactNativeTest(500); - await client1.init(API_KEY, undefined, clientOptions(send, cookieStorage, true)).promise; - - client1.setActive(1000); - - expect(client1.config.sessionId).toEqual(1000); - expect(client1.config.lastEventTime).toEqual(1000); - expect(client1.config.lastEventId).toEqual(2); - - void client1.track({ event_type: 'event-1', time: 1200 }); - - expect(client1.config.sessionId).toEqual(1000); - expect(client1.config.lastEventTime).toEqual(1200); - expect(client1.config.lastEventId).toEqual(3); - - const client2 = new AmplitudeReactNativeTest(1250); - await client2.init(API_KEY, undefined, clientOptions(send, cookieStorage, true)).promise; - - expect(client2.config.sessionId).toEqual(1000); - expect(client2.config.lastEventTime).toEqual(1250); - expect(client2.config.lastEventId).toEqual(3); - - void client2.track({ event_type: 'event-2', time: 1270 }); - - expect(client2.config.sessionId).toEqual(1000); - expect(client2.config.lastEventTime).toEqual(1270); - expect(client2.config.lastEventId).toEqual(4); - - const client3 = new AmplitudeReactNativeTest(1300); - await client3.init(API_KEY, undefined, clientOptions(send, cookieStorage, true)).promise; - - expect(client3.config.sessionId).toEqual(1000); - expect(client3.config.lastEventTime).toEqual(1300); - expect(client3.config.lastEventId).toEqual(4); - - client3.setActive(1500); - - expect(client3.config.sessionId).toEqual(1500); - expect(client3.config.lastEventTime).toEqual(1500); - expect(client3.config.lastEventId).toEqual(6); - }); - - describe('track session events', () => { - test('should assign session ids and track session_start/session_end events', async () => { - const send = jest.fn().mockReturnValue(sendResponse); - const client = new AmplitudeReactNativeTest(950); - const cookieStorage = new core.MemoryStorage(); - await cookieStorage.set(getStorageKey(API_KEY), { sessionId: 500, lastEventTime: 850, optOut: false }); - - await client.init(API_KEY, undefined, clientOptions(send, cookieStorage, true)).promise; - - void client.track({ event_type: 'event-1', time: 1000 }); - void client.track({ event_type: 'event-2', time: 1050 }); - void client.track({ event_type: 'event-3', time: 1200 }); - void client.track({ event_type: 'event-4', time: 1350 }); - - client.setActive(1500); - - void client.track({ event_type: 'event-5', time: 1700 }); - - client.setBackground(); - - void client.track({ event_type: 'event-6', time: 1750 }); - void client.track({ event_type: 'event-7', time: 2000 }); - - client.setActive(2050); - - await client.track({ event_type: 'event-8', time: 2200 }).promise; - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const events = send.mock.calls.flatMap((call) => call[1].events as Event[]); - expect(events.length).toEqual(18); - events.forEach((event, i) => expect(event.event_id).toEqual(i)); - - expect(events[0].event_type).toEqual('session_end'); - expect(events[0].session_id).toEqual(500); - expect(events[0].time).toEqual(851); - - expect(events[1].event_type).toEqual('session_start'); - expect(events[1].session_id).toEqual(950); - expect(events[1].time).toEqual(950); - - expect(events[2].event_type).toEqual('event-1'); - expect(events[2].session_id).toEqual(950); - expect(events[2].time).toEqual(1000); - - expect(events[3].event_type).toEqual('event-2'); - expect(events[3].session_id).toEqual(950); - expect(events[3].time).toEqual(1050); - - expect(events[4].event_type).toEqual('session_end'); - expect(events[4].session_id).toEqual(950); - expect(events[4].time).toEqual(1051); - - expect(events[5].event_type).toEqual('session_start'); - expect(events[5].session_id).toEqual(1200); - expect(events[5].time).toEqual(1200); - - expect(events[6].event_type).toEqual('event-3'); - expect(events[6].session_id).toEqual(1200); - expect(events[6].time).toEqual(1200); - - expect(events[7].event_type).toEqual('session_end'); - expect(events[7].session_id).toEqual(1200); - expect(events[7].time).toEqual(1201); - - expect(events[8].event_type).toEqual('session_start'); - expect(events[8].session_id).toEqual(1350); - expect(events[8].time).toEqual(1350); - - expect(events[9].event_type).toEqual('event-4'); - expect(events[9].session_id).toEqual(1350); - expect(events[9].time).toEqual(1350); - - expect(events[10].event_type).toEqual('session_end'); - expect(events[10].session_id).toEqual(1350); - expect(events[10].time).toEqual(1351); - - expect(events[11].event_type).toEqual('session_start'); - expect(events[11].session_id).toEqual(1500); - expect(events[11].time).toEqual(1500); - - expect(events[12].event_type).toEqual('event-5'); - expect(events[12].session_id).toEqual(1500); - expect(events[12].time).toEqual(1700); - - expect(events[13].event_type).toEqual('event-6'); - expect(events[13].session_id).toEqual(1500); - expect(events[13].time).toEqual(1750); - - expect(events[14].event_type).toEqual('session_end'); - expect(events[14].session_id).toEqual(1500); - expect(events[14].time).toEqual(1751); - - expect(events[15].event_type).toEqual('session_start'); - expect(events[15].session_id).toEqual(2000); - expect(events[15].time).toEqual(2000); - - expect(events[16].event_type).toEqual('event-7'); - expect(events[16].session_id).toEqual(2000); - expect(events[16].time).toEqual(2000); - - expect(events[17].event_type).toEqual('event-8'); - expect(events[17].session_id).toEqual(2000); - expect(events[17].time).toEqual(2200); - }); - - test('should use explicit session ids and track session_start/session_end events', async () => { - const send = jest.fn().mockReturnValue(sendResponse); - const client = new AmplitudeReactNativeTest(950); - const cookieStorage = new core.MemoryStorage(); - await cookieStorage.set(getStorageKey(API_KEY), { sessionId: 500, lastEventTime: 850, optOut: false }); - - await client.init(API_KEY, undefined, clientOptions(send, cookieStorage, true, 1000)).promise; - - void client.track({ event_type: 'event-1', time: 1000 }); - void client.track({ event_type: 'event-2', time: 1050 }); - - client.currentTime = 1100; - client.setSessionId(5000); - - void client.track({ event_type: 'event-3', time: 1200 }); - void client.track({ event_type: 'event-4', time: 1350 }); - - client.setActive(1500); - - void client.track({ event_type: 'event-5', time: 1700 }); - - client.currentTime = 1720; - client.setSessionId(5050); - - client.setBackground(); - - void client.track({ event_type: 'event-6', time: 1750 }); - void client.track({ event_type: 'event-7', time: 2000 }); - - client.setActive(2050); - - await client.track({ event_type: 'event-8', time: 2200 }).promise; - - client.setSessionId(6000); - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const events = send.mock.calls.flatMap((call) => call[1].events as Event[]); - expect(events.length).toEqual(14); - events.forEach((event, i) => expect(event.event_id).toEqual(i)); - - expect(events[0].event_type).toEqual('session_end'); - expect(events[0].session_id).toEqual(500); - expect(events[0].time).toEqual(851); - - expect(events[1].event_type).toEqual('session_start'); - expect(events[1].session_id).toEqual(1000); - expect(events[1].time).toEqual(950); - - expect(events[2].event_type).toEqual('event-1'); - expect(events[2].session_id).toEqual(1000); - expect(events[2].time).toEqual(1000); - - expect(events[3].event_type).toEqual('event-2'); - expect(events[3].session_id).toEqual(1000); - expect(events[3].time).toEqual(1050); - - expect(events[4].event_type).toEqual('session_end'); - expect(events[4].session_id).toEqual(1000); - expect(events[4].time).toEqual(1051); - - expect(events[5].event_type).toEqual('session_start'); - expect(events[5].session_id).toEqual(5000); - expect(events[5].time).toEqual(1100); - - expect(events[6].event_type).toEqual('event-3'); - expect(events[6].session_id).toEqual(5000); - expect(events[6].time).toEqual(1200); - - expect(events[7].event_type).toEqual('event-4'); - expect(events[7].session_id).toEqual(5000); - expect(events[7].time).toEqual(1350); - - expect(events[8].event_type).toEqual('event-5'); - expect(events[8].session_id).toEqual(5000); - expect(events[8].time).toEqual(1700); - - expect(events[9].event_type).toEqual('session_end'); - expect(events[9].session_id).toEqual(5000); - expect(events[9].time).toEqual(1701); - - expect(events[10].event_type).toEqual('session_start'); - expect(events[10].session_id).toEqual(5050); - expect(events[10].time).toEqual(1720); - - expect(events[11].event_type).toEqual('event-6'); - expect(events[11].session_id).toEqual(5050); - expect(events[11].time).toEqual(1750); - - expect(events[12].event_type).toEqual('event-7'); - expect(events[12].session_id).toEqual(5050); - expect(events[12].time).toEqual(2000); - - expect(events[13].event_type).toEqual('event-8'); - expect(events[13].session_id).toEqual(5050); - expect(events[13].time).toEqual(2200); - }); - }); - - describe('do not track session events', () => { - test('should assign session ids and do not track session_start/session_end events', async () => { - const send = jest.fn().mockReturnValue(sendResponse); - const client = new AmplitudeReactNativeTest(950); - const cookieStorage = new core.MemoryStorage(); - await cookieStorage.set(getStorageKey(API_KEY), { sessionId: 500, lastEventTime: 850, optOut: false }); - - await client.init(API_KEY, undefined, clientOptions(send, cookieStorage, false)).promise; - - void client.track({ event_type: 'event-1', time: 1000 }); - void client.track({ event_type: 'event-2', time: 1050 }); - void client.track({ event_type: 'event-3', time: 1200 }); - void client.track({ event_type: 'event-4', time: 1350 }); - - client.setActive(1500); - - void client.track({ event_type: 'event-5', time: 1700 }); - - client.setBackground(); - - void client.track({ event_type: 'event-6', time: 1750 }); - void client.track({ event_type: 'event-7', time: 2000 }); - - client.setActive(2050); - - await client.track({ event_type: 'event-8', time: 2200 }).promise; - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const events = send.mock.calls.flatMap((call) => call[1].events as Event[]); - expect(events.length).toEqual(8); - events.forEach((event, i) => expect(event.event_id).toEqual(i)); - - expect(events[0].event_type).toEqual('event-1'); - expect(events[0].session_id).toEqual(950); - expect(events[0].time).toEqual(1000); - - expect(events[1].event_type).toEqual('event-2'); - expect(events[1].session_id).toEqual(950); - expect(events[1].time).toEqual(1050); - - expect(events[2].event_type).toEqual('event-3'); - expect(events[2].session_id).toEqual(1200); - expect(events[2].time).toEqual(1200); - - expect(events[3].event_type).toEqual('event-4'); - expect(events[3].session_id).toEqual(1350); - expect(events[3].time).toEqual(1350); - - expect(events[4].event_type).toEqual('event-5'); - expect(events[4].session_id).toEqual(1500); - expect(events[4].time).toEqual(1700); - - expect(events[5].event_type).toEqual('event-6'); - expect(events[5].session_id).toEqual(1500); - expect(events[5].time).toEqual(1750); - - expect(events[6].event_type).toEqual('event-7'); - expect(events[6].session_id).toEqual(2000); - expect(events[6].time).toEqual(2000); - - expect(events[7].event_type).toEqual('event-8'); - expect(events[7].session_id).toEqual(2000); - expect(events[7].time).toEqual(2200); - }); - - test('should use explicit session ids and do not track session_start/session_end events', async () => { - const send = jest.fn().mockReturnValue(sendResponse); - const client = new AmplitudeReactNativeTest(950); - const cookieStorage = new core.MemoryStorage(); - await cookieStorage.set(getStorageKey(API_KEY), { sessionId: 500, lastEventTime: 850, optOut: false }); - - await client.init(API_KEY, undefined, clientOptions(send, cookieStorage, false, 1000)).promise; - - void client.track({ event_type: 'event-1', time: 1000 }); - void client.track({ event_type: 'event-2', time: 1050 }); - - client.currentTime = 1100; - client.setSessionId(5000); - - void client.track({ event_type: 'event-3', time: 1200 }); - void client.track({ event_type: 'event-4', time: 1350 }); - - client.setActive(1500); - - void client.track({ event_type: 'event-5', time: 1700 }); - - client.currentTime = 1720; - client.setSessionId(5050); - - client.setBackground(); - - void client.track({ event_type: 'event-6', time: 1750 }); - void client.track({ event_type: 'event-7', time: 2000 }); - - client.setActive(2050); - - await client.track({ event_type: 'event-8', time: 2200 }).promise; - - client.setSessionId(6000); - - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const events = send.mock.calls.flatMap((call) => call[1].events as Event[]); - expect(events.length).toEqual(8); - events.forEach((event, i) => expect(event.event_id).toEqual(i)); - - expect(events[0].event_type).toEqual('event-1'); - expect(events[0].session_id).toEqual(1000); - expect(events[0].time).toEqual(1000); - - expect(events[1].event_type).toEqual('event-2'); - expect(events[1].session_id).toEqual(1000); - expect(events[1].time).toEqual(1050); - - expect(events[2].event_type).toEqual('event-3'); - expect(events[2].session_id).toEqual(5000); - expect(events[2].time).toEqual(1200); - - expect(events[3].event_type).toEqual('event-4'); - expect(events[3].session_id).toEqual(5000); - expect(events[3].time).toEqual(1350); - - expect(events[4].event_type).toEqual('event-5'); - expect(events[4].session_id).toEqual(5000); - expect(events[4].time).toEqual(1700); - - expect(events[5].event_type).toEqual('event-6'); - expect(events[5].session_id).toEqual(5050); - expect(events[5].time).toEqual(1750); - - expect(events[6].event_type).toEqual('event-7'); - expect(events[6].session_id).toEqual(5050); - expect(events[6].time).toEqual(2000); - - expect(events[7].event_type).toEqual('event-8'); - expect(events[7].session_id).toEqual(5050); - expect(events[7].time).toEqual(2200); - }); - }); - }); -}); diff --git a/packages/analytics-react-native/test/storage/local-storage.test.ts b/packages/analytics-react-native/test/storage/local-storage.test.ts deleted file mode 100644 index c58850577..000000000 --- a/packages/analytics-react-native/test/storage/local-storage.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { LocalStorage } from '../../src/storage/local-storage'; - -describe('local-storage', () => { - describe('isEnabled', () => { - test('should return true', async () => { - const localStorage = new LocalStorage(); - expect(await localStorage.isEnabled()).toBe(true); - }); - }); - - describe('get', () => { - test('should return undefined if not set', async () => { - const localStorage = new LocalStorage(); - expect(await localStorage.get('1')).toBe(undefined); - }); - - test('should return object', async () => { - const localStorage = new LocalStorage>(); - await localStorage.set('1', { a: 1 }); - expect(await localStorage.get('1')).toEqual({ a: 1 }); - }); - - test('should return array', async () => { - const localStorage = new LocalStorage(); - await localStorage.set('1', [1]); - expect(await localStorage.get('1')).toEqual([1]); - }); - }); - - describe('set', () => { - test('should set value', async () => { - const localStorage = new LocalStorage(); - await localStorage.set('1', 'a'); - expect(await localStorage.get('1')).toBe('a'); - }); - }); - - describe('remove', () => { - test('should remove value of key', async () => { - const localStorage = new LocalStorage(); - await localStorage.set('1', 'a'); - await localStorage.set('2', 'b'); - expect(await localStorage.get('1')).toBe('a'); - expect(await localStorage.get('2')).toBe('b'); - await localStorage.remove('1'); - expect(await localStorage.get('1')).toBe(undefined); - expect(await localStorage.get('2')).toBe('b'); - }); - }); - - describe('reset', () => { - test('should remove all values', async () => { - const localStorage = new LocalStorage(); - await localStorage.set('1', 'a'); - await localStorage.set('2', 'b'); - expect(await localStorage.get('1')).toBe('a'); - expect(await localStorage.get('2')).toBe('b'); - await localStorage.reset(); - expect(await localStorage.get('1')).toBe(undefined); - expect(await localStorage.get('2')).toBe(undefined); - }); - }); -}); diff --git a/packages/analytics-react-native/tsconfig.build.json b/packages/analytics-react-native/tsconfig.build.json deleted file mode 100644 index 9e245f101..000000000 --- a/packages/analytics-react-native/tsconfig.build.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig", - "exclude": ["test", "__mocks__"], -} diff --git a/packages/analytics-react-native/tsconfig.json b/packages/analytics-react-native/tsconfig.json deleted file mode 100644 index 45ee9a6bf..000000000 --- a/packages/analytics-react-native/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "paths": { - "@amplitude/analytics-react-native": ["./src/index"] - }, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react", - "lib": ["esnext", "dom"], - "module": "esnext", - "moduleResolution": "node", - "noStrictGenericChecks": false, - "skipLibCheck": true, - "target": "es6" - } -} From 4dc6b1e65e281104a119a28ca7ef4beaa934a03b Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 14:53:41 -0700 Subject: [PATCH 2/9] fix(plugin-page-view-tracking-browser): move to core --- packages/analytics-core/src/index.ts | 9 +- .../package.json | 3 +- .../src/page-view-tracking.ts | 9 +- yarn.lock | 1081 +---------------- 4 files changed, 56 insertions(+), 1046 deletions(-) diff --git a/packages/analytics-core/src/index.ts b/packages/analytics-core/src/index.ts index 4d0450875..aaf7a7523 100644 --- a/packages/analytics-core/src/index.ts +++ b/packages/analytics-core/src/index.ts @@ -27,7 +27,14 @@ export { FetchTransport } from './transports/fetch'; export { LogLevel } from './types/loglevel'; export { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants'; export { Storage, IdentityStorageType } from './types/storage'; -export { Event, IdentifyOperation, SpecialEventType, IdentifyEvent, GroupIdentifyEvent } from './types/event/event'; +export { + Event, + IdentifyOperation, + SpecialEventType, + IdentifyEvent, + GroupIdentifyEvent, + IdentifyUserProperties, +} from './types/event/event'; export { EventOptions, BaseEvent } from './types/event/base-event'; export { IngestionMetadata } from './types/event/ingestion-metadata'; export { ServerZoneType, ServerZone } from './types/server-zone'; diff --git a/packages/plugin-page-view-tracking-browser/package.json b/packages/plugin-page-view-tracking-browser/package.json index bb091ef42..02f3cff96 100644 --- a/packages/plugin-page-view-tracking-browser/package.json +++ b/packages/plugin-page-view-tracking-browser/package.json @@ -37,8 +37,7 @@ "url": "https://github.com/amplitude/Amplitude-TypeScript/issues" }, "dependencies": { - "@amplitude/analytics-client-common": "^2.3.23", - "@amplitude/analytics-types": "^2.9.2", + "@amplitude/analytics-core": "^2.12.2", "tslib": "^2.4.1" }, "devDependencies": { diff --git a/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts b/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts index ea9e0be2c..64e3adafd 100644 --- a/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts +++ b/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts @@ -1,13 +1,14 @@ -import { CampaignParser, getGlobalScope } from '@amplitude/analytics-client-common'; import { + getGlobalScope, BrowserClient, BrowserConfig, EnrichmentPlugin, Event, IdentifyOperation, IdentifyUserProperties, - Logger, -} from '@amplitude/analytics-types'; + ILogger, +} from '@amplitude/analytics-core'; +import { CampaignParser } from '@amplitude/analytics-client-common'; import { BASE_CAMPAIGN } from '@amplitude/analytics-client-common'; import { CreatePageViewTrackingPlugin, Options } from './typings/page-view-tracking'; import { omitUndefined } from './utils'; @@ -17,7 +18,7 @@ export const defaultPageViewEvent = '[Amplitude] Page Viewed'; export const pageViewTrackingPlugin: CreatePageViewTrackingPlugin = (options: Options = {}) => { let amplitude: BrowserClient | undefined; const globalScope = getGlobalScope(); - let loggerProvider: Logger | undefined = undefined; + let loggerProvider: ILogger | undefined = undefined; let isTracking = false; let localConfig: BrowserConfig; const { trackOn, trackHistoryChanges, eventType = defaultPageViewEvent } = options; diff --git a/yarn.lock b/yarn.lock index 69847b230..7c0466666 100644 --- a/yarn.lock +++ b/yarn.lock @@ -682,7 +682,7 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.8.tgz#821c1d35641c355284d4a870b8a4a7b0c141e367" integrity sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ== -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.13.16", "@babel/core@^7.14.0", "@babel/core@^7.18.5", "@babel/core@^7.20.0", "@babel/core@^7.23.9", "@babel/core@^7.24.7": +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.13.16", "@babel/core@^7.18.5", "@babel/core@^7.20.0", "@babel/core@^7.23.9", "@babel/core@^7.24.7": version "7.26.10" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.10.tgz#5c876f83c8c4dcb233ee4b670c0606f2ac3000f9" integrity sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ== @@ -703,7 +703,7 @@ json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.14.0", "@babel/generator@^7.20.0", "@babel/generator@^7.26.10", "@babel/generator@^7.27.0", "@babel/generator@^7.7.2": +"@babel/generator@^7.20.0", "@babel/generator@^7.26.10", "@babel/generator@^7.27.0", "@babel/generator@^7.7.2": version "7.27.0" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.0.tgz#764382b5392e5b9aff93cadb190d0745866cbc2c" integrity sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw== @@ -867,7 +867,7 @@ "@babel/template" "^7.27.0" "@babel/types" "^7.27.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.13.16", "@babel/parser@^7.14.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.26.10", "@babel/parser@^7.27.0": +"@babel/parser@^7.1.0", "@babel/parser@^7.13.16", "@babel/parser@^7.14.7", "@babel/parser@^7.20.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.26.10", "@babel/parser@^7.27.0": version "7.27.0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.0.tgz#3d7d6ee268e41d2600091cbd4e145ffee85a44ec" integrity sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg== @@ -923,7 +923,7 @@ "@babel/helper-remap-async-to-generator" "^7.18.9" "@babel/plugin-syntax-async-generators" "^7.8.4" -"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.17.12", "@babel/plugin-proposal-class-properties@^7.18.0": +"@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.17.12", "@babel/plugin-proposal-class-properties@^7.18.0": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3" integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ== @@ -938,7 +938,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.25.9" -"@babel/plugin-proposal-nullish-coalescing-operator@^7.0.0", "@babel/plugin-proposal-nullish-coalescing-operator@^7.13.8", "@babel/plugin-proposal-nullish-coalescing-operator@^7.18.0": +"@babel/plugin-proposal-nullish-coalescing-operator@^7.13.8", "@babel/plugin-proposal-nullish-coalescing-operator@^7.18.0": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz#fdd940a99a740e577d6c753ab6fbb43fdb9467e1" integrity sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA== @@ -954,7 +954,7 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-numeric-separator" "^7.10.4" -"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.20.0": +"@babel/plugin-proposal-object-rest-spread@^7.20.0": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz#aa662940ef425779c75534a5c41e9d936edc390a" integrity sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg== @@ -973,7 +973,7 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" -"@babel/plugin-proposal-optional-chaining@^7.0.0", "@babel/plugin-proposal-optional-chaining@^7.13.12", "@babel/plugin-proposal-optional-chaining@^7.20.0": +"@babel/plugin-proposal-optional-chaining@^7.13.12", "@babel/plugin-proposal-optional-chaining@^7.20.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz#886f5c8978deb7d30f678b2e24346b287234d3ea" integrity sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA== @@ -1001,7 +1001,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-class-properties@^7.0.0", "@babel/plugin-syntax-class-properties@^7.12.13": +"@babel/plugin-syntax-class-properties@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== @@ -1015,7 +1015,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-dynamic-import@^7.0.0", "@babel/plugin-syntax-dynamic-import@^7.8.0": +"@babel/plugin-syntax-dynamic-import@^7.8.0": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== @@ -1029,7 +1029,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.25.9" -"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.12.1", "@babel/plugin-syntax-flow@^7.18.0", "@babel/plugin-syntax-flow@^7.2.0", "@babel/plugin-syntax-flow@^7.26.0": +"@babel/plugin-syntax-flow@^7.12.1", "@babel/plugin-syntax-flow@^7.18.0", "@babel/plugin-syntax-flow@^7.26.0": version "7.26.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.26.0.tgz#96507595c21b45fccfc2bc758d5c45452e6164fa" integrity sha512-B+O2DnPc0iG+YXFqOxv2WNuNU97ToWjOomUQ78DouOENWUaM5sVrmet9mcomUGQFwpJd//gvUagXBSdzO1fRKg== @@ -1064,7 +1064,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.25.9", "@babel/plugin-syntax-jsx@^7.7.2": +"@babel/plugin-syntax-jsx@^7.25.9", "@babel/plugin-syntax-jsx@^7.7.2": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz#a34313a178ea56f1951599b929c1ceacee719290" integrity sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA== @@ -1092,7 +1092,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": +"@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== @@ -1158,7 +1158,7 @@ "@babel/helper-remap-async-to-generator" "^7.25.9" "@babel/traverse" "^7.26.8" -"@babel/plugin-transform-async-to-generator@^7.0.0", "@babel/plugin-transform-async-to-generator@^7.20.0", "@babel/plugin-transform-async-to-generator@^7.25.9": +"@babel/plugin-transform-async-to-generator@^7.20.0", "@babel/plugin-transform-async-to-generator@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.25.9.tgz#c80008dacae51482793e5a9c08b39a5be7e12d71" integrity sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ== @@ -1167,7 +1167,7 @@ "@babel/helper-plugin-utils" "^7.25.9" "@babel/helper-remap-async-to-generator" "^7.25.9" -"@babel/plugin-transform-block-scoped-functions@^7.0.0", "@babel/plugin-transform-block-scoped-functions@^7.26.5": +"@babel/plugin-transform-block-scoped-functions@^7.26.5": version "7.26.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.26.5.tgz#3dc4405d31ad1cbe45293aa57205a6e3b009d53e" integrity sha512-chuTSY+hq09+/f5lMj8ZSYgCFpppV2CbYrhNFJ1BFoXpiWPnnAb7R0MqrafCpN8E1+YRrtM1MXZHJdIx8B6rMQ== @@ -1217,7 +1217,7 @@ "@babel/helper-plugin-utils" "^7.25.9" "@babel/template" "^7.25.9" -"@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.20.0", "@babel/plugin-transform-destructuring@^7.25.9": +"@babel/plugin-transform-destructuring@^7.20.0", "@babel/plugin-transform-destructuring@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.25.9.tgz#966ea2595c498224340883602d3cfd7a0c79cea1" integrity sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ== @@ -1254,7 +1254,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.25.9" -"@babel/plugin-transform-exponentiation-operator@^7.0.0", "@babel/plugin-transform-exponentiation-operator@^7.26.3": +"@babel/plugin-transform-exponentiation-operator@^7.26.3": version "7.26.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.26.3.tgz#e29f01b6de302c7c2c794277a48f04a9ca7f03bc" integrity sha512-7CAHcQ58z2chuXPWblnn1K6rLDnDWieghSOEmqQsrBenH0P9InCUtOJYD89pvngljmZlJcz3fcmgYsXFNGa1ZQ== @@ -1268,7 +1268,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.25.9" -"@babel/plugin-transform-flow-strip-types@^7.0.0", "@babel/plugin-transform-flow-strip-types@^7.20.0", "@babel/plugin-transform-flow-strip-types@^7.25.9": +"@babel/plugin-transform-flow-strip-types@^7.20.0", "@babel/plugin-transform-flow-strip-types@^7.25.9": version "7.26.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.26.5.tgz#2904c85a814e7abb1f4850b8baf4f07d0a2389d4" integrity sha512-eGK26RsbIkYUns3Y8qKl362juDDYK+wEdPGHGrhzUl6CewZFo55VZ7hg+CyMFU4dd5QQakBN86nBMpRsFpRvbQ== @@ -1276,7 +1276,7 @@ "@babel/helper-plugin-utils" "^7.26.5" "@babel/plugin-syntax-flow" "^7.26.0" -"@babel/plugin-transform-for-of@^7.0.0", "@babel/plugin-transform-for-of@^7.26.9": +"@babel/plugin-transform-for-of@^7.26.9": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.26.9.tgz#27231f79d5170ef33b5111f07fe5cafeb2c96a56" integrity sha512-Hry8AusVm8LW5BVFgiyUReuoGzPUpdHQQqJY5bZnbbf+ngOHWuCuYFKw/BqaaWlvEUrF91HMhDtEaI1hZzNbLg== @@ -1314,7 +1314,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.25.9" -"@babel/plugin-transform-member-expression-literals@^7.0.0", "@babel/plugin-transform-member-expression-literals@^7.25.9": +"@babel/plugin-transform-member-expression-literals@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.25.9.tgz#63dff19763ea64a31f5e6c20957e6a25e41ed5de" integrity sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA== @@ -1393,7 +1393,7 @@ "@babel/helper-plugin-utils" "^7.25.9" "@babel/plugin-transform-parameters" "^7.25.9" -"@babel/plugin-transform-object-super@^7.0.0", "@babel/plugin-transform-object-super@^7.25.9": +"@babel/plugin-transform-object-super@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.25.9.tgz#385d5de135162933beb4a3d227a2b7e52bb4cf03" integrity sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A== @@ -1440,7 +1440,7 @@ "@babel/helper-create-class-features-plugin" "^7.25.9" "@babel/helper-plugin-utils" "^7.25.9" -"@babel/plugin-transform-property-literals@^7.0.0", "@babel/plugin-transform-property-literals@^7.25.9": +"@babel/plugin-transform-property-literals@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.25.9.tgz#d72d588bd88b0dec8b62e36f6fda91cedfe28e3f" integrity sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA== @@ -1551,7 +1551,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.25.9" -"@babel/plugin-transform-template-literals@^7.0.0", "@babel/plugin-transform-template-literals@^7.26.8": +"@babel/plugin-transform-template-literals@^7.26.8": version "7.26.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.26.8.tgz#966b15d153a991172a540a69ad5e1845ced990b5" integrity sha512-OmGDL5/J0CJPJZTHZbi2XpO0tyT2Ia7fzpW5GURwdtp2X3fMmN8au/ej6peC/T33/+CRiIpA8Krse8hFGVmT5Q== @@ -1734,7 +1734,7 @@ pirates "^4.0.6" source-map-support "^0.5.16" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.25.0", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.25.0", "@babel/runtime@^7.8.4": version "7.27.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762" integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw== @@ -1750,7 +1750,7 @@ "@babel/parser" "^7.27.0" "@babel/types" "^7.27.0" -"@babel/traverse@^7.14.0", "@babel/traverse@^7.20.0", "@babel/traverse@^7.25.9", "@babel/traverse@^7.26.10", "@babel/traverse@^7.26.5", "@babel/traverse@^7.26.8", "@babel/traverse@^7.27.0": +"@babel/traverse@^7.20.0", "@babel/traverse@^7.25.9", "@babel/traverse@^7.26.10", "@babel/traverse@^7.26.5", "@babel/traverse@^7.26.8", "@babel/traverse@^7.27.0": version "7.27.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.0.tgz#11d7e644779e166c0442f9a07274d02cd91d4a70" integrity sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA== @@ -2297,13 +2297,6 @@ slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/create-cache-key-function@^27.0.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-27.5.1.tgz#7448fae15602ea95c828f5eceed35c202a820b31" - integrity sha512-dmH1yW+makpTSURTy8VzdUwFnfQh1G8R+DxO2Ho2FFmBbKFEVm+3jWdvFhE2VqB/LATCTokkP0dotjyQyw5/AQ== - dependencies: - "@jest/types" "^27.5.1" - "@jest/create-cache-key-function@^29.6.3": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz#793be38148fab78e65f40ae30c36785f4ad859f0" @@ -2456,17 +2449,6 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" -"@jest/types@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.5.1.tgz#3c79ec4a8ba61c170bf937bcf9e98a9df175ec80" - integrity sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^16.0.0" - chalk "^4.0.0" - "@jest/types@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" @@ -3120,13 +3102,6 @@ dependencies: playwright "1.52.0" -"@react-native-async-storage/async-storage@^1.17.11": - version "1.24.0" - resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-1.24.0.tgz#888efbc62a26f7d9464b32f4d3027b7f2771999b" - integrity sha512-W4/vbwUOYOjco0x3toB8QCr7EjIP6nE9G7o8PMguvvjYT5Awg09lyV4enACRx4s++PPulBiBSjL0KTFx2u0Z/g== - dependencies: - merge-options "^3.0.4" - "@react-native-community/cli-clean@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-12.1.1.tgz#4f92b3d5eaa301c9db3fef2cbbaf68b87652f6f1" @@ -3136,16 +3111,6 @@ chalk "^4.1.2" execa "^5.0.0" -"@react-native-community/cli-clean@^9.2.1": - version "9.2.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-9.2.1.tgz#198c5dd39c432efb5374582073065ff75d67d018" - integrity sha512-dyNWFrqRe31UEvNO+OFWmQ4hmqA07bR9Ief/6NnGwx67IO9q83D5PEAf/o96ML6jhSbDwCmpPKhPwwBbsyM3mQ== - dependencies: - "@react-native-community/cli-tools" "^9.2.1" - chalk "^4.1.2" - execa "^1.0.0" - prompts "^2.4.0" - "@react-native-community/cli-config@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-config/-/cli-config-12.1.1.tgz#6fe932b6215f731b39eb54c800d1b068a2080666" @@ -3158,17 +3123,6 @@ glob "^7.1.3" joi "^17.2.1" -"@react-native-community/cli-config@^9.2.1": - version "9.2.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-config/-/cli-config-9.2.1.tgz#54eb026d53621ccf3a9df8b189ac24f6e56b8750" - integrity sha512-gHJlBBXUgDN9vrr3aWkRqnYrPXZLztBDQoY97Mm5Yo6MidsEpYo2JIP6FH4N/N2p1TdjxJL4EFtdd/mBpiR2MQ== - dependencies: - "@react-native-community/cli-tools" "^9.2.1" - cosmiconfig "^5.1.0" - deepmerge "^3.2.0" - glob "^7.1.3" - joi "^17.2.1" - "@react-native-community/cli-debugger-ui@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-12.1.1.tgz#b2e3854f8f77d2f60f845a0a9553123cedfa4669" @@ -3183,13 +3137,6 @@ dependencies: serve-static "^1.13.1" -"@react-native-community/cli-debugger-ui@^9.0.0": - version "9.0.0" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-9.0.0.tgz#ea5c5dad6008bccd840d858e160d42bb2ced8793" - integrity sha512-7hH05ZwU9Tp0yS6xJW0bqcZPVt0YCK7gwj7gnRu1jDNN2kughf6Lg0Ys29rAvtZ7VO1PK5c1O+zs7yFnylQDUA== - dependencies: - serve-static "^1.13.1" - "@react-native-community/cli-doctor@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-doctor/-/cli-doctor-12.1.1.tgz#e651a63c537ad7c9b8d9baa69e63947f5384a6bd" @@ -3213,28 +3160,6 @@ wcwidth "^1.0.1" yaml "^2.2.1" -"@react-native-community/cli-doctor@^9.3.0": - version "9.3.0" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-doctor/-/cli-doctor-9.3.0.tgz#8817a3fd564453467def5b5bc8aecdc4205eff50" - integrity sha512-/fiuG2eDGC2/OrXMOWI5ifq4X1gdYTQhvW2m0TT5Lk1LuFiZsbTCp1lR+XILKekuTvmYNjEGdVpeDpdIWlXdEA== - dependencies: - "@react-native-community/cli-config" "^9.2.1" - "@react-native-community/cli-platform-ios" "^9.3.0" - "@react-native-community/cli-tools" "^9.2.1" - chalk "^4.1.2" - command-exists "^1.2.8" - envinfo "^7.7.2" - execa "^1.0.0" - hermes-profile-transformer "^0.0.6" - ip "^1.1.5" - node-stream-zip "^1.9.1" - ora "^5.4.1" - prompts "^2.4.0" - semver "^6.3.0" - strip-ansi "^5.2.0" - sudo-prompt "^9.0.0" - wcwidth "^1.0.1" - "@react-native-community/cli-hermes@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-hermes/-/cli-hermes-12.1.1.tgz#9b48c91acb4db88aab648e92d4d1fe19cd0a6191" @@ -3246,17 +3171,6 @@ hermes-profile-transformer "^0.0.6" ip "^1.1.5" -"@react-native-community/cli-hermes@^9.3.1": - version "9.3.4" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-hermes/-/cli-hermes-9.3.4.tgz#47851847c4990272687883bd8bf53733d5f3c341" - integrity sha512-VqTPA7kknCXgtYlRf+sDWW4yxZ6Gtg1Ga+Rdrn1qSKuo09iJ8YKPoQYOu5nqbIYJQAEhorWQyo1VvNgd0wd49w== - dependencies: - "@react-native-community/cli-platform-android" "^9.3.4" - "@react-native-community/cli-tools" "^9.2.1" - chalk "^4.1.2" - hermes-profile-transformer "^0.0.6" - ip "^1.1.5" - "@react-native-community/cli-platform-android@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-12.1.1.tgz#f6541ee07ee479ee0e1b082cbf4ff970737606e4" @@ -3269,32 +3183,6 @@ glob "^7.1.3" logkitty "^0.7.1" -"@react-native-community/cli-platform-android@9.3.1": - version "9.3.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-9.3.1.tgz#378cd72249653cc74672094400657139f21bafb8" - integrity sha512-m0bQ6Twewl7OEZoVf79I2GZmsDqh+Gh0bxfxWgwxobsKDxLx8/RNItAo1lVtTCgzuCR75cX4EEO8idIF9jYhew== - dependencies: - "@react-native-community/cli-tools" "^9.2.1" - chalk "^4.1.2" - execa "^1.0.0" - fs-extra "^8.1.0" - glob "^7.1.3" - logkitty "^0.7.1" - slash "^3.0.0" - -"@react-native-community/cli-platform-android@^9.3.4": - version "9.3.4" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-9.3.4.tgz#42f22943b6ee15713add6af8608c1d0ebf79d774" - integrity sha512-BTKmTMYFuWtMqimFQJfhRyhIWw1m+5N5svR1S5+DqPcyFuSXrpNYDWNSFR8E105xUbFANmsCZZQh6n1WlwMpOA== - dependencies: - "@react-native-community/cli-tools" "^9.2.1" - chalk "^4.1.2" - execa "^1.0.0" - fs-extra "^8.1.0" - glob "^7.1.3" - logkitty "^0.7.1" - slash "^3.0.0" - "@react-native-community/cli-platform-ios@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-12.1.1.tgz#399fc39279b8bd95f372c0f69180696b6f9767e1" @@ -3307,38 +3195,11 @@ glob "^7.1.3" ora "^5.4.1" -"@react-native-community/cli-platform-ios@9.3.0", "@react-native-community/cli-platform-ios@^9.3.0": - version "9.3.0" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-9.3.0.tgz#45abde2a395fddd7cf71e8b746c1dc1ee2260f9a" - integrity sha512-nihTX53BhF2Q8p4B67oG3RGe1XwggoGBrMb6vXdcu2aN0WeXJOXdBLgR900DAA1O8g7oy1Sudu6we+JsVTKnjw== - dependencies: - "@react-native-community/cli-tools" "^9.2.1" - chalk "^4.1.2" - execa "^1.0.0" - glob "^7.1.3" - ora "^5.4.1" - "@react-native-community/cli-plugin-metro@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-plugin-metro/-/cli-plugin-metro-12.1.1.tgz#446f829aa37caee7440d863a42d0f600a4713d8b" integrity sha512-HV+lW1mFSu6GL7du+0/tfq8/5jytKp+w3n4+MWzRkx5wXvUq3oJjzwe8y+ZvvCqkRPdsOiwFDgJrtPhvaZp+xA== -"@react-native-community/cli-plugin-metro@^9.2.1": - version "9.3.3" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-plugin-metro/-/cli-plugin-metro-9.3.3.tgz#330d7b9476a3fdabdd5863f114fa962289e280dc" - integrity sha512-lPBw6XieNdj2AbWDN0Rc+jNOx8hBgSQyv0gUAm01qtJe4I9FjSMU6nOGTxMpWpICo6TYl/cmPGXOzbfpwxwtkQ== - dependencies: - "@react-native-community/cli-server-api" "^9.2.1" - "@react-native-community/cli-tools" "^9.2.1" - chalk "^4.1.2" - metro "0.72.4" - metro-config "0.72.4" - metro-core "0.72.4" - metro-react-native-babel-transformer "0.72.4" - metro-resolver "0.72.4" - metro-runtime "0.72.4" - readline "^1.3.0" - "@react-native-community/cli-server-api@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-12.1.1.tgz#c00319cba3cdd1ba2cf82286cfa4aa3a6bc6a5b2" @@ -3369,21 +3230,6 @@ serve-static "^1.13.1" ws "^7.5.1" -"@react-native-community/cli-server-api@^9.2.1": - version "9.2.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-9.2.1.tgz#41ac5916b21d324bccef447f75600c03b2f54fbe" - integrity sha512-EI+9MUxEbWBQhWw2PkhejXfkcRqPl+58+whlXJvKHiiUd7oVbewFs0uLW0yZffUutt4FGx6Uh88JWEgwOzAdkw== - dependencies: - "@react-native-community/cli-debugger-ui" "^9.0.0" - "@react-native-community/cli-tools" "^9.2.1" - compression "^1.7.1" - connect "^3.6.5" - errorhandler "^1.5.0" - nocache "^3.0.1" - pretty-format "^26.6.2" - serve-static "^1.13.1" - ws "^7.5.1" - "@react-native-community/cli-tools@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-12.1.1.tgz#c70df5da2d3ad61e5e8ab70dd36d84a89c322b23" @@ -3416,21 +3262,6 @@ shell-quote "^1.7.3" sudo-prompt "^9.0.0" -"@react-native-community/cli-tools@^9.2.1": - version "9.2.1" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-9.2.1.tgz#c332324b1ea99f9efdc3643649bce968aa98191c" - integrity sha512-bHmL/wrKmBphz25eMtoJQgwwmeCylbPxqFJnFSbkqJPXQz3ManQ6q/gVVMqFyz7D3v+riaus/VXz3sEDa97uiQ== - dependencies: - appdirsjs "^1.2.4" - chalk "^4.1.2" - find-up "^5.0.0" - mime "^2.4.1" - node-fetch "^2.6.0" - open "^6.2.0" - ora "^5.4.1" - semver "^6.3.0" - shell-quote "^1.7.3" - "@react-native-community/cli-types@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli-types/-/cli-types-12.1.1.tgz#5a5c0593f50dc394af5265364d0e919ba6134653" @@ -3438,13 +3269,6 @@ dependencies: joi "^17.2.1" -"@react-native-community/cli-types@^9.1.0": - version "9.1.0" - resolved "https://registry.yarnpkg.com/@react-native-community/cli-types/-/cli-types-9.1.0.tgz#dcd6a0022f62790fe1f67417f4690db938746aab" - integrity sha512-KDybF9XHvafLEILsbiKwz5Iobd+gxRaPyn4zSaAerBxedug4er5VUWa8Szy+2GeYKZzMh/gsb1o9lCToUwdT/g== - dependencies: - joi "^17.2.1" - "@react-native-community/cli@12.1.1": version "12.1.1" resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-12.1.1.tgz#55e413ee620bea1e6b58c92dad2e9f196d3a5af2" @@ -3469,39 +3293,11 @@ prompts "^2.4.2" semver "^7.5.2" -"@react-native-community/cli@9.3.2": - version "9.3.2" - resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-9.3.2.tgz#81761880af00c1894d85380d8c9a358659865204" - integrity sha512-IAW4X0vmX/xozNpp/JVZaX7MrC85KV0OP2DF4o7lNGOfpUhzJAEWqTfkxFYS+VsRjZHDve4wSTiGIuXwE7FG1w== - dependencies: - "@react-native-community/cli-clean" "^9.2.1" - "@react-native-community/cli-config" "^9.2.1" - "@react-native-community/cli-debugger-ui" "^9.0.0" - "@react-native-community/cli-doctor" "^9.3.0" - "@react-native-community/cli-hermes" "^9.3.1" - "@react-native-community/cli-plugin-metro" "^9.2.1" - "@react-native-community/cli-server-api" "^9.2.1" - "@react-native-community/cli-tools" "^9.2.1" - "@react-native-community/cli-types" "^9.1.0" - chalk "^4.1.2" - commander "^9.4.0" - execa "^1.0.0" - find-up "^4.1.0" - fs-extra "^8.1.0" - graceful-fs "^4.1.3" - prompts "^2.4.0" - semver "^6.3.0" - "@react-native/assets-registry@^0.73.1": version "0.73.1" resolved "https://registry.yarnpkg.com/@react-native/assets-registry/-/assets-registry-0.73.1.tgz#e2a6b73b16c183a270f338dc69c36039b3946e85" integrity sha512-2FgAbU7uKM5SbbW9QptPPZx8N9Ke2L7bsHb+EhAanZjFZunA9PaYtyjUQ1s7HD+zDVqOQIvjkpXSv7Kejd2tqg== -"@react-native/assets@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@react-native/assets/-/assets-1.0.0.tgz#c6f9bf63d274bafc8e970628de24986b30a55c8e" - integrity sha512-KrwSpS1tKI70wuKl68DwJZYEvXktDHdZMG0k2AXD/rJVSlB23/X2CB2cutVR0HwNMJIal9HOUOBB2rVfa6UGtQ== - "@react-native/babel-plugin-codegen@0.73.4": version "0.73.4" resolved "https://registry.yarnpkg.com/@react-native/babel-plugin-codegen/-/babel-plugin-codegen-0.73.4.tgz#8a2037d5585b41877611498ae66adbf1dddfec1b" @@ -3629,21 +3425,11 @@ hermes-parser "0.15.0" nullthrows "^1.1.1" -"@react-native/normalize-color@2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@react-native/normalize-color/-/normalize-color-2.0.0.tgz#da955909432474a9a0fe1cbffc66576a0447f567" - integrity sha512-Wip/xsc5lw8vsBlmY2MO/gFLp3MvuZ2baBZjDeTjjndMgM0h5sxz7AZR62RDPGgstp8Np7JzjvVqVT7tpFZqsw== - "@react-native/normalize-colors@^0.73.0", "@react-native/normalize-colors@^0.73.2": version "0.73.2" resolved "https://registry.yarnpkg.com/@react-native/normalize-colors/-/normalize-colors-0.73.2.tgz#cc8e48fbae2bbfff53e12f209369e8d2e4cf34ec" integrity sha512-bRBcb2T+I88aG74LMVHaKms2p/T8aQd8+BZ7LuuzXlRfog1bMWWn/C5i0HVuvW4RPtXQYgIlGiXVDy9Ir1So/w== -"@react-native/polyfills@2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@react-native/polyfills/-/polyfills-2.0.0.tgz#4c40b74655c83982c8cf47530ee7dc13d957b6aa" - integrity sha512-K0aGNn1TjalKj+65D7ycc1//H9roAQ51GJVk5ZJQFb2teECGmzd86bYDC0aYdbRf7gtovescq4Zt6FR0tgXiHQ== - "@react-native/virtualized-lists@^0.73.3": version "0.73.4" resolved "https://registry.yarnpkg.com/@react-native/virtualized-lists/-/virtualized-lists-0.73.4.tgz#640e594775806f63685435b5d9c3d05c378ccd8c" @@ -4632,20 +4418,6 @@ resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.14.tgz#1433419d73b2a7ebfc6918dcefd2ec0d5cd698f2" integrity sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ== -"@types/react-native@0.70.8": - version "0.70.8" - resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.70.8.tgz#3302a0f7eddcd3350448ca17a9e415d02b1efde6" - integrity sha512-jvs5QMOrlyi0ScfT5Brha2roDoOWtbIOadNkp0jsueVen5+pH4SQAYtzL6xu0+dIcx3J/5LtZ/JYby2C1/zUug== - dependencies: - "@types/react" "*" - -"@types/react@*": - version "19.1.2" - resolved "https://registry.yarnpkg.com/@types/react/-/react-19.1.2.tgz#11df86f66f188f212c90ecb537327ec68bfd593f" - integrity sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw== - dependencies: - csstype "^3.0.2" - "@types/react@^18.0.26": version "18.3.20" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.20.tgz#b0dccda9d2f1bc24d2a04b1d0cb5d0b9a3576ad3" @@ -4679,11 +4451,6 @@ resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== -"@types/ua-parser-js@^0.7.36": - version "0.7.39" - resolved "https://registry.yarnpkg.com/@types/ua-parser-js/-/ua-parser-js-0.7.39.tgz#832c58e460c9435e4e34bb866e85e9146e12cdbb" - integrity sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg== - "@types/yargs-parser@*": version "21.0.3" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" @@ -4696,13 +4463,6 @@ dependencies: "@types/yargs-parser" "*" -"@types/yargs@^16.0.0": - version "16.0.9" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.9.tgz#ba506215e45f7707e6cbcaf386981155b7ab956e" - integrity sha512-tHhzvkFXZQeTECenFoRljLBYPZJ7jAVxqqtEI0qTLOmuultnFp4I9yKE17vTuhf7BkhCu7I4XuemPgikDVuYqA== - dependencies: - "@types/yargs-parser" "*" - "@types/yargs@^17.0.8": version "17.0.33" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" @@ -4864,11 +4624,6 @@ abort-controller@^3.0.0: dependencies: event-target-shim "^5.0.0" -absolute-path@^0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/absolute-path/-/absolute-path-0.0.0.tgz#a78762fbdadfb5297be99b15d35a785b2f095bf7" - integrity sha512-HQiug4c+/s3WOvEnDRxXVmNtSG5s2gJM9r19BTcqjp7BWcE48PB+Y2G6jE65kqI0LpsQeMZygt/b60Gi4KxGyA== - accepts@^1.3.7, accepts@~1.3.7: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -5116,7 +4871,7 @@ async-limiter@~1.0.0: resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== -async@^3.2.2, async@^3.2.3, async@^3.2.6: +async@^3.2.3, async@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== @@ -5388,11 +5143,6 @@ babel-plugin-syntax-trailing-function-commas@^6.22.0: resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" integrity sha512-Gx9CH3Q/3GKbhs07Bszw5fPTlU+ygrOGfAhEt7W2JICwufpC4SuO0mG0+4NykPBSYPMJhqvVlDBU17qB1D+hMQ== -babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" - integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ== - babel-plugin-transform-async-to-generator@^6.22.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz#6536e378aff6cb1d5517ac0e40eb3e9fc8d08761" @@ -5680,39 +5430,6 @@ babel-preset-env@^1.7.0: invariant "^2.2.2" semver "^5.3.0" -babel-preset-fbjs@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.4.0.tgz#38a14e5a7a3b285a3f3a86552d650dca5cf6111c" - integrity sha512-9ywCsCvo1ojrw0b+XYk7aFvTH6D9064t0RIL1rtMf3nsa02Xw41MS7sZw216Im35xj/UY0PDBQsa1brUDDF1Ow== - dependencies: - "@babel/plugin-proposal-class-properties" "^7.0.0" - "@babel/plugin-proposal-object-rest-spread" "^7.0.0" - "@babel/plugin-syntax-class-properties" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.0.0" - "@babel/plugin-syntax-jsx" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - "@babel/plugin-transform-arrow-functions" "^7.0.0" - "@babel/plugin-transform-block-scoped-functions" "^7.0.0" - "@babel/plugin-transform-block-scoping" "^7.0.0" - "@babel/plugin-transform-classes" "^7.0.0" - "@babel/plugin-transform-computed-properties" "^7.0.0" - "@babel/plugin-transform-destructuring" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" - "@babel/plugin-transform-for-of" "^7.0.0" - "@babel/plugin-transform-function-name" "^7.0.0" - "@babel/plugin-transform-literals" "^7.0.0" - "@babel/plugin-transform-member-expression-literals" "^7.0.0" - "@babel/plugin-transform-modules-commonjs" "^7.0.0" - "@babel/plugin-transform-object-super" "^7.0.0" - "@babel/plugin-transform-parameters" "^7.0.0" - "@babel/plugin-transform-property-literals" "^7.0.0" - "@babel/plugin-transform-react-display-name" "^7.0.0" - "@babel/plugin-transform-react-jsx" "^7.0.0" - "@babel/plugin-transform-shorthand-properties" "^7.0.0" - "@babel/plugin-transform-spread" "^7.0.0" - "@babel/plugin-transform-template-literals" "^7.0.0" - babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" - babel-preset-jest@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" @@ -5798,7 +5515,7 @@ base64-arraybuffer@^1.0.1: resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#1c37589a7c4b0746e34bd1feb951da2df01c1bdc" integrity sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ== -base64-js@1.5.1, base64-js@^1.1.2, base64-js@^1.3.1, base64-js@^1.5.1: +base64-js@1.5.1, base64-js@^1.3.1, base64-js@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== @@ -5988,7 +5705,7 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.0.0, camelcase@^6.2.0: +camelcase@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -6259,16 +5976,11 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^9.4.0, commander@^9.4.1: +commander@^9.4.1: version "9.5.0" resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== -commander@~2.13.0: - version "2.13.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" - integrity sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA== - common-ancestor-path@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz#4f7d2d1394d91b7abdf51871c62f71eadb0182a7" @@ -6538,17 +6250,6 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cross-spawn@^6.0.0: - version "6.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.6.tgz#30d0efa0712ddb7eb5a76e1e8721bffafa6b5d57" - integrity sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw== - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3, cross-spawn@^7.0.6: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" @@ -6673,11 +6374,6 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -deepmerge@^3.2.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.3.0.tgz#d3c47fd6f3a93d517b14426b0628a17b0125f5f7" - integrity sha512-GRQOafGHwMHpjPx9iCvTgpu9NojZ49q794EEL94JVEw6VaeA8XTUyBKvAkOOjBX9oJNiV6G3P+T+tihFjo2TqA== - deepmerge@^4.2.2, deepmerge@^4.3.0: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" @@ -6934,7 +6630,7 @@ envinfo@7.13.0: resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.13.0.tgz#81fbb81e5da35d74e814941aeab7c325a606fb31" integrity sha512-cvcaMr7KqXVh4nyzGTVqTum+gAiL265x5jUWQIDLq//zOGbW+gSW/C+OWLleY/rs9Qole6AZLMXPbtIFQbqu+Q== -envinfo@^7.10.0, envinfo@^7.7.2: +envinfo@^7.10.0: version "7.14.0" resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.14.0.tgz#26dac5db54418f2a4c1159153a0b2ae980838aae" integrity sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg== @@ -6958,7 +6654,7 @@ error-stack-parser@^2.0.6: dependencies: stackframe "^1.3.4" -errorhandler@^1.5.0, errorhandler@^1.5.1: +errorhandler@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/errorhandler/-/errorhandler-1.5.1.tgz#b9ba5d17cf90744cd1e851357a6e75bf806a9a91" integrity sha512-rcOwbfvP1WTViVoUjcfZicVzjhjTuhSMntHh6mW3IrEiyE6mJyXvsToJUJGlGlw/2xU9P5whlWNGlIDVeCiT4A== @@ -7242,19 +6938,6 @@ execa@7.2.0: signal-exit "^3.0.7" strip-final-newline "^3.0.0" -execa@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" - integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== - dependencies: - cross-spawn "^6.0.0" - get-stream "^4.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - execa@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" @@ -7508,11 +7191,6 @@ flow-parser@0.*: resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.269.1.tgz#92067f8100d89a84433c656eb59c5b92e4036eb9" integrity sha512-2Yr0kqvT7RwaGL192nT78O5AWJeECQjl0NEzBkMsx8OJt63BvNl5yvSIbE4qZ1VDSjEkhbUgaWYdwX354bVNjw== -flow-parser@^0.121.0: - version "0.121.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.121.0.tgz#9f9898eaec91a9f7c323e9e992d81ab5c58e618f" - integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg== - flow-parser@^0.206.0: version "0.206.0" resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.206.0.tgz#f4f794f8026535278393308e01ea72f31000bfef" @@ -7565,15 +7243,6 @@ fs-constants@^1.0.0: resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950" - integrity sha512-VerQV6vEKuhDWD2HGOybV6v5I73syoc/cXAbKlgTC7M/oFVEtklWlp9QH2Ijw3IaWDOQcMkldSPa7zXy79Z/UQ== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - fs-extra@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" @@ -7625,7 +7294,7 @@ fsevents@2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== -fsevents@^2.1.2, fsevents@^2.3.2, fsevents@~2.3.2, fsevents@~2.3.3: +fsevents@^2.3.2, fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -7694,13 +7363,6 @@ get-stream@6.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.0.tgz#3e0012cb6827319da2706e601a1583e8629a6718" integrity sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg== -get-stream@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" - integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== - dependencies: - pump "^3.0.0" - get-stream@^5.0.0: version "5.2.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" @@ -7871,7 +7533,7 @@ gopd@^1.2.0: resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== -graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: +graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -7959,11 +7621,6 @@ hermes-estree@0.23.1: resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.23.1.tgz#d0bac369a030188120ee7024926aabe5a9f84fdb" integrity sha512-eT5MU3f5aVhTqsfIReZ6n41X5sYn4IdQL0nvz6yO+MMlPxw49aSARHLg/MSehQftyjnrE8X6bYregzSumqc6cg== -hermes-estree@0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.8.0.tgz#530be27243ca49f008381c1f3e8b18fb26bf9ec0" - integrity sha512-W6JDAOLZ5pMPMjEiQGLCXSSV7pIBEgRR5zGkxgmzGSXHOxqV5dC/M1Zevqpbm9TZDE5tu358qZf8Vkzmsc+u7Q== - hermes-parser@0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.15.0.tgz#f611a297c2a2dbbfbce8af8543242254f604c382" @@ -7978,13 +7635,6 @@ hermes-parser@0.23.1: dependencies: hermes-estree "0.23.1" -hermes-parser@0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.8.0.tgz#116dceaba32e45b16d6aefb5c4c830eaeba2d257" - integrity sha512-yZKalg1fTYG5eOiToLUaw69rQfZq/fi+/NtEXRU7N87K/XobNRhRWorh80oSge2lWUiZfTgUvRJH+XgZWrhoqA== - dependencies: - hermes-estree "0.8.0" - hermes-profile-transformer@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/hermes-profile-transformer/-/hermes-profile-transformer-0.0.6.tgz#bd0f5ecceda80dd0ddaae443469ab26fb38fc27b" @@ -8169,11 +7819,6 @@ ignore@^5.0.4, ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== -image-size@^0.6.0: - version "0.6.3" - resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2" - integrity sha512-47xSUiQioGaB96nqtp5/q55m0aBQSQdyIloMOc/x+QVTDZLNmXE892IIDrJ0hM1A5vcNUDD5tDffkSP5lCaIIA== - image-size@^1.0.2: version "1.2.1" resolved "https://registry.yarnpkg.com/image-size/-/image-size-1.2.1.tgz#ee118aedfe666db1a6ee12bed5821cde3740276d" @@ -8435,11 +8080,6 @@ is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== -is-plain-obj@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== - is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -8478,11 +8118,6 @@ is-stream@2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== -is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== - is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" @@ -8763,11 +8398,6 @@ jest-environment-node@^29.6.3, jest-environment-node@^29.7.0: jest-mock "^29.7.0" jest-util "^29.7.0" -jest-get-type@^26.3.0: - version "26.3.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" - integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== - jest-get-type@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" @@ -8839,11 +8469,6 @@ jest-pnp-resolver@^1.2.2: resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== -jest-regex-util@^27.0.6: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.5.1.tgz#4da143f7e9fd1e542d4aa69617b38e4a78365b95" - integrity sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg== - jest-regex-util@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" @@ -8927,14 +8552,6 @@ jest-runtime@^29.7.0: slash "^3.0.0" strip-bom "^4.0.0" -jest-serializer@^27.0.6: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-27.5.1.tgz#81438410a30ea66fd57ff730835123dea1fb1f64" - integrity sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w== - dependencies: - "@types/node" "*" - graceful-fs "^4.2.9" - jest-snapshot@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" @@ -8961,18 +8578,6 @@ jest-snapshot@^29.7.0: pretty-format "^29.7.0" semver "^7.5.3" -jest-util@^27.2.0: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.5.1.tgz#3ba9771e8e31a0b85da48fe0b0891fb86c01c2f9" - integrity sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw== - dependencies: - "@jest/types" "^27.5.1" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - jest-util@^29.0.0, jest-util@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" @@ -8985,18 +8590,6 @@ jest-util@^29.0.0, jest-util@^29.7.0: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^26.5.2: - version "26.6.2" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.6.2.tgz#23d380971587150467342911c3d7b4ac57ab20ec" - integrity sha512-NEYZ9Aeyj0i5rQqbq+tpIOom0YS1u2MVu6+euBsvpgIme+FOfRmoC4R5p0JiAUpaFvFy24xgrpMknarR/93XjQ== - dependencies: - "@jest/types" "^26.6.2" - camelcase "^6.0.0" - chalk "^4.0.0" - jest-get-type "^26.3.0" - leven "^3.1.0" - pretty-format "^26.6.2" - jest-validate@^29.6.3, jest-validate@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" @@ -9032,15 +8625,6 @@ jest-worker@^26.2.1: merge-stream "^2.0.0" supports-color "^7.0.0" -jest-worker@^27.2.0: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" - integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== - dependencies: - "@types/node" "*" - merge-stream "^2.0.0" - supports-color "^8.0.0" - jest-worker@^29.6.3, jest-worker@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" @@ -9122,11 +8706,6 @@ jsbn@1.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== -jsc-android@^250230.2.1: - version "250230.2.1" - resolved "https://registry.yarnpkg.com/jsc-android/-/jsc-android-250230.2.1.tgz#3790313a970586a03ab0ad47defbc84df54f1b83" - integrity sha512-KmxeBlRjwoqCnBBKGsihFtvsBHyUFlBxJPK4FzeYcIuBfdjv6jFys44JITAgSTbQD+vIdwMEfyZklsuQX0yI1Q== - jsc-android@^250231.0.0: version "250231.0.0" resolved "https://registry.yarnpkg.com/jsc-android/-/jsc-android-250231.0.0.tgz#91720f8df382a108872fa4b3f558f33ba5e95262" @@ -9279,13 +8858,6 @@ jsonc-parser@^3.2.0: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.3.1.tgz#f2a524b4f7fd11e3d791e559977ad60b98b798b4" integrity sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ== -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - integrity sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw== - optionalDependencies: - graceful-fs "^4.1.6" - jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -9329,13 +8901,6 @@ kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -klaw@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" - integrity sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw== - optionalDependencies: - graceful-fs "^4.1.9" - kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -9813,13 +9378,6 @@ meow@^8.0.0, meow@^8.1.2: type-fest "^0.18.0" yargs-parser "^20.2.3" -merge-options@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-3.0.4.tgz#84709c2aa2a4b24c1981f66c179fe5565cc6dbb7" - integrity sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ== - dependencies: - is-plain-obj "^2.1.0" - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -9830,26 +9388,6 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -metro-babel-transformer@0.72.3: - version "0.72.3" - resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.72.3.tgz#2c60493a4eb7a8d20cc059f05e0e505dc1684d01" - integrity sha512-PTOR2zww0vJbWeeM3qN90WKENxCLzv9xrwWaNtwVlhcV8/diNdNe82sE1xIxLFI6OQuAVwNMv1Y7VsO2I7Ejrw== - dependencies: - "@babel/core" "^7.14.0" - hermes-parser "0.8.0" - metro-source-map "0.72.3" - nullthrows "^1.1.1" - -metro-babel-transformer@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.72.4.tgz#5149424896797980aa1758c8ef7c9a80f9d0f587" - integrity sha512-cg1TQUKDkKqrIClrqqIGE8ZDa9kRKSjhBtqPtNYt/ZSywXU41SrldfcI5uzPrzcIrYpH5hnN6OCLRACPgy2vsw== - dependencies: - "@babel/core" "^7.14.0" - hermes-parser "0.8.0" - metro-source-map "0.72.4" - nullthrows "^1.1.1" - metro-babel-transformer@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.80.12.tgz#ad02ade921dd4ced27b26b18ff31eb60608e3f56" @@ -9860,11 +9398,6 @@ metro-babel-transformer@0.80.12: hermes-parser "0.23.1" nullthrows "^1.1.1" -metro-cache-key@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-cache-key/-/metro-cache-key-0.72.4.tgz#f03d49214554b25968f04dc5e19dfe018cf9312b" - integrity sha512-DH3cgN4L7IKNCVBy8LBOXQ4tHDdvh7Vl7jWNkQKMOfHWu1EwsTtXD/+zdV7/be4ls/kHxrD0HbGzpK8XhUAHSw== - metro-cache-key@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-cache-key/-/metro-cache-key-0.80.12.tgz#52f5de698b85866503ace45d0ad76f75aaec92a4" @@ -9872,14 +9405,6 @@ metro-cache-key@0.80.12: dependencies: flow-enums-runtime "^0.0.6" -metro-cache@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-cache/-/metro-cache-0.72.4.tgz#e0ffb33dd044a7cf5897a09489088a413bfe7468" - integrity sha512-76fi9OVytiFVSuGQcNoquVOT7AENd0q3n1WmyBeJ7jvl/UrE3/NN3HTWzu2ezG5IxF3cmo5q1ehi0NEpgwaFGg== - dependencies: - metro-core "0.72.4" - rimraf "^2.5.4" - metro-cache@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-cache/-/metro-cache-0.80.12.tgz#bd81af02c4f17b5aeab19bb030566b14147cee8b" @@ -9889,18 +9414,6 @@ metro-cache@0.80.12: flow-enums-runtime "^0.0.6" metro-core "0.80.12" -metro-config@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-config/-/metro-config-0.72.4.tgz#3ad42b3ca0037125d5615f4cb7e1c7ed9442bedd" - integrity sha512-USv+H14D5RrSpfA5t4t5cbF1CnizgYGz6xJ3HB0r/bDYdJdZTVqB3/mMPft7Z5zHslS00JCG7oE51G1CK/FlKw== - dependencies: - cosmiconfig "^5.0.5" - jest-validate "^26.5.2" - metro "0.72.4" - metro-cache "0.72.4" - metro-core "0.72.4" - metro-runtime "0.72.4" - metro-config@0.80.12, metro-config@^0.80.3: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-config/-/metro-config-0.80.12.tgz#1543009f37f7ad26352ffc493fc6305d38bdf1c0" @@ -9915,14 +9428,6 @@ metro-config@0.80.12, metro-config@^0.80.3: metro-core "0.80.12" metro-runtime "0.80.12" -metro-core@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-core/-/metro-core-0.72.4.tgz#e4939aef4c50d953c44eee99a3c971d5162f1287" - integrity sha512-2JNT1nG0UV1uMrQHQOKUSII0sdS6MhVT3mBt2kwfjCvD+jvi1iYhKJ4kYCRlUQw9XNLGZ/B+C0VDQzlf2M3zVw== - dependencies: - lodash.throttle "^4.1.1" - metro-resolver "0.72.4" - metro-core@0.80.12, metro-core@^0.80.3: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-core/-/metro-core-0.80.12.tgz#5ae337923ab19ff524077efa1aeacdf4480cfa28" @@ -9932,26 +9437,6 @@ metro-core@0.80.12, metro-core@^0.80.3: lodash.throttle "^4.1.1" metro-resolver "0.80.12" -metro-file-map@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-file-map/-/metro-file-map-0.72.4.tgz#8a0c8a0e44d665af90dded2ac6e01baebff8552e" - integrity sha512-Mv5WgTsYs5svTR/df6jhq2aD4IkAuwV5TutHW0BfEg1YccQt8/v7q5ZypmUOkjdSS9bFR4r3677jalr/ceFypQ== - dependencies: - abort-controller "^3.0.0" - anymatch "^3.0.3" - debug "^2.2.0" - fb-watchman "^2.0.0" - graceful-fs "^4.2.4" - invariant "^2.2.4" - jest-regex-util "^27.0.6" - jest-serializer "^27.0.6" - jest-util "^27.2.0" - jest-worker "^27.2.0" - micromatch "^4.0.4" - walker "^1.0.7" - optionalDependencies: - fsevents "^2.1.2" - metro-file-map@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-file-map/-/metro-file-map-0.80.12.tgz#b03240166a68aa16c5a168c26e190d9da547eefb" @@ -9971,21 +9456,6 @@ metro-file-map@0.80.12: optionalDependencies: fsevents "^2.3.2" -metro-hermes-compiler@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-hermes-compiler/-/metro-hermes-compiler-0.72.4.tgz#06c946d74720d5132fa1690df0610ba367d3436c" - integrity sha512-AY1mAT5FKfDRYCthuKo2XHbuhG5TUV4ZpZlJ8peIgkiWICzfy0tau3yu+3jUD456N90CjMCOmdknji4uKiZ8ww== - -metro-inspector-proxy@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-inspector-proxy/-/metro-inspector-proxy-0.72.4.tgz#347e9634b6204c38117292edfb11eb2df71c09ad" - integrity sha512-pr+PsbNCZaStWuJRH8oclT170B7NxfgH+UUyTf9/aR+7PjX0gdDabJhPyzA633QgR+EFBaQKZuetHA+f5/cnEQ== - dependencies: - connect "^3.6.5" - debug "^2.2.0" - ws "^7.5.1" - yargs "^15.3.1" - metro-minify-terser@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-minify-terser/-/metro-minify-terser-0.80.12.tgz#9951030e3bc52d7f3ac8664ce5862401c673e3c6" @@ -9994,136 +9464,6 @@ metro-minify-terser@0.80.12: flow-enums-runtime "^0.0.6" terser "^5.15.0" -metro-minify-uglify@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-minify-uglify/-/metro-minify-uglify-0.72.4.tgz#b4504adc17f093173c0e5d44df32ac9e13f50a88" - integrity sha512-84Rrgie3O7Dqkak9ep/eIpMZkEFzpKD4bngPUNimYqAMCExKL7/aymydB27gKcqwus/BVkAV+aOnFsuOhlgnQg== - dependencies: - uglify-es "^3.1.9" - -metro-react-native-babel-preset@0.72.3: - version "0.72.3" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.72.3.tgz#e549199fa310fef34364fdf19bd210afd0c89432" - integrity sha512-uJx9y/1NIqoYTp6ZW1osJ7U5ZrXGAJbOQ/Qzl05BdGYvN1S7Qmbzid6xOirgK0EIT0pJKEEh1s8qbassYZe4cw== - dependencies: - "@babel/core" "^7.14.0" - "@babel/plugin-proposal-async-generator-functions" "^7.0.0" - "@babel/plugin-proposal-class-properties" "^7.0.0" - "@babel/plugin-proposal-export-default-from" "^7.0.0" - "@babel/plugin-proposal-nullish-coalescing-operator" "^7.0.0" - "@babel/plugin-proposal-object-rest-spread" "^7.0.0" - "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" - "@babel/plugin-proposal-optional-chaining" "^7.0.0" - "@babel/plugin-syntax-dynamic-import" "^7.0.0" - "@babel/plugin-syntax-export-default-from" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.0.0" - "@babel/plugin-syntax-optional-chaining" "^7.0.0" - "@babel/plugin-transform-arrow-functions" "^7.0.0" - "@babel/plugin-transform-async-to-generator" "^7.0.0" - "@babel/plugin-transform-block-scoping" "^7.0.0" - "@babel/plugin-transform-classes" "^7.0.0" - "@babel/plugin-transform-computed-properties" "^7.0.0" - "@babel/plugin-transform-destructuring" "^7.0.0" - "@babel/plugin-transform-exponentiation-operator" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" - "@babel/plugin-transform-function-name" "^7.0.0" - "@babel/plugin-transform-literals" "^7.0.0" - "@babel/plugin-transform-modules-commonjs" "^7.0.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.0.0" - "@babel/plugin-transform-parameters" "^7.0.0" - "@babel/plugin-transform-react-display-name" "^7.0.0" - "@babel/plugin-transform-react-jsx" "^7.0.0" - "@babel/plugin-transform-react-jsx-self" "^7.0.0" - "@babel/plugin-transform-react-jsx-source" "^7.0.0" - "@babel/plugin-transform-runtime" "^7.0.0" - "@babel/plugin-transform-shorthand-properties" "^7.0.0" - "@babel/plugin-transform-spread" "^7.0.0" - "@babel/plugin-transform-sticky-regex" "^7.0.0" - "@babel/plugin-transform-template-literals" "^7.0.0" - "@babel/plugin-transform-typescript" "^7.5.0" - "@babel/plugin-transform-unicode-regex" "^7.0.0" - "@babel/template" "^7.0.0" - react-refresh "^0.4.0" - -metro-react-native-babel-preset@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.72.4.tgz#2b320772d2489d1fb3a6413fc58dad13a56eea0e" - integrity sha512-YGCVaYe1H5fOFktdDdL9IwAyiXjPh1t2eZZFp3KFJak6fxKpN+q5PPhe1kzMa77dbCAqgImv43zkfGa6i27eyA== - dependencies: - "@babel/core" "^7.14.0" - "@babel/plugin-proposal-async-generator-functions" "^7.0.0" - "@babel/plugin-proposal-class-properties" "^7.0.0" - "@babel/plugin-proposal-export-default-from" "^7.0.0" - "@babel/plugin-proposal-nullish-coalescing-operator" "^7.0.0" - "@babel/plugin-proposal-object-rest-spread" "^7.0.0" - "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" - "@babel/plugin-proposal-optional-chaining" "^7.0.0" - "@babel/plugin-syntax-dynamic-import" "^7.0.0" - "@babel/plugin-syntax-export-default-from" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.0.0" - "@babel/plugin-syntax-optional-chaining" "^7.0.0" - "@babel/plugin-transform-arrow-functions" "^7.0.0" - "@babel/plugin-transform-async-to-generator" "^7.0.0" - "@babel/plugin-transform-block-scoping" "^7.0.0" - "@babel/plugin-transform-classes" "^7.0.0" - "@babel/plugin-transform-computed-properties" "^7.0.0" - "@babel/plugin-transform-destructuring" "^7.0.0" - "@babel/plugin-transform-exponentiation-operator" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" - "@babel/plugin-transform-function-name" "^7.0.0" - "@babel/plugin-transform-literals" "^7.0.0" - "@babel/plugin-transform-modules-commonjs" "^7.0.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.0.0" - "@babel/plugin-transform-parameters" "^7.0.0" - "@babel/plugin-transform-react-display-name" "^7.0.0" - "@babel/plugin-transform-react-jsx" "^7.0.0" - "@babel/plugin-transform-react-jsx-self" "^7.0.0" - "@babel/plugin-transform-react-jsx-source" "^7.0.0" - "@babel/plugin-transform-runtime" "^7.0.0" - "@babel/plugin-transform-shorthand-properties" "^7.0.0" - "@babel/plugin-transform-spread" "^7.0.0" - "@babel/plugin-transform-sticky-regex" "^7.0.0" - "@babel/plugin-transform-template-literals" "^7.0.0" - "@babel/plugin-transform-typescript" "^7.5.0" - "@babel/plugin-transform-unicode-regex" "^7.0.0" - "@babel/template" "^7.0.0" - react-refresh "^0.4.0" - -metro-react-native-babel-transformer@0.72.3: - version "0.72.3" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.72.3.tgz#f8eda8c07c0082cbdbef47a3293edc41587c6b5a" - integrity sha512-Ogst/M6ujYrl/+9mpEWqE3zF7l2mTuftDTy3L8wZYwX1pWUQWQpfU1aJBeWiLxt1XlIq+uriRjKzKoRoIK57EA== - dependencies: - "@babel/core" "^7.14.0" - babel-preset-fbjs "^3.4.0" - hermes-parser "0.8.0" - metro-babel-transformer "0.72.3" - metro-react-native-babel-preset "0.72.3" - metro-source-map "0.72.3" - nullthrows "^1.1.1" - -metro-react-native-babel-transformer@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.72.4.tgz#c1a38bf28513374dbb0fce45b4017d8abfe4a071" - integrity sha512-VxM8Cki+/tPAyQRPHEy1bsxAihpxz8cGLdteFo9t0eAJI7/vEegqICxQm4A+RiGQc4f8t2jiwI6YpnDWomI5Gw== - dependencies: - "@babel/core" "^7.14.0" - babel-preset-fbjs "^3.4.0" - hermes-parser "0.8.0" - metro-babel-transformer "0.72.4" - metro-react-native-babel-preset "0.72.4" - metro-source-map "0.72.4" - nullthrows "^1.1.1" - -metro-resolver@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.72.4.tgz#37893ff72273a2b7ea529564caa15fe2e2337267" - integrity sha512-aHxq/jypzGyi9Ic9woe//RymfxpzWliAkyTmBWPHE9ypGoiobstK0me2j5XuSfzASzCU8wcVt20qy870rxTWLw== - dependencies: - absolute-path "^0.0.0" - metro-resolver@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.80.12.tgz#e3815914c21315b04db200032c3243a4cc22dfb6" @@ -10131,22 +9471,6 @@ metro-resolver@0.80.12: dependencies: flow-enums-runtime "^0.0.6" -metro-runtime@0.72.3: - version "0.72.3" - resolved "https://registry.yarnpkg.com/metro-runtime/-/metro-runtime-0.72.3.tgz#1485ed7b5f06d09ebb40c83efcf8accc8d30b8b9" - integrity sha512-3MhvDKfxMg2u7dmTdpFOfdR71NgNNo4tzAyJumDVQKwnHYHN44f2QFZQqpPBEmqhWlojNeOxsqFsjYgeyMx6VA== - dependencies: - "@babel/runtime" "^7.0.0" - react-refresh "^0.4.0" - -metro-runtime@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-runtime/-/metro-runtime-0.72.4.tgz#b3469fd040a9526bfd897c0517c5f052a059ddeb" - integrity sha512-EA0ltqyYFpjOdpoRqE2U9FJleqTOIK+ZLRlLaDrx4yz3zTqUZ16W6w71dq+qrwD8BPg7bPKQu7RluU3K6tI79A== - dependencies: - "@babel/runtime" "^7.0.0" - react-refresh "^0.4.0" - metro-runtime@0.80.12, metro-runtime@^0.80.0: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-runtime/-/metro-runtime-0.80.12.tgz#a68af3a2a013f5372d3b8cee234fdd467455550b" @@ -10155,34 +9479,6 @@ metro-runtime@0.80.12, metro-runtime@^0.80.0: "@babel/runtime" "^7.25.0" flow-enums-runtime "^0.0.6" -metro-source-map@0.72.3: - version "0.72.3" - resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.72.3.tgz#5efcf354413804a62ff97864e797f60ef3cc689e" - integrity sha512-eNtpjbjxSheXu/jYCIDrbNEKzMGOvYW6/ePYpRM7gDdEagUOqKOCsi3St8NJIQJzZCsxD2JZ2pYOiomUSkT1yQ== - dependencies: - "@babel/traverse" "^7.14.0" - "@babel/types" "^7.0.0" - invariant "^2.2.4" - metro-symbolicate "0.72.3" - nullthrows "^1.1.1" - ob1 "0.72.3" - source-map "^0.5.6" - vlq "^1.0.0" - -metro-source-map@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.72.4.tgz#3c6444bba22b84d7d7e383f784a1d59e724192de" - integrity sha512-P09aMDEPkLo6BM8VYYoTsH/2B1w6t+mrCwNcNJV1zE+57FPiU4fSBlSeM8G9YeYaezDTHimS2JlMozP+2r+trA== - dependencies: - "@babel/traverse" "^7.14.0" - "@babel/types" "^7.0.0" - invariant "^2.2.4" - metro-symbolicate "0.72.4" - nullthrows "^1.1.1" - ob1 "0.72.4" - source-map "^0.5.6" - vlq "^1.0.0" - metro-source-map@0.80.12, metro-source-map@^0.80.0: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.80.12.tgz#36a2768c880f8c459d6d758e2d0975e36479f49c" @@ -10198,30 +9494,6 @@ metro-source-map@0.80.12, metro-source-map@^0.80.0: source-map "^0.5.6" vlq "^1.0.0" -metro-symbolicate@0.72.3: - version "0.72.3" - resolved "https://registry.yarnpkg.com/metro-symbolicate/-/metro-symbolicate-0.72.3.tgz#093d4f8c7957bcad9ca2ab2047caa90b1ee1b0c1" - integrity sha512-eXG0NX2PJzJ/jTG4q5yyYeN2dr1cUqUaY7worBB0SP5bRWRc3besfb+rXwfh49wTFiL5qR0oOawkU4ZiD4eHXw== - dependencies: - invariant "^2.2.4" - metro-source-map "0.72.3" - nullthrows "^1.1.1" - source-map "^0.5.6" - through2 "^2.0.1" - vlq "^1.0.0" - -metro-symbolicate@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-symbolicate/-/metro-symbolicate-0.72.4.tgz#3be7c9d1f382fc58198efcb515f2de0ec3fc4181" - integrity sha512-6ZRo66Q4iKiwaQuHjmogkSCCqaSpJ4QzbHsVHRUe57mFIL34lOLYp7aPfmX7NHCmy061HhDox/kGuYZQRmHB3A== - dependencies: - invariant "^2.2.4" - metro-source-map "0.72.4" - nullthrows "^1.1.1" - source-map "^0.5.6" - through2 "^2.0.1" - vlq "^1.0.0" - metro-symbolicate@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-symbolicate/-/metro-symbolicate-0.80.12.tgz#3a6aa783c6e494e2879342d88d5379fab69d1ed2" @@ -10235,17 +9507,6 @@ metro-symbolicate@0.80.12: through2 "^2.0.1" vlq "^1.0.0" -metro-transform-plugins@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-transform-plugins/-/metro-transform-plugins-0.72.4.tgz#01e95aa277216fb0887610067125fac9271d399e" - integrity sha512-yxB4v/LxQkmN1rjyyeLiV4x+jwCmId4FTTxNrmTYoi0tFPtOBOeSwuqY08LjxZQMJdZOKXqj2bgIewqFXJEkGw== - dependencies: - "@babel/core" "^7.14.0" - "@babel/generator" "^7.14.0" - "@babel/template" "^7.0.0" - "@babel/traverse" "^7.14.0" - nullthrows "^1.1.1" - metro-transform-plugins@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-transform-plugins/-/metro-transform-plugins-0.80.12.tgz#4a3853630ad0f36cc2bffd53bae659ee171a389c" @@ -10258,25 +9519,6 @@ metro-transform-plugins@0.80.12: flow-enums-runtime "^0.0.6" nullthrows "^1.1.1" -metro-transform-worker@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro-transform-worker/-/metro-transform-worker-0.72.4.tgz#356903c343dc62373b928b4325ad09a103398cc5" - integrity sha512-mIvzy6nRQKMALEdF5g8LXPgCOUi/tGESE5dlb7OSMCj2FAFBm3mTLRrpW5phzK/J6Wg+4Vb9PMS+wGbXR261rA== - dependencies: - "@babel/core" "^7.14.0" - "@babel/generator" "^7.14.0" - "@babel/parser" "^7.14.0" - "@babel/types" "^7.0.0" - babel-preset-fbjs "^3.4.0" - metro "0.72.4" - metro-babel-transformer "0.72.4" - metro-cache "0.72.4" - metro-cache-key "0.72.4" - metro-hermes-compiler "0.72.4" - metro-source-map "0.72.4" - metro-transform-plugins "0.72.4" - nullthrows "^1.1.1" - metro-transform-worker@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/metro-transform-worker/-/metro-transform-worker-0.80.12.tgz#80be8a185b7deb93402b682f58a1dd6724317ad1" @@ -10296,63 +9538,6 @@ metro-transform-worker@0.80.12: metro-transform-plugins "0.80.12" nullthrows "^1.1.1" -metro@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/metro/-/metro-0.72.4.tgz#fdfc43b3329388b5a3e8856727403f93a8c05250" - integrity sha512-UBqL2fswJjsq2LlfMPV4ArqzLzjyN0nReKRijP3DdSxZiaJDG4NC9sQoVJHbH1HP5qXQMAK/SftyAx1c1kuy+w== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/core" "^7.14.0" - "@babel/generator" "^7.14.0" - "@babel/parser" "^7.14.0" - "@babel/template" "^7.0.0" - "@babel/traverse" "^7.14.0" - "@babel/types" "^7.0.0" - absolute-path "^0.0.0" - accepts "^1.3.7" - async "^3.2.2" - chalk "^4.0.0" - ci-info "^2.0.0" - connect "^3.6.5" - debug "^2.2.0" - denodeify "^1.2.1" - error-stack-parser "^2.0.6" - fs-extra "^1.0.0" - graceful-fs "^4.2.4" - hermes-parser "0.8.0" - image-size "^0.6.0" - invariant "^2.2.4" - jest-worker "^27.2.0" - jsc-safe-url "^0.2.2" - lodash.throttle "^4.1.1" - metro-babel-transformer "0.72.4" - metro-cache "0.72.4" - metro-cache-key "0.72.4" - metro-config "0.72.4" - metro-core "0.72.4" - metro-file-map "0.72.4" - metro-hermes-compiler "0.72.4" - metro-inspector-proxy "0.72.4" - metro-minify-uglify "0.72.4" - metro-react-native-babel-preset "0.72.4" - metro-resolver "0.72.4" - metro-runtime "0.72.4" - metro-source-map "0.72.4" - metro-symbolicate "0.72.4" - metro-transform-plugins "0.72.4" - metro-transform-worker "0.72.4" - mime-types "^2.1.27" - node-fetch "^2.2.0" - nullthrows "^1.1.1" - rimraf "^2.5.4" - serialize-error "^2.1.0" - source-map "^0.5.6" - strip-ansi "^6.0.0" - temp "0.8.3" - throat "^5.0.0" - ws "^7.5.1" - yargs "^15.3.1" - metro@0.80.12, metro@^0.80.3: version "0.80.12" resolved "https://registry.yarnpkg.com/metro/-/metro-0.80.12.tgz#29a61fb83581a71e50c4d8d5d8458270edfe34cc" @@ -10715,11 +9900,6 @@ new-date@^1.0.3: dependencies: "@segment/isodate" "1.0.3" -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - nocache@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/nocache/-/nocache-3.0.4.tgz#5b37a56ec6e09fc7d401dceaed2eab40c8bfdf79" @@ -10921,13 +10101,6 @@ npm-registry-fetch@^17.0.0, npm-registry-fetch@^17.0.1, npm-registry-fetch@^17.1 npm-package-arg "^11.0.0" proc-log "^4.0.0" -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - integrity sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw== - dependencies: - path-key "^2.0.0" - npm-run-path@^4.0.0, npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -11054,16 +10227,6 @@ nx@17.3.2, nx@^17.2.0: "@nx/nx-win32-arm64-msvc" "20.8.1" "@nx/nx-win32-x64-msvc" "20.8.1" -ob1@0.72.3: - version "0.72.3" - resolved "https://registry.yarnpkg.com/ob1/-/ob1-0.72.3.tgz#fc1efcfe156f12ed23615f2465a796faad8b91e4" - integrity sha512-OnVto25Sj7Ghp0vVm2THsngdze3tVq0LOg9LUHsAVXMecpqOP0Y8zaATW8M9gEgs2lNEAcCqV0P/hlmOPhVRvg== - -ob1@0.72.4: - version "0.72.4" - resolved "https://registry.yarnpkg.com/ob1/-/ob1-0.72.4.tgz#d2ddedb09fb258d69490e8809157518a62b75506" - integrity sha512-/iPJKpXpVEZS0subUvjew4ept5LTBxj1hD20A4mAj9CJkGGPgvbBlfYtFEBubBkk4dv4Ef5lajsnRBYPxF74cQ== - ob1@0.80.12: version "0.80.12" resolved "https://registry.yarnpkg.com/ob1/-/ob1-0.80.12.tgz#0451944ba6e5be225cc9751d8cd0d7309d2d1537" @@ -11201,7 +10364,7 @@ os-homedir@^1.0.0: resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" integrity sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ== -os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: +os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== @@ -11422,11 +10585,6 @@ path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== -path-key@^2.0.0, path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== - path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -11644,7 +10802,7 @@ promise@^8.3.0: dependencies: asap "~2.0.6" -prompts@^2.0.1, prompts@^2.4.0, prompts@^2.4.2: +prompts@^2.0.1, prompts@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== @@ -11749,14 +10907,6 @@ range-parser@~1.2.1: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -react-devtools-core@4.24.0: - version "4.24.0" - resolved "https://registry.yarnpkg.com/react-devtools-core/-/react-devtools-core-4.24.0.tgz#7daa196bdc64f3626b3f54f2ff2b96f7c4fdf017" - integrity sha512-Rw7FzYOOzcfyUPaAm9P3g0tFdGqGq2LLiAI+wjYcp6CsF3DeeMrRS3HZAho4s273C29G/DJhx0e8BpRE/QZNGg== - dependencies: - shell-quote "^1.6.1" - ws "^7" - react-devtools-core@^4.27.7: version "4.28.5" resolved "https://registry.yarnpkg.com/react-devtools-core/-/react-devtools-core-4.28.5.tgz#c8442b91f068cdf0c899c543907f7f27d79c2508" @@ -11807,59 +10957,6 @@ react-native-builder-bob@^0.20.3: optionalDependencies: jetifier "^2.0.0" -react-native-codegen@^0.70.6: - version "0.70.7" - resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.70.7.tgz#8f6b47a88740ae703209d57b7605538d86dacfa6" - integrity sha512-qXE8Jrhc9BmxDAnCmrHFDLJrzgjsE/mH57dtC4IO7K76AwagdXNCMRp5SA8XdHJzvvHWRaghpiFHEMl9TtOBcQ== - dependencies: - "@babel/parser" "^7.14.0" - flow-parser "^0.121.0" - jscodeshift "^0.14.0" - nullthrows "^1.1.1" - -react-native-gradle-plugin@^0.70.3: - version "0.70.3" - resolved "https://registry.yarnpkg.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz#cbcf0619cbfbddaa9128701aa2d7b4145f9c4fc8" - integrity sha512-oOanj84fJEXUg9FoEAQomA8ISG+DVIrTZ3qF7m69VQUJyOGYyDZmPqKcjvRku4KXlEH6hWO9i4ACLzNBh8gC0A== - -react-native@0.70.6: - version "0.70.6" - resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.70.6.tgz#d692f8b51baffc28e1a8bc5190cdb779de937aa8" - integrity sha512-xtQdImPHnwgraEx3HIZFOF+D1hJ9bC5mfpIdUGoMHRws6OmvHAjmFpO6qfdnaQ29vwbmZRq7yf14sbury74R/w== - dependencies: - "@jest/create-cache-key-function" "^27.0.1" - "@react-native-community/cli" "9.3.2" - "@react-native-community/cli-platform-android" "9.3.1" - "@react-native-community/cli-platform-ios" "9.3.0" - "@react-native/assets" "1.0.0" - "@react-native/normalize-color" "2.0.0" - "@react-native/polyfills" "2.0.0" - abort-controller "^3.0.0" - anser "^1.4.9" - base64-js "^1.1.2" - event-target-shim "^5.0.1" - invariant "^2.2.4" - jsc-android "^250230.2.1" - memoize-one "^5.0.0" - metro-react-native-babel-transformer "0.72.3" - metro-runtime "0.72.3" - metro-source-map "0.72.3" - mkdirp "^0.5.1" - nullthrows "^1.1.1" - pretty-format "^26.5.2" - promise "^8.3.0" - react-devtools-core "4.24.0" - react-native-codegen "^0.70.6" - react-native-gradle-plugin "^0.70.3" - react-refresh "^0.4.0" - react-shallow-renderer "^16.15.0" - regenerator-runtime "^0.13.2" - scheduler "^0.22.0" - stacktrace-parser "^0.1.3" - use-sync-external-store "^1.0.0" - whatwg-fetch "^3.0.0" - ws "^6.1.4" - react-native@0.73.0: version "0.73.0" resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.73.0.tgz#553bce5ed4bd3d9f71014127bd687133562c5049" @@ -11908,11 +11005,6 @@ react-refresh@^0.14.0: resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9" integrity sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA== -react-refresh@^0.4.0: - version "0.4.3" - resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.4.3.tgz#966f1750c191672e76e16c2efa569150cc73ab53" - integrity sha512-Hwln1VNuGl/6bVwnd0Xdn1e84gT/8T9aYNL+HAKDArLCS7LWjwr7StE30IEYbIkx0Vi3vs+coQxe+SQDbGbbpA== - react-shallow-renderer@^16.15.0: version "16.15.0" resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz#48fb2cf9b23d23cde96708fe5273a7d3446f4457" @@ -12227,13 +11319,6 @@ rfdc@^1.3.0: resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca" integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA== -rimraf@^2.5.4: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -12248,11 +11333,6 @@ rimraf@^4.4.1: dependencies: glob "^9.2.0" -rimraf@~2.2.6: - version "2.2.8" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" - integrity sha512-R5KMKHnPAQaZMqLOsyuyUmcIjSeDm+73eoqQpaXA7AZ22BL+6C+1mcUscgOsNd8WVlJuvlgAPsegcx7pjlV0Dg== - rimraf@~2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" @@ -12364,19 +11444,12 @@ scheduler@0.24.0-canary-efb381bbf-20230505: dependencies: loose-envify "^1.1.0" -scheduler@^0.22.0: - version "0.22.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.22.0.tgz#83a5d63594edf074add9a7198b1bae76c3db01b8" - integrity sha512-6QAm1BgQI88NPYymgGQLCZgvep4FyePDWFpXVK+zNSUgHwlqpJy8VEh8Et0KxTACS4VWwMousBElAZOH9nkkoQ== - dependencies: - loose-envify "^1.1.0" - secure-compare@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/secure-compare/-/secure-compare-3.0.1.tgz#f1a0329b308b221fae37b9974f3d578d0ca999e3" integrity sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw== -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.6.0: version "5.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== @@ -12456,13 +11529,6 @@ shallow-clone@^3.0.0: dependencies: kind-of "^6.0.2" -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg== - dependencies: - shebang-regex "^1.0.0" - shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -12470,11 +11536,6 @@ shebang-command@^2.0.0: dependencies: shebang-regex "^3.0.0" -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== - shebang-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" @@ -12535,7 +11596,7 @@ side-channel@^1.1.0: side-channel-map "^1.0.1" side-channel-weakmap "^1.0.2" -signal-exit@3.0.7, signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: +signal-exit@3.0.7, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -12730,7 +11791,7 @@ stackframe@^1.3.4: resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.3.4.tgz#b881a004c8c149a5e8efef37d51b16e412943310" integrity sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw== -stacktrace-parser@^0.1.10, stacktrace-parser@^0.1.3: +stacktrace-parser@^0.1.10: version "0.1.11" resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.11.tgz#c7c08f9b29ef566b9a6f7b255d7db572f66fabc4" integrity sha512-WjlahMgHmCJpqzU8bIBy4qtsZdU9lRlcZE3Lvyej6t4tuOuv1vk57OW3MBrj6hXBFx/nNoC9MPMTcr5YA7NQbg== @@ -12765,16 +11826,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -12806,7 +11858,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -12827,13 +11879,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -12851,11 +11896,6 @@ strip-bom@^4.0.0: resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - integrity sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q== - strip-final-newline@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" @@ -12959,14 +11999,6 @@ temp-dir@^2.0.0: resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-2.0.0.tgz#bde92b05bdfeb1516e804c9c00ad45177f31321e" integrity sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg== -temp@0.8.3: - version "0.8.3" - resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.3.tgz#e0c6bc4d26b903124410e4fed81103014dfc1f59" - integrity sha512-jtnWJs6B1cZlHs9wPG7BrowKxZw/rf6+UpGAkr8AaYmiTyTO7zQlLoST8zx/8TcUPnZmeBoB+H8ARuHZaSijVw== - dependencies: - os-tmpdir "^1.0.0" - rimraf "~2.2.6" - temp@^0.8.4: version "0.8.4" resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.4.tgz#8c97a33a4770072e0a05f919396c7665a7dd59f2" @@ -13285,14 +12317,6 @@ typeson@^6.0.0, typeson@^6.1.0: resolved "https://registry.yarnpkg.com/typeson/-/typeson-6.1.0.tgz#5b2a53705a5f58ff4d6f82f965917cabd0d7448b" integrity sha512-6FTtyGr8ldU0pfbvW/eOZrEtEkczHRUtduBnA90Jh9kMPCiFNnXIon3vF41N0S4tV1HHQt4Hk1j4srpESziCaA== -uglify-es@^3.1.9: - version "3.3.9" - resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" - integrity sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ== - dependencies: - commander "~2.13.0" - source-map "~0.6.1" - uglify-js@^3.1.4: version "3.19.3" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" @@ -13430,11 +12454,6 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -use-sync-external-store@^1.0.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz#55122e2a3edd2a6c106174c27485e0fd59bcfca0" - integrity sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A== - util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -13619,13 +12638,6 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== -which@^1.2.9: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== - dependencies: - isexe "^2.0.0" - which@^2.0.1, which@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -13657,7 +12669,7 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -13675,15 +12687,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -13744,7 +12747,7 @@ write-pkg@4.0.0: type-fest "^0.4.1" write-json-file "^3.2.0" -ws@^6.1.4, ws@^6.2.2: +ws@^6.2.2: version "6.2.3" resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.3.tgz#ccc96e4add5fd6fedbc491903075c85c5a11d9ee" integrity sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA== @@ -13842,7 +12845,7 @@ yargs@17.7.2, yargs@^17.0.0, yargs@^17.3.1, yargs@^17.5.1, yargs@^17.6.2, yargs@ y18n "^5.0.5" yargs-parser "^21.1.1" -yargs@^15.1.0, yargs@^15.3.1: +yargs@^15.1.0: version "15.4.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== From e86841270a95ca8a35618624b37ae516e1a26232 Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 15:33:09 -0700 Subject: [PATCH 3/9] fix(plugin-page-view-tracking-browser): move to core --- .../analytics-browser/src/attribution/helpers.ts | 4 +--- .../src/attribution/web-attribution.ts | 14 ++++++++++---- packages/analytics-browser/src/types.ts | 7 +++++-- .../src/attribution/campaign-parser.ts | 2 +- .../src/attribution/campaign.ts | 0 .../src/attribution/constants.ts | 0 packages/analytics-core/src/index.ts | 4 ++++ .../test/attribution/campaign-parser.test.ts | 2 +- .../src/page-view-tracking.ts | 4 ++-- .../src/typings/page-view-tracking.ts | 4 ++-- .../test/mock-browser-client.ts | 2 +- .../test/page-view-tracking.test.ts | 12 +++++++++--- 12 files changed, 36 insertions(+), 19 deletions(-) rename packages/{analytics-browser => analytics-core}/src/attribution/campaign-parser.ts (97%) rename packages/{analytics-browser => analytics-core}/src/attribution/campaign.ts (100%) rename packages/{analytics-browser => analytics-core}/src/attribution/constants.ts (100%) rename packages/{analytics-browser => analytics-core}/test/attribution/campaign-parser.test.ts (98%) diff --git a/packages/analytics-browser/src/attribution/helpers.ts b/packages/analytics-browser/src/attribution/helpers.ts index e3b142351..12bb9cc4a 100644 --- a/packages/analytics-browser/src/attribution/helpers.ts +++ b/packages/analytics-browser/src/attribution/helpers.ts @@ -1,6 +1,4 @@ -import { createIdentifyEvent, Identify, ILogger } from '@amplitude/analytics-core'; -import { Campaign } from './campaign'; -import { BASE_CAMPAIGN } from './constants'; +import { createIdentifyEvent, Identify, ILogger, Campaign, BASE_CAMPAIGN } from '@amplitude/analytics-core'; export interface Options { excludeReferrers?: (string | RegExp)[]; diff --git a/packages/analytics-browser/src/attribution/web-attribution.ts b/packages/analytics-browser/src/attribution/web-attribution.ts index 7be31e55a..e19da3c4b 100644 --- a/packages/analytics-browser/src/attribution/web-attribution.ts +++ b/packages/analytics-browser/src/attribution/web-attribution.ts @@ -1,8 +1,14 @@ -import { BrowserConfig, ILogger, Storage, getStorageKey, isNewSession } from '@amplitude/analytics-core'; -import { Campaign } from './campaign'; +import { + BrowserConfig, + ILogger, + Storage, + getStorageKey, + isNewSession, + Campaign, + CampaignParser, + BASE_CAMPAIGN, +} from '@amplitude/analytics-core'; import { Options, getDefaultExcludedReferrers, createCampaignEvent, isNewCampaign } from './helpers'; -import { CampaignParser } from './campaign-parser'; -import { BASE_CAMPAIGN } from './constants'; export class WebAttribution { options: Options; diff --git a/packages/analytics-browser/src/types.ts b/packages/analytics-browser/src/types.ts index d6f4f15f5..2b3ee3e8c 100644 --- a/packages/analytics-browser/src/types.ts +++ b/packages/analytics-browser/src/types.ts @@ -36,6 +36,9 @@ export { DEFAULT_CSS_SELECTOR_ALLOWLIST, DEFAULT_DATA_ATTRIBUTE_PREFIX, DEFAULT_ACTION_CLICK_ALLOWLIST, + Campaign, + CampaignParser, + ClickIdParameters, + ReferrerParameters, + UTMParameters, } from '@amplitude/analytics-core'; - -export { Campaign, CampaignParser, ClickIdParameters, ReferrerParameters, UTMParameters } from './attribution/campaign'; diff --git a/packages/analytics-browser/src/attribution/campaign-parser.ts b/packages/analytics-core/src/attribution/campaign-parser.ts similarity index 97% rename from packages/analytics-browser/src/attribution/campaign-parser.ts rename to packages/analytics-core/src/attribution/campaign-parser.ts index 45b33fe0f..b4d5ecc79 100644 --- a/packages/analytics-browser/src/attribution/campaign-parser.ts +++ b/packages/analytics-core/src/attribution/campaign-parser.ts @@ -1,4 +1,4 @@ -import { getQueryParams } from '@amplitude/analytics-core'; +import { getQueryParams } from '../query-params'; import { UTM_CAMPAIGN, UTM_CONTENT, diff --git a/packages/analytics-browser/src/attribution/campaign.ts b/packages/analytics-core/src/attribution/campaign.ts similarity index 100% rename from packages/analytics-browser/src/attribution/campaign.ts rename to packages/analytics-core/src/attribution/campaign.ts diff --git a/packages/analytics-browser/src/attribution/constants.ts b/packages/analytics-core/src/attribution/constants.ts similarity index 100% rename from packages/analytics-browser/src/attribution/constants.ts rename to packages/analytics-core/src/attribution/constants.ts diff --git a/packages/analytics-core/src/index.ts b/packages/analytics-core/src/index.ts index aaf7a7523..dc7ff41a2 100644 --- a/packages/analytics-core/src/index.ts +++ b/packages/analytics-core/src/index.ts @@ -24,6 +24,10 @@ export { getStorageKey } from './storage/helpers'; export { BaseTransport } from './transports/base'; export { FetchTransport } from './transports/fetch'; +export { Campaign, ClickIdParameters, ReferrerParameters, UTMParameters } from './attribution/campaign'; +export { BASE_CAMPAIGN } from './attribution/constants'; +export { CampaignParser } from './attribution/campaign-parser'; + export { LogLevel } from './types/loglevel'; export { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants'; export { Storage, IdentityStorageType } from './types/storage'; diff --git a/packages/analytics-browser/test/attribution/campaign-parser.test.ts b/packages/analytics-core/test/attribution/campaign-parser.test.ts similarity index 98% rename from packages/analytics-browser/test/attribution/campaign-parser.test.ts rename to packages/analytics-core/test/attribution/campaign-parser.test.ts index eccf88ba2..c102ffce2 100644 --- a/packages/analytics-browser/test/attribution/campaign-parser.test.ts +++ b/packages/analytics-core/test/attribution/campaign-parser.test.ts @@ -1,6 +1,6 @@ import { BASE_CAMPAIGN } from '../../src/attribution/constants'; import { CampaignParser } from '../../src/attribution/campaign-parser'; -import * as queryParams from '@amplitude/analytics-core'; +import * as queryParams from '../../src/query-params'; beforeAll(() => { Object.defineProperty(window, 'location', { diff --git a/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts b/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts index 64e3adafd..0c28bb42b 100644 --- a/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts +++ b/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts @@ -7,9 +7,9 @@ import { IdentifyOperation, IdentifyUserProperties, ILogger, + CampaignParser, + BASE_CAMPAIGN, } from '@amplitude/analytics-core'; -import { CampaignParser } from '@amplitude/analytics-client-common'; -import { BASE_CAMPAIGN } from '@amplitude/analytics-client-common'; import { CreatePageViewTrackingPlugin, Options } from './typings/page-view-tracking'; import { omitUndefined } from './utils'; diff --git a/packages/plugin-page-view-tracking-browser/src/typings/page-view-tracking.ts b/packages/plugin-page-view-tracking-browser/src/typings/page-view-tracking.ts index f22fc66c3..ede565827 100644 --- a/packages/plugin-page-view-tracking-browser/src/typings/page-view-tracking.ts +++ b/packages/plugin-page-view-tracking-browser/src/typings/page-view-tracking.ts @@ -1,10 +1,10 @@ -import { EnrichmentPlugin, PageTrackingOptions as Options } from '@amplitude/analytics-types'; +import { EnrichmentPlugin, PageTrackingOptions as Options } from '@amplitude/analytics-core'; export { PageTrackingOptions as Options, PageTrackingTrackOn, PageTrackingHistoryChanges, -} from '@amplitude/analytics-types'; +} from '@amplitude/analytics-core'; export interface CreatePageViewTrackingPlugin { (options?: Options): EnrichmentPlugin; diff --git a/packages/plugin-page-view-tracking-browser/test/mock-browser-client.ts b/packages/plugin-page-view-tracking-browser/test/mock-browser-client.ts index 0edbe5aa9..4159a5679 100644 --- a/packages/plugin-page-view-tracking-browser/test/mock-browser-client.ts +++ b/packages/plugin-page-view-tracking-browser/test/mock-browser-client.ts @@ -1,4 +1,4 @@ -import { BrowserClient } from '@amplitude/analytics-types'; +import { BrowserClient } from '@amplitude/analytics-core'; // Mock BrowserClient implementation export const createMockBrowserClient = (): jest.Mocked => { diff --git a/packages/plugin-page-view-tracking-browser/test/page-view-tracking.test.ts b/packages/plugin-page-view-tracking-browser/test/page-view-tracking.test.ts index 2a9bd0d9e..182c96bb6 100644 --- a/packages/plugin-page-view-tracking-browser/test/page-view-tracking.test.ts +++ b/packages/plugin-page-view-tracking-browser/test/page-view-tracking.test.ts @@ -1,7 +1,13 @@ -import { Logger, UUID } from '@amplitude/analytics-core'; -import { BrowserClient, BrowserConfig, LogLevel } from '@amplitude/analytics-types'; +import { + Logger, + UUID, + CookieStorage, + FetchTransport, + BrowserClient, + BrowserConfig, + LogLevel, +} from '@amplitude/analytics-core'; import { defaultPageViewEvent, pageViewTrackingPlugin, shouldTrackHistoryPageView } from '../src/page-view-tracking'; -import { CookieStorage, FetchTransport } from '@amplitude/analytics-client-common'; // Mock BrowserClient implementation const createMockBrowserClient = (): jest.Mocked => { From ef8d67d695a0ba920cfb909ed1e43305d830a1cf Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 15:35:13 -0700 Subject: [PATCH 4/9] chore(plugin-web-attribution-browser): deprecated --- .../CHANGELOG.md | 1158 ----------------- .../plugin-web-attribution-browser/README.md | 96 -- .../jest.config.js | 10 - .../package.json | 58 - .../rollup.config.js | 3 - .../src/index.ts | 2 - .../src/typings/web-attribution.ts | 11 - .../src/web-attribution.ts | 43 - .../test/web-attribution.test.ts | 269 ---- .../tsconfig.es5.json | 10 - .../tsconfig.esm.json | 10 - .../tsconfig.json | 11 - 12 files changed, 1681 deletions(-) delete mode 100644 packages/plugin-web-attribution-browser/CHANGELOG.md delete mode 100644 packages/plugin-web-attribution-browser/README.md delete mode 100644 packages/plugin-web-attribution-browser/jest.config.js delete mode 100644 packages/plugin-web-attribution-browser/package.json delete mode 100644 packages/plugin-web-attribution-browser/rollup.config.js delete mode 100644 packages/plugin-web-attribution-browser/src/index.ts delete mode 100644 packages/plugin-web-attribution-browser/src/typings/web-attribution.ts delete mode 100644 packages/plugin-web-attribution-browser/src/web-attribution.ts delete mode 100644 packages/plugin-web-attribution-browser/test/web-attribution.test.ts delete mode 100644 packages/plugin-web-attribution-browser/tsconfig.es5.json delete mode 100644 packages/plugin-web-attribution-browser/tsconfig.esm.json delete mode 100644 packages/plugin-web-attribution-browser/tsconfig.json diff --git a/packages/plugin-web-attribution-browser/CHANGELOG.md b/packages/plugin-web-attribution-browser/CHANGELOG.md deleted file mode 100644 index 2c4935e31..000000000 --- a/packages/plugin-web-attribution-browser/CHANGELOG.md +++ /dev/null @@ -1,1158 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.53](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.52...@amplitude/plugin-web-attribution-browser@2.1.53) (2025-06-03) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.52](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.52-main.0...@amplitude/plugin-web-attribution-browser@2.1.52) (2025-05-27) - - -### Reverts - -* "chore(release): publish" ([#1094](https://github.com/amplitude/Amplitude-TypeScript/issues/1094)) ([f6db1ee](https://github.com/amplitude/Amplitude-TypeScript/commit/f6db1eed32ed77c7ce626624dc55972971f3b27d)) - - - - - -## [2.1.51](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.50...@amplitude/plugin-web-attribution-browser@2.1.51) (2025-05-14) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.50](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.49...@amplitude/plugin-web-attribution-browser@2.1.50) (2025-05-13) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.49](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.48...@amplitude/plugin-web-attribution-browser@2.1.49) (2025-05-07) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.48](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.47...@amplitude/plugin-web-attribution-browser@2.1.48) (2025-05-05) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.47](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.46...@amplitude/plugin-web-attribution-browser@2.1.47) (2025-05-02) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.46](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.45...@amplitude/plugin-web-attribution-browser@2.1.46) (2025-05-02) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.45](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.44...@amplitude/plugin-web-attribution-browser@2.1.45) (2025-05-02) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.44](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.43...@amplitude/plugin-web-attribution-browser@2.1.44) (2025-04-30) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.43](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.42...@amplitude/plugin-web-attribution-browser@2.1.43) (2025-04-22) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.42](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.41...@amplitude/plugin-web-attribution-browser@2.1.42) (2025-04-17) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.41](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.40...@amplitude/plugin-web-attribution-browser@2.1.41) (2025-04-15) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.40](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.39...@amplitude/plugin-web-attribution-browser@2.1.40) (2025-04-10) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.39](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.38...@amplitude/plugin-web-attribution-browser@2.1.39) (2025-04-07) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.38](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.37...@amplitude/plugin-web-attribution-browser@2.1.38) (2025-04-07) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.37](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.36...@amplitude/plugin-web-attribution-browser@2.1.37) (2025-04-02) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.36](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.35...@amplitude/plugin-web-attribution-browser@2.1.36) (2025-03-24) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.35](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.34...@amplitude/plugin-web-attribution-browser@2.1.35) (2025-03-21) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.34](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.33...@amplitude/plugin-web-attribution-browser@2.1.34) (2025-03-14) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.33](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.32...@amplitude/plugin-web-attribution-browser@2.1.33) (2025-02-28) - - -### Reverts - -* Revert "chore(release): publish" ([d392f62](https://github.com/amplitude/Amplitude-TypeScript/commit/d392f6290b8bb4dd955d6e6f20b00191679489c4)) - - - - - -## [2.1.32](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.31...@amplitude/plugin-web-attribution-browser@2.1.32) (2025-02-14) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.31](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.30...@amplitude/plugin-web-attribution-browser@2.1.31) (2024-12-31) - - -### Bug Fixes - -* add comments in isNewCampaign() ([#941](https://github.com/amplitude/Amplitude-TypeScript/issues/941)) ([a14a68c](https://github.com/amplitude/Amplitude-TypeScript/commit/a14a68c65cea7a4bf8a842761ff7a81830e5d3ba)) - - - - - -## [2.1.30](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.29...@amplitude/plugin-web-attribution-browser@2.1.30) (2024-12-17) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.29](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.28...@amplitude/plugin-web-attribution-browser@2.1.29) (2024-11-05) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.28](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.27...@amplitude/plugin-web-attribution-browser@2.1.28) (2024-10-21) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.27](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.26...@amplitude/plugin-web-attribution-browser@2.1.27) (2024-09-26) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.26](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.25...@amplitude/plugin-web-attribution-browser@2.1.26) (2024-09-18) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.25](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.24...@amplitude/plugin-web-attribution-browser@2.1.25) (2024-09-17) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.24](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.23...@amplitude/plugin-web-attribution-browser@2.1.24) (2024-09-16) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.23](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.22...@amplitude/plugin-web-attribution-browser@2.1.23) (2024-09-10) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.22](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.21...@amplitude/plugin-web-attribution-browser@2.1.22) (2024-09-05) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.21](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.20...@amplitude/plugin-web-attribution-browser@2.1.21) (2024-08-23) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.20](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.19...@amplitude/plugin-web-attribution-browser@2.1.20) (2024-08-13) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.19](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.18...@amplitude/plugin-web-attribution-browser@2.1.19) (2024-08-02) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -## [2.1.18](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.17...@amplitude/plugin-web-attribution-browser@2.1.18) (2024-06-26) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - - - - - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.17](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.16...@amplitude/plugin-web-attribution-browser@2.1.17) (2024-06-24) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.16](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.15...@amplitude/plugin-web-attribution-browser@2.1.16) (2024-06-24) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.15](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.14...@amplitude/plugin-web-attribution-browser@2.1.15) (2024-06-17) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.14](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.13...@amplitude/plugin-web-attribution-browser@2.1.14) (2024-05-24) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.13](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.12...@amplitude/plugin-web-attribution-browser@2.1.13) (2024-05-21) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.12](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.11...@amplitude/plugin-web-attribution-browser@2.1.12) (2024-05-17) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.11](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.10...@amplitude/plugin-web-attribution-browser@2.1.11) (2024-05-15) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.10](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.9...@amplitude/plugin-web-attribution-browser@2.1.10) (2024-05-07) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.9](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.8...@amplitude/plugin-web-attribution-browser@2.1.9) (2024-05-03) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.8-beta.0...@amplitude/plugin-web-attribution-browser@2.1.8) (2024-04-29) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.8-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.7...@amplitude/plugin-web-attribution-browser@2.1.8-beta.0) (2024-04-19) - -### Bug Fixes - -- fix web attribution identify and session start order - ([#696](https://github.com/amplitude/Amplitude-TypeScript/issues/696)) - ([2f077da](https://github.com/amplitude/Amplitude-TypeScript/commit/2f077da7b528ed6f23f7459b7c961c099dbcb1bb)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.7-beta.0...@amplitude/plugin-web-attribution-browser@2.1.7) (2024-04-09) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.7-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.6...@amplitude/plugin-web-attribution-browser@2.1.7-beta.0) (2024-03-28) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.5...@amplitude/plugin-web-attribution-browser@2.1.6) (2024-03-27) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.4...@amplitude/plugin-web-attribution-browser@2.1.5) (2024-03-23) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.3...@amplitude/plugin-web-attribution-browser@2.1.4) (2024-03-12) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.2...@amplitude/plugin-web-attribution-browser@2.1.3) (2024-02-23) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.1...@amplitude/plugin-web-attribution-browser@2.1.2) (2024-02-23) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.1.0...@amplitude/plugin-web-attribution-browser@2.1.1) (2024-02-13) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.1.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.18...@amplitude/plugin-web-attribution-browser@2.1.0) (2024-01-24) - -### Features - -- add offline mode ([#644](https://github.com/amplitude/Amplitude-TypeScript/issues/644)) - ([f2cd717](https://github.com/amplitude/Amplitude-TypeScript/commit/f2cd717316eef66b101153cb8eedf37fadc6de0c)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.18](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.17...@amplitude/plugin-web-attribution-browser@2.0.18) (2023-12-20) - -### Reverts - -- update attribution plugin to apply utm params to the `session_start` event - ([#638](https://github.com/amplitude/Amplitude-TypeScript/issues/638)) - ([c820279](https://github.com/amplitude/Amplitude-TypeScript/commit/c820279cbef2123d890beb7861d7edbbc3926f6e)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.17](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.16...@amplitude/plugin-web-attribution-browser@2.0.17) (2023-12-12) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.16](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.16-beta.0...@amplitude/plugin-web-attribution-browser@2.0.16) (2023-12-01) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.16-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.15...@amplitude/plugin-web-attribution-browser@2.0.16-beta.0) (2023-11-22) - -### Bug Fixes - -- update attribution plugin to apply utm params to the `session_start` event - ([#619](https://github.com/amplitude/Amplitude-TypeScript/issues/619)) - ([bf45ca6](https://github.com/amplitude/Amplitude-TypeScript/commit/bf45ca6c17ac8d656cb6c5bb4f4fa19ff344ac85)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.15](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.14...@amplitude/plugin-web-attribution-browser@2.0.15) (2023-11-16) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.14](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.13...@amplitude/plugin-web-attribution-browser@2.0.14) (2023-11-16) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.13](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.12...@amplitude/plugin-web-attribution-browser@2.0.13) (2023-10-18) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.12](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.11...@amplitude/plugin-web-attribution-browser@2.0.12) (2023-09-26) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.11](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.10...@amplitude/plugin-web-attribution-browser@2.0.11) (2023-09-18) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.10](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.9...@amplitude/plugin-web-attribution-browser@2.0.10) (2023-09-15) - -### Bug Fixes - -- fix attribution to capture UTMs even if there is no referral info - ([#584](https://github.com/amplitude/Amplitude-TypeScript/issues/584)) - ([a1f03a5](https://github.com/amplitude/Amplitude-TypeScript/commit/a1f03a5c2c69cdbb7af9a5fb03cd81d35c51ecd4)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.9](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.8...@amplitude/plugin-web-attribution-browser@2.0.9) (2023-08-31) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.7...@amplitude/plugin-web-attribution-browser@2.0.8) (2023-08-29) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.6...@amplitude/plugin-web-attribution-browser@2.0.7) (2023-08-24) - -### Bug Fixes - -- fix web attribution behavior for no referrer in the same session - ([#554](https://github.com/amplitude/Amplitude-TypeScript/issues/554)) - ([ed54eb2](https://github.com/amplitude/Amplitude-TypeScript/commit/ed54eb28810a3edb3326f82bdd7aed901ec9452f)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.5...@amplitude/plugin-web-attribution-browser@2.0.6) (2023-08-15) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.4...@amplitude/plugin-web-attribution-browser@2.0.5) (2023-07-27) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.3...@amplitude/plugin-web-attribution-browser@2.0.4) (2023-07-03) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.2...@amplitude/plugin-web-attribution-browser@2.0.3) (2023-06-30) - -### Bug Fixes - -- missing core dependency for web attribution ([#461](https://github.com/amplitude/Amplitude-TypeScript/issues/461)) - ([3c5e6f2](https://github.com/amplitude/Amplitude-TypeScript/commit/3c5e6f2b13e55bf645c185649688867a69f6b0da)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.1...@amplitude/plugin-web-attribution-browser@2.0.2) (2023-06-22) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0...@amplitude/plugin-web-attribution-browser@2.0.1) (2023-06-21) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.10...@amplitude/plugin-web-attribution-browser@2.0.0) (2023-06-14) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.10](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.9...@amplitude/plugin-web-attribution-browser@2.0.0-beta.10) (2023-06-14) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.9](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.8...@amplitude/plugin-web-attribution-browser@2.0.0-beta.9) (2023-06-14) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.7...@amplitude/plugin-web-attribution-browser@2.0.0-beta.8) (2023-06-13) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.6...@amplitude/plugin-web-attribution-browser@2.0.0-beta.7) (2023-06-13) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.5...@amplitude/plugin-web-attribution-browser@2.0.0-beta.6) (2023-06-09) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.4...@amplitude/plugin-web-attribution-browser@2.0.0-beta.5) (2023-06-08) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.3...@amplitude/plugin-web-attribution-browser@2.0.0-beta.4) (2023-06-07) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.2...@amplitude/plugin-web-attribution-browser@2.0.0-beta.3) (2023-06-07) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@2.0.0-beta.1...@amplitude/plugin-web-attribution-browser@2.0.0-beta.2) (2023-06-06) - -### Bug Fixes - -- simplify plugins and eliminate enums ([#407](https://github.com/amplitude/Amplitude-TypeScript/issues/407)) - ([890ec66](https://github.com/amplitude/Amplitude-TypeScript/commit/890ec6695a8b25cd6988e9f7ae584d4ba2835f67)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.7.0...@amplitude/plugin-web-attribution-browser@2.0.0-beta.1) (2023-06-06) - -### Bug Fixes - -- dependency tree - ([d7ce659](https://github.com/amplitude/Amplitude-TypeScript/commit/d7ce659c72321c373346bab0f4c0e6d23304e1b6)) - -### Features - -- allow cross subdomain excluded referrer ([#391](https://github.com/amplitude/Amplitude-TypeScript/issues/391)) - ([f34f64b](https://github.com/amplitude/Amplitude-TypeScript/commit/f34f64b68bbd328da354afae61ca416d7055a734)) -- simplify browser SDK options and plugin options interface - ([#384](https://github.com/amplitude/Amplitude-TypeScript/issues/384)) - ([b464cfb](https://github.com/amplitude/Amplitude-TypeScript/commit/b464cfb8e09d722bf06ed3c11955f77465a23daf)) -- simplify user identity storage options/configuration - ([#390](https://github.com/amplitude/Amplitude-TypeScript/issues/390)) - ([f8cf0cc](https://github.com/amplitude/Amplitude-TypeScript/commit/f8cf0cca8c2a17738f13878642fa5b37c0070f77)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.7.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.7...@amplitude/plugin-web-attribution-browser@0.7.0) (2023-05-04) - -### Features - -- add attribution tracking for linkedin click id li_fat_id - ([ca81f3d](https://github.com/amplitude/Amplitude-TypeScript/commit/ca81f3d75ece7e0e23a1bc1b6889107d53a60a86)) -- add rtd_cid for Reddit campaign tracking/attribution - ([784e080](https://github.com/amplitude/Amplitude-TypeScript/commit/784e080aa129c37e850d7f34115beb9770044e4e)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.6...@amplitude/plugin-web-attribution-browser@0.6.7) (2023-04-27) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.5...@amplitude/plugin-web-attribution-browser@0.6.6) (2023-04-27) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.4...@amplitude/plugin-web-attribution-browser@0.6.5) (2023-04-25) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.3...@amplitude/plugin-web-attribution-browser@0.6.4) (2023-04-06) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.2...@amplitude/plugin-web-attribution-browser@0.6.3) (2023-03-31) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.2-beta.0...@amplitude/plugin-web-attribution-browser@0.6.2) (2023-03-31) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.2-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.1...@amplitude/plugin-web-attribution-browser@0.6.2-beta.0) (2023-03-31) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.1-beta.1...@amplitude/plugin-web-attribution-browser@0.6.1) (2023-03-03) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.1-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.1-beta.0...@amplitude/plugin-web-attribution-browser@0.6.1-beta.1) (2023-03-03) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.1-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.0...@amplitude/plugin-web-attribution-browser@0.6.1-beta.0) (2023-03-03) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.6.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.0-beta.4...@amplitude/plugin-web-attribution-browser@0.6.0) (2023-02-27) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.6.0-beta.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.0-beta.3...@amplitude/plugin-web-attribution-browser@0.6.0-beta.4) (2023-02-27) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.6.0-beta.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.0-beta.2...@amplitude/plugin-web-attribution-browser@0.6.0-beta.3) (2023-02-26) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.6.0-beta.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.0-beta.1...@amplitude/plugin-web-attribution-browser@0.6.0-beta.2) (2023-02-25) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.6.0-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.6.0-beta.0...@amplitude/plugin-web-attribution-browser@0.6.0-beta.1) (2023-02-24) - -### Bug Fixes - -- improper cookie usage ([#330](https://github.com/amplitude/Amplitude-TypeScript/issues/330)) - ([e670091](https://github.com/amplitude/Amplitude-TypeScript/commit/e670091e59014bb35bd9b3ec2a7192f259393575)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.6.0-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.7...@amplitude/plugin-web-attribution-browser@0.6.0-beta.0) (2023-02-24) - -### Bug Fixes - -- remove client parameter requirement for page view tracking plugin - ([#329](https://github.com/amplitude/Amplitude-TypeScript/issues/329)) - ([1e01575](https://github.com/amplitude/Amplitude-TypeScript/commit/1e015750b52880ca63afa5162cb482995f04d1c6)) - -### Features - -- pass amplitude instance to plugin.setup for enhanced plugin capabilities - ([#328](https://github.com/amplitude/Amplitude-TypeScript/issues/328)) - ([91eeaa0](https://github.com/amplitude/Amplitude-TypeScript/commit/91eeaa0d6bff6bde39538bb54548a938df784462)) -- retrofit web attribution and page view plugins to browser SDK - ([#331](https://github.com/amplitude/Amplitude-TypeScript/issues/331)) - ([ba845d3](https://github.com/amplitude/Amplitude-TypeScript/commit/ba845d3329bd6bebe3b89f24f4f316088c2d62b9)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.6...@amplitude/plugin-web-attribution-browser@0.5.7) (2023-02-09) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.5...@amplitude/plugin-web-attribution-browser@0.5.6) (2023-02-02) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.5-beta.0...@amplitude/plugin-web-attribution-browser@0.5.5) (2023-01-31) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.5-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.4...@amplitude/plugin-web-attribution-browser@0.5.5-beta.0) (2023-01-26) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.3...@amplitude/plugin-web-attribution-browser@0.5.4) (2023-01-11) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.2...@amplitude/plugin-web-attribution-browser@0.5.3) (2022-12-21) - -### Bug Fixes - -- upgrade dependencies to resolve dependabot vulnerability alerts - ([#299](https://github.com/amplitude/Amplitude-TypeScript/issues/299)) - ([7dd1cd1](https://github.com/amplitude/Amplitude-TypeScript/commit/7dd1cd1b23a71981a4ad90b4b30cc9b7d28c4412)) - -### Reverts - -- Revert "Updated dependencies" - ([7ca9964](https://github.com/amplitude/Amplitude-TypeScript/commit/7ca9964781e4b900c6c027bdddf2ae1e7428ba18)) - -## [0.5.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.1...@amplitude/plugin-web-attribution-browser@0.5.2) (2022-12-06) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.5.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.5.0...@amplitude/plugin-web-attribution-browser@0.5.1) (2022-12-05) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# [0.5.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.4.2...@amplitude/plugin-web-attribution-browser@0.5.0) (2022-11-28) - -### Features - -- add utm_id tracking ([#284](https://github.com/amplitude/Amplitude-TypeScript/issues/284)) - ([f72dcf1](https://github.com/amplitude/Amplitude-TypeScript/commit/f72dcf1788ebc84544aaee1dc41b1d1ba6e4c06e)) - -## [0.4.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.4.1...@amplitude/plugin-web-attribution-browser@0.4.2) (2022-11-22) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.4.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.4.0...@amplitude/plugin-web-attribution-browser@0.4.1) (2022-11-15) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# [0.4.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.3.0...@amplitude/plugin-web-attribution-browser@0.4.0) (2022-11-01) - -### Features - -- ignore subdomains when comparing newness of campaigns - ([#260](https://github.com/amplitude/Amplitude-TypeScript/issues/260)) - ([8bb2b76](https://github.com/amplitude/Amplitude-TypeScript/commit/8bb2b76faf37783a58e953391468bd31c089e3a3)) - -# [0.3.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.2.5...@amplitude/plugin-web-attribution-browser@0.3.0) (2022-11-01) - -### Features - -- enhance logger with debug information ([#254](https://github.com/amplitude/Amplitude-TypeScript/issues/254)) - ([5c6175e](https://github.com/amplitude/Amplitude-TypeScript/commit/5c6175e9372cbeea264ddb34c6cc68148063d4f7)) - -## [0.2.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.2.4...@amplitude/plugin-web-attribution-browser@0.2.5) (2022-10-30) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.2.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.2.3...@amplitude/plugin-web-attribution-browser@0.2.4) (2022-10-26) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.2.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.2.3-beta.1...@amplitude/plugin-web-attribution-browser@0.2.3) (2022-10-25) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.2.3-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.2.3-beta.0...@amplitude/plugin-web-attribution-browser@0.2.3-beta.1) (2022-10-25) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.2.3-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.2.2...@amplitude/plugin-web-attribution-browser@0.2.3-beta.0) (2022-10-25) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.2.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.2.1...@amplitude/plugin-web-attribution-browser@0.2.2) (2022-10-25) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.2.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.2.0...@amplitude/plugin-web-attribution-browser@0.2.1) (2022-10-14) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# [0.2.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.6...@amplitude/plugin-web-attribution-browser@0.2.0) (2022-10-04) - -### Features - -- add gbraid and wbraid as campaign parameters ([#242](https://github.com/amplitude/Amplitude-TypeScript/issues/242)) - ([514b7cd](https://github.com/amplitude/Amplitude-TypeScript/commit/514b7cdea9fee0c4e61479b087f7acdfea889350)) - -## [0.1.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.5...@amplitude/plugin-web-attribution-browser@0.1.6) (2022-09-30) - -### Bug Fixes - -- resolve web attribution is not tracking the first direct/organic traffic - ([#239](https://github.com/amplitude/Amplitude-TypeScript/issues/239)) - ([98a3363](https://github.com/amplitude/Amplitude-TypeScript/commit/98a33633a7a6de7ee147c8cbf690e5546ce53163)) - -## [0.1.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.4...@amplitude/plugin-web-attribution-browser@0.1.5) (2022-09-30) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.1.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.4-beta.2...@amplitude/plugin-web-attribution-browser@0.1.4) (2022-09-28) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.1.4-beta.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.4-beta.1...@amplitude/plugin-web-attribution-browser@0.1.4-beta.2) (2022-09-27) - -### Bug Fixes - -- js script export name for marketing analytics plugins - ([aa7b05c](https://github.com/amplitude/Amplitude-TypeScript/commit/aa7b05cb192e23924081a363f3567573f76a3b62)) - -## [0.1.4-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.4-beta.0...@amplitude/plugin-web-attribution-browser@0.1.4-beta.1) (2022-09-27) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.1.4-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.3...@amplitude/plugin-web-attribution-browser@0.1.4-beta.0) (2022-09-26) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.1.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.2...@amplitude/plugin-web-attribution-browser@0.1.3) (2022-09-26) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -## [0.1.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.1...@amplitude/plugin-web-attribution-browser@0.1.2) (2022-09-26) - -### Bug Fixes - -- update base config to include additional click ids - ([#229](https://github.com/amplitude/Amplitude-TypeScript/issues/229)) - ([5596931](https://github.com/amplitude/Amplitude-TypeScript/commit/55969310714c43f138e1702ba285fd4dadcdcb44)) - -## [0.1.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/plugin-web-attribution-browser@0.1.0...@amplitude/plugin-web-attribution-browser@0.1.1) (2022-09-22) - -**Note:** Version bump only for package @amplitude/plugin-web-attribution-browser - -# 0.1.0 (2022-09-16) - -### Features - -- new marketing analytics plugin ([#213](https://github.com/amplitude/Amplitude-TypeScript/issues/213)) - ([02ff174](https://github.com/amplitude/Amplitude-TypeScript/commit/02ff174e3361173dbf15ed3acf72e950810e174f)) diff --git a/packages/plugin-web-attribution-browser/README.md b/packages/plugin-web-attribution-browser/README.md deleted file mode 100644 index 3dd4f9d37..000000000 --- a/packages/plugin-web-attribution-browser/README.md +++ /dev/null @@ -1,96 +0,0 @@ -

- - - -
-

- -# @amplitude/plugin-web-attribution-browser - -Official Browser SDK plugin for web attribution tracking - -## Installation - -This package is published on NPM registry and is available to be installed using npm and yarn. - -```sh -# npm -npm install @amplitude/plugin-web-attribution-browser - -# yarn -yarn add @amplitude/plugin-web-attribution-browser -``` - -## Usage - -This plugin works on top of Amplitude Browser SDK and adds web attribution tracking features to built-in features. To use this plugin, you need to install `@amplitude/analytics-browser` version `v2.0.0` or later. - -### 1. Import Amplitude packages - -* `@amplitude/plugin-web-attribution-browser` - -```typescript -import { webAttributionPlugin } from '@amplitude/plugin-web-attribution-browser'; -``` - -### 2. Instantiate page view plugin - -The plugin accepts an optional parameter of type `Object` to configure the plugin based on your use case. - -```typescript -const webAttributionTracking = webAttributionPlugin(amplitude, { - excludeReferrers: undefined, - initialEmptyValue: undefined, - resetSessionOnNewCampaign: undefined, -}); -``` - -#### Options - -|Name|Type|Default|Description| -|-|-|-|-| -|`excludeReferrers`|`(string \| RegExp)[]`|`[]`|Use this option to prevent the plugin from tracking campaigns parameters from specific referrers. For example: `subdomain.domain.com`.| -|`initialEmptyValue`|`string`|`"EMPTY"`|Use this option to specify empty values for [first-touch attribution](https://www.docs.developers.amplitude.com/data/sdks/marketing-analytics-browser/#first-touch-attribution).| -|`resetSessionOnNewCampaign`|`boolean`|`false`|Use this option to control whether a new session should start on a new campaign.| - -### 3. Install plugin to Amplitude SDK - -```typescript -amplitude.add(webAttributionTracking); -``` - -### 4. Initialize Amplitude SDK - -```typescript -amplitude.init('API_KEY'); -``` - -## Resulting web attribution event - -This plugin tracks campaign parameters based on your configuration. A web attribution event is composed of the following values: - -#### Event type -* `"$idenfity"` - -#### User properties - -|Property|Description| -|-|-| -|`utm_source`|URL query parameter value for `utm_source`| -|`utm_medium`|URL query parameter value for `utm_medium`| -|`utm_campaign`|URL query parameter value for `utm_campaign`| -|`utm_term`|URL query parameter value for `utm_term`| -|`utm_content`|URL query parameter value for `utm_content`| -|`referrer`|Referring webstite or `document.referrer`| -|`referring_domain`|Referring website's domain, including subdomain| -|`dclid`|URL query parameter value for `dclid`| -|`gbraid`|URL query parameter value for `gbraid`| -|`gclid`|URL query parameter value for `gclid`| -|`fbclid`|URL query parameter value for `fbclid`| -|`ko_click_id`|URL query parameter value for `ko_click_id`| -|`li_fat_id`|URL query parameter value for `li_fat_id`| -|`msclkid`|URL query parameter value for `msclkid`| -|`rtd_cid`|URL query parameter value for `rtd_cid`| -|`ttclid`|URL query parameter value for `ttclid`| -|`twclid`|URL query parameter value for `twclid`| -|`wbraid`|URL query parameter value for `wbraid`| diff --git a/packages/plugin-web-attribution-browser/jest.config.js b/packages/plugin-web-attribution-browser/jest.config.js deleted file mode 100644 index dc4094b18..000000000 --- a/packages/plugin-web-attribution-browser/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('../../jest.config.js'); -const package = require('./package'); - -module.exports = { - ...baseConfig, - displayName: package.name, - rootDir: '.', - testEnvironment: 'jsdom', - coveragePathIgnorePatterns: ['index.ts'], -}; diff --git a/packages/plugin-web-attribution-browser/package.json b/packages/plugin-web-attribution-browser/package.json deleted file mode 100644 index 2ccbd1cb0..000000000 --- a/packages/plugin-web-attribution-browser/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@amplitude/plugin-web-attribution-browser", - "version": "2.1.53", - "description": "", - "author": "Amplitude Inc", - "homepage": "https://github.com/amplitude/Amplitude-TypeScript", - "license": "MIT", - "main": "lib/cjs/index.js", - "module": "lib/esm/index.js", - "types": "lib/esm/index.d.ts", - "sideEffects": false, - "publishConfig": { - "access": "public", - "tag": "latest" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/amplitude/Amplitude-TypeScript.git" - }, - "scripts": { - "build": "yarn bundle && yarn build:es5 && yarn build:esm", - "bundle": "rollup --config rollup.config.js", - "build:es5": "tsc -p ./tsconfig.es5.json", - "build:esm": "tsc -p ./tsconfig.esm.json", - "watch": "tsc -p ./tsconfig.esm.json --watch", - "clean": "rimraf node_modules lib coverage", - "fix": "yarn fix:eslint & yarn fix:prettier", - "fix:eslint": "eslint '{src,test}/**/*.ts' --fix", - "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"", - "lint": "yarn lint:eslint & yarn lint:prettier", - "lint:eslint": "eslint '{src,test}/**/*.ts'", - "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"", - "test": "jest", - "typecheck": "tsc -p ./tsconfig.json" - }, - "bugs": { - "url": "https://github.com/amplitude/Amplitude-TypeScript/issues" - }, - "dependencies": { - "@amplitude/analytics-client-common": "^2.3.23", - "@amplitude/analytics-core": "^2.12.2", - "@amplitude/analytics-types": "^2.9.2", - "tslib": "^2.4.1" - }, - "devDependencies": { - "@amplitude/analytics-browser": "^2.17.8", - "@rollup/plugin-commonjs": "^23.0.4", - "@rollup/plugin-node-resolve": "^15.0.1", - "@rollup/plugin-typescript": "^10.0.1", - "rollup": "^2.79.1", - "rollup-plugin-execute": "^1.1.1", - "rollup-plugin-gzip": "^3.1.0", - "rollup-plugin-terser": "^7.0.2" - }, - "files": [ - "lib" - ] -} diff --git a/packages/plugin-web-attribution-browser/rollup.config.js b/packages/plugin-web-attribution-browser/rollup.config.js deleted file mode 100644 index 2718b91d7..000000000 --- a/packages/plugin-web-attribution-browser/rollup.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import { umd } from '../../scripts/build/rollup.config'; - -export default [umd]; diff --git a/packages/plugin-web-attribution-browser/src/index.ts b/packages/plugin-web-attribution-browser/src/index.ts deleted file mode 100644 index dccc937c6..000000000 --- a/packages/plugin-web-attribution-browser/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { webAttributionPlugin } from './web-attribution'; -export { webAttributionPlugin as plugin } from './web-attribution'; diff --git a/packages/plugin-web-attribution-browser/src/typings/web-attribution.ts b/packages/plugin-web-attribution-browser/src/typings/web-attribution.ts deleted file mode 100644 index c1771a46d..000000000 --- a/packages/plugin-web-attribution-browser/src/typings/web-attribution.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BeforePlugin } from '@amplitude/analytics-types'; - -export interface Options { - excludeReferrers?: (string | RegExp)[]; - initialEmptyValue?: string; - resetSessionOnNewCampaign?: boolean; -} - -export interface CreateWebAttributionPlugin { - (options?: Options): BeforePlugin; -} diff --git a/packages/plugin-web-attribution-browser/src/web-attribution.ts b/packages/plugin-web-attribution-browser/src/web-attribution.ts deleted file mode 100644 index e4124cf6b..000000000 --- a/packages/plugin-web-attribution-browser/src/web-attribution.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { WebAttribution } from '@amplitude/analytics-client-common'; -import { BeforePlugin, BrowserClient, BrowserConfig, Event } from '@amplitude/analytics-types'; -import { isNewCampaign } from '@amplitude/analytics-client-common'; -import { CreateWebAttributionPlugin, Options } from './typings/web-attribution'; -import { isNewSession } from '@amplitude/analytics-client-common'; - -/** - * @deprecated - * This plugin is not used by @amplitude/analytics-browser and - * is replaced by WebAttribution in @amplitude/analytics-client-common to - * be able to send identify events before session start. - */ -export const webAttributionPlugin: CreateWebAttributionPlugin = function (options: Options = {}) { - const plugin: BeforePlugin = { - name: '@amplitude/plugin-web-attribution-browser', - type: 'before', - - setup: async function (config: BrowserConfig, amplitude: BrowserClient) { - const webAttribution = new WebAttribution(options, config); - await webAttribution.init(); - - const pluginConfig = webAttribution.options; - const currentCampaign = webAttribution.currentCampaign; - const previousCampaign = webAttribution.previousCampaign; - - const isEventInNewSession = isNewSession(config.sessionTimeout, config.lastEventTime); - - if (isNewCampaign(currentCampaign, previousCampaign, pluginConfig, config.loggerProvider, isEventInNewSession)) { - if (pluginConfig.resetSessionOnNewCampaign) { - amplitude.setSessionId(Date.now()); - config.loggerProvider.log('Created a new session for new campaign.'); - } - config.loggerProvider.log('Tracking attribution.'); - const campaignEvent = webAttribution.generateCampaignEvent(); - amplitude.track(campaignEvent); - } - }, - - execute: async (event: Event) => event, - }; - - return plugin; -}; diff --git a/packages/plugin-web-attribution-browser/test/web-attribution.test.ts b/packages/plugin-web-attribution-browser/test/web-attribution.test.ts deleted file mode 100644 index 77af1d4e6..000000000 --- a/packages/plugin-web-attribution-browser/test/web-attribution.test.ts +++ /dev/null @@ -1,269 +0,0 @@ -import { createInstance } from '@amplitude/analytics-browser'; -import { BASE_CAMPAIGN, CampaignParser, CookieStorage, FetchTransport } from '@amplitude/analytics-client-common'; -import { webAttributionPlugin } from '../src/web-attribution'; -import * as helpers from '@amplitude/analytics-client-common'; -import { BrowserConfig, LogLevel } from '@amplitude/analytics-types'; -import { Logger, UUID } from '@amplitude/analytics-core'; - -describe('webAttributionPlugin', () => { - const mockConfig: BrowserConfig = { - apiKey: UUID(), - flushIntervalMillis: 0, - flushMaxRetries: 0, - flushQueueSize: 0, - logLevel: LogLevel.None, - loggerProvider: new Logger(), - offline: false, - optOut: false, - serverUrl: undefined, - transportProvider: new FetchTransport(), - useBatch: false, - - cookieOptions: { - domain: '.amplitude.com', - expiration: 365, - sameSite: 'Lax', - secure: false, - upgrade: true, - }, - cookieStorage: new CookieStorage(), - sessionTimeout: 30 * 60 * 1000, - trackingOptions: { - ipAddress: true, - language: true, - platform: true, - }, - }; - - describe('setup', () => { - describe('should send an identify event', () => { - test('when a campaign changes', async () => { - const amplitude = createInstance(); - const setSessionId = jest.spyOn(amplitude, 'setSessionId'); - const track = jest.spyOn(amplitude, 'track').mockReturnValueOnce({ - promise: Promise.resolve({ - code: 200, - message: '', - event: { - event_type: '$identify', - }, - }), - }); - jest.spyOn(helpers, 'isNewCampaign').mockReturnValue(true); - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValueOnce({ - ...BASE_CAMPAIGN, - utm_source: 'amp-test', - }); - - const plugin = webAttributionPlugin(); - const overrideMockConfig = { - ...mockConfig, - cookieOptions: undefined, - }; - await plugin.setup?.(overrideMockConfig, amplitude); - expect(track).toHaveBeenCalledWith({ - event_type: '$identify', - user_properties: { - $set: { - utm_source: 'amp-test', - }, - $setOnce: { - initial_dclid: 'EMPTY', - initial_fbclid: 'EMPTY', - initial_gbraid: 'EMPTY', - initial_gclid: 'EMPTY', - initial_ko_click_id: 'EMPTY', - initial_li_fat_id: 'EMPTY', - initial_msclkid: 'EMPTY', - initial_wbraid: 'EMPTY', - initial_referrer: 'EMPTY', - initial_referring_domain: 'EMPTY', - initial_rtd_cid: 'EMPTY', - initial_ttclid: 'EMPTY', - initial_twclid: 'EMPTY', - initial_utm_campaign: 'EMPTY', - initial_utm_content: 'EMPTY', - initial_utm_id: 'EMPTY', - initial_utm_medium: 'EMPTY', - initial_utm_source: 'amp-test', - initial_utm_term: 'EMPTY', - }, - $unset: { - dclid: '-', - fbclid: '-', - gbraid: '-', - gclid: '-', - ko_click_id: '-', - li_fat_id: '-', - msclkid: '-', - wbraid: '-', - referrer: '-', - referring_domain: '-', - rtd_cid: '-', - ttclid: '-', - twclid: '-', - utm_campaign: '-', - utm_content: '-', - utm_id: '-', - utm_medium: '-', - utm_term: '-', - }, - }, - }); - expect(track).toHaveBeenCalledTimes(1); - expect(setSessionId).toHaveBeenCalledTimes(0); - }); - - test('when a campaign changes and reset session id', async () => { - const amplitude = createInstance(); - const setSessionId = jest.spyOn(amplitude, 'setSessionId'); - const track = jest.spyOn(amplitude, 'track').mockReturnValueOnce({ - promise: Promise.resolve({ - code: 200, - message: '', - event: { - event_type: '$identify', - }, - }), - }); - jest.spyOn(helpers, 'isNewCampaign').mockReturnValue(true); - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValueOnce({ - ...BASE_CAMPAIGN, - utm_source: 'amp-test', - }); - - const plugin = webAttributionPlugin({ - resetSessionOnNewCampaign: true, - }); - await plugin.setup?.(mockConfig, amplitude); - expect(track).toHaveBeenCalledWith({ - event_type: '$identify', - user_properties: { - $set: { - utm_source: 'amp-test', - }, - $setOnce: { - initial_dclid: 'EMPTY', - initial_fbclid: 'EMPTY', - initial_gbraid: 'EMPTY', - initial_gclid: 'EMPTY', - initial_ko_click_id: 'EMPTY', - initial_li_fat_id: 'EMPTY', - initial_msclkid: 'EMPTY', - initial_wbraid: 'EMPTY', - initial_referrer: 'EMPTY', - initial_referring_domain: 'EMPTY', - initial_rtd_cid: 'EMPTY', - initial_ttclid: 'EMPTY', - initial_twclid: 'EMPTY', - initial_utm_campaign: 'EMPTY', - initial_utm_content: 'EMPTY', - initial_utm_id: 'EMPTY', - initial_utm_medium: 'EMPTY', - initial_utm_source: 'amp-test', - initial_utm_term: 'EMPTY', - }, - $unset: { - dclid: '-', - fbclid: '-', - gbraid: '-', - gclid: '-', - ko_click_id: '-', - li_fat_id: '-', - msclkid: '-', - wbraid: '-', - referrer: '-', - referring_domain: '-', - rtd_cid: '-', - ttclid: '-', - twclid: '-', - utm_campaign: '-', - utm_content: '-', - utm_id: '-', - utm_medium: '-', - utm_term: '-', - }, - }, - }); - expect(track).toHaveBeenCalledTimes(1); - expect(setSessionId).toHaveBeenCalledTimes(1); - }); - }); - - describe('should not send an identify event', () => { - test('when a campaign does not change', async () => { - const amplitude = createInstance(); - const track = jest.spyOn(amplitude, 'track').mockReturnValueOnce({ - promise: Promise.resolve({ - code: 200, - message: '', - event: { - event_type: '$identify', - }, - }), - }); - jest.spyOn(helpers, 'isNewCampaign').mockReturnValue(false); - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValueOnce({ - ...BASE_CAMPAIGN, - utm_source: 'amp-test', - }); - - const plugin = webAttributionPlugin({ - excludeReferrers: [], - }); - await plugin.setup?.(mockConfig, amplitude); - expect(track).toHaveBeenCalledTimes(0); - }); - }); - }); - - test('should not send attribution event on default excluded referrer', async () => { - const amplitude = createInstance(); - const track = jest.spyOn(amplitude, 'track').mockReturnValueOnce({ - promise: Promise.resolve({ - code: 200, - message: '', - event: { - event_type: '$identify', - }, - }), - }); - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValueOnce({ - ...BASE_CAMPAIGN, - referring_domain: 'amplitude.com', - }); - - const overrideMockConfig = { - ...mockConfig, - cookieOptions: { - ...mockConfig.cookieOptions, - domain: '.amplitude.com', - }, - }; - const plugin = webAttributionPlugin(); - await plugin.setup?.(overrideMockConfig, amplitude); - expect(track).toHaveBeenCalledTimes(0); - }); - - describe('execute', () => { - test('should return same event', async () => { - jest.spyOn(helpers, 'isNewCampaign').mockReturnValue(true); - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValueOnce({ - ...BASE_CAMPAIGN, - utm_source: 'amp-test', - }); - const plugin = webAttributionPlugin({}); - const event = { - event_properties: { - page_location: '', - page_path: '', - page_title: '', - }, - event_type: '[Amplitude] Page Viewed', - }; - const result = await plugin.execute?.(event); - - expect(result).toBe(event); - }); - }); -}); diff --git a/packages/plugin-web-attribution-browser/tsconfig.es5.json b/packages/plugin-web-attribution-browser/tsconfig.es5.json deleted file mode 100644 index 77e041d3f..000000000 --- a/packages/plugin-web-attribution-browser/tsconfig.es5.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "module": "commonjs", - "noEmit": false, - "outDir": "lib/cjs", - "rootDir": "./src" - } -} diff --git a/packages/plugin-web-attribution-browser/tsconfig.esm.json b/packages/plugin-web-attribution-browser/tsconfig.esm.json deleted file mode 100644 index bec981eee..000000000 --- a/packages/plugin-web-attribution-browser/tsconfig.esm.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "module": "es6", - "noEmit": false, - "outDir": "lib/esm", - "rootDir": "./src" - } -} diff --git a/packages/plugin-web-attribution-browser/tsconfig.json b/packages/plugin-web-attribution-browser/tsconfig.json deleted file mode 100644 index 955dcce78..000000000 --- a/packages/plugin-web-attribution-browser/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*", "test/**/*"], - "compilerOptions": { - "baseUrl": ".", - "esModuleInterop": true, - "lib": ["dom"], - "noEmit": true, - "rootDir": ".", - } -} From 40ec375257b497da405fe421b04b78d691653c61 Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 15:39:07 -0700 Subject: [PATCH 5/9] test(analytics-browser-test): use core --- packages/analytics-browser-test/test/helpers.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/analytics-browser-test/test/helpers.ts b/packages/analytics-browser-test/test/helpers.ts index 6c807ddaf..0b5d50f1d 100644 --- a/packages/analytics-browser-test/test/helpers.ts +++ b/packages/analytics-browser-test/test/helpers.ts @@ -1,8 +1,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -import { BaseEvent, Campaign } from '@amplitude/analytics-types'; -import { BASE_CAMPAIGN } from '@amplitude/analytics-client-common'; +import { BaseEvent, Campaign, BASE_CAMPAIGN } from '@amplitude/analytics-core'; import { uuidPattern } from './constants'; const uuid: string = expect.stringMatching(uuidPattern) as string; From 02a7039f9b6b30bee308a3e3a0abcbd936004a6e Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 15:42:17 -0700 Subject: [PATCH 6/9] chore: delete client common and node packages --- packages/analytics-client-common/CHANGELOG.md | 880 ------------------ .../analytics-client-common/jest.config.js | 10 - packages/analytics-client-common/package.json | 47 - .../src/analytics-connector.ts | 15 - .../src/attribution/campaign-parser.ts | 90 -- .../src/attribution/campaign-tracker.ts | 129 --- .../src/attribution/constants.ts | 46 - .../src/attribution/helpers.ts | 96 -- .../src/attribution/web-attribution.ts | 68 -- .../src/cookie-name.ts | 9 - .../src/default-tracking.ts | 128 --- .../src/global-scope.ts | 24 - packages/analytics-client-common/src/index.ts | 32 - .../analytics-client-common/src/language.ts | 7 - .../src/plugins/identity.ts | 23 - .../src/query-params.ts | 29 - .../analytics-client-common/src/session.ts | 6 - .../src/storage/cookie.ts | 121 --- .../src/storage/helpers.ts | 5 - .../src/transports/fetch.ts | 27 - .../src/types/global.ts | 3 - .../test/analytics-connector.test.ts | 73 -- .../test/attribution/campaign-parser.test.ts | 112 --- .../test/attribution/campaign-tracker.test.ts | 383 -------- .../test/attribution/helpers.test.ts | 328 ------- .../test/attribution/web-attribution.test.ts | 145 --- .../test/cookie-name.test.ts | 24 - .../test/default-tracking.test.ts | 336 ------- .../test/global-scope.test.ts | 45 - .../test/helpers/constants.ts | 1 - .../test/language.test.ts | 69 -- .../test/plugins/identity.test.ts | 56 -- .../test/query-params.test.ts | 46 - .../test/session.test.ts | 25 - .../test/storage/cookies.test.ts | 142 --- .../test/transports/fetch.test.ts | 33 - .../analytics-client-common/tsconfig.es5.json | 10 - .../analytics-client-common/tsconfig.esm.json | 10 - .../analytics-client-common/tsconfig.json | 11 - packages/analytics-node/CHANGELOG.md | 299 ------ packages/analytics-node/README.md | 164 ---- packages/analytics-node/jest.config.js | 9 - packages/analytics-node/package.json | 48 - packages/analytics-node/src/config.ts | 17 - packages/analytics-node/src/index.ts | 8 - packages/analytics-node/src/node-client.ts | 115 --- .../analytics-node/src/plugins/context.ts | 42 - .../analytics-node/src/transports/http.ts | 55 -- packages/analytics-node/src/version.ts | 1 - packages/analytics-node/test/config.test.ts | 64 -- .../analytics-node/test/helpers/default.ts | 25 - packages/analytics-node/test/index.test.ts | 35 - .../analytics-node/test/node-client.test.ts | 119 --- .../test/plugins/context.test.ts | 116 --- .../test/transport/http.test.ts | 160 ---- packages/analytics-node/tsconfig.es5.json | 10 - packages/analytics-node/tsconfig.esm.json | 10 - packages/analytics-node/tsconfig.json | 9 - 58 files changed, 4950 deletions(-) delete mode 100644 packages/analytics-client-common/CHANGELOG.md delete mode 100644 packages/analytics-client-common/jest.config.js delete mode 100644 packages/analytics-client-common/package.json delete mode 100644 packages/analytics-client-common/src/analytics-connector.ts delete mode 100644 packages/analytics-client-common/src/attribution/campaign-parser.ts delete mode 100644 packages/analytics-client-common/src/attribution/campaign-tracker.ts delete mode 100644 packages/analytics-client-common/src/attribution/constants.ts delete mode 100644 packages/analytics-client-common/src/attribution/helpers.ts delete mode 100644 packages/analytics-client-common/src/attribution/web-attribution.ts delete mode 100644 packages/analytics-client-common/src/cookie-name.ts delete mode 100644 packages/analytics-client-common/src/default-tracking.ts delete mode 100644 packages/analytics-client-common/src/global-scope.ts delete mode 100644 packages/analytics-client-common/src/index.ts delete mode 100644 packages/analytics-client-common/src/language.ts delete mode 100644 packages/analytics-client-common/src/plugins/identity.ts delete mode 100644 packages/analytics-client-common/src/query-params.ts delete mode 100644 packages/analytics-client-common/src/session.ts delete mode 100644 packages/analytics-client-common/src/storage/cookie.ts delete mode 100644 packages/analytics-client-common/src/storage/helpers.ts delete mode 100644 packages/analytics-client-common/src/transports/fetch.ts delete mode 100644 packages/analytics-client-common/src/types/global.ts delete mode 100644 packages/analytics-client-common/test/analytics-connector.test.ts delete mode 100644 packages/analytics-client-common/test/attribution/campaign-parser.test.ts delete mode 100644 packages/analytics-client-common/test/attribution/campaign-tracker.test.ts delete mode 100644 packages/analytics-client-common/test/attribution/helpers.test.ts delete mode 100644 packages/analytics-client-common/test/attribution/web-attribution.test.ts delete mode 100644 packages/analytics-client-common/test/cookie-name.test.ts delete mode 100644 packages/analytics-client-common/test/default-tracking.test.ts delete mode 100644 packages/analytics-client-common/test/global-scope.test.ts delete mode 100644 packages/analytics-client-common/test/helpers/constants.ts delete mode 100644 packages/analytics-client-common/test/language.test.ts delete mode 100644 packages/analytics-client-common/test/plugins/identity.test.ts delete mode 100644 packages/analytics-client-common/test/query-params.test.ts delete mode 100644 packages/analytics-client-common/test/session.test.ts delete mode 100644 packages/analytics-client-common/test/storage/cookies.test.ts delete mode 100644 packages/analytics-client-common/test/transports/fetch.test.ts delete mode 100644 packages/analytics-client-common/tsconfig.es5.json delete mode 100644 packages/analytics-client-common/tsconfig.esm.json delete mode 100644 packages/analytics-client-common/tsconfig.json delete mode 100644 packages/analytics-node/CHANGELOG.md delete mode 100644 packages/analytics-node/README.md delete mode 100644 packages/analytics-node/jest.config.js delete mode 100644 packages/analytics-node/package.json delete mode 100644 packages/analytics-node/src/config.ts delete mode 100644 packages/analytics-node/src/index.ts delete mode 100644 packages/analytics-node/src/node-client.ts delete mode 100644 packages/analytics-node/src/plugins/context.ts delete mode 100644 packages/analytics-node/src/transports/http.ts delete mode 100644 packages/analytics-node/src/version.ts delete mode 100644 packages/analytics-node/test/config.test.ts delete mode 100644 packages/analytics-node/test/helpers/default.ts delete mode 100644 packages/analytics-node/test/index.test.ts delete mode 100644 packages/analytics-node/test/node-client.test.ts delete mode 100644 packages/analytics-node/test/plugins/context.test.ts delete mode 100644 packages/analytics-node/test/transport/http.test.ts delete mode 100644 packages/analytics-node/tsconfig.es5.json delete mode 100644 packages/analytics-node/tsconfig.esm.json delete mode 100644 packages/analytics-node/tsconfig.json diff --git a/packages/analytics-client-common/CHANGELOG.md b/packages/analytics-client-common/CHANGELOG.md deleted file mode 100644 index 91540bbfc..000000000 --- a/packages/analytics-client-common/CHANGELOG.md +++ /dev/null @@ -1,880 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.3.23](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.22...@amplitude/analytics-client-common@2.3.23) (2025-06-03) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.22](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.21...@amplitude/analytics-client-common@2.3.22) (2025-05-27) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.21](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.20...@amplitude/analytics-client-common@2.3.21) (2025-05-13) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.20](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.19...@amplitude/analytics-client-common@2.3.20) (2025-05-05) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.19](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.18...@amplitude/analytics-client-common@2.3.19) (2025-05-02) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.18](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.17...@amplitude/analytics-client-common@2.3.18) (2025-05-02) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.17](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.16...@amplitude/analytics-client-common@2.3.17) (2025-04-22) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.16](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.15...@amplitude/analytics-client-common@2.3.16) (2025-04-17) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.15](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.14...@amplitude/analytics-client-common@2.3.15) (2025-04-15) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.14](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.13...@amplitude/analytics-client-common@2.3.14) (2025-04-10) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.13](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.12...@amplitude/analytics-client-common@2.3.13) (2025-04-07) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.12](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.11...@amplitude/analytics-client-common@2.3.12) (2025-04-02) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.11](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.10...@amplitude/analytics-client-common@2.3.11) (2025-03-24) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.10](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.9...@amplitude/analytics-client-common@2.3.10) (2025-03-21) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.9](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.8...@amplitude/analytics-client-common@2.3.9) (2025-03-14) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.7...@amplitude/analytics-client-common@2.3.8) (2025-02-28) - - -### Reverts - -* Revert "chore(release): publish" ([d392f62](https://github.com/amplitude/Amplitude-TypeScript/commit/d392f6290b8bb4dd955d6e6f20b00191679489c4)) - - - - - -## [2.3.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.6...@amplitude/analytics-client-common@2.3.7) (2024-12-31) - - -### Bug Fixes - -* add comments in isNewCampaign() ([#941](https://github.com/amplitude/Amplitude-TypeScript/issues/941)) ([a14a68c](https://github.com/amplitude/Amplitude-TypeScript/commit/a14a68c65cea7a4bf8a842761ff7a81830e5d3ba)) - - - - - -## [2.3.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.5...@amplitude/analytics-client-common@2.3.6) (2024-12-17) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.4...@amplitude/analytics-client-common@2.3.5) (2024-11-05) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.3...@amplitude/analytics-client-common@2.3.4) (2024-10-21) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.2...@amplitude/analytics-client-common@2.3.3) (2024-09-17) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.1...@amplitude/analytics-client-common@2.3.2) (2024-09-10) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -## [2.3.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.3.0...@amplitude/analytics-client-common@2.3.1) (2024-08-13) - -**Note:** Version bump only for package @amplitude/analytics-client-common - - - - - -# [2.3.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.2.4...@amplitude/analytics-client-common@2.3.0) (2024-08-02) - - -### Features - -* remote config ([#832](https://github.com/amplitude/Amplitude-TypeScript/issues/832)) ([c415f79](https://github.com/amplitude/Amplitude-TypeScript/commit/c415f792a98253ac60885eb1dc7e53b78ca47dcb)), closes [#769](https://github.com/amplitude/Amplitude-TypeScript/issues/769) [#772](https://github.com/amplitude/Amplitude-TypeScript/issues/772) [#780](https://github.com/amplitude/Amplitude-TypeScript/issues/780) [#782](https://github.com/amplitude/Amplitude-TypeScript/issues/782) [#811](https://github.com/amplitude/Amplitude-TypeScript/issues/811) [#828](https://github.com/amplitude/Amplitude-TypeScript/issues/828) - - - - - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.2.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.2.3...@amplitude/analytics-client-common@2.2.4) (2024-06-24) - -### Bug Fixes - -- **analytics-browser:** handle double URL encoded cookie values - ([#790](https://github.com/amplitude/Amplitude-TypeScript/issues/790)) - ([577c1a9](https://github.com/amplitude/Amplitude-TypeScript/commit/577c1a940cfe2d3b64590b09bf2cdb03cb961c3f)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.2.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.2.2...@amplitude/analytics-client-common@2.2.3) (2024-06-24) - -### Bug Fixes - -- adding ampIntegrationsContext to getGlobalScope - ([bd6f08c](https://github.com/amplitude/Amplitude-TypeScript/commit/bd6f08c10c9814e4f098c37810332c6881b4f424)) -- checking for undefined and added tests - ([4176f5f](https://github.com/amplitude/Amplitude-TypeScript/commit/4176f5f0571dbd535761f92c997fb825253807a5)) -- fix reference error - ([1af86fa](https://github.com/amplitude/Amplitude-TypeScript/commit/1af86fa8900d8755848d0dece9658cb1f136ed48)) -- fixed minifing the global variable name - ([09b733b](https://github.com/amplitude/Amplitude-TypeScript/commit/09b733bcb0dfcb4da2969c5332fdb9b24b060633)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.2.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.2.1...@amplitude/analytics-client-common@2.2.2) (2024-06-17) - -### Bug Fixes - -- add cookie storage logs ([#778](https://github.com/amplitude/Amplitude-TypeScript/issues/778)) - ([743b9c0](https://github.com/amplitude/Amplitude-TypeScript/commit/743b9c053ec4db4fc754da812534c329de4d1fff)) -- response with non-json format ([#758](https://github.com/amplitude/Amplitude-TypeScript/issues/758)) - ([3d234ca](https://github.com/amplitude/Amplitude-TypeScript/commit/3d234ca5a71bacf9ab7f82a115cb2010e94a3a33)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.2.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.2.0...@amplitude/analytics-client-common@2.2.1) (2024-05-24) - -### Bug Fixes - -- success response with no body ([#755](https://github.com/amplitude/Amplitude-TypeScript/issues/755)) - ([5d1eb72](https://github.com/amplitude/Amplitude-TypeScript/commit/5d1eb72bf9114acd884e709660eeedb0511ef4af)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.2.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.6...@amplitude/analytics-client-common@2.2.0) (2024-05-21) - -### Features - -- support sessionId from url for cross domain tracking - ([#753](https://github.com/amplitude/Amplitude-TypeScript/issues/753)) - ([691d725](https://github.com/amplitude/Amplitude-TypeScript/commit/691d725131b5dfba497084fcf101a4e6e22bbd59)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.5...@amplitude/analytics-client-common@2.1.6) (2024-05-15) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.4...@amplitude/analytics-client-common@2.1.5) (2024-05-03) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.4-beta.0...@amplitude/analytics-client-common@2.1.4) (2024-04-29) - -### Bug Fixes - -- add logic to escape campaign tracking for direct traffic in session - ([#726](https://github.com/amplitude/Amplitude-TypeScript/issues/726)) - ([c0c9a9d](https://github.com/amplitude/Amplitude-TypeScript/commit/c0c9a9d3fcd2a9d6dfe9e12d4a187cf2dba6424c)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.4-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.3...@amplitude/analytics-client-common@2.1.4-beta.0) (2024-04-19) - -### Bug Fixes - -- fix web attribution identify and session start order - ([#696](https://github.com/amplitude/Amplitude-TypeScript/issues/696)) - ([2f077da](https://github.com/amplitude/Amplitude-TypeScript/commit/2f077da7b528ed6f23f7459b7c961c099dbcb1bb)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.3-beta.0...@amplitude/analytics-client-common@2.1.3) (2024-04-09) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.3-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.2...@amplitude/analytics-client-common@2.1.3-beta.0) (2024-03-28) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.1...@amplitude/analytics-client-common@2.1.2) (2024-03-23) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.1.0...@amplitude/analytics-client-common@2.1.1) (2024-03-12) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.1.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.11...@amplitude/analytics-client-common@2.1.0) (2024-02-23) - -### Features - -- landing page improvement ([#667](https://github.com/amplitude/Amplitude-TypeScript/issues/667)) - ([5f365f0](https://github.com/amplitude/Amplitude-TypeScript/commit/5f365f0b933ee890aee1d9ac083576f09b0defc3)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.11](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.10...@amplitude/analytics-client-common@2.0.11) (2024-01-24) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.10](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.9...@amplitude/analytics-client-common@2.0.10) (2023-12-20) - -### Reverts - -- update attribution plugin to apply utm params to the `session_start` event - ([#638](https://github.com/amplitude/Amplitude-TypeScript/issues/638)) - ([c820279](https://github.com/amplitude/Amplitude-TypeScript/commit/c820279cbef2123d890beb7861d7edbbc3926f6e)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.9](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.9-beta.0...@amplitude/analytics-client-common@2.0.9) (2023-12-01) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.9-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.8...@amplitude/analytics-client-common@2.0.9-beta.0) (2023-11-22) - -### Bug Fixes - -- update attribution plugin to apply utm params to the `session_start` event - ([#619](https://github.com/amplitude/Amplitude-TypeScript/issues/619)) - ([bf45ca6](https://github.com/amplitude/Amplitude-TypeScript/commit/bf45ca6c17ac8d656cb6c5bb4f4fa19ff344ac85)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.7...@amplitude/analytics-client-common@2.0.8) (2023-11-16) - -### Bug Fixes - -- npm latest tags ([#624](https://github.com/amplitude/Amplitude-TypeScript/issues/624)) - ([76bf7a4](https://github.com/amplitude/Amplitude-TypeScript/commit/76bf7a4c871375649fac45d549b711ac52c16b0d)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.6...@amplitude/analytics-client-common@2.0.7) (2023-10-18) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.5...@amplitude/analytics-client-common@2.0.6) (2023-09-18) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.4...@amplitude/analytics-client-common@2.0.5) (2023-08-24) - -### Bug Fixes - -- fix web attribution behavior for no referrer in the same session - ([#554](https://github.com/amplitude/Amplitude-TypeScript/issues/554)) - ([ed54eb2](https://github.com/amplitude/Amplitude-TypeScript/commit/ed54eb28810a3edb3326f82bdd7aed901ec9452f)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.3...@amplitude/analytics-client-common@2.0.4) (2023-07-03) - -### Bug Fixes - -- handle concurrent cookie testing ([#465](https://github.com/amplitude/Amplitude-TypeScript/issues/465)) - ([92bb7de](https://github.com/amplitude/Amplitude-TypeScript/commit/92bb7de48861438e987778390a66831191b15907)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.2...@amplitude/analytics-client-common@2.0.3) (2023-06-30) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.1...@amplitude/analytics-client-common@2.0.2) (2023-06-22) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.0.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0...@amplitude/analytics-client-common@2.0.1) (2023-06-21) - -### Bug Fixes - -- cookie-storage SSR incompatibility ([#445](https://github.com/amplitude/Amplitude-TypeScript/issues/445)) - ([0086808](https://github.com/amplitude/Amplitude-TypeScript/commit/008680806d3cd34c3d6a1fd2b8cdb77806e37bff)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0-beta.8...@amplitude/analytics-client-common@2.0.0) (2023-06-14) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0-beta.7...@amplitude/analytics-client-common@2.0.0-beta.8) (2023-06-14) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0-beta.6...@amplitude/analytics-client-common@2.0.0-beta.7) (2023-06-14) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0-beta.5...@amplitude/analytics-client-common@2.0.0-beta.6) (2023-06-13) - -### Features - -- add option for instance name ([#428](https://github.com/amplitude/Amplitude-TypeScript/issues/428)) - ([1a8ff7d](https://github.com/amplitude/Amplitude-TypeScript/commit/1a8ff7d665d2a936db7cb42f4cde5350379b7cae)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0-beta.4...@amplitude/analytics-client-common@2.0.0-beta.5) (2023-06-13) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0-beta.3...@amplitude/analytics-client-common@2.0.0-beta.4) (2023-06-08) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0-beta.2...@amplitude/analytics-client-common@2.0.0-beta.3) (2023-06-07) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@2.0.0-beta.1...@amplitude/analytics-client-common@2.0.0-beta.2) (2023-06-06) - -### Bug Fixes - -- simplify plugins and eliminate enums ([#407](https://github.com/amplitude/Amplitude-TypeScript/issues/407)) - ([890ec66](https://github.com/amplitude/Amplitude-TypeScript/commit/890ec6695a8b25cd6988e9f7ae584d4ba2835f67)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [2.0.0-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.7.0...@amplitude/analytics-client-common@2.0.0-beta.1) (2023-06-06) - -### Features - -- allow cross subdomain excluded referrer ([#391](https://github.com/amplitude/Amplitude-TypeScript/issues/391)) - ([f34f64b](https://github.com/amplitude/Amplitude-TypeScript/commit/f34f64b68bbd328da354afae61ca416d7055a734)) -- make default event tracking enabled by default ([#386](https://github.com/amplitude/Amplitude-TypeScript/issues/386)) - ([242f42d](https://github.com/amplitude/Amplitude-TypeScript/commit/242f42dd2e46eaec95c827795e04f74fba39c35f)) -- simplify browser SDK options and plugin options interface - ([#384](https://github.com/amplitude/Amplitude-TypeScript/issues/384)) - ([b464cfb](https://github.com/amplitude/Amplitude-TypeScript/commit/b464cfb8e09d722bf06ed3c11955f77465a23daf)) -- use server side user agent parser ([#382](https://github.com/amplitude/Amplitude-TypeScript/issues/382)) - ([69bd255](https://github.com/amplitude/Amplitude-TypeScript/commit/69bd2558cb37d027064b6459cc2887c219196973)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.7.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.6.5...@amplitude/analytics-client-common@0.7.0) (2023-05-04) - -### Features - -- add attribution tracking for linkedin click id li_fat_id - ([ca81f3d](https://github.com/amplitude/Amplitude-TypeScript/commit/ca81f3d75ece7e0e23a1bc1b6889107d53a60a86)) -- add rtd_cid for Reddit campaign tracking/attribution - ([784e080](https://github.com/amplitude/Amplitude-TypeScript/commit/784e080aa129c37e850d7f34115beb9770044e4e)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.6.4...@amplitude/analytics-client-common@0.6.5) (2023-04-27) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.6.3...@amplitude/analytics-client-common@0.6.4) (2023-04-25) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.6.2...@amplitude/analytics-client-common@0.6.3) (2023-04-06) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.6.1...@amplitude/analytics-client-common@0.6.2) (2023-03-31) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.6.1-beta.0...@amplitude/analytics-client-common@0.6.1) (2023-03-03) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.1-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.6.0...@amplitude/analytics-client-common@0.6.1-beta.0) (2023-03-03) - -### Bug Fixes - -- push user id and device id changes to analytics connector - ([#342](https://github.com/amplitude/Amplitude-TypeScript/issues/342)) - ([3214b08](https://github.com/amplitude/Amplitude-TypeScript/commit/3214b0836eb03e39b5753b1e6be30e1c2f5770ca)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.6.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.6.0-beta.0...@amplitude/analytics-client-common@0.6.0) (2023-02-27) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.6.0-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.5.4...@amplitude/analytics-client-common@0.6.0-beta.0) (2023-02-24) - -### Bug Fixes - -- consolidate web attribution and page view tracking plugins for marketing analytics use case - ([c268997](https://github.com/amplitude/Amplitude-TypeScript/commit/c26899787611daeda7fca288e260bbc42a831130)) - -### Features - -- allow custom page view event type ([#335](https://github.com/amplitude/Amplitude-TypeScript/issues/335)) - ([0a4f8ed](https://github.com/amplitude/Amplitude-TypeScript/commit/0a4f8ede6e30ec3450ac0a468cf22b9266b0b23c)) -- pass amplitude instance to plugin.setup for enhanced plugin capabilities - ([#328](https://github.com/amplitude/Amplitude-TypeScript/issues/328)) - ([91eeaa0](https://github.com/amplitude/Amplitude-TypeScript/commit/91eeaa0d6bff6bde39538bb54548a938df784462)) -- retrofit web attribution and page view plugins to browser SDK - ([#331](https://github.com/amplitude/Amplitude-TypeScript/issues/331)) - ([ba845d3](https://github.com/amplitude/Amplitude-TypeScript/commit/ba845d3329bd6bebe3b89f24f4f316088c2d62b9)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.5.3...@amplitude/analytics-client-common@0.5.4) (2023-02-09) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.5.3-beta.0...@amplitude/analytics-client-common@0.5.3) (2023-01-31) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.3-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.5.2...@amplitude/analytics-client-common@0.5.3-beta.0) (2023-01-26) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.5.1...@amplitude/analytics-client-common@0.5.2) (2023-01-11) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.5.0...@amplitude/analytics-client-common@0.5.1) (2022-12-21) - -### Bug Fixes - -- upgrade dependencies to resolve dependabot vulnerability alerts - ([#299](https://github.com/amplitude/Amplitude-TypeScript/issues/299)) - ([7dd1cd1](https://github.com/amplitude/Amplitude-TypeScript/commit/7dd1cd1b23a71981a4ad90b4b30cc9b7d28c4412)) - -### Reverts - -- Revert "Updated dependencies" - ([7ca9964](https://github.com/amplitude/Amplitude-TypeScript/commit/7ca9964781e4b900c6c027bdddf2ae1e7428ba18)) - -# [0.5.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.4.1...@amplitude/analytics-client-common@0.5.0) (2022-11-28) - -### Features - -- add utm_id tracking ([#284](https://github.com/amplitude/Amplitude-TypeScript/issues/284)) - ([f72dcf1](https://github.com/amplitude/Amplitude-TypeScript/commit/f72dcf1788ebc84544aaee1dc41b1d1ba6e4c06e)) -- persisted event identifiers (React Native) ([#280](https://github.com/amplitude/Amplitude-TypeScript/issues/280)) - ([bd35e73](https://github.com/amplitude/Amplitude-TypeScript/commit/bd35e73a0a08db6609938d27f00f54cbf77ff6c1)) - -## [0.4.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.4.0...@amplitude/analytics-client-common@0.4.1) (2022-11-15) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# [0.4.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.3.5...@amplitude/analytics-client-common@0.4.0) (2022-11-01) - -### Features - -- ignore subdomains when comparing newness of campaigns - ([#260](https://github.com/amplitude/Amplitude-TypeScript/issues/260)) - ([8bb2b76](https://github.com/amplitude/Amplitude-TypeScript/commit/8bb2b76faf37783a58e953391468bd31c089e3a3)) - -## [0.3.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.3.4...@amplitude/analytics-client-common@0.3.5) (2022-11-01) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -## [0.3.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.3.3...@amplitude/analytics-client-common@0.3.4) (2022-10-26) - -### Bug Fixes - -- adds optional chaining to window.location ([#258](https://github.com/amplitude/Amplitude-TypeScript/issues/258)) - ([c30a1e0](https://github.com/amplitude/Amplitude-TypeScript/commit/c30a1e06feb632942a1697bda4948259ea0721a5)) - -## [0.3.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.3.3-beta.1...@amplitude/analytics-client-common@0.3.3) (2022-10-25) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -## [0.3.3-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.3.3-beta.0...@amplitude/analytics-client-common@0.3.3-beta.1) (2022-10-25) - -### Reverts - -- add logging around cookie storage ([#256](https://github.com/amplitude/Amplitude-TypeScript/issues/256)) - ([12016e7](https://github.com/amplitude/Amplitude-TypeScript/commit/12016e7eddb7bec885883c0ebf1619fc447beb87)) - -## [0.3.3-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.3.2...@amplitude/analytics-client-common@0.3.3-beta.0) (2022-10-25) - -### Bug Fixes - -- add logging around cookie storage ([#255](https://github.com/amplitude/Amplitude-TypeScript/issues/255)) - ([dee9d32](https://github.com/amplitude/Amplitude-TypeScript/commit/dee9d3299b90b71576a8c435c26a03c1dcabdae4)) - -## [0.3.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.3.1...@amplitude/analytics-client-common@0.3.2) (2022-10-25) - -### Bug Fixes - -- add safe check for global scope before loading SDK - ([#252](https://github.com/amplitude/Amplitude-TypeScript/issues/252)) - ([a3f4f6f](https://github.com/amplitude/Amplitude-TypeScript/commit/a3f4f6f7b11abd9cdbdf064e31e32d5fc3e92031)) -- invoke pre-init track fns after attribution ([#253](https://github.com/amplitude/Amplitude-TypeScript/issues/253)) - ([b8996d7](https://github.com/amplitude/Amplitude-TypeScript/commit/b8996d793f74d388c1a96e0cde5c0ac060c1e565)) - -## [0.3.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.3.0...@amplitude/analytics-client-common@0.3.1) (2022-10-14) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -# [0.3.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.2.4...@amplitude/analytics-client-common@0.3.0) (2022-10-04) - -### Features - -- add gbraid and wbraid as campaign parameters ([#242](https://github.com/amplitude/Amplitude-TypeScript/issues/242)) - ([514b7cd](https://github.com/amplitude/Amplitude-TypeScript/commit/514b7cdea9fee0c4e61479b087f7acdfea889350)) - -## [0.2.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.2.3...@amplitude/analytics-client-common@0.2.4) (2022-09-30) - -### Bug Fixes - -- resolve web attribution is not tracking the first direct/organic traffic - ([#239](https://github.com/amplitude/Amplitude-TypeScript/issues/239)) - ([98a3363](https://github.com/amplitude/Amplitude-TypeScript/commit/98a33633a7a6de7ee147c8cbf690e5546ce53163)) - -## [0.2.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.2.2...@amplitude/analytics-client-common@0.2.3) (2022-09-30) - -### Bug Fixes - -- cover the case when apiKey is missing in the runtime - ([#240](https://github.com/amplitude/Amplitude-TypeScript/issues/240)) - ([308bbe8](https://github.com/amplitude/Amplitude-TypeScript/commit/308bbe8337cbab366a0ca255f2d665101f4781a0)) - -## [0.2.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.2.2-beta.1...@amplitude/analytics-client-common@0.2.2) (2022-09-28) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -## [0.2.2-beta.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.2.2-beta.0...@amplitude/analytics-client-common@0.2.2-beta.1) (2022-09-27) - -### Bug Fixes - -- define correct dependencies for @amplitude/analytics-connector - ([#234](https://github.com/amplitude/Amplitude-TypeScript/issues/234)) - ([41c1351](https://github.com/amplitude/Amplitude-TypeScript/commit/41c1351e441b890b016ba123c4ed5747a4c33adb)) - -## [0.2.2-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.2.1...@amplitude/analytics-client-common@0.2.2-beta.0) (2022-09-26) - -**Note:** Version bump only for package @amplitude/analytics-client-common - -## [0.2.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.2.0...@amplitude/analytics-client-common@0.2.1) (2022-09-26) - -### Bug Fixes - -- update base config to include additional click ids - ([#229](https://github.com/amplitude/Amplitude-TypeScript/issues/229)) - ([5596931](https://github.com/amplitude/Amplitude-TypeScript/commit/55969310714c43f138e1702ba285fd4dadcdcb44)) - -# [0.2.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.1.0...@amplitude/analytics-client-common@0.2.0) (2022-09-22) - -### Features - -- add campaign params to page view events ([#216](https://github.com/amplitude/Amplitude-TypeScript/issues/216)) - ([c0f99b9](https://github.com/amplitude/Amplitude-TypeScript/commit/c0f99b98d0d2c24f6f9486312b568194c690a202)) - -# [0.1.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-client-common@0.0.1...@amplitude/analytics-client-common@0.1.0) (2022-09-16) - -### Features - -- attl click id campaign params ([#220](https://github.com/amplitude/Amplitude-TypeScript/issues/220)) - ([7598895](https://github.com/amplitude/Amplitude-TypeScript/commit/75988950d7d3a97d00e038ae368b311f0b314604)) - -## 0.0.1 (2022-09-08) - -**Note:** Version bump only for package @amplitude/analytics-client-common diff --git a/packages/analytics-client-common/jest.config.js b/packages/analytics-client-common/jest.config.js deleted file mode 100644 index 77259ec9e..000000000 --- a/packages/analytics-client-common/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('../../jest.config.js'); -const package = require('./package'); - -module.exports = { - ...baseConfig, - displayName: package.name, - rootDir: '.', - testEnvironment: 'jsdom', - coveragePathIgnorePatterns: ['index.ts', 'global-scope.ts'], -}; diff --git a/packages/analytics-client-common/package.json b/packages/analytics-client-common/package.json deleted file mode 100644 index f2ffa11b0..000000000 --- a/packages/analytics-client-common/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@amplitude/analytics-client-common", - "version": "2.3.23", - "description": "", - "author": "Amplitude Inc", - "homepage": "https://github.com/amplitude/Amplitude-TypeScript", - "license": "MIT", - "main": "lib/cjs/index.js", - "module": "lib/esm/index.js", - "types": "lib/esm/index.d.ts", - "sideEffects": false, - "publishConfig": { - "access": "public", - "tag": "latest" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/amplitude/Amplitude-TypeScript.git" - }, - "scripts": { - "build": "yarn build:es5 && yarn build:esm", - "build:es5": "tsc -p ./tsconfig.es5.json", - "build:esm": "tsc -p ./tsconfig.esm.json", - "watch": "tsc -p ./tsconfig.esm.json --watch", - "clean": "rimraf node_modules lib coverage", - "fix": "yarn fix:eslint & yarn fix:prettier", - "fix:eslint": "eslint '{src,test}/**/*.ts' --fix", - "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"", - "lint": "yarn lint:eslint & yarn lint:prettier", - "lint:eslint": "eslint '{src,test}/**/*.ts'", - "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"", - "test": "jest", - "typecheck": "tsc -p ./tsconfig.json" - }, - "bugs": { - "url": "https://github.com/amplitude/Amplitude-TypeScript/issues" - }, - "dependencies": { - "@amplitude/analytics-connector": "^1.4.8", - "@amplitude/analytics-core": "^2.12.2", - "@amplitude/analytics-types": "^2.9.2", - "tslib": "^2.4.1" - }, - "files": [ - "lib" - ] -} diff --git a/packages/analytics-client-common/src/analytics-connector.ts b/packages/analytics-client-common/src/analytics-connector.ts deleted file mode 100644 index 4d2fb87bb..000000000 --- a/packages/analytics-client-common/src/analytics-connector.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { AnalyticsConnector } from '@amplitude/analytics-connector'; - -export const getAnalyticsConnector = (instanceName = '$default_instance'): AnalyticsConnector => { - return AnalyticsConnector.getInstance(instanceName); -}; - -export const setConnectorUserId = (userId: string | undefined, instanceName?: string): void => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - getAnalyticsConnector(instanceName).identityStore.editIdentity().setUserId(userId).commit(); -}; - -export const setConnectorDeviceId = (deviceId: string, instanceName?: string): void => { - getAnalyticsConnector(instanceName).identityStore.editIdentity().setDeviceId(deviceId).commit(); -}; diff --git a/packages/analytics-client-common/src/attribution/campaign-parser.ts b/packages/analytics-client-common/src/attribution/campaign-parser.ts deleted file mode 100644 index 84a07580b..000000000 --- a/packages/analytics-client-common/src/attribution/campaign-parser.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { getQueryParams } from '../query-params'; -import { - UTM_CAMPAIGN, - UTM_CONTENT, - UTM_MEDIUM, - UTM_SOURCE, - UTM_TERM, - GCLID, - FBCLID, - BASE_CAMPAIGN, - DCLID, - MSCLKID, - RDT_CID, - TWCLID, - TTCLID, - KO_CLICK_ID, - LI_FAT_ID, - GBRAID, - WBRAID, - UTM_ID, -} from './constants'; -import { - Campaign, - CampaignParser as ICampaignParser, - ClickIdParameters, - ReferrerParameters, - UTMParameters, -} from '@amplitude/analytics-types'; - -export class CampaignParser implements ICampaignParser { - async parse(): Promise { - return { - ...BASE_CAMPAIGN, - ...this.getUtmParam(), - ...this.getReferrer(), - ...this.getClickIds(), - } as Campaign; - } - - getUtmParam(): UTMParameters { - const params = getQueryParams(); - - const utmCampaign = params[UTM_CAMPAIGN]; - const utmContent = params[UTM_CONTENT]; - const utmId = params[UTM_ID]; - const utmMedium = params[UTM_MEDIUM]; - const utmSource = params[UTM_SOURCE]; - const utmTerm = params[UTM_TERM]; - - return { - utm_campaign: utmCampaign, - utm_content: utmContent, - utm_id: utmId, - utm_medium: utmMedium, - utm_source: utmSource, - utm_term: utmTerm, - }; - } - - getReferrer(): ReferrerParameters { - const data: ReferrerParameters = { - referrer: undefined, - referring_domain: undefined, - }; - try { - data.referrer = document.referrer || undefined; - data.referring_domain = data.referrer?.split('/')[2] ?? undefined; - } catch { - // nothing to track - } - return data; - } - - getClickIds(): ClickIdParameters { - const params = getQueryParams(); - return { - [DCLID]: params[DCLID], - [FBCLID]: params[FBCLID], - [GBRAID]: params[GBRAID], - [GCLID]: params[GCLID], - [KO_CLICK_ID]: params[KO_CLICK_ID], - [LI_FAT_ID]: params[LI_FAT_ID], - [MSCLKID]: params[MSCLKID], - [RDT_CID]: params[RDT_CID], - [TTCLID]: params[TTCLID], - [TWCLID]: params[TWCLID], - [WBRAID]: params[WBRAID], - }; - } -} diff --git a/packages/analytics-client-common/src/attribution/campaign-tracker.ts b/packages/analytics-client-common/src/attribution/campaign-tracker.ts deleted file mode 100644 index efab324ea..000000000 --- a/packages/analytics-client-common/src/attribution/campaign-tracker.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { createIdentifyEvent, Identify } from '@amplitude/analytics-core'; -import { - Storage, - Campaign, - CampaignParser as ICampaignParser, - CampaignTracker as ICampaignTracker, - CampaignTrackFunction, - CampaignTrackerOptions, - BaseEvent, -} from '@amplitude/analytics-types'; -import { getCookieName as getStorageKey } from '../cookie-name'; -import { CampaignParser } from './campaign-parser'; -import { BASE_CAMPAIGN, EMPTY_VALUE, MKTG } from './constants'; - -/** - * @deprecated - * Campaign tracker has mixed logic from built-in and plugin web attribution - * features. Do not add more features here. The plan moving foward is to consolidate - * logic in @amplitude/plugin-web-attribution-browser with backward compatibility. - */ -export class CampaignTracker implements ICampaignTracker { - storage: Storage; - storageKey: string; - parser: ICampaignParser; - track: CampaignTrackFunction; - onNewCampaign: (campaign: Campaign) => unknown; - - disabled: boolean; - trackNewCampaigns: boolean; - trackPageViews: boolean; - excludeReferrers: string[]; - initialEmptyValue: string; - - constructor(apiKey: string, options: CampaignTrackerOptions) { - this.storage = options.storage; - this.storageKey = getStorageKey(apiKey, MKTG); - this.parser = new CampaignParser(); - this.track = options.track; - this.onNewCampaign = options.onNewCampaign; - - this.disabled = Boolean(options.disabled); - this.trackNewCampaigns = Boolean(options.trackNewCampaigns); - this.trackPageViews = Boolean(options.trackPageViews); - this.excludeReferrers = options.excludeReferrers ?? []; - if (typeof location !== 'undefined') { - this.excludeReferrers.unshift(location.hostname); - } - this.initialEmptyValue = options.initialEmptyValue ?? EMPTY_VALUE; - } - - isNewCampaign(current: Campaign, previous: Campaign | undefined, ignoreSubdomainInReferrer = false) { - const { referrer, referring_domain, ...currentCampaign } = current; - const { referrer: _previous_referrer, referring_domain: prevReferringDomain, ...previousCampaign } = previous || {}; - - if (current.referring_domain && this.excludeReferrers.includes(current.referring_domain)) { - return false; - } - - const hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign); - const hasNewDomain = ignoreSubdomainInReferrer - ? domainWithoutSubdomain(referring_domain || '') !== domainWithoutSubdomain(prevReferringDomain || '') - : referring_domain !== prevReferringDomain; - - return !previous || hasNewCampaign || hasNewDomain; - } - - async saveCampaignToStorage(campaign: Campaign): Promise { - await this.storage.set(this.storageKey, campaign); - } - - async getCampaignFromStorage(): Promise { - return await this.storage.get(this.storageKey); - } - - createCampaignEvent(campaign: Campaign) { - const campaignParameters: Campaign = { - // This object definition allows undefined keys to be iterated on - // in .reduce() to build indentify object - ...BASE_CAMPAIGN, - ...campaign, - }; - const identifyEvent = Object.entries(campaignParameters).reduce((identify, [key, value]) => { - identify.setOnce(`initial_${key}`, value || this.initialEmptyValue); - if (value) { - return identify.set(key, value); - } - return identify.unset(key); - }, new Identify()); - - const pageViewEvent: BaseEvent = { - event_type: 'Page View', - event_properties: { - page_title: /* istanbul ignore next */ (typeof document !== 'undefined' && document.title) || '', - page_location: /* istanbul ignore next */ (typeof location !== 'undefined' && location.href) || '', - page_path: /* istanbul ignore next */ (typeof location !== 'undefined' && location.pathname) || '', - }, - }; - return { - ...createIdentifyEvent(identifyEvent), - ...(this.trackPageViews && pageViewEvent), - }; - } - - async send(isNewSession: boolean) { - if (this.disabled) { - return; - } - const currentCampaign = await this.parser.parse(); - const previousCampaign = await this.getCampaignFromStorage(); - if (!isNewSession) { - if (!this.trackNewCampaigns || !this.isNewCampaign(currentCampaign, previousCampaign)) { - return; - } - this.onNewCampaign(currentCampaign); - } - await this.track(this.createCampaignEvent(currentCampaign)); - await this.saveCampaignToStorage(currentCampaign); - } -} - -const domainWithoutSubdomain = (domain: string) => { - const parts = domain.split('.'); - - if (parts.length <= 2) { - return domain; - } - - return parts.slice(parts.length - 2, parts.length).join('.'); -}; diff --git a/packages/analytics-client-common/src/attribution/constants.ts b/packages/analytics-client-common/src/attribution/constants.ts deleted file mode 100644 index af7f53acc..000000000 --- a/packages/analytics-client-common/src/attribution/constants.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Campaign } from '@amplitude/analytics-types'; - -export const UTM_CAMPAIGN = 'utm_campaign'; -export const UTM_CONTENT = 'utm_content'; -export const UTM_ID = 'utm_id'; -export const UTM_MEDIUM = 'utm_medium'; -export const UTM_SOURCE = 'utm_source'; -export const UTM_TERM = 'utm_term'; - -export const DCLID = 'dclid'; -export const FBCLID = 'fbclid'; -export const GBRAID = 'gbraid'; -export const GCLID = 'gclid'; -export const KO_CLICK_ID = 'ko_click_id'; -export const LI_FAT_ID = 'li_fat_id'; -export const MSCLKID = 'msclkid'; -export const RDT_CID = 'rtd_cid'; -export const TTCLID = 'ttclid'; -export const TWCLID = 'twclid'; -export const WBRAID = 'wbraid'; - -export const EMPTY_VALUE = 'EMPTY'; - -export const BASE_CAMPAIGN: Campaign = { - utm_campaign: undefined, - utm_content: undefined, - utm_id: undefined, - utm_medium: undefined, - utm_source: undefined, - utm_term: undefined, - referrer: undefined, - referring_domain: undefined, - dclid: undefined, - gbraid: undefined, - gclid: undefined, - fbclid: undefined, - ko_click_id: undefined, - li_fat_id: undefined, - msclkid: undefined, - rtd_cid: undefined, - ttclid: undefined, - twclid: undefined, - wbraid: undefined, -}; - -export const MKTG = 'MKTG'; diff --git a/packages/analytics-client-common/src/attribution/helpers.ts b/packages/analytics-client-common/src/attribution/helpers.ts deleted file mode 100644 index 66d5f07da..000000000 --- a/packages/analytics-client-common/src/attribution/helpers.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { createIdentifyEvent, Identify } from '@amplitude/analytics-core'; -import { Campaign, Logger } from '@amplitude/analytics-types'; -import { BASE_CAMPAIGN } from './constants'; - -export interface Options { - excludeReferrers?: (string | RegExp)[]; - initialEmptyValue?: string; - resetSessionOnNewCampaign?: boolean; -} - -const domainWithoutSubdomain = (domain: string) => { - const parts = domain.split('.'); - - if (parts.length <= 2) { - return domain; - } - - return parts.slice(parts.length - 2, parts.length).join('.'); -}; - -//Direct traffic mean no external referral, no UTMs, no click-ids, and no other customer identified marketing campaign url params. -const isDirectTraffic = (current: Campaign) => { - return Object.values(current).every((value) => !value); -}; - -export const isNewCampaign = ( - current: Campaign, - previous: Campaign | undefined, - options: Options, - logger: Logger, - isNewSession = true, -) => { - const { referrer, referring_domain, ...currentCampaign } = current; - const { referrer: _previous_referrer, referring_domain: prevReferringDomain, ...previousCampaign } = previous || {}; - - if (isExcludedReferrer(options.excludeReferrers, current.referring_domain)) { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - logger.debug(`This is not a new campaign because ${current.referring_domain} is in the exclude referrer list.`); - return false; - } - - //In the same session, direct traffic should not override or unset any persisting query params - if (!isNewSession && isDirectTraffic(current) && previous) { - logger.debug('This is not a new campaign because this is a direct traffic in the same session.'); - return false; - } - - const hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign); - const hasNewDomain = - domainWithoutSubdomain(referring_domain || '') !== domainWithoutSubdomain(prevReferringDomain || ''); - - const result = !previous || hasNewCampaign || hasNewDomain; - - if (!result) { - logger.debug("This is not a new campaign because it's the same as the previous one."); - } else { - logger.debug(`This is a new campaign. An $identify event will be sent.`); - } - - return result; -}; - -export const isExcludedReferrer = (excludeReferrers: (string | RegExp)[] = [], referringDomain = '') => { - return excludeReferrers.some((value) => - value instanceof RegExp ? value.test(referringDomain) : value === referringDomain, - ); -}; - -export const createCampaignEvent = (campaign: Campaign, options: Options) => { - const campaignParameters: Campaign = { - // This object definition allows undefined keys to be iterated on - // in .reduce() to build indentify object - ...BASE_CAMPAIGN, - ...campaign, - }; - const identifyEvent = Object.entries(campaignParameters).reduce((identify, [key, value]) => { - identify.setOnce(`initial_${key}`, value ?? options.initialEmptyValue ?? 'EMPTY'); - if (value) { - return identify.set(key, value); - } - return identify.unset(key); - }, new Identify()); - - return createIdentifyEvent(identifyEvent); -}; - -export const getDefaultExcludedReferrers = (cookieDomain: string | undefined) => { - let domain = cookieDomain; - if (domain) { - if (domain.startsWith('.')) { - domain = domain.substring(1); - } - return [new RegExp(`${domain.replace('.', '\\.')}$`)]; - } - return []; -}; diff --git a/packages/analytics-client-common/src/attribution/web-attribution.ts b/packages/analytics-client-common/src/attribution/web-attribution.ts deleted file mode 100644 index 6d5cb7d40..000000000 --- a/packages/analytics-client-common/src/attribution/web-attribution.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { BrowserConfig, Logger } from '@amplitude/analytics-types'; -import { Campaign, Storage } from '@amplitude/analytics-types'; -import { Options, getDefaultExcludedReferrers, createCampaignEvent, isNewCampaign } from './helpers'; -import { getStorageKey } from '../storage/helpers'; -import { CampaignParser } from './campaign-parser'; -import { BASE_CAMPAIGN } from './constants'; -import { isNewSession } from '../session'; - -export class WebAttribution { - options: Options; - storage: Storage; - storageKey: string; - previousCampaign?: Campaign; - currentCampaign: Campaign; - shouldTrackNewCampaign = false; - sessionTimeout: number; - lastEventTime?: number; - logger: Logger; - - constructor(options: Options, config: BrowserConfig) { - this.options = { - initialEmptyValue: 'EMPTY', - resetSessionOnNewCampaign: false, - excludeReferrers: getDefaultExcludedReferrers(config.cookieOptions?.domain), - ...options, - }; - this.storage = config.cookieStorage as unknown as Storage; - this.storageKey = getStorageKey(config.apiKey, 'MKTG'); - this.currentCampaign = BASE_CAMPAIGN; - this.sessionTimeout = config.sessionTimeout; - this.lastEventTime = config.lastEventTime; - this.logger = config.loggerProvider; - config.loggerProvider.log('Installing web attribution tracking.'); - } - - async init() { - [this.currentCampaign, this.previousCampaign] = await this.fetchCampaign(); - const isEventInNewSession = !this.lastEventTime ? true : isNewSession(this.sessionTimeout, this.lastEventTime); - - if (isNewCampaign(this.currentCampaign, this.previousCampaign, this.options, this.logger, isEventInNewSession)) { - this.shouldTrackNewCampaign = true; - await this.storage.set(this.storageKey, this.currentCampaign); - } - } - - async fetchCampaign() { - return await Promise.all([new CampaignParser().parse(), this.storage.get(this.storageKey)]); - } - - /** - * This can be called when enable web attribution and either - * 1. set a new session - * 2. has new campaign and enable resetSessionOnNewCampaign - */ - generateCampaignEvent(event_id?: number) { - // Mark this campaign has been tracked - this.shouldTrackNewCampaign = false; - const campaignEvent = createCampaignEvent(this.currentCampaign, this.options); - if (event_id) { - campaignEvent.event_id = event_id; - } - return campaignEvent; - } - - shouldSetSessionIdOnNewCampaign() { - return this.shouldTrackNewCampaign && !!this.options.resetSessionOnNewCampaign; - } -} diff --git a/packages/analytics-client-common/src/cookie-name.ts b/packages/analytics-client-common/src/cookie-name.ts deleted file mode 100644 index 7f2677496..000000000 --- a/packages/analytics-client-common/src/cookie-name.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core'; - -export const getCookieName = (apiKey: string, postKey = '', limit = 10) => { - return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join('_'); -}; - -export const getOldCookieName = (apiKey: string) => { - return `${AMPLITUDE_PREFIX.toLowerCase()}_${apiKey.substring(0, 6)}`; -}; diff --git a/packages/analytics-client-common/src/default-tracking.ts b/packages/analytics-client-common/src/default-tracking.ts deleted file mode 100644 index 281ef9998..000000000 --- a/packages/analytics-client-common/src/default-tracking.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { - AttributionOptions, - AutocaptureOptions, - BrowserOptions, - PageTrackingHistoryChanges, - PageTrackingOptions, - PageTrackingTrackOn, - ElementInteractionsOptions, -} from '@amplitude/analytics-types'; - -/** - * Returns false if autocapture === false or if autocapture[event], - * otherwise returns true - */ -const isTrackingEnabled = (autocapture: AutocaptureOptions | boolean | undefined, event: keyof AutocaptureOptions) => { - if (typeof autocapture === 'boolean') { - return autocapture; - } - - if (autocapture?.[event] === false) { - return false; - } - - return true; -}; - -export const isAttributionTrackingEnabled = (autocapture: AutocaptureOptions | boolean | undefined) => - isTrackingEnabled(autocapture, 'attribution'); - -export const isFileDownloadTrackingEnabled = (autocapture: AutocaptureOptions | boolean | undefined) => - isTrackingEnabled(autocapture, 'fileDownloads'); - -export const isFormInteractionTrackingEnabled = (autocapture: AutocaptureOptions | boolean | undefined) => - isTrackingEnabled(autocapture, 'formInteractions'); - -export const isPageViewTrackingEnabled = (autocapture: AutocaptureOptions | boolean | undefined) => - isTrackingEnabled(autocapture, 'pageViews'); - -export const isSessionTrackingEnabled = (autocapture: AutocaptureOptions | boolean | undefined) => - isTrackingEnabled(autocapture, 'sessions'); - -/** - * Returns true if - * 1. autocapture === true - * 2. if autocapture.elementInteractions === true - * 3. if autocapture.elementInteractions === object - * otherwise returns false - */ -export const isElementInteractionsEnabled = (autocapture: AutocaptureOptions | boolean | undefined): boolean => { - if (typeof autocapture === 'boolean') { - return autocapture; - } - - if ( - typeof autocapture === 'object' && - (autocapture.elementInteractions === true || typeof autocapture.elementInteractions === 'object') - ) { - return true; - } - - return false; -}; - -export const getElementInteractionsConfig = (config: BrowserOptions): ElementInteractionsOptions | undefined => { - if ( - isElementInteractionsEnabled(config.autocapture) && - typeof config.autocapture === 'object' && - typeof config.autocapture.elementInteractions === 'object' - ) { - return config.autocapture.elementInteractions; - } - return undefined; -}; - -export const getPageViewTrackingConfig = (config: BrowserOptions): PageTrackingOptions => { - let trackOn: PageTrackingTrackOn | undefined = () => false; - let trackHistoryChanges: PageTrackingHistoryChanges | undefined = undefined; - let eventType: string | undefined; - const pageCounter = config.pageCounter; - - const isDefaultPageViewTrackingEnabled = isPageViewTrackingEnabled(config.defaultTracking); - if (isDefaultPageViewTrackingEnabled) { - trackOn = undefined; - eventType = undefined; - - if ( - config.defaultTracking && - typeof config.defaultTracking === 'object' && - config.defaultTracking.pageViews && - typeof config.defaultTracking.pageViews === 'object' - ) { - if ('trackOn' in config.defaultTracking.pageViews) { - trackOn = config.defaultTracking.pageViews.trackOn; - } - - if ('trackHistoryChanges' in config.defaultTracking.pageViews) { - trackHistoryChanges = config.defaultTracking.pageViews.trackHistoryChanges; - } - - if ('eventType' in config.defaultTracking.pageViews && config.defaultTracking.pageViews.eventType) { - eventType = config.defaultTracking.pageViews.eventType; - } - } - } - - return { - trackOn, - trackHistoryChanges, - eventType, - pageCounter, - }; -}; - -export const getAttributionTrackingConfig = (config: BrowserOptions): AttributionOptions => { - if ( - isAttributionTrackingEnabled(config.defaultTracking) && - config.defaultTracking && - typeof config.defaultTracking === 'object' && - config.defaultTracking.attribution && - typeof config.defaultTracking.attribution === 'object' - ) { - return { - ...config.defaultTracking.attribution, - }; - } - - return {}; -}; diff --git a/packages/analytics-client-common/src/global-scope.ts b/packages/analytics-client-common/src/global-scope.ts deleted file mode 100644 index 183d0caaf..000000000 --- a/packages/analytics-client-common/src/global-scope.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-disable no-restricted-globals */ -/* Only file allowed to access to globalThis, window, self */ - -export const getGlobalScope = (): typeof globalThis | undefined => { - // This should only be used for integrations with Amplitude that are not running in a browser environment - // We need to specify the name of the global variable as a string to prevent it from being minified - const ampIntegrationContextName = 'ampIntegrationContext' as keyof typeof globalThis; - if (typeof globalThis !== 'undefined' && typeof globalThis[ampIntegrationContextName] !== 'undefined') { - return globalThis[ampIntegrationContextName] as typeof globalThis; - } - if (typeof globalThis !== 'undefined') { - return globalThis; - } - if (typeof window !== 'undefined') { - return window; - } - if (typeof self !== 'undefined') { - return self; - } - if (typeof global !== 'undefined') { - return global; - } - return undefined; -}; diff --git a/packages/analytics-client-common/src/index.ts b/packages/analytics-client-common/src/index.ts deleted file mode 100644 index f6bf03cc7..000000000 --- a/packages/analytics-client-common/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -export { CampaignParser } from './attribution/campaign-parser'; -export { CampaignTracker } from './attribution/campaign-tracker'; -export { - Options, - isNewCampaign, - isExcludedReferrer, - createCampaignEvent, - getDefaultExcludedReferrers, -} from './attribution/helpers'; -export { WebAttribution } from './attribution/web-attribution'; -export { BASE_CAMPAIGN } from './attribution/constants'; -export { getQueryParams } from './query-params'; -export { isNewSession } from './session'; -export { getCookieName, getOldCookieName } from './cookie-name'; -export { getStorageKey } from './storage/helpers'; -export { CookieStorage } from './storage/cookie'; -export { FetchTransport } from './transports/fetch'; -export { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector'; -export { IdentityEventSender } from './plugins/identity'; -export { getLanguage } from './language'; -export { getGlobalScope } from './global-scope'; -export { - getPageViewTrackingConfig, - getAttributionTrackingConfig, - getElementInteractionsConfig, - isAttributionTrackingEnabled, - isFileDownloadTrackingEnabled, - isFormInteractionTrackingEnabled, - isPageViewTrackingEnabled, - isSessionTrackingEnabled, - isElementInteractionsEnabled, -} from './default-tracking'; diff --git a/packages/analytics-client-common/src/language.ts b/packages/analytics-client-common/src/language.ts deleted file mode 100644 index ae2154a1f..000000000 --- a/packages/analytics-client-common/src/language.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const getLanguage = (): string => { - if (typeof navigator === 'undefined') return ''; - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const userLanguage = (navigator as any).userLanguage as string | undefined; - - return navigator.languages?.[0] ?? navigator.language ?? userLanguage ?? ''; -}; diff --git a/packages/analytics-client-common/src/plugins/identity.ts b/packages/analytics-client-common/src/plugins/identity.ts deleted file mode 100644 index 69b6dee5a..000000000 --- a/packages/analytics-client-common/src/plugins/identity.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { BeforePlugin, Config, Event } from '@amplitude/analytics-types'; -import { getAnalyticsConnector } from '../analytics-connector'; - -export class IdentityEventSender implements BeforePlugin { - name = 'identity'; - type = 'before' as const; - - identityStore = getAnalyticsConnector().identityStore; - - async execute(context: Event): Promise { - const userProperties = context.user_properties as Record; - if (userProperties) { - this.identityStore.editIdentity().updateUserProperties(userProperties).commit(); - } - return context; - } - - async setup(config: Config) { - if (config.instanceName) { - this.identityStore = getAnalyticsConnector(config.instanceName).identityStore; - } - } -} diff --git a/packages/analytics-client-common/src/query-params.ts b/packages/analytics-client-common/src/query-params.ts deleted file mode 100644 index 0bfa5da69..000000000 --- a/packages/analytics-client-common/src/query-params.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { getGlobalScope } from './global-scope'; - -export const getQueryParams = (): Record => { - const globalScope = getGlobalScope(); - /* istanbul ignore if */ - if (!globalScope?.location?.search) { - return {}; - } - const pairs = globalScope.location.search.substring(1).split('&').filter(Boolean); - const params = pairs.reduce>((acc, curr) => { - const query = curr.split('=', 2); - const key = tryDecodeURIComponent(query[0]); - const value = tryDecodeURIComponent(query[1]); - if (!value) { - return acc; - } - acc[key] = value; - return acc; - }, {}); - return params; -}; - -export const tryDecodeURIComponent = (value = '') => { - try { - return decodeURIComponent(value); - } catch { - return ''; - } -}; diff --git a/packages/analytics-client-common/src/session.ts b/packages/analytics-client-common/src/session.ts deleted file mode 100644 index 575544914..000000000 --- a/packages/analytics-client-common/src/session.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const isNewSession = (sessionTimeout: number, lastEventTime: number = Date.now()): boolean => { - const currentTime = Date.now(); - const timeSinceLastEvent = currentTime - lastEventTime; - - return timeSinceLastEvent > sessionTimeout; -}; diff --git a/packages/analytics-client-common/src/storage/cookie.ts b/packages/analytics-client-common/src/storage/cookie.ts deleted file mode 100644 index e6e45561e..000000000 --- a/packages/analytics-client-common/src/storage/cookie.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { Storage, CookieStorageOptions } from '@amplitude/analytics-types'; -import { getGlobalScope } from '../global-scope'; - -export class CookieStorage implements Storage { - options: CookieStorageOptions; - private static testValue: undefined | string; - - constructor(options?: CookieStorageOptions) { - this.options = { ...options }; - } - - async isEnabled(): Promise { - /* istanbul ignore if */ - if (!getGlobalScope()) { - return false; - } - - CookieStorage.testValue = String(Date.now()); - const testStrorage = new CookieStorage(this.options); - const testKey = 'AMP_TEST'; - try { - await testStrorage.set(testKey, CookieStorage.testValue); - const value = await testStrorage.get(testKey); - return value === CookieStorage.testValue; - } catch { - /* istanbul ignore next */ - return false; - } finally { - await testStrorage.remove(testKey); - } - } - - async get(key: string): Promise { - const value = await this.getRaw(key); - if (!value) { - return undefined; - } - try { - const decodedValue = decodeCookiesAsDefault(value) ?? decodeCookiesWithDoubleUrlEncoding(value); - if (decodedValue === undefined) { - console.error(`Amplitude Logger [Error]: Failed to decode cookie value for key: ${key}, value: ${value}`); - return undefined; - } - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return JSON.parse(decodedValue); - } catch { - console.error(`Amplitude Logger [Error]: Failed to parse cookie value for key: ${key}, value: ${value}`); - return undefined; - } - } - - async getRaw(key: string): Promise { - const globalScope = getGlobalScope(); - const cookie = globalScope?.document?.cookie.split('; ') ?? []; - const match = cookie.find((c) => c.indexOf(key + '=') === 0); - if (!match) { - return undefined; - } - return match.substring(key.length + 1); - } - - async set(key: string, value: T | null): Promise { - try { - const expirationDays = this.options.expirationDays ?? 0; - const expires = value !== null ? expirationDays : -1; - let expireDate: Date | undefined = undefined; - if (expires) { - const date = new Date(); - date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1000); - expireDate = date; - } - let str = `${key}=${btoa(encodeURIComponent(JSON.stringify(value)))}`; - if (expireDate) { - str += `; expires=${expireDate.toUTCString()}`; - } - str += '; path=/'; - if (this.options.domain) { - str += `; domain=${this.options.domain}`; - } - if (this.options.secure) { - str += '; Secure'; - } - if (this.options.sameSite) { - str += `; SameSite=${this.options.sameSite}`; - } - const globalScope = getGlobalScope(); - if (globalScope) { - globalScope.document.cookie = str; - } - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error(`Amplitude Logger [Error]: Failed to set cookie for key: ${key}. Error: ${errorMessage}`); - } - } - - async remove(key: string): Promise { - await this.set(key, null); - } - - async reset(): Promise { - return; - } -} - -const decodeCookiesAsDefault = (value: string): string | undefined => { - try { - return decodeURIComponent(atob(value)); - } catch { - return undefined; - } -}; - -const decodeCookiesWithDoubleUrlEncoding = (value: string): string | undefined => { - // Modern Ruby (v7+) automatically encodes cookies with URL encoding by - // https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html - try { - return decodeURIComponent(atob(decodeURIComponent(value))); - } catch { - return undefined; - } -}; diff --git a/packages/analytics-client-common/src/storage/helpers.ts b/packages/analytics-client-common/src/storage/helpers.ts deleted file mode 100644 index abad806b8..000000000 --- a/packages/analytics-client-common/src/storage/helpers.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core'; - -export const getStorageKey = (apiKey: string, postKey = '', limit = 10) => { - return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join('_'); -}; diff --git a/packages/analytics-client-common/src/transports/fetch.ts b/packages/analytics-client-common/src/transports/fetch.ts deleted file mode 100644 index 5c7f64837..000000000 --- a/packages/analytics-client-common/src/transports/fetch.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { BaseTransport } from '@amplitude/analytics-core'; -import { Payload, Response, Transport } from '@amplitude/analytics-types'; - -export class FetchTransport extends BaseTransport implements Transport { - async send(serverUrl: string, payload: Payload): Promise { - /* istanbul ignore if */ - if (typeof fetch === 'undefined') { - throw new Error('FetchTransport is not supported'); - } - const options: RequestInit = { - headers: { - 'Content-Type': 'application/json', - Accept: '*/*', - }, - body: JSON.stringify(payload), - method: 'POST', - }; - const response = await fetch(serverUrl, options); - const responseText = await response.text(); - try { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - return this.buildResponse(JSON.parse(responseText)); - } catch { - return this.buildResponse({ code: response.status }); - } - } -} diff --git a/packages/analytics-client-common/src/types/global.ts b/packages/analytics-client-common/src/types/global.ts deleted file mode 100644 index c32301f99..000000000 --- a/packages/analytics-client-common/src/types/global.ts +++ /dev/null @@ -1,3 +0,0 @@ -/* eslint-disable no-restricted-globals */ -// eslint-disable-next-line no-var -export var ampIntegrationContext: typeof globalThis; diff --git a/packages/analytics-client-common/test/analytics-connector.test.ts b/packages/analytics-client-common/test/analytics-connector.test.ts deleted file mode 100644 index 77d65b9aa..000000000 --- a/packages/analytics-client-common/test/analytics-connector.test.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { AnalyticsConnector } from '@amplitude/analytics-connector'; -import { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from '../src/analytics-connector'; - -describe('analytics-connector', () => { - describe('getAnalyticsConnector', () => { - test('should return connector instance', () => { - const instance = new AnalyticsConnector(); - const getInstance = jest.spyOn(AnalyticsConnector, 'getInstance').mockReturnValueOnce(instance); - expect(getAnalyticsConnector()).toBe(instance); - expect(getInstance).toHaveBeenCalledTimes(1); - }); - }); - - describe('setConnectorUserId', () => { - test('should return connector instance', () => { - const commit = jest.fn(); - const identityEditor = { - setUserId: function () { - return this; - }, - setDeviceId: function () { - return this; - }, - setUserProperties: function () { - return this; - }, - updateUserProperties: function () { - return this; - }, - setOptOut: function () { - return this; - }, - commit, - }; - const instance = new AnalyticsConnector(); - jest.spyOn(instance.identityStore, 'editIdentity').mockReturnValueOnce(identityEditor); - const getInstance = jest.spyOn(AnalyticsConnector, 'getInstance').mockReturnValueOnce(instance); - expect(setConnectorUserId('123')).toBe(undefined); - expect(getInstance).toHaveBeenCalledTimes(1); - expect(commit).toHaveBeenCalledTimes(1); - }); - }); - - describe('setConnectorDeviceId', () => { - test('should return connector instance', () => { - const commit = jest.fn(); - const identityEditor = { - setUserId: function () { - return this; - }, - setDeviceId: function () { - return this; - }, - setUserProperties: function () { - return this; - }, - updateUserProperties: function () { - return this; - }, - setOptOut: function () { - return this; - }, - commit, - }; - const instance = new AnalyticsConnector(); - jest.spyOn(instance.identityStore, 'editIdentity').mockReturnValueOnce(identityEditor); - const getInstance = jest.spyOn(AnalyticsConnector, 'getInstance').mockReturnValueOnce(instance); - expect(setConnectorDeviceId('123')).toBe(undefined); - expect(getInstance).toHaveBeenCalledTimes(1); - expect(commit).toHaveBeenCalledTimes(1); - }); - }); -}); diff --git a/packages/analytics-client-common/test/attribution/campaign-parser.test.ts b/packages/analytics-client-common/test/attribution/campaign-parser.test.ts deleted file mode 100644 index c102ffce2..000000000 --- a/packages/analytics-client-common/test/attribution/campaign-parser.test.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { BASE_CAMPAIGN } from '../../src/attribution/constants'; -import { CampaignParser } from '../../src/attribution/campaign-parser'; -import * as queryParams from '../../src/query-params'; - -beforeAll(() => { - Object.defineProperty(window, 'location', { - value: { - hostname: '', - href: '', - pathname: '', - search: '', - }, - writable: true, - }); - Object.defineProperty(document, 'referrer', { - value: '', - writable: true, - }); -}); - -describe('campaign-parser', () => { - describe('parse', () => { - test('should return parameters', async () => { - const parser = new CampaignParser(); - const referringDomain = 'https://google.com'; - const search = '?utm_campaign=utm_campaign&gclid=123'; - (document.referrer as any) = referringDomain; - window.location.search = search; - - const campaign = await parser.parse(); - expect(campaign).toEqual({ - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - referrer: 'https://google.com', - referring_domain: 'google.com', - gclid: '123', - }); - }); - }); - - describe('getUtmParam', () => { - test('should return utm param from query params', async () => { - const parser = new CampaignParser(); - const getQueryParams = jest.spyOn(queryParams, 'getQueryParams'); - window.location.search = - '?utm_source=utm_source&utm_medium=utm_medium&utm_campaign=utm_campaign&utm_term=utm_term&utm_content=utm_content'; - const utmParam = parser.getUtmParam(); - expect(utmParam).toEqual({ - utm_source: 'utm_source', - utm_medium: 'utm_medium', - utm_campaign: 'utm_campaign', - utm_term: 'utm_term', - utm_content: 'utm_content', - }); - expect(getQueryParams).toHaveBeenCalledTimes(1); - }); - }); - - describe('getReferrer', () => { - afterEach(() => { - Object.defineProperty(document, 'referrer', { - value: '', - writable: true, - }); - }); - - test('should return referrer info', () => { - Object.defineProperty(document, 'referrer', { - value: 'https://amplitude.com', - writable: true, - }); - const parser = new CampaignParser(); - const referrer = parser.getReferrer(); - expect(referrer).toEqual({ - referrer: 'https://amplitude.com', - referring_domain: 'amplitude.com', - }); - }); - - test('should return not referrer info', () => { - Object.defineProperty(document, 'referrer', { - value: undefined, - writable: true, - }); - const parser = new CampaignParser(); - const referrer = parser.getReferrer(); - expect(referrer).toEqual({}); - }); - }); - - describe('getGclid', () => { - test('should return gclid data', () => { - const parser = new CampaignParser(); - jest.spyOn(queryParams, 'getQueryParams').mockReturnValueOnce({ - gclid: 'hello google', - fbclid: 'hello fb', - }); - const data = parser.getClickIds(); - expect(data).toEqual({ - gclid: 'hello google', - fbclid: 'hello fb', - }); - }); - - test('should return empty data', () => { - const parser = new CampaignParser(); - jest.spyOn(queryParams, 'getQueryParams').mockReturnValueOnce({}); - const data = parser.getClickIds(); - expect(data).toEqual({}); - }); - }); -}); diff --git a/packages/analytics-client-common/test/attribution/campaign-tracker.test.ts b/packages/analytics-client-common/test/attribution/campaign-tracker.test.ts deleted file mode 100644 index fb64aa278..000000000 --- a/packages/analytics-client-common/test/attribution/campaign-tracker.test.ts +++ /dev/null @@ -1,383 +0,0 @@ -import { API_KEY } from '../helpers/constants'; -import { CampaignTracker } from '../../src/attribution/campaign-tracker'; -import { BASE_CAMPAIGN } from '../../src/attribution/constants'; -import { MemoryStorage } from '@amplitude/analytics-core'; -import { Campaign } from '@amplitude/analytics-types'; - -describe('CampaignTracker', () => { - describe('isNewCampaign', () => { - test('should return true for new campaign', () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const previousCampaign = { - ...BASE_CAMPAIGN, - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - }; - expect(campaignTracker.isNewCampaign(currentCampaign, previousCampaign)).toBe(true); - }); - - test('should return true for new referrer', () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const previousCampaign = { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - referring_domain: 'a', - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - referring_domain: 'b', - }; - expect(campaignTracker.isNewCampaign(currentCampaign, previousCampaign)).toBe(true); - }); - - test('should return false for excluded referrer', () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - excludeReferrers: ['a'], - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const previousCampaign = { - ...BASE_CAMPAIGN, - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - referring_domain: 'a', - }; - expect(campaignTracker.isNewCampaign(currentCampaign, previousCampaign)).toBe(false); - }); - - test('should return true for undefined previous campaign', () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - excludeReferrers: ['a'], - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const previousCampaign = undefined; - const currentCampaign = { - ...BASE_CAMPAIGN, - }; - expect(campaignTracker.isNewCampaign(currentCampaign, previousCampaign)).toBe(true); - }); - - test('should return false for undefined previous campaign and excluded referrer', () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - excludeReferrers: ['a'], - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const previousCampaign = undefined; - const currentCampaign = { - ...BASE_CAMPAIGN, - referring_domain: 'a', - }; - expect(campaignTracker.isNewCampaign(currentCampaign, previousCampaign)).toBe(false); - }); - }); - - describe('saveCampaignToStorage', () => { - test('should save campaign', async () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const set = jest.spyOn(campaignTracker.storage, 'set'); - await campaignTracker.saveCampaignToStorage({ - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - }); - expect(set).toHaveBeenCalledTimes(1); - }); - }); - - describe('getCampaignFromStorage', () => { - test('should get campaign', async () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const get = jest.spyOn(campaignTracker.storage, 'get'); - expect(await campaignTracker.getCampaignFromStorage()).toEqual(undefined); - expect(get).toHaveBeenCalledTimes(1); - }); - }); - - describe('createCampaignEvent', () => { - test('should return event', () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - trackPageViews: true, - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const campaignEvent = campaignTracker.createCampaignEvent({ - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - }); - expect(campaignEvent).toEqual({ - event_type: 'Page View', - event_properties: { - page_location: 'http://localhost/', - page_path: '/', - page_title: '', - }, - user_id: undefined, - user_properties: { - $set: { - utm_campaign: 'utm_campaign', - }, - $setOnce: { - initial_dclid: 'EMPTY', - initial_fbclid: 'EMPTY', - initial_gbraid: 'EMPTY', - initial_gclid: 'EMPTY', - initial_ko_click_id: 'EMPTY', - initial_li_fat_id: 'EMPTY', - initial_msclkid: 'EMPTY', - initial_wbraid: 'EMPTY', - initial_referrer: 'EMPTY', - initial_referring_domain: 'EMPTY', - initial_rtd_cid: 'EMPTY', - initial_ttclid: 'EMPTY', - initial_twclid: 'EMPTY', - initial_utm_campaign: 'utm_campaign', - initial_utm_content: 'EMPTY', - initial_utm_id: 'EMPTY', - initial_utm_medium: 'EMPTY', - initial_utm_source: 'EMPTY', - initial_utm_term: 'EMPTY', - }, - $unset: { - dclid: '-', - fbclid: '-', - gbraid: '-', - gclid: '-', - ko_click_id: '-', - li_fat_id: '-', - msclkid: '-', - wbraid: '-', - referrer: '-', - referring_domain: '-', - rtd_cid: '-', - ttclid: '-', - twclid: '-', - utm_content: '-', - utm_id: '-', - utm_medium: '-', - utm_source: '-', - utm_term: '-', - }, - }, - }); - }); - - test('should return event with custom empty value', () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - initialEmptyValue: '(none)', - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const campaignEvent = campaignTracker.createCampaignEvent({ - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - }); - expect(campaignEvent).toEqual({ - event_type: '$identify', - user_id: undefined, - user_properties: { - $set: { - utm_campaign: 'utm_campaign', - }, - $setOnce: { - initial_dclid: '(none)', - initial_fbclid: '(none)', - initial_gbraid: '(none)', - initial_gclid: '(none)', - initial_ko_click_id: '(none)', - initial_li_fat_id: '(none)', - initial_msclkid: '(none)', - initial_wbraid: '(none)', - initial_referrer: '(none)', - initial_referring_domain: '(none)', - initial_rtd_cid: '(none)', - initial_ttclid: '(none)', - initial_twclid: '(none)', - initial_utm_campaign: 'utm_campaign', - initial_utm_content: '(none)', - initial_utm_id: '(none)', - initial_utm_medium: '(none)', - initial_utm_source: '(none)', - initial_utm_term: '(none)', - }, - $unset: { - dclid: '-', - fbclid: '-', - gbraid: '-', - gclid: '-', - ko_click_id: '-', - li_fat_id: '-', - msclkid: '-', - wbraid: '-', - referrer: '-', - referring_domain: '-', - rtd_cid: '-', - ttclid: '-', - twclid: '-', - utm_content: '-', - utm_id: '-', - utm_medium: '-', - utm_source: '-', - utm_term: '-', - }, - }, - }); - }); - }); - - describe('send', () => { - test('should force track', async () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const track = jest.spyOn(campaignTracker, 'track').mockReturnValueOnce(Promise.resolve()); - const saveCampaignToStorage = jest - .spyOn(campaignTracker, 'saveCampaignToStorage') - .mockResolvedValueOnce(undefined); - await campaignTracker.send(true); - expect(track).toHaveBeenCalledTimes(1); - expect(saveCampaignToStorage).toHaveBeenCalledTimes(1); - }); - - test('should disbale tracking', async () => { - const config = { - disabled: true, - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: jest.fn(), - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const track = jest.spyOn(campaignTracker, 'track').mockReturnValueOnce(Promise.resolve()); - const saveCampaignToStorage = jest - .spyOn(campaignTracker, 'saveCampaignToStorage') - .mockResolvedValueOnce(undefined); - await campaignTracker.send(true); - expect(track).toHaveBeenCalledTimes(0); - expect(saveCampaignToStorage).toHaveBeenCalledTimes(0); - }); - - test('should track new campaigns', async () => { - const onNewCampaign = jest.fn(); - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign, - trackNewCampaigns: true, - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const isNewCampaign = jest.spyOn(campaignTracker, 'isNewCampaign').mockReturnValueOnce(true); - const track = jest.spyOn(campaignTracker, 'track').mockReturnValueOnce(Promise.resolve()); - const saveCampaignToStorage = jest - .spyOn(campaignTracker, 'saveCampaignToStorage') - .mockResolvedValueOnce(undefined); - await campaignTracker.send(false); - expect(onNewCampaign).toHaveBeenCalledTimes(1); - expect(isNewCampaign).toHaveBeenCalledTimes(1); - expect(track).toHaveBeenCalledTimes(1); - expect(saveCampaignToStorage).toHaveBeenCalledTimes(1); - }); - - test('should not track same campaigns', async () => { - const onNewCampaign = jest.fn(); - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign, - trackNewCampaigns: true, - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const isNewCampaign = jest.spyOn(campaignTracker, 'isNewCampaign').mockReturnValueOnce(false); - const track = jest.spyOn(campaignTracker, 'track').mockReturnValueOnce(Promise.resolve()); - const saveCampaignToStorage = jest - .spyOn(campaignTracker, 'saveCampaignToStorage') - .mockResolvedValueOnce(undefined); - await campaignTracker.send(false); - expect(onNewCampaign).toHaveBeenCalledTimes(0); - expect(isNewCampaign).toHaveBeenCalledTimes(1); - expect(track).toHaveBeenCalledTimes(0); - expect(saveCampaignToStorage).toHaveBeenCalledTimes(0); - }); - - test('should not track new campaigns', async () => { - const onNewCampaign = jest.fn(); - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign, - trackNewCampaigns: false, - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const track = jest.spyOn(campaignTracker, 'track').mockReturnValueOnce(Promise.resolve()); - const saveCampaignToStorage = jest - .spyOn(campaignTracker, 'saveCampaignToStorage') - .mockResolvedValueOnce(undefined); - await campaignTracker.send(false); - expect(onNewCampaign).toHaveBeenCalledTimes(0); - expect(track).toHaveBeenCalledTimes(0); - expect(saveCampaignToStorage).toHaveBeenCalledTimes(0); - }); - }); - - describe('domain comparison without subdomains', () => { - const cases = [ - ['amplitude.com', 'www.amplitude.com', false] as const, - ['google.com', 'amplitude.com', true] as const, - ['', '', false] as const, - ['www.amplitude.com', 'www.amplitude.com', false] as const, - ['', 'www.amplitude.com', true] as const, - ]; - for (const [domain1, domain2, isNewCampaign] of cases) { - test(`for "${domain1}" and "${domain2}", should track new campaign: ${isNewCampaign.toString()} `, () => { - const config = { - storage: new MemoryStorage(), - track: jest.fn(), - onNewCampaign: () => false, - }; - const campaignTracker = new CampaignTracker(API_KEY, config); - const result = campaignTracker.isNewCampaign( - { referring_domain: domain1 } as Campaign, - { referring_domain: domain2 } as Campaign, - true, - ); - expect(result).toBe(isNewCampaign); - }); - } - }); -}); diff --git a/packages/analytics-client-common/test/attribution/helpers.test.ts b/packages/analytics-client-common/test/attribution/helpers.test.ts deleted file mode 100644 index 04ef1a095..000000000 --- a/packages/analytics-client-common/test/attribution/helpers.test.ts +++ /dev/null @@ -1,328 +0,0 @@ -import { BASE_CAMPAIGN } from '../../src/attribution/constants'; -import { - isNewCampaign, - createCampaignEvent, - getDefaultExcludedReferrers, - isExcludedReferrer, -} from '../../src/attribution/helpers'; - -import { getStorageKey } from '../../src/storage/helpers'; - -const loggerProvider = { - log: jest.fn(), - debug: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - enable: jest.fn(), - disable: jest.fn(), -}; - -describe('getStorageKey', () => { - test('should return storage key without explicit suffix and limit', () => { - expect(getStorageKey('API_KEY')).toBe('AMP_API_KEY'); - }); - - test('should return storage key', () => { - expect(getStorageKey('API_KEY', 'MKTG', 3)).toBe('AMP_MKTG_API'); - }); -}); - -describe('isNewCampaign', () => { - test('should return true for new campaign', () => { - const previousCampaign = { - ...BASE_CAMPAIGN, - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - }; - expect(isNewCampaign(currentCampaign, previousCampaign, {}, loggerProvider)).toBe(true); - }); - - test('should return true for new referrer', () => { - const previousCampaign = { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - referring_domain: 'a.b.c.d', - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - referring_domain: 'b.c.d.e', - }; - expect(isNewCampaign(currentCampaign, previousCampaign, {}, loggerProvider)).toBe(true); - }); - - test('should return false for string excluded referrer', () => { - const previousCampaign = { - ...BASE_CAMPAIGN, - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - referring_domain: 'amplitude.com', - }; - expect( - isNewCampaign( - currentCampaign, - previousCampaign, - { - excludeReferrers: ['amplitude.com'], - }, - loggerProvider, - ), - ).toBe(false); - }); - - test('should return false for regexp excluded referrer', () => { - const previousCampaign = { - ...BASE_CAMPAIGN, - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - referring_domain: 'amplitude.com', - }; - expect( - isNewCampaign( - currentCampaign, - previousCampaign, - { - excludeReferrers: getDefaultExcludedReferrers('.amplitude.com'), - }, - loggerProvider, - ), - ).toBe(false); - }); - - test('should return false for cross subdomain regexp excluded referrer', () => { - const previousCampaign = { - ...BASE_CAMPAIGN, - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - referring_domain: 'analytics.amplitude.com', - }; - expect( - isNewCampaign( - currentCampaign, - previousCampaign, - { - excludeReferrers: getDefaultExcludedReferrers('.amplitude.com'), - }, - loggerProvider, - ), - ).toBe(false); - }); - - test('should return true for undefined previous campaign', () => { - const previousCampaign = undefined; - const currentCampaign = { - ...BASE_CAMPAIGN, - }; - expect( - isNewCampaign( - currentCampaign, - previousCampaign, - { - excludeReferrers: ['a'], - }, - loggerProvider, - ), - ).toBe(true); - }); - - test('should return false for undefined previous campaign and excluded referrer', () => { - const previousCampaign = undefined; - const currentCampaign = { - ...BASE_CAMPAIGN, - referring_domain: 'a', - }; - expect( - isNewCampaign( - currentCampaign, - previousCampaign, - { - excludeReferrers: ['a'], - }, - loggerProvider, - ), - ).toBe(false); - }); - - test('should return false for no extra referrer with direct traffic in the same session', () => { - const previousCampaign = { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - referring_domain: 'a.b.c.d', - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - }; - - expect(isNewCampaign(currentCampaign, previousCampaign, {}, loggerProvider, false)).toBe(false); - }); - - test('should return true for no referrer with any new campaign in the same session', () => { - const previousCampaign = { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - referring_domain: 'a.b.c.d', - }; - const currentCampaign = { - ...BASE_CAMPAIGN, - utm_source: 'utm_source', - }; - - expect(isNewCampaign(currentCampaign, previousCampaign, {}, loggerProvider, false)).toBe(true); - }); -}); - -describe('isExcludedReferrer', () => { - test('should return true with string excluded referrer', () => { - expect(isExcludedReferrer(['data.amplitude.com'], 'data.amplitude.com')).toEqual(true); - }); - - test('should return true with regexp excluded referrer', () => { - expect(isExcludedReferrer(getDefaultExcludedReferrers('.amplitude.com'), 'data.amplitude.com')).toEqual(true); - }); -}); - -describe('createCampaignEvent', () => { - test('should return event', () => { - const campaignEvent = createCampaignEvent( - { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - }, - {}, - ); - expect(campaignEvent).toEqual({ - event_type: '$identify', - user_id: undefined, - user_properties: { - $set: { - utm_campaign: 'utm_campaign', - }, - $setOnce: { - initial_dclid: 'EMPTY', - initial_fbclid: 'EMPTY', - initial_gbraid: 'EMPTY', - initial_gclid: 'EMPTY', - initial_ko_click_id: 'EMPTY', - initial_li_fat_id: 'EMPTY', - initial_msclkid: 'EMPTY', - initial_wbraid: 'EMPTY', - initial_referrer: 'EMPTY', - initial_referring_domain: 'EMPTY', - initial_rtd_cid: 'EMPTY', - initial_ttclid: 'EMPTY', - initial_twclid: 'EMPTY', - initial_utm_campaign: 'utm_campaign', - initial_utm_content: 'EMPTY', - initial_utm_id: 'EMPTY', - initial_utm_medium: 'EMPTY', - initial_utm_source: 'EMPTY', - initial_utm_term: 'EMPTY', - }, - $unset: { - dclid: '-', - fbclid: '-', - gbraid: '-', - gclid: '-', - ko_click_id: '-', - li_fat_id: '-', - msclkid: '-', - wbraid: '-', - referrer: '-', - referring_domain: '-', - rtd_cid: '-', - ttclid: '-', - twclid: '-', - utm_content: '-', - utm_id: '-', - utm_medium: '-', - utm_source: '-', - utm_term: '-', - }, - }, - }); - }); - - test('should return event with custom empty value', () => { - const campaignEvent = createCampaignEvent( - { - ...BASE_CAMPAIGN, - utm_campaign: 'utm_campaign', - }, - { - initialEmptyValue: '(none)', - }, - ); - expect(campaignEvent).toEqual({ - event_type: '$identify', - user_id: undefined, - user_properties: { - $set: { - utm_campaign: 'utm_campaign', - }, - $setOnce: { - initial_dclid: '(none)', - initial_fbclid: '(none)', - initial_gbraid: '(none)', - initial_gclid: '(none)', - initial_ko_click_id: '(none)', - initial_li_fat_id: '(none)', - initial_msclkid: '(none)', - initial_wbraid: '(none)', - initial_referrer: '(none)', - initial_referring_domain: '(none)', - initial_rtd_cid: '(none)', - initial_ttclid: '(none)', - initial_twclid: '(none)', - initial_utm_campaign: 'utm_campaign', - initial_utm_content: '(none)', - initial_utm_id: '(none)', - initial_utm_medium: '(none)', - initial_utm_source: '(none)', - initial_utm_term: '(none)', - }, - $unset: { - dclid: '-', - fbclid: '-', - gbraid: '-', - gclid: '-', - ko_click_id: '-', - li_fat_id: '-', - msclkid: '-', - wbraid: '-', - referrer: '-', - referring_domain: '-', - rtd_cid: '-', - ttclid: '-', - twclid: '-', - utm_content: '-', - utm_id: '-', - utm_medium: '-', - utm_source: '-', - utm_term: '-', - }, - }, - }); - }); -}); - -describe('getDefaultExcludedReferrers', () => { - test('should return empty array', () => { - const excludedReferrers = getDefaultExcludedReferrers(undefined); - expect(excludedReferrers).toEqual([]); - }); - - test('should return array with regex 1', () => { - const excludedReferrers = getDefaultExcludedReferrers('amplitude.com'); - expect(excludedReferrers).toEqual([new RegExp('amplitude\\.com$')]); - }); - - test('should return array with regex 2', () => { - const excludedReferrers = getDefaultExcludedReferrers('.amplitude.com'); - expect(excludedReferrers).toEqual([new RegExp('amplitude\\.com$')]); - }); -}); diff --git a/packages/analytics-client-common/test/attribution/web-attribution.test.ts b/packages/analytics-client-common/test/attribution/web-attribution.test.ts deleted file mode 100644 index 71f06b3b9..000000000 --- a/packages/analytics-client-common/test/attribution/web-attribution.test.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { Logger, UUID } from '@amplitude/analytics-core'; -import { AttributionOptions, BrowserConfig, LogLevel } from '@amplitude/analytics-types'; -import { BASE_CAMPAIGN } from '../../src/attribution/constants'; -import { CampaignParser } from '../../src/attribution/campaign-parser'; -import { WebAttribution } from '../../src/attribution/web-attribution'; -import { FetchTransport } from '../../src/transports/fetch'; -import { CookieStorage } from '../../src/storage/cookie'; - -describe('shouldTrackNewCampaign', () => { - const mockConfig: BrowserConfig = { - apiKey: UUID(), - flushIntervalMillis: 0, - flushMaxRetries: 0, - flushQueueSize: 0, - logLevel: LogLevel.None, - loggerProvider: new Logger(), - offline: false, - optOut: false, - serverUrl: undefined, - transportProvider: new FetchTransport(), - useBatch: false, - cookieOptions: { - domain: '.amplitude.com', - expiration: 365, - sameSite: 'Lax', - secure: false, - upgrade: true, - }, - cookieStorage: new CookieStorage(), - sessionTimeout: 30 * 60 * 1000, - trackingOptions: { - ipAddress: true, - language: true, - platform: true, - }, - }; - const option: AttributionOptions = {}; - - test('should track campaign with new campaign', async () => { - const overrideMockConfig = { - ...mockConfig, - cookieOptions: undefined, - }; - const webAttribution = new WebAttribution(option, overrideMockConfig); - - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValueOnce({ - ...BASE_CAMPAIGN, - utm_source: 'amp-test', - }); - jest.spyOn(webAttribution.storage, 'get').mockResolvedValueOnce({ - ...BASE_CAMPAIGN, - }); - - await webAttribution.init(); - expect(webAttribution.shouldTrackNewCampaign).toBe(true); - }); - - test('should not track campaign without new campaign', async () => { - const overrideMockConfig = { - ...mockConfig, - cookieOptions: undefined, - }; - const emptyCampaign = { ...BASE_CAMPAIGN }; - const webAttribution = new WebAttribution(option, overrideMockConfig); - - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValue(emptyCampaign); - jest.spyOn(webAttribution.storage, 'get').mockResolvedValue(emptyCampaign); - - await webAttribution.init(); - expect(webAttribution.shouldTrackNewCampaign).toBe(false); - }); - - test('should generate campaign event with given eventId', async () => { - const webAttribution = new WebAttribution(option, mockConfig); - const event_id = 1; - const campaignEvent = webAttribution.generateCampaignEvent(event_id); - expect(campaignEvent.event_id).toBe(event_id); - }); - - test('should set session id on a new Campaign', async () => { - const option = { - resetSessionOnNewCampaign: true, - }; - const webAttribution = new WebAttribution(option, mockConfig); - await webAttribution.init(); - - expect(webAttribution.shouldSetSessionIdOnNewCampaign()).toBe(true); - }); - - test('should not set session id on a new Campaign', async () => { - const option = { - resetSessionOnNewCampaign: true, - }; - const webAttribution = new WebAttribution(option, mockConfig); - await webAttribution.init(); - - webAttribution.generateCampaignEvent(); - expect(webAttribution.shouldSetSessionIdOnNewCampaign()).toBe(false); - }); - - test('should ignore the campaign for direct traffic in session', async () => { - const lastEventTime = Date.now(); - - const overrideMockConfig = { - ...mockConfig, - // In session event - lastEventTime, - }; - const webAttribution = new WebAttribution({}, overrideMockConfig); - const previousCampaign = { - ...BASE_CAMPAIGN, - referrer: 'https://www.google.com', - referring_domain: 'www.google.com', - }; - - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValue(BASE_CAMPAIGN); // Direct Traffic - jest.spyOn(webAttribution.storage, 'get').mockResolvedValue(previousCampaign); - - await webAttribution.init(); - expect(webAttribution.shouldTrackNewCampaign).toBe(false); - }); - - test('should not ignore the campaign for direct traffic in new session', async () => { - const lastEventTime = Date.now() - 2 * 30 * 60 * 1000; - - const overrideMockConfig = { - ...mockConfig, - // Out of session event - lastEventTime, - }; - - const webAttribution = new WebAttribution({}, overrideMockConfig); - const previousCampaign = { - ...BASE_CAMPAIGN, - referrer: 'https://www.google.com', - referring_domain: 'www.google.com', - }; - - jest.spyOn(CampaignParser.prototype, 'parse').mockResolvedValue(BASE_CAMPAIGN); // Direct Traffic - jest.spyOn(webAttribution.storage, 'get').mockResolvedValue(previousCampaign); - - await webAttribution.init(); - expect(webAttribution.shouldTrackNewCampaign).toBe(true); - }); -}); diff --git a/packages/analytics-client-common/test/cookie-name.test.ts b/packages/analytics-client-common/test/cookie-name.test.ts deleted file mode 100644 index 297c61efb..000000000 --- a/packages/analytics-client-common/test/cookie-name.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { getCookieName, getOldCookieName } from '../src/cookie-name'; -import { API_KEY } from './helpers/constants'; - -describe('cookie-name', () => { - describe('getCookieName', () => { - test('should return cookie name', () => { - expect(getCookieName(API_KEY)).toBe('AMP_apiKey'); - }); - - test('should handle apiKey is empty string', () => { - expect(getCookieName('')).toBe('AMP'); - }); - }); - - describe('getOldCookieName', () => { - test('should return cookie name', () => { - expect(getOldCookieName(API_KEY)).toBe('amp_apiKey'); - }); - - test('should handle apiKey is empty string', () => { - expect(getOldCookieName('')).toBe('amp_'); - }); - }); -}); diff --git a/packages/analytics-client-common/test/default-tracking.test.ts b/packages/analytics-client-common/test/default-tracking.test.ts deleted file mode 100644 index eaa502262..000000000 --- a/packages/analytics-client-common/test/default-tracking.test.ts +++ /dev/null @@ -1,336 +0,0 @@ -import { - getAttributionTrackingConfig, - getPageViewTrackingConfig, - getElementInteractionsConfig, - isAttributionTrackingEnabled, - isFileDownloadTrackingEnabled, - isFormInteractionTrackingEnabled, - isPageViewTrackingEnabled, - isSessionTrackingEnabled, - isElementInteractionsEnabled, -} from '../src/default-tracking'; - -describe('isFileDownloadTrackingEnabled', () => { - test('should return true with true parameter', () => { - expect(isFileDownloadTrackingEnabled(true)).toBe(true); - }); - - test('should return true with undefined parameter', () => { - expect(isFileDownloadTrackingEnabled(undefined)).toBe(true); - }); - - test('should return false with false parameter', () => { - expect(isFileDownloadTrackingEnabled(false)).toBe(false); - }); - - test('should return true with object parameter', () => { - expect( - isFileDownloadTrackingEnabled({ - fileDownloads: true, - }), - ).toBe(true); - }); - - test('should return false with object parameter', () => { - expect( - isFileDownloadTrackingEnabled({ - fileDownloads: false, - }), - ).toBe(false); - }); -}); - -describe('isFormInteractionTrackingEnabled', () => { - test('should return true with true parameter', () => { - expect(isFormInteractionTrackingEnabled(true)).toBe(true); - }); - - test('should return true with undefined parameter', () => { - expect(isFormInteractionTrackingEnabled(undefined)).toBe(true); - }); - - test('should return false with false parameter', () => { - expect(isFormInteractionTrackingEnabled(false)).toBe(false); - }); - - test('should return true with object parameter', () => { - expect( - isFormInteractionTrackingEnabled({ - formInteractions: true, - }), - ).toBe(true); - }); - - test('should return false with object parameter', () => { - expect( - isFormInteractionTrackingEnabled({ - formInteractions: false, - }), - ).toBe(false); - }); -}); - -describe('isPageViewTrackingEnabled', () => { - test('should return true with true parameter', () => { - expect(isPageViewTrackingEnabled(true)).toBe(true); - }); - - test('should return true with undefined parameter', () => { - expect(isPageViewTrackingEnabled(undefined)).toBe(true); - }); - - test('should return true with false parameter', () => { - expect(isPageViewTrackingEnabled(false)).toBe(false); - }); - - test('should return true with object parameter', () => { - expect( - isPageViewTrackingEnabled({ - pageViews: true, - }), - ).toBe(true); - }); - - test('should return false with object parameter', () => { - expect( - isPageViewTrackingEnabled({ - pageViews: false, - }), - ).toBe(false); - }); - - test('should return true with nested object parameter', () => { - expect( - isPageViewTrackingEnabled({ - pageViews: {}, - }), - ).toBe(true); - }); -}); - -describe('isSessionTrackingEnabled', () => { - test('should return true with true parameter', () => { - expect(isSessionTrackingEnabled(true)).toBe(true); - }); - - test('should return true with undefined parameter', () => { - expect(isSessionTrackingEnabled(undefined)).toBe(true); - }); - - test('should return false with false parameter', () => { - expect(isSessionTrackingEnabled(false)).toBe(false); - }); - - test('should return true with object parameter', () => { - expect( - isSessionTrackingEnabled({ - sessions: true, - }), - ).toBe(true); - }); - - test('should return false with object parameter', () => { - expect( - isSessionTrackingEnabled({ - sessions: false, - }), - ).toBe(false); - }); -}); - -describe('isAttributionTrackingEnabled', () => { - test('should return true with true parameter', () => { - expect(isAttributionTrackingEnabled(true)).toBe(true); - }); - - test('should return true with undefined parameter', () => { - expect(isAttributionTrackingEnabled(undefined)).toBe(true); - }); - - test('should return false with false parameter', () => { - expect(isAttributionTrackingEnabled(false)).toBe(false); - }); - - test('should return true with object parameter', () => { - expect( - isAttributionTrackingEnabled({ - attribution: true, - }), - ).toBe(true); - }); - - test('should return false with object parameter', () => { - expect( - isAttributionTrackingEnabled({ - attribution: false, - }), - ).toBe(false); - }); -}); - -describe('isElementInteractionsEnabled', () => { - test('should return true with true parameter', () => { - expect(isElementInteractionsEnabled(true)).toBe(true); - }); - - test('should return false with undefined parameter', () => { - expect(isElementInteractionsEnabled(undefined)).toBe(false); - }); - - test('should return false with false parameter', () => { - expect(isElementInteractionsEnabled(false)).toBe(false); - }); - - test('should return true with object parameter', () => { - expect( - isElementInteractionsEnabled({ - elementInteractions: true, - }), - ).toBe(true); - }); - - test('should return false with object parameter', () => { - expect( - isElementInteractionsEnabled({ - elementInteractions: false, - }), - ).toBe(false); - }); - - test('should return false with object parameter undefined', () => { - expect( - isElementInteractionsEnabled({ - elementInteractions: undefined, - }), - ).toBe(false); - }); -}); - -describe('getPageViewTrackingConfig', () => { - test('should return undefined trackOn config', () => { - const config = getPageViewTrackingConfig({ - defaultTracking: { - pageViews: true, - }, - }); - - expect(config.trackOn).toBe(undefined); - }); - - test('should return trackOn config returning false', () => { - const config = getPageViewTrackingConfig({ - defaultTracking: { - pageViews: false, - }, - }); - - expect(typeof config.trackOn).toBe('function'); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore asserts that track on is a function that returns a boolean - expect(config.trackOn()).toBe(false); - }); - - test('should return advanced options', () => { - const config = getPageViewTrackingConfig({ - defaultTracking: { - pageViews: { - trackOn: 'attribution', - trackHistoryChanges: 'all', - eventType: 'Page View', - }, - }, - }); - - expect(typeof config.trackOn).toBe('string'); - expect(config.trackOn).toBe('attribution'); - expect(config.trackHistoryChanges).toBe('all'); - expect(config.eventType).toBe('Page View'); - }); -}); - -describe('getAttributionTrackingConfig', () => { - test('should return disabled config', () => { - const config = getAttributionTrackingConfig({ - defaultTracking: { - attribution: false, - }, - }); - expect(config).toEqual({ - excludeReferrers: undefined, - initialEmptyValue: undefined, - resetSessionOnNewCampaign: undefined, - }); - }); - - test('should return default config', () => { - const config = getAttributionTrackingConfig({ - defaultTracking: { - attribution: {}, - }, - }); - expect(config).toEqual({ - excludeReferrers: undefined, - initialEmptyValue: undefined, - resetSessionOnNewCampaign: undefined, - }); - }); - - test('should return custom config', () => { - const config = getAttributionTrackingConfig({ - defaultTracking: { - attribution: { - excludeReferrers: [], - initialEmptyValue: 'EMPTY', - resetSessionOnNewCampaign: true, - }, - }, - }); - expect(config).toEqual({ - excludeReferrers: [], - initialEmptyValue: 'EMPTY', - resetSessionOnNewCampaign: true, - }); - }); -}); - -describe('getElementInteractionsConfig', () => { - test('should return an empty object when autocapture is true', () => { - const config = getElementInteractionsConfig({ - autocapture: true, - }); - - expect(config).toBeUndefined(); - }); - - test('should return an empty object when userInteraction is true', () => { - const config = getElementInteractionsConfig({ - autocapture: { - elementInteractions: true, - }, - }); - - expect(config).toBeUndefined(); - }); - - test('should return advanced options', () => { - const testCssSelectorAllowlist = ['button']; - const testPageUrlAllowlist = ['example.com']; - const mockedShouldTrackEventResolver = jest.fn(() => true); - const testDataAttributePrefix = 'data-amp-track'; - const config = getElementInteractionsConfig({ - autocapture: { - elementInteractions: { - cssSelectorAllowlist: testCssSelectorAllowlist, - pageUrlAllowlist: testPageUrlAllowlist, - shouldTrackEventResolver: mockedShouldTrackEventResolver, - dataAttributePrefix: testDataAttributePrefix, - }, - }, - }); - - expect(config?.cssSelectorAllowlist).toBe(testCssSelectorAllowlist); - expect(config?.pageUrlAllowlist).toBe(testPageUrlAllowlist); - expect(config?.shouldTrackEventResolver).toBe(mockedShouldTrackEventResolver); - expect(config?.dataAttributePrefix).toBe(testDataAttributePrefix); - }); -}); diff --git a/packages/analytics-client-common/test/global-scope.test.ts b/packages/analytics-client-common/test/global-scope.test.ts deleted file mode 100644 index 9b96c5b56..000000000 --- a/packages/analytics-client-common/test/global-scope.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -import { getGlobalScope } from '../src/global-scope'; - -describe('getGlobalScope', () => { - let originalGlobalThis: any; - - beforeEach(() => { - originalGlobalThis = globalThis; - }); - - afterEach(() => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - globalThis = originalGlobalThis; - delete (globalThis as any).ampIntegrationContext; - }); - - test('returns ampIntegrationContext if it exists', () => { - (globalThis as any).ampIntegrationContext = { someKey: 'someValue' }; - expect(getGlobalScope()).toBe((globalThis as any).ampIntegrationContext); - }); - - test('returns globalThis if ampIntegrationContext does not exist', () => { - const scope = getGlobalScope(); - // Need to use Object.is because expect(scope).toBe(globalThis) will throw an error - expect(Object.is(scope, globalThis)).toBeTruthy(); - }); - - test('should return window if globalThis is undefined and window is defined', () => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - globalThis = undefined; - - const scope = getGlobalScope(); - - // Note: We NEED to reassign globalThis to its original state because the jest expect function requires it - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - globalThis = originalGlobalThis; - // Need to use Object.is because expect(scope).toBe(globalThis) will throw an error - expect(Object.is(scope, window)).toBeTruthy(); - }); -}); diff --git a/packages/analytics-client-common/test/helpers/constants.ts b/packages/analytics-client-common/test/helpers/constants.ts deleted file mode 100644 index 2e5a7d1f1..000000000 --- a/packages/analytics-client-common/test/helpers/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const API_KEY = 'apiKey'; diff --git a/packages/analytics-client-common/test/language.test.ts b/packages/analytics-client-common/test/language.test.ts deleted file mode 100644 index e914814ea..000000000 --- a/packages/analytics-client-common/test/language.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { getLanguage } from '../src/language'; -interface Navigator { - language: string | undefined; - languages: string[] | undefined; - userLanguage: string | undefined; -} - -describe('language', () => { - // Simulates other browser version - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - const nav: Navigator = navigator; - - beforeAll(() => { - Object.defineProperty(nav, 'userLanguage', { - get: () => '', - configurable: true, - enumerable: true, - }); - }); - - afterAll(() => { - if (nav.userLanguage) { - delete nav.userLanguage; - } - }); - - test('should return a language', () => { - enableNavigatorLanguageProperties(['languages', 'language', 'userLanguage']); - expect(getLanguage()).not.toBeNull(); - }); - - test('should prioritize the first language of navigator.languages', () => { - enableNavigatorLanguageProperties(['languages', 'language', 'userLanguage']); - expect(getLanguage()).toBe('some-locale'); - }); - - test('should secondly use the language of navigator.language', () => { - enableNavigatorLanguageProperties(['language', 'userLanguage']); - expect(getLanguage()).toBe('some-second-locale'); - }); - - test('should thirdly use the language of navigator.userLanguage', () => { - enableNavigatorLanguageProperties(['userLanguage']); - expect(getLanguage()).toBe('some-third-locale'); - }); - - test('should return empty string if navigator language is not set', () => { - enableNavigatorLanguageProperties([]); - expect(getLanguage()).toBe(''); - }); - - test('should return empty string if navigator is not set', () => { - jest.spyOn(window as any, 'navigator', 'get').mockReturnValue(undefined); - expect(getLanguage()).toBe(''); - }); - - function enableNavigatorLanguageProperties(properties: Array<'languages' | 'language' | 'userLanguage'>) { - jest - .spyOn(nav, 'languages', 'get') - .mockReturnValue(properties.includes('languages') ? ['some-locale', 'some-other-locale'] : undefined); - jest - .spyOn(nav, 'language', 'get') - .mockReturnValue(properties.includes('language') ? 'some-second-locale' : undefined); - jest - .spyOn(nav, 'userLanguage', 'get') - .mockReturnValue(properties.includes('userLanguage') ? 'some-third-locale' : undefined); - } -}); diff --git a/packages/analytics-client-common/test/plugins/identity.test.ts b/packages/analytics-client-common/test/plugins/identity.test.ts deleted file mode 100644 index 1e005d860..000000000 --- a/packages/analytics-client-common/test/plugins/identity.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { IdentityEventSender } from '../../src/plugins/identity'; -import { Config } from '@amplitude/analytics-types'; -import { getAnalyticsConnector } from '../../src/analytics-connector'; - -describe('identity', () => { - describe('execute', () => { - beforeEach(() => { - getAnalyticsConnector().identityStore.setIdentity({ userProperties: {} }); - }); - - test('should set identity in analytics connector on identify with default instance', async () => { - const plugin = new IdentityEventSender(); - await plugin.setup({} as Config); - const event = { - event_type: '$identify', - user_properties: { - $set: { k: 'v' }, - }, - }; - const result = await plugin.execute(event); - const identity = getAnalyticsConnector().identityStore.getIdentity(); - expect(result).toEqual(event); - expect(identity.userProperties).toEqual({ k: 'v' }); - }); - - test('should set identity in analytics connector on identify with instance name', async () => { - const plugin = new IdentityEventSender(); - await plugin.setup({ - instanceName: 'env', - } as Config); - const event = { - event_type: '$identify', - user_properties: { - $set: { k: 'v' }, - }, - }; - const result = await plugin.execute(event); - const identity = getAnalyticsConnector('env').identityStore.getIdentity(); - expect(result).toEqual(event); - expect(identity.userProperties).toEqual({ k: 'v' }); - }); - - test('should do nothing on track event', async () => { - const plugin = new IdentityEventSender(); - await plugin.setup({} as Config); - const event = { - event_type: 'test_track', - }; - const result = await plugin.execute(event); - expect(result).toEqual(event); - const emptyIdentity = { userProperties: {} }; - const identity = getAnalyticsConnector().identityStore.getIdentity(); - expect(identity).toEqual(emptyIdentity); - }); - }); -}); diff --git a/packages/analytics-client-common/test/query-params.test.ts b/packages/analytics-client-common/test/query-params.test.ts deleted file mode 100644 index 59ff7bc53..000000000 --- a/packages/analytics-client-common/test/query-params.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { getQueryParams } from '../src/query-params'; -import * as GlobalScopeModule from '../src/global-scope'; - -describe('query-params', () => { - describe('getQueryParams', () => { - beforeAll(() => { - Object.defineProperty(window, 'location', { - value: { - search: '', - writable: true, - }, - }); - }); - - afterAll(() => { - Object.defineProperty(window, 'location', { - value: { - search: '', - writable: false, - }, - }); - }); - - test('should parse query params', () => { - window.location.search = '?a=1&b=2%20test&&c%24=hello&d'; - const params = getQueryParams(); - expect(params).toEqual({ - a: '1', - b: '2 test', - c$: 'hello', - }); - }); - - test('should parse malformed uri', () => { - window.location.search = '?fb=X+%EF%BF%BD%93+C'; - const params = getQueryParams(); - expect(params).toEqual({}); - }); - - test('should handle undefined global scope', () => { - jest.spyOn(GlobalScopeModule, 'getGlobalScope').mockReturnValueOnce(undefined); - const params = getQueryParams(); - expect(params).toEqual({}); - }); - }); -}); diff --git a/packages/analytics-client-common/test/session.test.ts b/packages/analytics-client-common/test/session.test.ts deleted file mode 100644 index 0eed0b79d..000000000 --- a/packages/analytics-client-common/test/session.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { isNewSession } from '../src/session'; - -describe('session', () => { - const sessionTimeout: number = 30 * 60 * 1000; - - test('should be in a same session for undefined lastEventTime', () => { - const isEventInNewSession = isNewSession(sessionTimeout, undefined); - - expect(isEventInNewSession).toBe(false); - }); - - test('should be a new session', () => { - const lastEventTime = Date.now() - sessionTimeout * 2; - const isEventInNewSession = isNewSession(sessionTimeout, lastEventTime); - - expect(isEventInNewSession).toBe(true); - }); - - test('should be in a same session', () => { - const lastEventTime = Date.now(); - const isEventInNewSession = isNewSession(sessionTimeout, lastEventTime); - - expect(isEventInNewSession).toBe(false); - }); -}); diff --git a/packages/analytics-client-common/test/storage/cookies.test.ts b/packages/analytics-client-common/test/storage/cookies.test.ts deleted file mode 100644 index d04387d48..000000000 --- a/packages/analytics-client-common/test/storage/cookies.test.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { CookieStorage } from '../../src/storage/cookie'; -import * as GlobalScopeModule from '../../src/global-scope'; - -describe('cookies', () => { - describe('isEnabled', () => { - test('should return true', async () => { - const cookies = new CookieStorage(); - expect(await cookies.isEnabled()).toBe(true); - }); - }); - - describe('get', () => { - test('should return undefined for no cookie value', async () => { - const cookies = new CookieStorage(); - expect(await cookies.get('hello')).toBe(undefined); - }); - - test('should return non-encoded value', async () => { - const cookies = new CookieStorage(); - document.cookie = 'hello=world'; - expect(await cookies.get('hello')).toBe(undefined); - await cookies.remove('world'); - }); - - test('should handle double url encoded value for Ruby Rails', async () => { - const cookies = new CookieStorage(); - const value = { a: 1 }; - const cookieValue = encodeURIComponent(btoa(encodeURIComponent(JSON.stringify(value)))); - document.cookie = `hello=${cookieValue}`; - expect(await cookies.get('hello')).toEqual(value); - await cookies.remove('world'); - }); - - test('should return cookie object value', async () => { - const cookies = new CookieStorage>(); - await cookies.set('hello', { a: 1 }); - expect(await cookies.get('hello')).toEqual({ a: 1 }); - await cookies.remove('hello'); - }); - - test('should catch non-json format value', async () => { - const cookies = new CookieStorage(); - const value = '{"a":1'; - const encodedValue = btoa(encodeURIComponent(value)); - document.cookie = `hello=${encodedValue}`; - expect(await cookies.get('hello')).toBe(undefined); - }); - - test('should return cookie array value', async () => { - const cookies = new CookieStorage(); - await cookies.set('hello', [1]); - expect(await cookies.get('hello')).toEqual([1]); - await cookies.remove('hello'); - }); - - test('should return undefined when global scope is not defined', async () => { - const cookies = new CookieStorage(); - await cookies.set('hello', [1]); - jest.spyOn(GlobalScopeModule, 'getGlobalScope').mockReturnValueOnce(undefined); - expect(await cookies.get('hello')).toEqual(undefined); - await cookies.remove('hello'); - }); - - test('should return undefined when global scope is defined but document is not', async () => { - const cookies = new CookieStorage(); - await cookies.set('hello', [1]); - jest.spyOn(GlobalScopeModule, 'getGlobalScope').mockReturnValueOnce({} as typeof globalThis); - expect(await cookies.get('hello')).toEqual(undefined); - await cookies.remove('hello'); - }); - }); - - describe('set', () => { - test('should set cookie value', async () => { - const cookies = new CookieStorage(); - await cookies.set('hello', 'world'); - expect(await cookies.get('hello')).toBe('world'); - await cookies.remove('hello'); - }); - - test('should set cookie value with options', async () => { - const cookies = new CookieStorage({ - expirationDays: 365, - domain: '', - secure: false, - sameSite: 'Lax', - }); - await cookies.set('hello', 'world'); - expect(await cookies.get('hello')).toBe('world'); - await cookies.remove('hello'); - }); - - test('should set restricted cookie value with options', async () => { - const cookies = new CookieStorage({ - expirationDays: 365, - domain: '.amplitude.com', - secure: true, - sameSite: 'Lax', - }); - await cookies.set('hello', 'world'); - expect(await cookies.get('hello')).toBe(undefined); - await cookies.remove('hello'); - }); - - test.each([new Error('Simulated error'), 'Simulated error'])( - 'logs an error message when setting a cookie fails', - async (error) => { - console.error = jest.fn(); - jest.spyOn(global, 'btoa').mockImplementation(() => { - throw error; - }); - - const cookies = new CookieStorage(); - await cookies.set('hello', 'world'); - - expect(console.error).toHaveBeenCalledWith( - expect.stringContaining( - `Amplitude Logger [Error]: Failed to set cookie for key: hello. Error: Simulated error`, - ), - ); - - jest.restoreAllMocks(); - }, - ); - }); - - describe('remove', () => { - test('should call set', async () => { - const cookies = new CookieStorage(); - const set = jest.spyOn(cookies, 'set'); - await cookies.remove('key'); - expect(set).toHaveBeenCalledTimes(1); - }); - }); - - describe('reset', () => { - test('should return undefined', async () => { - const cookies = new CookieStorage(); - expect(await cookies.reset()).toBe(undefined); - }); - }); -}); diff --git a/packages/analytics-client-common/test/transports/fetch.test.ts b/packages/analytics-client-common/test/transports/fetch.test.ts deleted file mode 100644 index 06bc568c8..000000000 --- a/packages/analytics-client-common/test/transports/fetch.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { FetchTransport } from '../../src/transports/fetch'; -import { Status } from '@amplitude/analytics-types'; -import 'isomorphic-fetch'; - -describe('fetch', () => { - describe('send', () => { - test.each([ - ['{}'], // ideally response body should be json format to an application/json request - [''], // test the edge case where response body is non-json format - ['<'], - ])('should resolve with response', async (body) => { - const transport = new FetchTransport(); - const url = 'http://localhost:3000'; - const payload = { - api_key: '', - events: [], - }; - const result = { - statusCode: 200, - status: Status.Success as const, - body: { - eventsIngested: 0, - payloadSizeBytes: 0, - serverUploadTime: 0, - }, - }; - jest.spyOn(window, 'fetch').mockReturnValueOnce(Promise.resolve(new Response(body))); - jest.spyOn(transport, 'buildResponse').mockReturnValueOnce(result); - const response = await transport.send(url, payload); - expect(response).toEqual(result); - }); - }); -}); diff --git a/packages/analytics-client-common/tsconfig.es5.json b/packages/analytics-client-common/tsconfig.es5.json deleted file mode 100644 index 77e041d3f..000000000 --- a/packages/analytics-client-common/tsconfig.es5.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "module": "commonjs", - "noEmit": false, - "outDir": "lib/cjs", - "rootDir": "./src" - } -} diff --git a/packages/analytics-client-common/tsconfig.esm.json b/packages/analytics-client-common/tsconfig.esm.json deleted file mode 100644 index bec981eee..000000000 --- a/packages/analytics-client-common/tsconfig.esm.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "module": "es6", - "noEmit": false, - "outDir": "lib/esm", - "rootDir": "./src" - } -} diff --git a/packages/analytics-client-common/tsconfig.json b/packages/analytics-client-common/tsconfig.json deleted file mode 100644 index 955dcce78..000000000 --- a/packages/analytics-client-common/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*", "test/**/*"], - "compilerOptions": { - "baseUrl": ".", - "esModuleInterop": true, - "lib": ["dom"], - "noEmit": true, - "rootDir": ".", - } -} diff --git a/packages/analytics-node/CHANGELOG.md b/packages/analytics-node/CHANGELOG.md deleted file mode 100644 index 9bc6ec147..000000000 --- a/packages/analytics-node/CHANGELOG.md +++ /dev/null @@ -1,299 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.1.5...@amplitude/analytics-node@1.1.6) (2023-05-04) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.1.4...@amplitude/analytics-node@1.1.5) (2023-04-27) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.1.3...@amplitude/analytics-node@1.1.4) (2023-04-25) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.1.2...@amplitude/analytics-node@1.1.3) (2023-04-06) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.1.1...@amplitude/analytics-node@1.1.2) (2023-03-31) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.1.1-beta.0...@amplitude/analytics-node@1.1.1) (2023-03-31) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.1.1-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.1.0...@amplitude/analytics-node@1.1.1-beta.0) (2023-03-31) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.1.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.1.0-beta.0...@amplitude/analytics-node@1.1.0) (2023-02-27) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.1.0-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.0.5...@amplitude/analytics-node@1.1.0-beta.0) (2023-02-24) - -### Features - -- pass amplitude instance to plugin.setup for enhanced plugin capabilities - ([#328](https://github.com/amplitude/Amplitude-TypeScript/issues/328)) - ([91eeaa0](https://github.com/amplitude/Amplitude-TypeScript/commit/91eeaa0d6bff6bde39538bb54548a938df784462)) - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.0.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.0.4...@amplitude/analytics-node@1.0.5) (2023-02-09) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.0.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.0.3...@amplitude/analytics-node@1.0.4) (2023-02-02) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.0.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.0.3-beta.0...@amplitude/analytics-node@1.0.3) (2023-01-31) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.0.3-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.0.2...@amplitude/analytics-node@1.0.3-beta.0) (2023-01-26) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.0.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.0.1...@amplitude/analytics-node@1.0.2) (2023-01-11) - -**Note:** Version bump only for package @amplitude/analytics-node - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [1.0.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@1.0.0...@amplitude/analytics-node@1.0.1) (2022-12-21) - -### Bug Fixes - -- upgrade dependencies to resolve dependabot vulnerability alerts - ([#299](https://github.com/amplitude/Amplitude-TypeScript/issues/299)) - ([7dd1cd1](https://github.com/amplitude/Amplitude-TypeScript/commit/7dd1cd1b23a71981a4ad90b4b30cc9b7d28c4412)) - -### Reverts - -- Revert "Updated dependencies" - ([7ca9964](https://github.com/amplitude/Amplitude-TypeScript/commit/7ca9964781e4b900c6c027bdddf2ae1e7428ba18)) - -# [1.0.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.6.2...@amplitude/analytics-node@1.0.0) (2022-12-10) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.6.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.6.1...@amplitude/analytics-node@0.6.2) (2022-11-28) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.6.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.6.0...@amplitude/analytics-node@0.6.1) (2022-11-15) - -**Note:** Version bump only for package @amplitude/analytics-node - -# [0.6.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.8...@amplitude/analytics-node@0.6.0) (2022-11-01) - -### Features - -- enhance logger with debug information ([#254](https://github.com/amplitude/Amplitude-TypeScript/issues/254)) - ([5c6175e](https://github.com/amplitude/Amplitude-TypeScript/commit/5c6175e9372cbeea264ddb34c6cc68148063d4f7)) - -## [0.5.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.7...@amplitude/analytics-node@0.5.8) (2022-10-25) - -### Bug Fixes - -- invoke pre-init track fns after attribution ([#253](https://github.com/amplitude/Amplitude-TypeScript/issues/253)) - ([b8996d7](https://github.com/amplitude/Amplitude-TypeScript/commit/b8996d793f74d388c1a96e0cde5c0ac060c1e565)) - -## [0.5.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.6...@amplitude/analytics-node@0.5.7) (2022-10-14) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.5.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.5...@amplitude/analytics-node@0.5.6) (2022-10-04) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.5.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.4...@amplitude/analytics-node@0.5.5) (2022-09-30) - -### Bug Fixes - -- cover the case when apiKey is missing in the runtime - ([#240](https://github.com/amplitude/Amplitude-TypeScript/issues/240)) - ([308bbe8](https://github.com/amplitude/Amplitude-TypeScript/commit/308bbe8337cbab366a0ca255f2d665101f4781a0)) - -## [0.5.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.4-beta.0...@amplitude/analytics-node@0.5.4) (2022-09-28) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.5.4-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.3...@amplitude/analytics-node@0.5.4-beta.0) (2022-09-26) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.5.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.2...@amplitude/analytics-node@0.5.3) (2022-09-26) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.5.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.1...@amplitude/analytics-node@0.5.2) (2022-09-22) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.5.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.5.0...@amplitude/analytics-node@0.5.1) (2022-09-16) - -**Note:** Version bump only for package @amplitude/analytics-node - -# [0.5.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.4.1...@amplitude/analytics-node@0.5.0) (2022-09-08) - -### Features - -- add ingestion_metadata field ([#212](https://github.com/amplitude/Amplitude-TypeScript/issues/212)) - ([ebe8448](https://github.com/amplitude/Amplitude-TypeScript/commit/ebe8448b23609134f846e18da2e769158ca30bf1)) - -## [0.4.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.4.0...@amplitude/analytics-node@0.4.1) (2022-08-31) - -**Note:** Version bump only for package @amplitude/analytics-node - -# [0.4.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.3.7...@amplitude/analytics-node@0.4.0) (2022-08-18) - -### Bug Fixes - -- prevent concurrent init calls ([#191](https://github.com/amplitude/Amplitude-TypeScript/issues/191)) - ([efda076](https://github.com/amplitude/Amplitude-TypeScript/commit/efda0760f4f1e92e47a3150985e18efcc3b108d9)) - -### Features - -- adds create instance api ([#188](https://github.com/amplitude/Amplitude-TypeScript/issues/188)) - ([050c1d9](https://github.com/amplitude/Amplitude-TypeScript/commit/050c1d96cedbc9e68aedf6fd55e85d2d3dc2fee4)) - -## [0.3.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.3.6...@amplitude/analytics-node@0.3.7) (2022-08-16) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.3.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.3.5...@amplitude/analytics-node@0.3.6) (2022-08-13) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.3.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.3.4...@amplitude/analytics-node@0.3.5) (2022-08-12) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.3.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.3.3...@amplitude/analytics-node@0.3.4) (2022-07-22) - -### Bug Fixes - -- allow undefined storage provider ([#146](https://github.com/amplitude/Amplitude-TypeScript/issues/146)) - ([e704342](https://github.com/amplitude/Amplitude-TypeScript/commit/e704342761c8ad7de3921ba21901ef8d3a768188)) -- missing tracked events before init issue ([#144](https://github.com/amplitude/Amplitude-TypeScript/issues/144)) - ([60d0f68](https://github.com/amplitude/Amplitude-TypeScript/commit/60d0f6848087f7b8fc3c870d55489a238e841b26)) -- removes saveEvents config ([#147](https://github.com/amplitude/Amplitude-TypeScript/issues/147)) - ([6fde736](https://github.com/amplitude/Amplitude-TypeScript/commit/6fde736ca8a865462522082a8085673756dbcc7d)) -- update default flush config for node ([#152](https://github.com/amplitude/Amplitude-TypeScript/issues/152)) - ([2445dff](https://github.com/amplitude/Amplitude-TypeScript/commit/2445dff0842e7e0a2b7ee767ab926b5a93348214)) - -## [0.3.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.3.2...@amplitude/analytics-node@0.3.3) (2022-07-15) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.3.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.3.1...@amplitude/analytics-node@0.3.2) (2022-07-13) - -**Note:** Version bump only for package @amplitude/analytics-node - -## [0.3.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.3.0...@amplitude/analytics-node@0.3.1) (2022-06-29) - -**Note:** Version bump only for package @amplitude/analytics-node - -# [0.3.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.2.0...@amplitude/analytics-node@0.3.0) (2022-06-29) - -### Features - -- add flush() api to send all events immediately ([#125](https://github.com/amplitude/Amplitude-TypeScript/issues/125)) - ([b5dbcbb](https://github.com/amplitude/Amplitude-TypeScript/commit/b5dbcbb803c76ee5ade7ea85f76fbea50d8bab49)) -- make storage interface async to enable react-native - ([#122](https://github.com/amplitude/Amplitude-TypeScript/issues/122)) - ([42bb39c](https://github.com/amplitude/Amplitude-TypeScript/commit/42bb39c967db015d5899487618d066f3540c9f18)) - -# [0.2.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.1.1...@amplitude/analytics-node@0.2.0) (2022-06-24) - -### Features - -- add marketing campaign tracking ([#112](https://github.com/amplitude/Amplitude-TypeScript/issues/112)) - ([bca73ed](https://github.com/amplitude/Amplitude-TypeScript/commit/bca73ede308ecb1663986a99600657732969d60c)) - -## [0.1.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node@0.1.0...@amplitude/analytics-node@0.1.1) (2022-06-21) - -**Note:** Version bump only for package @amplitude/analytics-node - -# 0.1.0 (2022-06-17) - -### Features - -- add Plan option to config ([#117](https://github.com/amplitude/Amplitude-TypeScript/issues/117)) - ([194d7e6](https://github.com/amplitude/Amplitude-TypeScript/commit/194d7e66af0209cb8155cf6aa0b05a5dcb170f9d)) -- introduce NodeJS package ([#92](https://github.com/amplitude/Amplitude-TypeScript/issues/92)) - ([476fb44](https://github.com/amplitude/Amplitude-TypeScript/commit/476fb44efcf2dfcd84af6f0ef45e141ad87dac43)) diff --git a/packages/analytics-node/README.md b/packages/analytics-node/README.md deleted file mode 100644 index 5a743cc43..000000000 --- a/packages/analytics-node/README.md +++ /dev/null @@ -1,164 +0,0 @@ -

- - - -
-

- -# @amplitude/analytics-node - -Official Amplitude SDK for Node.js - -# Doc - -See our [Typescript Analytics Node SDK](https://amplitude.github.io/Amplitude-TypeScript/modules/_amplitude_analytics_node.html) Reference for a list and description of all available SDK methods. - -# Installation and Quick Start - -Please visit our :100:[Developer Center](https://www.docs.developers.amplitude.com/data/sdks/typescript-node/) for instructions on installing and using our the SDK. - -## Installation - -To get started with using Amplitude Node.js SDK, install the package to your project via NPM. - -### Using Node package - -This package is published on NPM registry and is available to be installed using npm and yarn. - -```sh -# npm -npm install @amplitude/analytics-node - -# yarn -yarn add @amplitude/analytics-node -``` - -## Usage - -### Initializing SDK - -Initialization is necessary before any instrumentation is done. The API key for your Amplitude project is required. - -```typescript -amplitude.init(API_KEY); -``` - -### Tracking an Event - -Events represent how users interact with your application. For example, "Button Clicked" may be an action you want to note. - -```typescript -import { track } from '@amplitude/analytics-node'; - -// Track a basic event -track('Button Clicked', undefined, { - user_id: 'user@amplitude.com', -}); - -// Track events with additional properties -const eventProperties = { - selectedColors: ['red', 'blue'], -}; -track('Button Clicked', eventProperties, { - user_id: 'user@amplitude.com', -}); -``` - -### User Properties - -User properties help you understand your users at the time they performed some action within your app such as their device details, their preferences, or language. - -```typescript -import { Identify, identify } from '@amplitude/analytics-node'; - -const event = new Identify(); - -// sets the value of a user property -event.set('key1', 'value1'); - -// sets the value of a user property only once -event.setOnce('key1', 'value1'); - -// increments a user property by some numerical value. -event.add('value1', 10); - -// pre inserts a value or values to a user property -event.preInsert('ab-tests', 'new-user-test'); - -// post inserts a value or values to a user property -event.postInsert('ab-tests', 'new-user-test'); - -// removes a value or values to a user property -event.remove('ab-tests', 'new-user-test') - -// sends identify event -identify(event); -``` - -### prepend/append - -* append will append a value or values to a user property array. -* prepend will prepend a value or values to a user property. - -### User Groups - -```typescript -import { setGroup } from '@amplitude/analytics-node'; - -// set group with single group name -setGroup('orgId', '15'); - -// set group with multiple group names -setGroup('sport', ['soccer', 'tennis']); -``` - -### Group Identify - -This feature is only available to Growth and Enterprise customers who have purchased the [Accounts add-on](https://amplitude.zendesk.com/hc/en-us/articles/115001765532). - -Use the Group Identify API to set or update properties of particular groups. However, these updates will only affect events going forward. - -```typescript -import { Identify, groupIdentify } from '@amplitude/analytics-node'; - -const groupType = 'plan'; -const groupName = 'enterprise'; -const identity = new Identify() -identity.set('key1', 'value1'); - -groupIdentify(groupType, groupName, identity); -``` - -### Track Revenue - -Revenue instances will store each revenue transaction and allow you to define several special revenue properties (such as 'revenueType', 'productIdentifier', etc.) that are used in Amplitude's Event Segmentation and Revenue LTV charts. These Revenue instance objects are then passed into `revenue` to send as revenue events to Amplitude. This allows us to automatically display data relevant to revenue in the platform. You can use this to track both in-app and non-in-app purchases. - -```typescript -import { Revenue, revenue } from '@amplitude/analytics-node'; - -const event = new Revenue() - .setProductId('com.company.productId') - .setPrice(3.99) - .setQuantity(3); - -revenue(event); -``` - -### Callback - -All asynchronous API are optionally awaitable through a specific Promise interface. This also serves as callback interface. - -```typescript -// Using async/await -const results = await track('Button Clicked').promise; -result.event; // {...} (The final event object sent to Amplitude) -result.code; // 200 (The HTTP response status code of the request. -result.message; // "Event tracked successfully" (The response message) - -// Using promises -track('Button Clicked').promise.then((result) => { - result.event; // {...} (The final event object sent to Amplitude) - result.code; // 200 (The HTTP response status code of the request. - result.message; // "Event tracked successfully" (The response message) -}); -``` diff --git a/packages/analytics-node/jest.config.js b/packages/analytics-node/jest.config.js deleted file mode 100644 index 22b3c6e63..000000000 --- a/packages/analytics-node/jest.config.js +++ /dev/null @@ -1,9 +0,0 @@ -const baseConfig = require('../../jest.config.js'); -const package = require('./package'); - -module.exports = { - ...baseConfig, - displayName: package.name, - rootDir: '.', - testEnvironment: 'node', -}; diff --git a/packages/analytics-node/package.json b/packages/analytics-node/package.json deleted file mode 100644 index 4e641eb78..000000000 --- a/packages/analytics-node/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@amplitude/analytics-node", - "version": "2.0.0-beta.0", - "description": "Official Amplitude SDK for NodeJS", - "author": "Amplitude Inc", - "homepage": "https://github.com/amplitude/Amplitude-TypeScript", - "license": "MIT", - "main": "lib/cjs/index.js", - "module": "lib/esm/index.js", - "types": "lib/esm/index.d.ts", - "sideEffects": false, - "private": true, - "publishConfig": { - "tag": "beta" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/amplitude/Amplitude-TypeScript.git" - }, - "scripts": { - "build": "yarn build:es5 & yarn build:esm", - "build:es5": "tsc -p ./tsconfig.es5.json", - "build:esm": "tsc -p ./tsconfig.esm.json", - "watch": "tsc -p ./tsconfig.esm.json --watch", - "clean": "rimraf node_modules lib coverage", - "fix": "yarn fix:eslint & yarn fix:prettier", - "fix:eslint": "eslint '{src,test}/**/*.ts' --fix", - "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"", - "lint": "yarn lint:eslint & yarn lint:prettier", - "lint:eslint": "eslint '{src,test}/**/*.ts'", - "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"", - "test": "jest", - "typecheck": "tsc -p ./tsconfig.json", - "version": "yarn version-file && yarn build", - "version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts" - }, - "bugs": { - "url": "https://github.com/amplitude/Amplitude-TypeScript/issues" - }, - "dependencies": { - "@amplitude/analytics-core": "^2.10.1", - "@amplitude/analytics-types": "^2.0.0", - "tslib": "^2.4.1" - }, - "files": [ - "lib" - ] -} diff --git a/packages/analytics-node/src/config.ts b/packages/analytics-node/src/config.ts deleted file mode 100644 index f3e772f22..000000000 --- a/packages/analytics-node/src/config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NodeOptions, NodeConfig as INodeConfig } from '@amplitude/analytics-types'; -import { Config } from '@amplitude/analytics-core'; -import { Http } from './transports/http'; - -export class NodeConfig extends Config implements INodeConfig { - constructor(apiKey: string, options?: NodeOptions) { - super({ - transportProvider: new Http(), - ...options, - apiKey, - }); - } -} - -export const useNodeConfig = (apiKey: string, overrides?: NodeOptions): INodeConfig => { - return new NodeConfig(apiKey, overrides); -}; diff --git a/packages/analytics-node/src/index.ts b/packages/analytics-node/src/index.ts deleted file mode 100644 index 42cc88453..000000000 --- a/packages/analytics-node/src/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable @typescript-eslint/unbound-method */ - -import client from './node-client'; -export { createInstance } from './node-client'; -export const { add, groupIdentify, identify, init, logEvent, remove, revenue, setGroup, setOptOut, track, flush } = - client; -export { Revenue, Identify } from '@amplitude/analytics-core'; -export * as Types from '@amplitude/analytics-types'; diff --git a/packages/analytics-node/src/node-client.ts b/packages/analytics-node/src/node-client.ts deleted file mode 100644 index d52f82e62..000000000 --- a/packages/analytics-node/src/node-client.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { - AmplitudeCore, - Destination, - returnWrapper, - debugWrapper, - getClientLogConfig, - getClientStates, -} from '@amplitude/analytics-core'; -import { NodeClient, NodeConfig, NodeOptions } from '@amplitude/analytics-types'; -import { Context } from './plugins/context'; -import { useNodeConfig } from './config'; - -export class AmplitudeNode extends AmplitudeCore { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - config: NodeConfig; - - init(apiKey = '', options?: NodeOptions) { - return returnWrapper(this._init({ ...options, apiKey })); - } - protected async _init(options: NodeOptions & { apiKey: string }) { - // Step 0: Block concurrent initialization - if (this.initializing) { - return; - } - this.initializing = true; - - const nodeOptions = useNodeConfig(options.apiKey, { - ...options, - }); - - await super._init(nodeOptions); - - await this.add(new Destination()).promise; - await this.add(new Context()).promise; - - this.initializing = false; - - await this.runQueuedFunctions('dispatchQ'); - } -} - -export const createInstance = (): NodeClient => { - const client = new AmplitudeNode(); - return { - init: debugWrapper( - client.init.bind(client), - 'init', - getClientLogConfig(client), - getClientStates(client, ['config']), - ), - add: debugWrapper( - client.add.bind(client), - 'add', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.plugins']), - ), - remove: debugWrapper( - client.remove.bind(client), - 'remove', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.plugins']), - ), - track: debugWrapper( - client.track.bind(client), - 'track', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - logEvent: debugWrapper( - client.logEvent.bind(client), - 'logEvent', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - identify: debugWrapper( - client.identify.bind(client), - 'identify', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - groupIdentify: debugWrapper( - client.groupIdentify.bind(client), - 'groupIdentify', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - setGroup: debugWrapper( - client.setGroup.bind(client), - 'setGroup', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - revenue: debugWrapper( - client.revenue.bind(client), - 'revenue', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - flush: debugWrapper( - client.flush.bind(client), - 'flush', - getClientLogConfig(client), - getClientStates(client, ['config.apiKey', 'timeline.queue.length']), - ), - setOptOut: debugWrapper( - client.setOptOut.bind(client), - 'setOptOut', - getClientLogConfig(client), - getClientStates(client, ['config']), - ), - }; -}; - -export default createInstance(); diff --git a/packages/analytics-node/src/plugins/context.ts b/packages/analytics-node/src/plugins/context.ts deleted file mode 100644 index ec636bec3..000000000 --- a/packages/analytics-node/src/plugins/context.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { BeforePlugin, NodeConfig, Event } from '@amplitude/analytics-types'; -import { UUID } from '@amplitude/analytics-core'; -import { VERSION } from '../version'; - -export class Context implements BeforePlugin { - name = '@amplitude/plugin-context-node'; - type = 'before' as const; - - // this.config is defined in setup() which will always be called first - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - config: NodeConfig; - eventId = 0; - library = `amplitude-node-ts/${VERSION}`; - - setup(config: NodeConfig): Promise { - this.config = config; - return Promise.resolve(undefined); - } - - execute(context: Event): Promise { - return new Promise((resolve) => { - const time = new Date().getTime(); - - const contextEvent: Event = { - time, - insert_id: UUID(), - plan: this.config.plan, - ...(this.config.ingestionMetadata && { - ingestion_metadata: { - source_name: this.config.ingestionMetadata.sourceName, - source_version: this.config.ingestionMetadata.sourceVersion, - }, - }), - ...context, - event_id: this.eventId++, - library: this.library, - }; - return resolve(contextEvent); - }); - } -} diff --git a/packages/analytics-node/src/transports/http.ts b/packages/analytics-node/src/transports/http.ts deleted file mode 100644 index 2c119cc1b..000000000 --- a/packages/analytics-node/src/transports/http.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Payload, Response, Transport } from '@amplitude/analytics-types'; -import { BaseTransport } from '@amplitude/analytics-core'; -import * as http from 'http'; -import * as https from 'https'; - -export class Http extends BaseTransport implements Transport { - send(serverUrl: string, payload: Payload): Promise { - let protocol: typeof http | typeof https; - if (serverUrl.startsWith('http://')) { - protocol = http; - } else if (serverUrl.startsWith('https://')) { - protocol = https; - } else { - throw new Error('Invalid server url'); - } - - const url = new URL(serverUrl); - const requestPayload = JSON.stringify(payload); - const options = { - headers: { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(requestPayload), - }, - hostname: url.hostname, - method: 'POST', - path: url.pathname, - port: url.port, - protocol: url.protocol, - }; - return new Promise((resolve) => { - const req = protocol.request(options, (res) => { - res.setEncoding('utf8'); - let responsePayload = ''; - res.on('data', (chunk: string) => { - responsePayload += chunk; - }); - - res.on('end', () => { - if (res.complete && responsePayload.length > 0) { - try { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - const parsedResponsePayload: Record = JSON.parse(responsePayload); - const result = this.buildResponse(parsedResponsePayload); - resolve(result); - } catch { - resolve(this.buildResponse({ code: res.statusCode })); - } - } - }); - }); - req.on('error', () => resolve(null)); - req.end(requestPayload); - }); - } -} diff --git a/packages/analytics-node/src/version.ts b/packages/analytics-node/src/version.ts deleted file mode 100644 index 29591928d..000000000 --- a/packages/analytics-node/src/version.ts +++ /dev/null @@ -1 +0,0 @@ -export const VERSION = '1.1.6'; diff --git a/packages/analytics-node/test/config.test.ts b/packages/analytics-node/test/config.test.ts deleted file mode 100644 index f4657ab9d..000000000 --- a/packages/analytics-node/test/config.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import * as Config from '../src/config'; -import * as core from '@amplitude/analytics-core'; -import { LogLevel } from '@amplitude/analytics-types'; -import { Http } from '../src/transports/http'; - -describe('config', () => { - const API_KEY = 'apiKey'; - - describe('NodeConfig', () => { - test('should create overwrite config', () => { - const logger = new core.Logger(); - logger.enable(LogLevel.Warn); - const config = new Config.NodeConfig(API_KEY); - expect(config).toEqual({ - apiKey: API_KEY, - flushIntervalMillis: 10000, - flushMaxRetries: 12, - flushQueueSize: 200, - instanceName: '$default_instance', - loggerProvider: logger, - logLevel: LogLevel.Warn, - offline: false, - _optOut: false, - plan: undefined, - ingestionMetadata: undefined, - serverUrl: 'https://api2.amplitude.com/2/httpapi', - serverZone: 'US', - storageProvider: undefined, - transportProvider: new Http(), - useBatch: false, - }); - }); - }); - - describe('useNodeConfig', () => { - test('should create default config', () => { - const logger = new core.Logger(); - logger.enable(LogLevel.Warn); - const config = Config.useNodeConfig(API_KEY, undefined); - expect(config).toEqual({ - apiKey: API_KEY, - deviceId: undefined, - flushIntervalMillis: 10000, - flushMaxRetries: 12, - flushQueueSize: 200, - instanceName: '$default_instance', - loggerProvider: logger, - logLevel: LogLevel.Warn, - offline: false, - _optOut: false, - partnerId: undefined, - plan: undefined, - ingestionMetadata: undefined, - serverUrl: 'https://api2.amplitude.com/2/httpapi', - serverZone: 'US', - sessionId: undefined, - storageProvider: undefined, - transportProvider: new Http(), - userId: undefined, - useBatch: false, - }); - }); - }); -}); diff --git a/packages/analytics-node/test/helpers/default.ts b/packages/analytics-node/test/helpers/default.ts deleted file mode 100644 index f5004f7bb..000000000 --- a/packages/analytics-node/test/helpers/default.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { NodeConfig as INodeConfig, NodeOptions } from '@amplitude/analytics-types'; - -import { NodeConfig } from '../../src/config'; - -export const useDefaultConfig = (overrides?: NodeOptions) => - new NodeConfig(API_KEY, { ...DEFAULT_OPTIONS, ...overrides }); - -export const API_KEY = 'apiKey'; - -export const USER_ID = 'userId'; - -export const DEFAULT_OPTIONS: Partial = { - apiKey: API_KEY, - storageProvider: { - isEnabled: async () => true, - get: async () => undefined, - set: async () => undefined, - remove: async () => undefined, - reset: async () => undefined, - getRaw: async () => undefined, - }, - transportProvider: { - send: () => Promise.resolve(null), - }, -}; diff --git a/packages/analytics-node/test/index.test.ts b/packages/analytics-node/test/index.test.ts deleted file mode 100644 index 10c6f61cc..000000000 --- a/packages/analytics-node/test/index.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { - add, - createInstance, - groupIdentify, - Identify, - identify, - init, - logEvent, - remove, - Revenue, - revenue, - setGroup, - setOptOut, - track, - flush, -} from '../src/index'; - -describe('index', () => { - test('should expose apis', () => { - expect(typeof add).toBe('function'); - expect(typeof createInstance).toBe('function'); - expect(typeof groupIdentify).toBe('function'); - expect(typeof Identify).toBe('function'); - expect(typeof identify).toBe('function'); - expect(typeof init).toBe('function'); - expect(typeof logEvent).toBe('function'); - expect(typeof remove).toBe('function'); - expect(typeof Revenue).toBe('function'); - expect(typeof revenue).toBe('function'); - expect(typeof setGroup).toBe('function'); - expect(typeof setOptOut).toBe('function'); - expect(typeof track).toBe('function'); - expect(typeof flush).toBe('function'); - }); -}); diff --git a/packages/analytics-node/test/node-client.test.ts b/packages/analytics-node/test/node-client.test.ts deleted file mode 100644 index 46cb1e09a..000000000 --- a/packages/analytics-node/test/node-client.test.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { AmplitudeNode } from '../src/node-client'; -import * as core from '@amplitude/analytics-core'; -import { Status } from '@amplitude/analytics-types'; -import * as Config from '../src/config'; - -describe('node-client', () => { - const API_KEY = 'API_KEY'; - - describe('init', () => { - test('should return config', async () => { - const client = new AmplitudeNode(); - await client.init(API_KEY, { - flushIntervalMillis: 1000, - }).promise; - expect(client.config).toBeDefined(); - }); - - test('should initialize without error when apiKey is undefined', async () => { - const client = new AmplitudeNode(); - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - await client.init(undefined as any, { - flushIntervalMillis: 1000, - }).promise; - expect(client.config).toBeDefined(); - }); - - test('should call prevent concurrent init executions', async () => { - const client = new AmplitudeNode(); - const useNodeConfig = jest.spyOn(Config, 'useNodeConfig'); - await Promise.all([client.init(API_KEY), client.init(API_KEY), client.init(API_KEY)]); - // NOTE: `useNodeConfig` is only called once despite multiple init calls - expect(useNodeConfig).toHaveBeenCalledTimes(1); - }); - }); - - describe('setOptOut', () => { - test('should set opt out', async () => { - const client = new AmplitudeNode(); - await client.init(API_KEY).promise; - client.setOptOut(true); - expect(client.config.optOut).toBe(true); - }); - }); - - describe('identify', () => { - test('should track identify', async () => { - const send = jest.fn().mockReturnValueOnce({ - status: Status.Success, - statusCode: 200, - body: { - eventsIngested: 1, - payloadSizeBytes: 1, - serverUploadTime: 1, - }, - }); - const client = new AmplitudeNode(); - await client.init(API_KEY, { - flushIntervalMillis: 1000, - transportProvider: { - send, - }, - }).promise; - const identifyObject = new core.Identify(); - const result = await client.identify(identifyObject).promise; - expect(result.code).toEqual(200); - expect(send).toHaveBeenCalledTimes(1); - }); - }); - - describe('groupIdentify', () => { - test('should track group identify', async () => { - const send = jest.fn().mockReturnValueOnce({ - status: Status.Success, - statusCode: 200, - body: { - eventsIngested: 1, - payloadSizeBytes: 1, - serverUploadTime: 1, - }, - }); - const client = new AmplitudeNode(); - await client.init(API_KEY, { - flushIntervalMillis: 1000, - transportProvider: { - send, - }, - }).promise; - const identifyObject = new core.Identify(); - const result = await client.groupIdentify('g', '1', identifyObject).promise; - expect(result.code).toEqual(200); - expect(send).toHaveBeenCalledTimes(1); - }); - }); - - describe('revenue', () => { - test('should track revenue', async () => { - const send = jest.fn().mockReturnValueOnce({ - status: Status.Success, - statusCode: 200, - body: { - eventsIngested: 1, - payloadSizeBytes: 1, - serverUploadTime: 1, - }, - }); - const client = new AmplitudeNode(); - await client.init(API_KEY, { - flushIntervalMillis: 1000, - transportProvider: { - send, - }, - }).promise; - const revenueObject = new core.Revenue(); - const result = await client.revenue(revenueObject).promise; - expect(result.code).toEqual(200); - expect(send).toHaveBeenCalledTimes(1); - }); - }); -}); diff --git a/packages/analytics-node/test/plugins/context.test.ts b/packages/analytics-node/test/plugins/context.test.ts deleted file mode 100644 index e3f4ad896..000000000 --- a/packages/analytics-node/test/plugins/context.test.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Context } from '../../src/plugins/context'; -import { useDefaultConfig } from '../helpers/default'; - -describe('context', () => { - describe('setup', () => { - test('should setup plugin', async () => { - const context = new Context(); - const config = useDefaultConfig(); - await context.setup(config); - expect(context.eventId).toEqual(0); - }); - - test('should setup plugin without app version', async () => { - const context = new Context(); - const config = useDefaultConfig(); - await context.setup(config); - expect(context.eventId).toEqual(0); - }); - }); - - describe('execute', () => { - test('should execute plugin', async () => { - const context = new Context(); - const config = useDefaultConfig(); - await context.setup(config); - - const event = { - event_type: 'event_type', - device_id: 'deviceId', - session_id: 1, - user_id: 'user@amplitude.com', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.event_id).toEqual(0); - expect(firstContextEvent.insert_id).toBeDefined(); - expect(firstContextEvent.device_id).toEqual('deviceId'); - expect(firstContextEvent.session_id).toEqual(1); - expect(firstContextEvent.user_id).toEqual('user@amplitude.com'); - - const secondContextEvent = await context.execute(event); - expect(secondContextEvent.event_id).toEqual(1); - }); - - test('should be overwritten by the context', async () => { - const sourceName = 'ampli'; - const sourceVersion = '2.0.0'; - const context = new Context(); - const config = useDefaultConfig({ - ingestionMetadata: { - sourceName, - sourceVersion, - }, - }); - await context.setup(config); - - const event = { - event_type: 'event_type', - device_id: 'new deviceId', - session_id: 1, - user_id: 'user@amplitude.com', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.event_id).toEqual(0); - expect(firstContextEvent.insert_id).toBeDefined(); - expect(firstContextEvent.event_type).toEqual('event_type'); - expect(firstContextEvent.device_id).toEqual('new deviceId'); - expect(firstContextEvent.session_id).toEqual(1); - expect(firstContextEvent.user_id).toEqual('user@amplitude.com'); - expect(firstContextEvent.ingestion_metadata?.source_name).toEqual(sourceName); - expect(firstContextEvent.ingestion_metadata?.source_version).toEqual(sourceVersion); - - const secondContextEvent = await context.execute(event); - expect(secondContextEvent.event_id).toEqual(1); - }); - - describe('ingestionMetadata config', () => { - test('sourceName should be optional', async () => { - const sourceVersion = '2.0.0'; - const context = new Context(); - const config = useDefaultConfig({ - ingestionMetadata: { - sourceVersion, - }, - }); - await context.setup(config); - - const event = { - event_type: 'event_type', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.event_id).toEqual(0); - expect(firstContextEvent.ingestion_metadata?.source_name).toBeUndefined(); - expect(firstContextEvent.ingestion_metadata?.source_version).toEqual(sourceVersion); - }); - - test('sourceVersion should be optional', async () => { - const sourceName = 'ampli'; - const context = new Context(); - const config = useDefaultConfig({ - ingestionMetadata: { - sourceName, - }, - }); - await context.setup(config); - - const event = { - event_type: 'event_type', - }; - const firstContextEvent = await context.execute(event); - expect(firstContextEvent.event_id).toEqual(0); - expect(firstContextEvent.ingestion_metadata?.source_name).toEqual(sourceName); - expect(firstContextEvent.ingestion_metadata?.source_version).toBeUndefined(); - }); - }); - }); -}); diff --git a/packages/analytics-node/test/transport/http.test.ts b/packages/analytics-node/test/transport/http.test.ts deleted file mode 100644 index 6dfe8462b..000000000 --- a/packages/analytics-node/test/transport/http.test.ts +++ /dev/null @@ -1,160 +0,0 @@ -import { Http } from '../../src/transports/http'; -import * as http from 'http'; -import * as https from 'https'; -import { Status } from '@amplitude/analytics-types'; - -describe('http transport', () => { - test('should send to http url', async () => { - const provider = new Http(); - const url = 'http://localhost:3000'; - const payload = { - api_key: '', - events: [], - }; - - const request = jest.spyOn(http, 'request').mockImplementation((_, cb) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - cb({ - complete: true, - on: jest.fn().mockImplementation((event: string, callback: (data?: string) => void) => { - if (event === 'data') { - callback(JSON.stringify({ code: 200 })); - } - if (event === 'end') { - callback(); - } - }), - setEncoding: jest.fn(), - }); - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return { - on: jest.fn().mockImplementation((_: string, cb: (error: Error) => void) => cb(new Error())), - end: jest.fn(), - } as any; - }); - - const response = await provider.send(url, payload); - expect(response?.statusCode).toBe(200); - expect(request).toHaveBeenCalledTimes(1); - }); - - test('should send to https url', async () => { - const provider = new Http(); - const url = 'https://localhost:3000'; - const payload = { - api_key: '', - events: [], - }; - - const request = jest.spyOn(https, 'request').mockImplementation((_, cb) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - cb({ - complete: true, - on: jest.fn().mockImplementation((event: string, callback: (data?: string) => void) => { - if (event === 'data') { - callback(JSON.stringify({ code: 200 })); - } - if (event === 'end') { - callback(); - } - }), - setEncoding: jest.fn(), - }); - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return { - on: jest.fn().mockImplementation((_: string, cb: (error: Error) => void) => cb(new Error())), - end: jest.fn(), - } as any; - }); - - const response = await provider.send(url, payload); - expect(response?.statusCode).toBe(200); - expect(request).toHaveBeenCalledTimes(1); - }); - - test('should throw an error if no protocal', () => { - const provider = new Http(); - const url = 'localhost:3000'; - const payload = { - api_key: '', - events: [], - }; - - expect(() => provider.send(url, payload)).toThrow('Invalid server url'); - }); - - test('should handle error', async () => { - const provider = new Http(); - const url = 'http://localhost:3000'; - const payload = { - api_key: '', - events: [], - }; - - const request = jest.spyOn(http, 'request').mockImplementation((_, cb) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - cb({ - complete: true, - on: jest.fn().mockImplementation((event: string, callback: (data?: string) => void) => { - if (event === 'data') { - callback(JSON.stringify({ code: 400 })); - } - if (event === 'end') { - callback(); - } - }), - setEncoding: jest.fn(), - }); - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return { - on: jest.fn(), - end: jest.fn(), - } as any; - }); - - const response = await provider.send(url, payload); - expect(response?.statusCode).toBe(400); - expect(response?.status).toBe(Status.Invalid); - expect(request).toHaveBeenCalledTimes(1); - }); - - test('should handle unexpected error', async () => { - const provider = new Http(); - const url = 'http://localhost:3000'; - const payload = { - api_key: '', - events: [], - }; - - const request = jest.spyOn(http, 'request').mockImplementation((_, cb) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - cb({ - statusCode: 502, - complete: true, - on: jest.fn().mockImplementation((event: string, callback: (data?: string) => void) => { - if (event === 'data') { - callback('<'); - } - if (event === 'end') { - callback(); - } - }), - setEncoding: jest.fn(), - }); - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return { - on: jest.fn(), - end: jest.fn(), - } as any; - }); - - const response = await provider.send(url, payload); - expect(response?.status).toBe(Status.Failed); - expect(response?.statusCode).toBe(502); - expect(request).toHaveBeenCalledTimes(1); - }); -}); diff --git a/packages/analytics-node/tsconfig.es5.json b/packages/analytics-node/tsconfig.es5.json deleted file mode 100644 index 77e041d3f..000000000 --- a/packages/analytics-node/tsconfig.es5.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "module": "commonjs", - "noEmit": false, - "outDir": "lib/cjs", - "rootDir": "./src" - } -} diff --git a/packages/analytics-node/tsconfig.esm.json b/packages/analytics-node/tsconfig.esm.json deleted file mode 100644 index bec981eee..000000000 --- a/packages/analytics-node/tsconfig.esm.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*"], - "compilerOptions": { - "module": "es6", - "noEmit": false, - "outDir": "lib/esm", - "rootDir": "./src" - } -} diff --git a/packages/analytics-node/tsconfig.json b/packages/analytics-node/tsconfig.json deleted file mode 100644 index 7cd255f13..000000000 --- a/packages/analytics-node/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*", "test/**/*"], - "compilerOptions": { - "baseUrl": ".", - "noEmit": true, - "rootDir": "." - } -} From 94919c515efb282dc33c1e48055827a0c45b54a9 Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 15:48:07 -0700 Subject: [PATCH 7/9] chore: delete node test package --- packages/analytics-node-test/CHANGELOG.md | 252 -------- packages/analytics-node-test/README.md | 10 - packages/analytics-node-test/jest.config.js | 10 - packages/analytics-node-test/package.json | 24 - .../analytics-node-test/test/constants.ts | 4 - .../analytics-node-test/test/index.test.ts | 550 ------------------ .../analytics-node-test/test/responses.ts | 6 - packages/analytics-node-test/tsconfig.json | 10 - 8 files changed, 866 deletions(-) delete mode 100644 packages/analytics-node-test/CHANGELOG.md delete mode 100644 packages/analytics-node-test/README.md delete mode 100644 packages/analytics-node-test/jest.config.js delete mode 100644 packages/analytics-node-test/package.json delete mode 100644 packages/analytics-node-test/test/constants.ts delete mode 100644 packages/analytics-node-test/test/index.test.ts delete mode 100644 packages/analytics-node-test/test/responses.ts delete mode 100644 packages/analytics-node-test/tsconfig.json diff --git a/packages/analytics-node-test/CHANGELOG.md b/packages/analytics-node-test/CHANGELOG.md deleted file mode 100644 index 587b95831..000000000 --- a/packages/analytics-node-test/CHANGELOG.md +++ /dev/null @@ -1,252 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.14](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.13...@amplitude/analytics-node-test@0.1.14) (2023-05-04) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.13](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.12...@amplitude/analytics-node-test@0.1.13) (2023-04-27) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.12](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.11...@amplitude/analytics-node-test@0.1.12) (2023-04-25) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.11](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.10...@amplitude/analytics-node-test@0.1.11) (2023-04-06) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.10](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.9...@amplitude/analytics-node-test@0.1.10) (2023-03-31) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.9](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.9-beta.0...@amplitude/analytics-node-test@0.1.9) (2023-03-31) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.9-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.8...@amplitude/analytics-node-test@0.1.9-beta.0) (2023-03-31) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.8-beta.0...@amplitude/analytics-node-test@0.1.8) (2023-02-27) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.8-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.7...@amplitude/analytics-node-test@0.1.8-beta.0) (2023-02-24) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.6...@amplitude/analytics-node-test@0.1.7) (2023-02-09) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.5...@amplitude/analytics-node-test@0.1.6) (2023-02-02) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.5-beta.0...@amplitude/analytics-node-test@0.1.5) (2023-01-31) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.5-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.4...@amplitude/analytics-node-test@0.1.5-beta.0) (2023-01-26) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.3...@amplitude/analytics-node-test@0.1.4) (2023-01-11) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# Change Log - -All notable changes to this project will be documented in this file. See -[Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.1.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.2...@amplitude/analytics-node-test@0.1.3) (2022-12-21) - -### Bug Fixes - -- upgrade dependencies to resolve dependabot vulnerability alerts - ([#299](https://github.com/amplitude/Amplitude-TypeScript/issues/299)) - ([7dd1cd1](https://github.com/amplitude/Amplitude-TypeScript/commit/7dd1cd1b23a71981a4ad90b4b30cc9b7d28c4412)) - -## [0.1.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.1...@amplitude/analytics-node-test@0.1.2) (2022-11-28) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.1.1](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.1.0...@amplitude/analytics-node-test@0.1.1) (2022-11-15) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -# [0.1.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.22...@amplitude/analytics-node-test@0.1.0) (2022-11-01) - -### Features - -- enhance logger with debug information ([#254](https://github.com/amplitude/Amplitude-TypeScript/issues/254)) - ([5c6175e](https://github.com/amplitude/Amplitude-TypeScript/commit/5c6175e9372cbeea264ddb34c6cc68148063d4f7)) - -## [0.0.22](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.21...@amplitude/analytics-node-test@0.0.22) (2022-10-25) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.21](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.20...@amplitude/analytics-node-test@0.0.21) (2022-10-14) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.20](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.19...@amplitude/analytics-node-test@0.0.20) (2022-10-04) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.19](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.18...@amplitude/analytics-node-test@0.0.19) (2022-09-30) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.18](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.18-beta.0...@amplitude/analytics-node-test@0.0.18) (2022-09-28) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.18-beta.0](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.17...@amplitude/analytics-node-test@0.0.18-beta.0) (2022-09-26) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.17](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.16...@amplitude/analytics-node-test@0.0.17) (2022-09-26) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.16](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.15...@amplitude/analytics-node-test@0.0.16) (2022-09-22) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.15](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.14...@amplitude/analytics-node-test@0.0.15) (2022-09-16) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.14](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.13...@amplitude/analytics-node-test@0.0.14) (2022-09-08) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.13](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.12...@amplitude/analytics-node-test@0.0.13) (2022-08-31) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.12](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.11...@amplitude/analytics-node-test@0.0.12) (2022-08-18) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.11](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.10...@amplitude/analytics-node-test@0.0.11) (2022-08-16) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.10](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.9...@amplitude/analytics-node-test@0.0.10) (2022-08-13) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.9](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.8...@amplitude/analytics-node-test@0.0.9) (2022-08-12) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.8](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.7...@amplitude/analytics-node-test@0.0.8) (2022-07-22) - -### Bug Fixes - -- adds error handling for invalid api ([#153](https://github.com/amplitude/Amplitude-TypeScript/issues/153)) - ([c03f9d7](https://github.com/amplitude/Amplitude-TypeScript/commit/c03f9d7dad51e3026673dca31418a74591d79bbc)) -- missing tracked events before init issue ([#144](https://github.com/amplitude/Amplitude-TypeScript/issues/144)) - ([60d0f68](https://github.com/amplitude/Amplitude-TypeScript/commit/60d0f6848087f7b8fc3c870d55489a238e841b26)) -- update default flush config for node ([#152](https://github.com/amplitude/Amplitude-TypeScript/issues/152)) - ([2445dff](https://github.com/amplitude/Amplitude-TypeScript/commit/2445dff0842e7e0a2b7ee767ab926b5a93348214)) - -## [0.0.7](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.6...@amplitude/analytics-node-test@0.0.7) (2022-07-15) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.6](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.5...@amplitude/analytics-node-test@0.0.6) (2022-07-13) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.5](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.4...@amplitude/analytics-node-test@0.0.5) (2022-06-29) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.4](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.3...@amplitude/analytics-node-test@0.0.4) (2022-06-29) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.3](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.2...@amplitude/analytics-node-test@0.0.3) (2022-06-24) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## [0.0.2](https://github.com/amplitude/Amplitude-TypeScript/compare/@amplitude/analytics-node-test@0.0.1...@amplitude/analytics-node-test@0.0.2) (2022-06-21) - -**Note:** Version bump only for package @amplitude/analytics-node-test - -## 0.0.1 (2022-06-17) - -**Note:** Version bump only for package @amplitude/analytics-node-test diff --git a/packages/analytics-node-test/README.md b/packages/analytics-node-test/README.md deleted file mode 100644 index c5d55d4ec..000000000 --- a/packages/analytics-node-test/README.md +++ /dev/null @@ -1,10 +0,0 @@ -

- - - -
-

- -# `@amplitude/analytics-node-test` - -> Internal Node package for Amplitude diff --git a/packages/analytics-node-test/jest.config.js b/packages/analytics-node-test/jest.config.js deleted file mode 100644 index b42aa3f5d..000000000 --- a/packages/analytics-node-test/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('../../jest.config.js'); -const package = require('./package'); - -module.exports = { - ...baseConfig, - collectCoverage: false, - displayName: package.name, - rootDir: '.', - testEnvironment: 'node', -}; diff --git a/packages/analytics-node-test/package.json b/packages/analytics-node-test/package.json deleted file mode 100644 index d669ebfdb..000000000 --- a/packages/analytics-node-test/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@amplitude/analytics-node-test", - "version": "2.0.0-beta.0", - "private": true, - "description": "", - "author": "Amplitude Inc", - "homepage": "https://github.com/amplitude/Amplitude-TypeScript", - "repository": { - "type": "git", - "url": "git+https://github.com/amplitude/Amplitude-TypeScript.git" - }, - "scripts": { - "test": "jest -i" - }, - "bugs": { - "url": "https://github.com/amplitude/Amplitude-TypeScript/issues" - }, - "dependencies": { - "@amplitude/analytics-node": "^2.0.0-beta.0" - }, - "devDependencies": { - "nock": "^13.2.4" - } -} diff --git a/packages/analytics-node-test/test/constants.ts b/packages/analytics-node-test/test/constants.ts deleted file mode 100644 index 613ffe4b3..000000000 --- a/packages/analytics-node-test/test/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const uuidPattern = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/; -export const url = 'https://api2.amplitude.com'; -export const path = '/2/httpapi'; -export const SUCCESS_MESSAGE = 'Event tracked successfully'; diff --git a/packages/analytics-node-test/test/index.test.ts b/packages/analytics-node-test/test/index.test.ts deleted file mode 100644 index 342aaf992..000000000 --- a/packages/analytics-node-test/test/index.test.ts +++ /dev/null @@ -1,550 +0,0 @@ -import * as amplitude from '@amplitude/analytics-node'; -import { default as nock } from 'nock'; -import { success } from './responses'; -import { path, SUCCESS_MESSAGE, url, uuidPattern } from './constants'; -import { LogLevel } from '@amplitude/analytics-types'; - -describe('integration', () => { - const uuid: string = expect.stringMatching(uuidPattern) as string; - const library = expect.stringMatching(/^amplitude-node-ts\/.+/) as string; - const number = expect.any(Number) as number; - const opts = { - flushIntervalMillis: 1000, - }; - - describe('track', () => { - test('should track event', async () => { - const scope = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', opts); - const response = await amplitude.track('test event', { - mode: 'test', - }).promise; - expect(response.event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event', - event_id: 0, - event_properties: { - mode: 'test', - }, - library: library, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - }); - - test('should track event with event options', async () => { - const scope = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', opts); - const response = await amplitude.track('test event', undefined, { - user_id: 'sdk.dev@amplitude.com', - device_id: 'deviceId', - }).promise; - expect(response.event).toEqual({ - user_id: 'sdk.dev@amplitude.com', - device_id: 'deviceId', - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event', - event_id: 0, - library: library, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - }); - - test('should track event when init is called after', async () => { - const scope = nock(url).post(path).reply(200, success); - - const pendingResponse = amplitude.track('test event', undefined, { - user_id: 'sdk.dev@amplitude.com', - device_id: 'deviceId', - }).promise; - await amplitude.init('API_KEY', opts).promise; - const response = await pendingResponse; - expect(response.event).toEqual({ - user_id: 'sdk.dev@amplitude.com', - device_id: 'deviceId', - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event', - event_id: 0, - library: library, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - }); - - test('should track event with base event', async () => { - const scope = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', opts); - const response = await amplitude.track( - { - event_type: 'test event', - groups: { - org: '15', - }, - }, - undefined, - { - user_id: 'sdk.dev@amplitude.com', - device_id: 'deviceId', - }, - ).promise; - expect(response.event).toEqual({ - user_id: 'sdk.dev@amplitude.com', - device_id: 'deviceId', - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event', - event_id: 0, - library: library, - groups: { - org: '15', - }, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - }); - - test('should handle 400 error', async () => { - const first = nock(url) - .post(path) - .reply(400, { - code: 400, - error: 'Invalid field values on some events', - events_with_invalid_fields: { - device_id: [1], - }, - }); - const second = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', { - ...opts, - logLevel: 0, - }); - const response = await Promise.all([ - amplitude.track('test event 1').promise, - amplitude.track('test event 2', undefined, { - device_id: undefined, - }).promise, - ]); - expect(response[0].event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event 1', - event_id: 0, - library: library, - }); - expect(response[0].code).toBe(200); - expect(response[0].message).toBe(SUCCESS_MESSAGE); - expect(response[1].event).toEqual({ - user_id: undefined, - device_id: undefined, - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event 2', - event_id: 1, - library: library, - }); - expect(response[1].code).toBe(400); - expect(response[1].message).toBe('Invalid field values on some events'); - first.done(); - second.done(); - }); - - test('should handle 413 error', async () => { - const first = nock(url).post(path).reply(413, { - code: 413, - error: 'Payload too large', - }); - const second = nock(url).post(path).times(2).reply(200, success); - - amplitude.init('API_KEY', { - ...opts, - logLevel: 0, - flushQueueSize: 2, - }); - const response = await Promise.all([ - amplitude.track('test event 1').promise, - amplitude.track('test event 2').promise, - ]); - expect(response[0].event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event 1', - event_id: 0, - library: library, - }); - expect(response[0].code).toBe(200); - expect(response[0].message).toBe(SUCCESS_MESSAGE); - expect(response[1].event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event 2', - event_id: 1, - library: library, - }); - expect(response[1].code).toBe(200); - expect(response[1].message).toBe(SUCCESS_MESSAGE); - first.done(); - second.done(); - }); - - test('should handle 429 error', async () => { - const first = nock(url) - .post(path) - .reply(429, { - code: 429, - error: 'Too many requests for some devices and users', - exceeded_daily_quota_devices: { - throttled_device_id: 1, - }, - }); - const second = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', { - ...opts, - logLevel: 0, - }); - const response = await Promise.all([ - amplitude.track('test event 1').promise, - amplitude.track('test event 2', undefined, { - device_id: 'throttled_device_id', - }).promise, - ]); - expect(response[0].event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event 1', - event_id: 0, - library: library, - }); - expect(response[0].code).toBe(200); - expect(response[0].message).toBe(SUCCESS_MESSAGE); - expect(response[1].event).toEqual({ - device_id: 'throttled_device_id', - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event 2', - event_id: 1, - library: library, - }); - expect(response[1].code).toBe(429); - expect(response[1].message).toBe('Too many requests for some devices and users'); - first.done(); - second.done(); - }); - - test('should handle 500 error', async () => { - const first = nock(url).post(path).reply(500, { - code: 500, - }); - const second = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', { - ...opts, - logLevel: 0, - }); - const response = await Promise.all([ - amplitude.track('test event 1').promise, - amplitude.track('test event 2').promise, - ]); - expect(response[0].event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event 1', - event_id: 0, - library: library, - }); - expect(response[0].code).toBe(200); - expect(response[0].message).toBe(SUCCESS_MESSAGE); - expect(response[1].event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event 2', - event_id: 1, - library: library, - }); - expect(response[0].code).toBe(200); - expect(response[0].message).toBe(SUCCESS_MESSAGE); - first.done(); - second.done(); - }); - - test('should exhaust max retries', async () => { - const scope = nock(url).post(path).times(3).reply(500, { - code: 500, - }); - - amplitude.init('API_KEY', { - ...opts, - logLevel: 0, - flushMaxRetries: 3, - }); - const response = await amplitude.track('test event').promise; - expect(response.event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event', - event_id: 0, - library: library, - }); - expect(response.code).toBe(500); - expect(response.message).toBe('Event rejected due to exceeded retry count'); - scope.done(); - }, 10000); - - test('should handle missing api key', async () => { - amplitude.init('', { - ...opts, - logLevel: 0, - }); - const response = await amplitude.track('test event').promise; - expect(response.code).toBe(400); - expect(response.message).toBe('Event rejected due to missing API key'); - }); - - test('should handle client opt out', async () => { - amplitude.init('API_KEY', { - ...opts, - logLevel: 0, - }); - amplitude.setOptOut(true); - const response = await amplitude.track('test event').promise; - expect(response.code).toBe(0); - expect(response.message).toBe('Event skipped due to optOut config'); - }); - }); - - describe('identify', () => { - test('should track event', async () => { - const scope = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', opts); - const id = new amplitude.Identify(); - id.set('org', 'amp'); - id.setOnce('initial_org', 'amp'); - id.append('locations_1', 'ca'); - id.prepend('locations_2', 'ny'); - id.postInsert('tasks_1', 'a'); - id.preInsert('tasks_2', 'b'); - id.remove('company', 'x'); - id.add('employees', 1); - const response = await amplitude.identify(id).promise; - expect(response.event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: '$identify', - event_id: 0, - library: library, - user_properties: { - $add: { - employees: 1, - }, - $append: { - locations_1: 'ca', - }, - $postInsert: { - tasks_1: 'a', - }, - $preInsert: { - tasks_2: 'b', - }, - $prepend: { - locations_2: 'ny', - }, - $remove: { - company: 'x', - }, - $set: { - org: 'amp', - }, - $setOnce: { - initial_org: 'amp', - }, - }, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - }); - }); - - describe('revenue', () => { - test('should track event', async () => { - const scope = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', opts); - const rev = new amplitude.Revenue(); - rev.setProductId('1'); - rev.setQuantity(1); - rev.setPrice(100); - rev.setRevenueType('t'); - rev.setRevenue(200); - const response = await amplitude.revenue(rev).promise; - expect(response.event).toEqual({ - event_id: 0, - event_properties: { - $price: 100, - $productId: '1', - $quantity: 1, - $revenue: 200, - $revenueType: 't', - }, - event_type: 'revenue_amount', - insert_id: uuid, - library: library, - partner_id: undefined, - time: number, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - }); - }); - - describe('setGroup', () => { - test('should track event', async () => { - const scope = nock(url).post(path).reply(200, success); - - amplitude.init('API_KEY', opts); - const response = await amplitude.setGroup('org', 'engineering').promise; - expect(response.event).toEqual({ - event_id: 0, - event_type: '$identify', - groups: { - org: 'engineering', - }, - insert_id: uuid, - library: library, - partner_id: undefined, - time: number, - user_properties: { - $set: { - org: 'engineering', - }, - }, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - }); - }); - - describe('custom config', () => { - describe('serverUrl', () => { - test('should track event to custom serverUrl', async () => { - const serverUrl = 'https://domain.com'; - const scope = nock(serverUrl).post(path).reply(200, success); - - amplitude.init('API_KEY', { - ...opts, - serverUrl: serverUrl + path, - }); - const response = await amplitude.track('test event').promise; - expect(response.event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event', - event_id: 0, - library: library, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - }); - }); - - describe('debug mode', () => { - test('should enable debug mode for track', async () => { - const scope = nock(url).post(path).reply(200, success); - - const logger = { - disable: jest.fn(), - enable: jest.fn(), - debug: jest.fn(), - log: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - }; - amplitude.init('API_KEY', { ...opts, loggerProvider: logger, logLevel: LogLevel.Debug }); - - const response = await amplitude.track('test event', { - mode: 'test', - }).promise; - expect(response.event).toEqual({ - time: number, - insert_id: uuid, - partner_id: undefined, - event_type: 'test event', - event_id: 0, - event_properties: { - mode: 'test', - }, - library: library, - }); - expect(response.code).toBe(200); - expect(response.message).toBe(SUCCESS_MESSAGE); - scope.done(); - - expect(logger.debug).toHaveBeenCalledTimes(1); - /* eslint-disable */ - const debugContext = JSON.parse(logger.debug.mock.calls[0]); - expect(debugContext.type).toBeDefined(); - expect(debugContext.name).toEqual('track'); - expect(debugContext.args).toBeDefined(); - expect(debugContext.stacktrace).toBeDefined(); - expect(debugContext.time).toBeDefined(); - expect(debugContext.states).toBeDefined(); - /* eslint-enable */ - }); - - test('should enable debug mode for setOptOut', async () => { - const logger = { - disable: jest.fn(), - enable: jest.fn(), - debug: jest.fn(), - log: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - }; - amplitude.init('API_KEY', { ...opts, loggerProvider: logger, logLevel: LogLevel.Debug }); - amplitude.setOptOut(true); - - expect(logger.debug).toHaveBeenCalledTimes(1); - /* eslint-disable */ - const debugContext = JSON.parse(logger.debug.mock.calls[0]); - expect(debugContext.type).toBeDefined(); - expect(debugContext.name).toEqual('setOptOut'); - expect(debugContext.args).toBeDefined(); - expect(debugContext.stacktrace).toBeDefined(); - expect(debugContext.time).toBeDefined(); - expect(debugContext.states).toBeDefined(); - /* eslint-enable */ - }); - }); - }); -}); diff --git a/packages/analytics-node-test/test/responses.ts b/packages/analytics-node-test/test/responses.ts deleted file mode 100644 index af32c7ed6..000000000 --- a/packages/analytics-node-test/test/responses.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const success = { - code: 200, - events_ingested: 1, - payload_size_bytes: 50, - server_upload_time: 1396381378123, -}; diff --git a/packages/analytics-node-test/tsconfig.json b/packages/analytics-node-test/tsconfig.json deleted file mode 100644 index 954a27f1b..000000000 --- a/packages/analytics-node-test/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["test/**/*"], - "compilerOptions": { - "baseUrl": ".", - "esModuleInterop": true, - "noEmit": true, - "rootDir": ".", - } -} From b8fbaf863ee78f6de39bd28221ac012099c86adf Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 15:48:37 -0700 Subject: [PATCH 8/9] chore: clean analytics-types --- examples/plugins/page-view-tracking-enrichment/index.ts | 5 +++-- examples/plugins/remove-event-key/index.ts | 3 +-- packages/analytics-browser-test/test/index.test.ts | 3 +-- packages/analytics-core/test/core-client.test.ts | 3 ++- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/plugins/page-view-tracking-enrichment/index.ts b/examples/plugins/page-view-tracking-enrichment/index.ts index 3b4d393b2..9bc4b9cb8 100644 --- a/examples/plugins/page-view-tracking-enrichment/index.ts +++ b/examples/plugins/page-view-tracking-enrichment/index.ts @@ -1,5 +1,5 @@ import { createInstance } from '@amplitude/analytics-browser'; -import { EnrichmentPlugin } from '@amplitude/analytics-types'; +import { EnrichmentPlugin } from '@amplitude/analytics-core'; /** * This is an example plugin that enriches events with event_type "Page View" by adding @@ -13,7 +13,8 @@ export const pageViewTrackingEnrichment = (): EnrichmentPlugin => { type: 'enrichment', setup: async () => undefined, execute: async (event) => { - if (event.event_type !== '[Amplitude] Page Viewed') { // event name format if using Autocapture Pageviews + if (event.event_type !== '[Amplitude] Page Viewed') { + // event name format if using Autocapture Pageviews return event; } event.event_properties = { diff --git a/examples/plugins/remove-event-key/index.ts b/examples/plugins/remove-event-key/index.ts index 86cafc453..e93000683 100644 --- a/examples/plugins/remove-event-key/index.ts +++ b/examples/plugins/remove-event-key/index.ts @@ -1,6 +1,5 @@ import { createInstance } from '@amplitude/analytics-browser'; -import { EnrichmentPlugin } from '@amplitude/analytics-types'; -import { BaseEvent } from '@amplitude/analytics-types/src'; +import { EnrichmentPlugin, BaseEvent } from '@amplitude/analytics-core'; type KeyOfEvent = keyof BaseEvent; diff --git a/packages/analytics-browser-test/test/index.test.ts b/packages/analytics-browser-test/test/index.test.ts index 198473966..9efcebf26 100644 --- a/packages/analytics-browser-test/test/index.test.ts +++ b/packages/analytics-browser-test/test/index.test.ts @@ -6,8 +6,7 @@ import { default as nock } from 'nock'; import { success } from './responses'; import 'isomorphic-fetch'; import { path, url, SUCCESS_MESSAGE, uuidPattern } from './constants'; -import { LogLevel } from '@amplitude/analytics-types'; -import { UUID } from '@amplitude/analytics-core'; +import { UUID, LogLevel } from '@amplitude/analytics-core'; describe('integration', () => { const uuid: string = expect.stringMatching(uuidPattern) as string; diff --git a/packages/analytics-core/test/core-client.test.ts b/packages/analytics-core/test/core-client.test.ts index 9269de147..083c8f10a 100644 --- a/packages/analytics-core/test/core-client.test.ts +++ b/packages/analytics-core/test/core-client.test.ts @@ -8,7 +8,8 @@ import { CLIENT_NOT_INITIALIZED, OPT_OUT_MESSAGE } from '../src/types/messages'; import { useDefaultConfig } from './helpers/default'; import { IdentifyOperation } from '../src/identify'; import { UNSET_VALUE } from '../src/types/constants'; -import { BrowserConfig, LogLevel } from '@amplitude/analytics-types'; +import { BrowserConfig } from '../src/types/browser-config'; +import { LogLevel } from '../src/types/loglevel'; async function runScheduleTimers() { // eslint-disable-next-line @typescript-eslint/unbound-method From c5f9b442865552ab6d8d51b21538d23b5fcfad6d Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 10 Jun 2025 16:00:44 -0700 Subject: [PATCH 9/9] test: fix ci --- packages/analytics-browser/test/attribution/helpers.test.ts | 3 +-- .../test/attribution/web-attribution.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/analytics-browser/test/attribution/helpers.test.ts b/packages/analytics-browser/test/attribution/helpers.test.ts index 76e83b84e..3e9200e4e 100644 --- a/packages/analytics-browser/test/attribution/helpers.test.ts +++ b/packages/analytics-browser/test/attribution/helpers.test.ts @@ -1,4 +1,3 @@ -import { BASE_CAMPAIGN } from '../../src/attribution/constants'; import { isNewCampaign, createCampaignEvent, @@ -6,7 +5,7 @@ import { isExcludedReferrer, } from '../../src/attribution/helpers'; -import { getStorageKey } from '@amplitude/analytics-core'; +import { getStorageKey, BASE_CAMPAIGN } from '@amplitude/analytics-core'; const loggerProvider = { log: jest.fn(), diff --git a/packages/analytics-browser/test/attribution/web-attribution.test.ts b/packages/analytics-browser/test/attribution/web-attribution.test.ts index 327bdd7b2..a77d32da9 100644 --- a/packages/analytics-browser/test/attribution/web-attribution.test.ts +++ b/packages/analytics-browser/test/attribution/web-attribution.test.ts @@ -1,5 +1,3 @@ -import { BASE_CAMPAIGN } from '../../src/attribution/constants'; -import { CampaignParser } from '../../src/attribution/campaign-parser'; import { WebAttribution } from '../../src/attribution/web-attribution'; import { FetchTransport, @@ -9,6 +7,8 @@ import { AttributionOptions, BrowserConfig, LogLevel, + BASE_CAMPAIGN, + CampaignParser, } from '@amplitude/analytics-core'; describe('shouldTrackNewCampaign', () => {