react-native-nitro-amplitude 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.watchmanconfig +6 -0
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/android/CMakeLists.txt +34 -0
- package/android/build.gradle +85 -0
- package/android/consumer-rules.pro +35 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/cpp/AndroidAmplitudeAdapterCpp.cpp +126 -0
- package/android/src/main/cpp/AndroidAmplitudeAdapterCpp.hpp +48 -0
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/nitroamplitude/AndroidAmplitudeAdapter.kt +147 -0
- package/android/src/main/java/com/nitroamplitude/NitroAmplitudePackage.kt +24 -0
- package/app.plugin.js +36 -0
- package/cpp/bindings/HybridAmplitudeContext.cpp +83 -0
- package/cpp/bindings/HybridAmplitudeContext.hpp +29 -0
- package/cpp/bindings/HybridAmplitudeStorage.cpp +163 -0
- package/cpp/bindings/HybridAmplitudeStorage.hpp +38 -0
- package/cpp/bindings/HybridAmplitudeWorker.cpp +162 -0
- package/cpp/bindings/HybridAmplitudeWorker.hpp +74 -0
- package/cpp/core/NativeAmplitudeAdapter.hpp +44 -0
- package/ios/IOSAmplitudeAdapterCpp.hpp +37 -0
- package/ios/IOSAmplitudeAdapterCpp.mm +155 -0
- package/lib/commonjs/AmplitudeContext.nitro.js +6 -0
- package/lib/commonjs/AmplitudeContext.nitro.js.map +1 -0
- package/lib/commonjs/AmplitudeStorage.nitro.js +6 -0
- package/lib/commonjs/AmplitudeStorage.nitro.js.map +1 -0
- package/lib/commonjs/AmplitudeWorker.nitro.js +6 -0
- package/lib/commonjs/AmplitudeWorker.nitro.js.map +1 -0
- package/lib/commonjs/analytics/campaign/campaign-tracker.js +105 -0
- package/lib/commonjs/analytics/campaign/campaign-tracker.js.map +1 -0
- package/lib/commonjs/analytics/campaign/types.js +6 -0
- package/lib/commonjs/analytics/campaign/types.js.map +1 -0
- package/lib/commonjs/analytics/config.js +283 -0
- package/lib/commonjs/analytics/config.js.map +1 -0
- package/lib/commonjs/analytics/cookie-migration/index.js +59 -0
- package/lib/commonjs/analytics/cookie-migration/index.js.map +1 -0
- package/lib/commonjs/analytics/index.js +95 -0
- package/lib/commonjs/analytics/index.js.map +1 -0
- package/lib/commonjs/analytics/migration/remnant-data-migration.js +177 -0
- package/lib/commonjs/analytics/migration/remnant-data-migration.js.map +1 -0
- package/lib/commonjs/analytics/nitro-transport.js +31 -0
- package/lib/commonjs/analytics/nitro-transport.js.map +1 -0
- package/lib/commonjs/analytics/plugins/context.js +140 -0
- package/lib/commonjs/analytics/plugins/context.js.map +1 -0
- package/lib/commonjs/analytics/react-native-client.js +352 -0
- package/lib/commonjs/analytics/react-native-client.js.map +1 -0
- package/lib/commonjs/analytics/storage/local-storage.js +73 -0
- package/lib/commonjs/analytics/storage/local-storage.js.map +1 -0
- package/lib/commonjs/analytics/types.js +175 -0
- package/lib/commonjs/analytics/types.js.map +1 -0
- package/lib/commonjs/analytics/typings/browser-snippet.d.js +6 -0
- package/lib/commonjs/analytics/typings/browser-snippet.d.js.map +1 -0
- package/lib/commonjs/analytics/typings/ua-parser.d.js +2 -0
- package/lib/commonjs/analytics/typings/ua-parser.d.js.map +1 -0
- package/lib/commonjs/analytics/utils/platform.js +16 -0
- package/lib/commonjs/analytics/utils/platform.js.map +1 -0
- package/lib/commonjs/analytics/version.js +8 -0
- package/lib/commonjs/analytics/version.js.map +1 -0
- package/lib/commonjs/experiment/experimentClient.js +792 -0
- package/lib/commonjs/experiment/experimentClient.js.map +1 -0
- package/lib/commonjs/experiment/factory.js +77 -0
- package/lib/commonjs/experiment/factory.js.map +1 -0
- package/lib/commonjs/experiment/gen/version.js +9 -0
- package/lib/commonjs/experiment/gen/version.js.map +1 -0
- package/lib/commonjs/experiment/index.js +143 -0
- package/lib/commonjs/experiment/index.js.map +1 -0
- package/lib/commonjs/experiment/integration/NativeExperimentReactNativeClient.js +11 -0
- package/lib/commonjs/experiment/integration/NativeExperimentReactNativeClient.js.map +1 -0
- package/lib/commonjs/experiment/integration/connector.js +67 -0
- package/lib/commonjs/experiment/integration/connector.js.map +1 -0
- package/lib/commonjs/experiment/integration/default.js +92 -0
- package/lib/commonjs/experiment/integration/default.js.map +1 -0
- package/lib/commonjs/experiment/logger/ampLogger.js +80 -0
- package/lib/commonjs/experiment/logger/ampLogger.js.map +1 -0
- package/lib/commonjs/experiment/logger/consoleLogger.js +60 -0
- package/lib/commonjs/experiment/logger/consoleLogger.js.map +1 -0
- package/lib/commonjs/experiment/storage/cache.js +197 -0
- package/lib/commonjs/experiment/storage/cache.js.map +1 -0
- package/lib/commonjs/experiment/storage/local-storage.js +25 -0
- package/lib/commonjs/experiment/storage/local-storage.js.map +1 -0
- package/lib/commonjs/experiment/stubClient.js +46 -0
- package/lib/commonjs/experiment/stubClient.js.map +1 -0
- package/lib/commonjs/experiment/transport/http.js +72 -0
- package/lib/commonjs/experiment/transport/http.js.map +1 -0
- package/lib/commonjs/experiment/types/client.js +6 -0
- package/lib/commonjs/experiment/types/client.js.map +1 -0
- package/lib/commonjs/experiment/types/config.js +67 -0
- package/lib/commonjs/experiment/types/config.js.map +1 -0
- package/lib/commonjs/experiment/types/exposure.js +2 -0
- package/lib/commonjs/experiment/types/exposure.js.map +1 -0
- package/lib/commonjs/experiment/types/logger.js +42 -0
- package/lib/commonjs/experiment/types/logger.js.map +1 -0
- package/lib/commonjs/experiment/types/source.js +54 -0
- package/lib/commonjs/experiment/types/source.js.map +1 -0
- package/lib/commonjs/experiment/types/storage.js +2 -0
- package/lib/commonjs/experiment/types/storage.js.map +1 -0
- package/lib/commonjs/experiment/types/transport.js +2 -0
- package/lib/commonjs/experiment/types/transport.js.map +1 -0
- package/lib/commonjs/experiment/types/user.js +2 -0
- package/lib/commonjs/experiment/types/user.js.map +1 -0
- package/lib/commonjs/experiment/types/variant.js +2 -0
- package/lib/commonjs/experiment/types/variant.js.map +1 -0
- package/lib/commonjs/experiment/util/backoff.js +54 -0
- package/lib/commonjs/experiment/util/backoff.js.map +1 -0
- package/lib/commonjs/experiment/util/base64.js +23 -0
- package/lib/commonjs/experiment/util/base64.js.map +1 -0
- package/lib/commonjs/experiment/util/convert.js +78 -0
- package/lib/commonjs/experiment/util/convert.js.map +1 -0
- package/lib/commonjs/experiment/util/index.js +25 -0
- package/lib/commonjs/experiment/util/index.js.map +1 -0
- package/lib/commonjs/experiment/util/platform.js +16 -0
- package/lib/commonjs/experiment/util/platform.js.map +1 -0
- package/lib/commonjs/experiment/util/randomstring.js +16 -0
- package/lib/commonjs/experiment/util/randomstring.js.map +1 -0
- package/lib/commonjs/experiment/util/userSessionExposureTracker.js +40 -0
- package/lib/commonjs/experiment/util/userSessionExposureTracker.js.map +1 -0
- package/lib/commonjs/index.js +298 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.web.js +22 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/native/context.js +43 -0
- package/lib/commonjs/native/context.js.map +1 -0
- package/lib/commonjs/native/http.js +62 -0
- package/lib/commonjs/native/http.js.map +1 -0
- package/lib/commonjs/native/hybrid.js +31 -0
- package/lib/commonjs/native/hybrid.js.map +1 -0
- package/lib/commonjs/native/storage.js +93 -0
- package/lib/commonjs/native/storage.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/AmplitudeContext.nitro.js +4 -0
- package/lib/module/AmplitudeContext.nitro.js.map +1 -0
- package/lib/module/AmplitudeStorage.nitro.js +4 -0
- package/lib/module/AmplitudeStorage.nitro.js.map +1 -0
- package/lib/module/AmplitudeWorker.nitro.js +4 -0
- package/lib/module/AmplitudeWorker.nitro.js.map +1 -0
- package/lib/module/analytics/campaign/campaign-tracker.js +100 -0
- package/lib/module/analytics/campaign/campaign-tracker.js.map +1 -0
- package/lib/module/analytics/campaign/types.js +4 -0
- package/lib/module/analytics/campaign/types.js.map +1 -0
- package/lib/module/analytics/config.js +272 -0
- package/lib/module/analytics/config.js.map +1 -0
- package/lib/module/analytics/cookie-migration/index.js +51 -0
- package/lib/module/analytics/cookie-migration/index.js.map +1 -0
- package/lib/module/analytics/index.js +34 -0
- package/lib/module/analytics/index.js.map +1 -0
- package/lib/module/analytics/migration/remnant-data-migration.js +172 -0
- package/lib/module/analytics/migration/remnant-data-migration.js.map +1 -0
- package/lib/module/analytics/nitro-transport.js +26 -0
- package/lib/module/analytics/nitro-transport.js.map +1 -0
- package/lib/module/analytics/plugins/context.js +134 -0
- package/lib/module/analytics/plugins/context.js.map +1 -0
- package/lib/module/analytics/react-native-client.js +346 -0
- package/lib/module/analytics/react-native-client.js.map +1 -0
- package/lib/module/analytics/storage/local-storage.js +68 -0
- package/lib/module/analytics/storage/local-storage.js.map +1 -0
- package/lib/module/analytics/types.js +4 -0
- package/lib/module/analytics/types.js.map +1 -0
- package/lib/module/analytics/typings/browser-snippet.d.js +4 -0
- package/lib/module/analytics/typings/browser-snippet.d.js.map +1 -0
- package/lib/module/analytics/typings/ua-parser.d.js +2 -0
- package/lib/module/analytics/typings/ua-parser.d.js.map +1 -0
- package/lib/module/analytics/utils/platform.js +10 -0
- package/lib/module/analytics/utils/platform.js.map +1 -0
- package/lib/module/analytics/version.js +4 -0
- package/lib/module/analytics/version.js.map +1 -0
- package/lib/module/experiment/experimentClient.js +788 -0
- package/lib/module/experiment/experimentClient.js.map +1 -0
- package/lib/module/experiment/factory.js +73 -0
- package/lib/module/experiment/factory.js.map +1 -0
- package/lib/module/experiment/gen/version.js +5 -0
- package/lib/module/experiment/gen/version.js.map +1 -0
- package/lib/module/experiment/index.js +16 -0
- package/lib/module/experiment/index.js.map +1 -0
- package/lib/module/experiment/integration/NativeExperimentReactNativeClient.js +7 -0
- package/lib/module/experiment/integration/NativeExperimentReactNativeClient.js.map +1 -0
- package/lib/module/experiment/integration/connector.js +61 -0
- package/lib/module/experiment/integration/connector.js.map +1 -0
- package/lib/module/experiment/integration/default.js +87 -0
- package/lib/module/experiment/integration/default.js.map +1 -0
- package/lib/module/experiment/logger/ampLogger.js +76 -0
- package/lib/module/experiment/logger/ampLogger.js.map +1 -0
- package/lib/module/experiment/logger/consoleLogger.js +55 -0
- package/lib/module/experiment/logger/consoleLogger.js.map +1 -0
- package/lib/module/experiment/storage/cache.js +187 -0
- package/lib/module/experiment/storage/cache.js.map +1 -0
- package/lib/module/experiment/storage/local-storage.js +19 -0
- package/lib/module/experiment/storage/local-storage.js.map +1 -0
- package/lib/module/experiment/stubClient.js +41 -0
- package/lib/module/experiment/stubClient.js.map +1 -0
- package/lib/module/experiment/transport/http.js +66 -0
- package/lib/module/experiment/transport/http.js.map +1 -0
- package/lib/module/experiment/types/client.js +4 -0
- package/lib/module/experiment/types/client.js.map +1 -0
- package/lib/module/experiment/types/config.js +64 -0
- package/lib/module/experiment/types/config.js.map +1 -0
- package/lib/module/experiment/types/exposure.js +2 -0
- package/lib/module/experiment/types/exposure.js.map +1 -0
- package/lib/module/experiment/types/logger.js +39 -0
- package/lib/module/experiment/types/logger.js.map +1 -0
- package/lib/module/experiment/types/source.js +51 -0
- package/lib/module/experiment/types/source.js.map +1 -0
- package/lib/module/experiment/types/storage.js +2 -0
- package/lib/module/experiment/types/storage.js.map +1 -0
- package/lib/module/experiment/types/transport.js +2 -0
- package/lib/module/experiment/types/transport.js.map +1 -0
- package/lib/module/experiment/types/user.js +2 -0
- package/lib/module/experiment/types/user.js.map +1 -0
- package/lib/module/experiment/types/variant.js +2 -0
- package/lib/module/experiment/types/variant.js.map +1 -0
- package/lib/module/experiment/util/backoff.js +49 -0
- package/lib/module/experiment/util/backoff.js.map +1 -0
- package/lib/module/experiment/util/base64.js +16 -0
- package/lib/module/experiment/util/base64.js.map +1 -0
- package/lib/module/experiment/util/convert.js +71 -0
- package/lib/module/experiment/util/convert.js.map +1 -0
- package/lib/module/experiment/util/index.js +17 -0
- package/lib/module/experiment/util/index.js.map +1 -0
- package/lib/module/experiment/util/platform.js +10 -0
- package/lib/module/experiment/util/platform.js.map +1 -0
- package/lib/module/experiment/util/randomstring.js +11 -0
- package/lib/module/experiment/util/randomstring.js.map +1 -0
- package/lib/module/experiment/util/userSessionExposureTracker.js +35 -0
- package/lib/module/experiment/util/userSessionExposureTracker.js.map +1 -0
- package/lib/module/index.js +50 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +14 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/native/context.js +35 -0
- package/lib/module/native/context.js.map +1 -0
- package/lib/module/native/http.js +57 -0
- package/lib/module/native/http.js.map +1 -0
- package/lib/module/native/hybrid.js +24 -0
- package/lib/module/native/hybrid.js.map +1 -0
- package/lib/module/native/storage.js +86 -0
- package/lib/module/native/storage.js.map +1 -0
- package/lib/typescript/AmplitudeContext.nitro.d.ts +17 -0
- package/lib/typescript/AmplitudeContext.nitro.d.ts.map +1 -0
- package/lib/typescript/AmplitudeStorage.nitro.d.ts +17 -0
- package/lib/typescript/AmplitudeStorage.nitro.d.ts.map +1 -0
- package/lib/typescript/AmplitudeWorker.nitro.d.ts +11 -0
- package/lib/typescript/AmplitudeWorker.nitro.d.ts.map +1 -0
- package/lib/typescript/analytics/campaign/campaign-tracker.d.ts +85 -0
- package/lib/typescript/analytics/campaign/campaign-tracker.d.ts.map +1 -0
- package/lib/typescript/analytics/campaign/types.d.ts +11 -0
- package/lib/typescript/analytics/campaign/types.d.ts.map +1 -0
- package/lib/typescript/analytics/config.d.ts +68 -0
- package/lib/typescript/analytics/config.d.ts.map +1 -0
- package/lib/typescript/analytics/cookie-migration/index.d.ts +6 -0
- package/lib/typescript/analytics/cookie-migration/index.d.ts.map +1 -0
- package/lib/typescript/analytics/index.d.ts +7 -0
- package/lib/typescript/analytics/index.d.ts.map +1 -0
- package/lib/typescript/analytics/migration/remnant-data-migration.d.ts +20 -0
- package/lib/typescript/analytics/migration/remnant-data-migration.d.ts.map +1 -0
- package/lib/typescript/analytics/nitro-transport.d.ts +9 -0
- package/lib/typescript/analytics/nitro-transport.d.ts.map +1 -0
- package/lib/typescript/analytics/plugins/context.d.ts +14 -0
- package/lib/typescript/analytics/plugins/context.d.ts.map +1 -0
- package/lib/typescript/analytics/react-native-client.d.ts +55 -0
- package/lib/typescript/analytics/react-native-client.d.ts.map +1 -0
- package/lib/typescript/analytics/storage/local-storage.d.ts +14 -0
- package/lib/typescript/analytics/storage/local-storage.d.ts.map +1 -0
- package/lib/typescript/analytics/types.d.ts +2 -0
- package/lib/typescript/analytics/types.d.ts.map +1 -0
- package/lib/typescript/analytics/utils/platform.d.ts +3 -0
- package/lib/typescript/analytics/utils/platform.d.ts.map +1 -0
- package/lib/typescript/analytics/version.d.ts +2 -0
- package/lib/typescript/analytics/version.d.ts.map +1 -0
- package/lib/typescript/experiment/experimentClient.d.ts +234 -0
- package/lib/typescript/experiment/experimentClient.d.ts.map +1 -0
- package/lib/typescript/experiment/factory.d.ts +11 -0
- package/lib/typescript/experiment/factory.d.ts.map +1 -0
- package/lib/typescript/experiment/gen/version.d.ts +2 -0
- package/lib/typescript/experiment/gen/version.d.ts.map +1 -0
- package/lib/typescript/experiment/index.d.ts +15 -0
- package/lib/typescript/experiment/index.d.ts.map +1 -0
- package/lib/typescript/experiment/integration/NativeExperimentReactNativeClient.d.ts +16 -0
- package/lib/typescript/experiment/integration/NativeExperimentReactNativeClient.d.ts.map +1 -0
- package/lib/typescript/experiment/integration/connector.d.ts +16 -0
- package/lib/typescript/experiment/integration/connector.d.ts.map +1 -0
- package/lib/typescript/experiment/integration/default.d.ts +20 -0
- package/lib/typescript/experiment/integration/default.d.ts.map +1 -0
- package/lib/typescript/experiment/logger/ampLogger.d.ts +47 -0
- package/lib/typescript/experiment/logger/ampLogger.d.ts.map +1 -0
- package/lib/typescript/experiment/logger/consoleLogger.d.ts +40 -0
- package/lib/typescript/experiment/logger/consoleLogger.d.ts.map +1 -0
- package/lib/typescript/experiment/storage/cache.d.ts +35 -0
- package/lib/typescript/experiment/storage/cache.d.ts.map +1 -0
- package/lib/typescript/experiment/storage/local-storage.d.ts +11 -0
- package/lib/typescript/experiment/storage/local-storage.d.ts.map +1 -0
- package/lib/typescript/experiment/stubClient.d.ts +21 -0
- package/lib/typescript/experiment/stubClient.d.ts.map +1 -0
- package/lib/typescript/experiment/transport/http.d.ts +17 -0
- package/lib/typescript/experiment/transport/http.d.ts.map +1 -0
- package/lib/typescript/experiment/types/client.d.ts +36 -0
- package/lib/typescript/experiment/types/client.d.ts.map +1 -0
- package/lib/typescript/experiment/types/config.d.ts +164 -0
- package/lib/typescript/experiment/types/config.d.ts.map +1 -0
- package/lib/typescript/experiment/types/exposure.d.ts +107 -0
- package/lib/typescript/experiment/types/exposure.d.ts.map +1 -0
- package/lib/typescript/experiment/types/logger.d.ts +67 -0
- package/lib/typescript/experiment/types/logger.d.ts.map +1 -0
- package/lib/typescript/experiment/types/source.d.ts +43 -0
- package/lib/typescript/experiment/types/source.d.ts.map +1 -0
- package/lib/typescript/experiment/types/storage.d.ts +7 -0
- package/lib/typescript/experiment/types/storage.d.ts.map +1 -0
- package/lib/typescript/experiment/types/transport.d.ts +8 -0
- package/lib/typescript/experiment/types/transport.d.ts.map +1 -0
- package/lib/typescript/experiment/types/user.d.ts +106 -0
- package/lib/typescript/experiment/types/user.d.ts.map +1 -0
- package/lib/typescript/experiment/types/variant.d.ts +33 -0
- package/lib/typescript/experiment/types/variant.d.ts.map +1 -0
- package/lib/typescript/experiment/util/backoff.d.ts +14 -0
- package/lib/typescript/experiment/util/backoff.d.ts.map +1 -0
- package/lib/typescript/experiment/util/base64.d.ts +3 -0
- package/lib/typescript/experiment/util/base64.d.ts.map +1 -0
- package/lib/typescript/experiment/util/convert.d.ts +7 -0
- package/lib/typescript/experiment/util/convert.d.ts.map +1 -0
- package/lib/typescript/experiment/util/index.d.ts +6 -0
- package/lib/typescript/experiment/util/index.d.ts.map +1 -0
- package/lib/typescript/experiment/util/platform.d.ts +3 -0
- package/lib/typescript/experiment/util/platform.d.ts.map +1 -0
- package/lib/typescript/experiment/util/randomstring.d.ts +2 -0
- package/lib/typescript/experiment/util/randomstring.d.ts.map +1 -0
- package/lib/typescript/experiment/util/userSessionExposureTracker.d.ts +16 -0
- package/lib/typescript/experiment/util/userSessionExposureTracker.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +31 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/index.web.d.ts +12 -0
- package/lib/typescript/index.web.d.ts.map +1 -0
- package/lib/typescript/native/context.d.ts +29 -0
- package/lib/typescript/native/context.d.ts.map +1 -0
- package/lib/typescript/native/http.d.ts +6 -0
- package/lib/typescript/native/http.d.ts.map +1 -0
- package/lib/typescript/native/hybrid.d.ts +8 -0
- package/lib/typescript/native/hybrid.d.ts.map +1 -0
- package/lib/typescript/native/storage.d.ts +29 -0
- package/lib/typescript/native/storage.d.ts.map +1 -0
- package/nitro.json +33 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroAmplitude+autolinking.cmake +83 -0
- package/nitrogen/generated/android/NitroAmplitude+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroAmplitudeOnLoad.cpp +69 -0
- package/nitrogen/generated/android/NitroAmplitudeOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitroamplitude/NitroAmplitudeOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NitroAmplitude+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroAmplitude-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/NitroAmplitude-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/NitroAmplitude-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/NitroAmplitudeAutolinking.mm +55 -0
- package/nitrogen/generated/ios/NitroAmplitudeAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/HybridAmplitudeContextSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridAmplitudeContextSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridAmplitudeStorageSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridAmplitudeStorageSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridAmplitudeWorkerSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridAmplitudeWorkerSpec.hpp +66 -0
- package/package.json +130 -0
- package/react-native-nitro-amplitude.podspec +36 -0
- package/src/AmplitudeContext.nitro.ts +21 -0
- package/src/AmplitudeStorage.nitro.ts +17 -0
- package/src/AmplitudeWorker.nitro.ts +25 -0
- package/src/analytics/campaign/campaign-tracker.ts +162 -0
- package/src/analytics/campaign/types.ts +18 -0
- package/src/analytics/config.ts +373 -0
- package/src/analytics/cookie-migration/index.ts +69 -0
- package/src/analytics/index.ts +36 -0
- package/src/analytics/migration/remnant-data-migration.ts +206 -0
- package/src/analytics/nitro-transport.ts +35 -0
- package/src/analytics/plugins/context.ts +166 -0
- package/src/analytics/react-native-client.ts +573 -0
- package/src/analytics/storage/local-storage.ts +76 -0
- package/src/analytics/types.ts +30 -0
- package/src/analytics/typings/browser-snippet.d.ts +7 -0
- package/src/analytics/typings/ua-parser.d.ts +4 -0
- package/src/analytics/utils/platform.ts +9 -0
- package/src/analytics/version.ts +1 -0
- package/src/experiment/experimentClient.ts +987 -0
- package/src/experiment/factory.ts +86 -0
- package/src/experiment/gen/version.ts +2 -0
- package/src/experiment/index.ts +14 -0
- package/src/experiment/integration/NativeExperimentReactNativeClient.ts +25 -0
- package/src/experiment/integration/connector.ts +82 -0
- package/src/experiment/integration/default.ts +107 -0
- package/src/experiment/logger/ampLogger.ts +76 -0
- package/src/experiment/logger/consoleLogger.ts +54 -0
- package/src/experiment/storage/cache.ts +271 -0
- package/src/experiment/storage/local-storage.ts +23 -0
- package/src/experiment/stubClient.ts +61 -0
- package/src/experiment/transport/http.ts +105 -0
- package/src/experiment/types/client.ts +38 -0
- package/src/experiment/types/config.ts +210 -0
- package/src/experiment/types/exposure.ts +107 -0
- package/src/experiment/types/logger.ts +71 -0
- package/src/experiment/types/source.ts +52 -0
- package/src/experiment/types/storage.ts +6 -0
- package/src/experiment/types/transport.ts +14 -0
- package/src/experiment/types/user.ts +132 -0
- package/src/experiment/types/variant.ts +36 -0
- package/src/experiment/util/backoff.ts +67 -0
- package/src/experiment/util/base64.ts +20 -0
- package/src/experiment/util/convert.ts +78 -0
- package/src/experiment/util/index.ts +23 -0
- package/src/experiment/util/platform.ts +9 -0
- package/src/experiment/util/randomstring.ts +12 -0
- package/src/experiment/util/userSessionExposureTracker.ts +47 -0
- package/src/index.ts +66 -0
- package/src/index.web.ts +19 -0
- package/src/native/context.ts +73 -0
- package/src/native/http.ts +77 -0
- package/src/native/hybrid.ts +32 -0
- package/src/native/storage.ts +107 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Campaign, ReactNativeAttributionOptions, Storage, BaseEvent } from "@amplitude/analytics-core";
|
|
2
|
+
export interface CampaignTrackerOptions extends ReactNativeAttributionOptions {
|
|
3
|
+
storage: Storage<Campaign>;
|
|
4
|
+
track: CampaignTrackFunction;
|
|
5
|
+
onNewCampaign: (campaign: Campaign) => unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface CampaignTracker extends CampaignTrackerOptions {
|
|
8
|
+
send(force: boolean): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export type CampaignTrackFunction = (event: BaseEvent) => Promise<unknown>;
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/analytics/campaign/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,6BAA6B,EAC7B,OAAO,EACP,SAAS,EACV,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,sBAAuB,SAAQ,6BAA6B;IAC3E,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,aAAa,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC;CAChD;AAED,MAAM,WAAW,eAAgB,SAAQ,sBAAsB;IAC7D,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Config, MemoryStorage, ReactNativeConfig as IReactNativeConfig, ReactNativeTrackingOptions, Event, ReactNativeOptions, Storage, UserSession } from "@amplitude/analytics-core";
|
|
2
|
+
import { NitroAnalyticsStorage } from "../native/storage";
|
|
3
|
+
export declare const getDefaultConfig: () => {
|
|
4
|
+
cookieExpiration: number;
|
|
5
|
+
cookieSameSite: string;
|
|
6
|
+
cookieSecure: boolean;
|
|
7
|
+
cookieStorage: MemoryStorage<UserSession>;
|
|
8
|
+
cookieUpgrade: boolean;
|
|
9
|
+
disableCookies: boolean;
|
|
10
|
+
domain: string;
|
|
11
|
+
sessionTimeout: number;
|
|
12
|
+
storageProvider: NitroAnalyticsStorage<Event[]>;
|
|
13
|
+
trackingSessionEvents: boolean;
|
|
14
|
+
trackingOptions: Required<ReactNativeTrackingOptions>;
|
|
15
|
+
transportProvider: import("./nitro-transport").NitroTransport;
|
|
16
|
+
};
|
|
17
|
+
export declare class ReactNativeConfig extends Config implements IReactNativeConfig {
|
|
18
|
+
appVersion?: string;
|
|
19
|
+
cookieExpiration: number;
|
|
20
|
+
cookieSameSite: string;
|
|
21
|
+
cookieSecure: boolean;
|
|
22
|
+
cookieStorage: Storage<UserSession>;
|
|
23
|
+
cookieUpgrade: boolean;
|
|
24
|
+
disableCookies: boolean;
|
|
25
|
+
domain: string;
|
|
26
|
+
partnerId?: string;
|
|
27
|
+
sessionTimeout: number;
|
|
28
|
+
trackingSessionEvents: boolean;
|
|
29
|
+
trackingOptions: ReactNativeTrackingOptions;
|
|
30
|
+
protected _deviceId?: string;
|
|
31
|
+
protected _lastEventId?: number;
|
|
32
|
+
protected _lastEventTime?: number;
|
|
33
|
+
protected _optOut: boolean;
|
|
34
|
+
protected _sessionId?: number;
|
|
35
|
+
protected _userId?: string;
|
|
36
|
+
constructor(apiKey: string, options?: ReactNativeOptions);
|
|
37
|
+
get deviceId(): string | undefined;
|
|
38
|
+
set deviceId(deviceId: string | undefined);
|
|
39
|
+
get userId(): string | undefined;
|
|
40
|
+
set userId(userId: string | undefined);
|
|
41
|
+
get sessionId(): number | undefined;
|
|
42
|
+
set sessionId(sessionId: number | undefined);
|
|
43
|
+
get optOut(): boolean;
|
|
44
|
+
set optOut(optOut: boolean);
|
|
45
|
+
get lastEventTime(): number | undefined;
|
|
46
|
+
set lastEventTime(lastEventTime: number | undefined);
|
|
47
|
+
get lastEventId(): number | undefined;
|
|
48
|
+
set lastEventId(lastEventId: number | undefined);
|
|
49
|
+
private updateStorage;
|
|
50
|
+
}
|
|
51
|
+
export declare const useReactNativeConfig: (apiKey: string, options?: ReactNativeOptions) => Promise<IReactNativeConfig>;
|
|
52
|
+
export declare const createCookieStorage: <T>(overrides?: ReactNativeOptions, baseConfig?: {
|
|
53
|
+
cookieExpiration: number;
|
|
54
|
+
cookieSameSite: string;
|
|
55
|
+
cookieSecure: boolean;
|
|
56
|
+
cookieStorage: MemoryStorage<UserSession>;
|
|
57
|
+
cookieUpgrade: boolean;
|
|
58
|
+
disableCookies: boolean;
|
|
59
|
+
domain: string;
|
|
60
|
+
sessionTimeout: number;
|
|
61
|
+
storageProvider: NitroAnalyticsStorage<Event[]>;
|
|
62
|
+
trackingSessionEvents: boolean;
|
|
63
|
+
trackingOptions: Required<ReactNativeTrackingOptions>;
|
|
64
|
+
transportProvider: import("./nitro-transport").NitroTransport;
|
|
65
|
+
}) => Promise<Storage<T>>;
|
|
66
|
+
export declare const createEventsStorage: (overrides?: ReactNativeOptions) => Promise<Storage<Event[]> | undefined>;
|
|
67
|
+
export declare const getTopLevelDomain: (url?: string) => Promise<string>;
|
|
68
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/analytics/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,aAAa,EAEb,iBAAiB,IAAI,kBAAkB,EACvC,0BAA0B,EAC1B,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,WAAW,EAKZ,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CA8B5B,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,MAAO,YAAW,kBAAkB;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,eAAe,EAAE,0BAA0B,CAAC;IAG5C,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,OAAO,UAAS;IAC1B,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEf,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB;IAuCxD,IAAI,QAAQ,IAIW,MAAM,GAAG,SAAS,CAFxC;IAED,IAAI,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAKxC;IAED,IAAI,MAAM,IAIS,MAAM,GAAG,SAAS,CAFpC;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAKpC;IAED,IAAI,SAAS,IAIY,MAAM,GAAG,SAAS,CAF1C;IAED,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAK1C;IAED,IAAI,MAAM,IAIS,OAAO,CAFzB;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAKzB;IAED,IAAI,aAAa,IAIgB,MAAM,GAAG,SAAS,CAFlD;IAED,IAAI,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,EAKlD;IAED,IAAI,WAAW,IAIc,MAAM,GAAG,SAAS,CAF9C;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAK9C;IAED,OAAO,CAAC,aAAa;CAuBtB;AAED,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,MAAM,EACd,UAAU,kBAAkB,KAC3B,OAAO,CAAC,kBAAkB,CAsE5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,CAAC,EACzC,YAAY,kBAAkB,EAC9B;;;;;;;;;;;;;CAA+B,KAC9B,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAOpB,CAAC;AA6BF,eAAO,MAAM,mBAAmB,GAC9B,YAAY,kBAAkB,KAC7B,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAoBtC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAU,MAAM,MAAM,oBA6BnD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UserSession, ReactNativeOptions } from "@amplitude/analytics-core";
|
|
2
|
+
export declare const parseOldCookies: (apiKey: string, options?: ReactNativeOptions) => Promise<UserSession>;
|
|
3
|
+
export declare const parseTime: (num: string) => number | undefined;
|
|
4
|
+
export declare const decode: (value?: string) => string | undefined;
|
|
5
|
+
export declare const parseOptOut: (value?: string) => boolean;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/analytics/cookie-migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAOnC,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,UAAU,kBAAkB,KAC3B,OAAO,CAAC,WAAW,CA+BrB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,uBAMpC,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAShD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,KAAG,OAE5C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as Types from "./types";
|
|
2
|
+
export { createInstance } from "./react-native-client";
|
|
3
|
+
export declare const add: (plugin: Types.Plugin<Types.ReactNativeClient, Types.ReactNativeConfig>) => Types.AmplitudeReturn<void>, flush: () => Types.AmplitudeReturn<void>, getDeviceId: () => string | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: Types.IIdentify, eventOptions?: Types.EventOptions) => Types.AmplitudeReturn<Types.Result>, identify: (identify: Types.IIdentify, eventOptions?: Types.EventOptions) => Types.AmplitudeReturn<Types.Result>, init: (apiKey: string, userId?: string, options?: Types.ReactNativeOptions) => Types.AmplitudeReturn<void>, logEvent: (eventInput: Types.BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: Types.EventOptions) => Types.AmplitudeReturn<Types.Result>, remove: (pluginName: string) => Types.AmplitudeReturn<void>, reset: () => void, revenue: (revenue: Types.IRevenue, eventOptions?: Types.EventOptions) => Types.AmplitudeReturn<Types.Result>, setDeviceId: (deviceId: string) => void, setGroup: (groupType: string, groupName: string | string[], eventOptions?: Types.EventOptions) => Types.AmplitudeReturn<Types.Result>, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setUserId: (userId: string | undefined) => void, shutdown: () => void, track: (eventInput: Types.BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: Types.EventOptions) => Types.AmplitudeReturn<Types.Result>, extendSession: () => void;
|
|
4
|
+
export { Revenue, Identify } from "@amplitude/analytics-core";
|
|
5
|
+
export { InMemoryStorage, LocalStorage, MemoryStorage, } from "./storage/local-storage";
|
|
6
|
+
export { Types };
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/analytics/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,eAAO,MACL,GAAG,2GACH,KAAK,qCACL,WAAW,4BACX,YAAY,4BACZ,SAAS,4BACT,aAAa,0JACb,QAAQ,yGACR,IAAI,wGACJ,QAAQ,2JACR,MAAM,uDACN,KAAK,cACL,OAAO,uGACP,WAAW,8BACX,QAAQ,+HACR,SAAS,6BACT,YAAY,+BACZ,SAAS,wCACT,QAAQ,cACR,KAAK,2JACL,aAAa,YACL,CAAC;AAEX,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,YAAY,EACZ,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Event, ILogger, Storage, UserSession } from "@amplitude/analytics-core";
|
|
2
|
+
export default class RemnantDataMigration {
|
|
3
|
+
private readonly apiKey;
|
|
4
|
+
private readonly instanceName;
|
|
5
|
+
private readonly storage;
|
|
6
|
+
private readonly firstRunSinceUpgrade;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
eventsStorageKey: string;
|
|
9
|
+
constructor(apiKey: string, instanceName: string | undefined, storage: Storage<Event[]> | undefined, firstRunSinceUpgrade: boolean, logger: ILogger | undefined);
|
|
10
|
+
execute(): Promise<Omit<UserSession, "optOut">>;
|
|
11
|
+
private moveEvents;
|
|
12
|
+
private moveIdentifies;
|
|
13
|
+
private moveInterceptedIdentifies;
|
|
14
|
+
private callNativeFunction;
|
|
15
|
+
private callNativeAction;
|
|
16
|
+
private callStorageFunction;
|
|
17
|
+
private moveLegacyEvents;
|
|
18
|
+
private convertLegacyEvent;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=remnant-data-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remnant-data-migration.d.ts","sourceRoot":"","sources":["../../../../src/analytics/migration/remnant-data-migration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EAEP,OAAO,EACP,WAAW,EACZ,MAAM,2BAA2B,CAAC;AASnC,MAAM,CAAC,OAAO,OAAO,oBAAoB;IAIrC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPzB,gBAAgB,EAAE,MAAM,CAAC;gBAGN,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,EACrC,oBAAoB,EAAE,OAAO,EAC7B,MAAM,EAAE,OAAO,GAAG,SAAS;IAKxC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YAYvC,UAAU;YAIV,cAAc;YAId,yBAAyB;YAIzB,kBAAkB;IAWhC,OAAO,CAAC,gBAAgB;YAQV,mBAAmB;YAWnB,gBAAgB;IA2C9B,OAAO,CAAC,kBAAkB;CAgF3B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseTransport } from "@amplitude/analytics-core";
|
|
2
|
+
import type { Payload, Response, Transport } from "@amplitude/analytics-core";
|
|
3
|
+
export declare class NitroTransport extends BaseTransport implements Transport {
|
|
4
|
+
private readonly customHeaders;
|
|
5
|
+
constructor(customHeaders?: Record<string, string>);
|
|
6
|
+
send(serverUrl: string, payload: Payload): Promise<Response | null>;
|
|
7
|
+
}
|
|
8
|
+
export declare const nitroTransport: NitroTransport;
|
|
9
|
+
//# sourceMappingURL=nitro-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nitro-transport.d.ts","sourceRoot":"","sources":["../../../src/analytics/nitro-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG9E,qBAAa,cAAe,SAAQ,aAAc,YAAW,SAAS;IACpE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;gBAE3C,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAKhD,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAoB1E;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BeforePlugin, ReactNativeConfig, Event } from "@amplitude/analytics-core";
|
|
2
|
+
import UAParser from "@amplitude/ua-parser-js";
|
|
3
|
+
export declare class Context implements BeforePlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
type: "before";
|
|
6
|
+
config: ReactNativeConfig;
|
|
7
|
+
uaResult: UAParser.IResult;
|
|
8
|
+
library: string;
|
|
9
|
+
constructor();
|
|
10
|
+
setup(config: ReactNativeConfig): Promise<undefined>;
|
|
11
|
+
private getNativeContext;
|
|
12
|
+
execute(context: Event): Promise<Event>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/analytics/plugins/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,KAAK,EAIN,MAAM,2BAA2B,CAAC;AACnC,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AA4C/C,qBAAa,OAAQ,YAAW,YAAY;IAC1C,IAAI,SAA4C;IAChD,IAAI,EAAG,QAAQ,CAAU;IAKzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B,OAAO,SAAmC;;IAY1C,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;IAKpD,OAAO,CAAC,gBAAgB;IAWlB,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;CA4E9C"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AppStateStatus } from "react-native";
|
|
2
|
+
import { AmplitudeCore, ReactNativeConfig, ReactNativeOptions, ReactNativeAttributionOptions as AttributionOptions, IIdentify, EventOptions, Event, Result, ReactNativeClient, AnalyticsClient } from "@amplitude/analytics-core";
|
|
3
|
+
export type AmplitudeReactNativeClient = ReactNativeClient & {
|
|
4
|
+
shutdown: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare class AmplitudeReactNative extends AmplitudeCore implements ReactNativeClient, AnalyticsClient {
|
|
7
|
+
appState: AppStateStatus;
|
|
8
|
+
private appStateChangeHandler;
|
|
9
|
+
private initPromise;
|
|
10
|
+
private readonly connectorOwnerId;
|
|
11
|
+
explicitSessionId: number | undefined;
|
|
12
|
+
config: ReactNativeConfig;
|
|
13
|
+
userProperties: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
} | undefined;
|
|
16
|
+
init(apiKey?: string, userId?: string, options?: ReactNativeOptions): import("@amplitude/analytics-core").AmplitudeReturn<void>;
|
|
17
|
+
protected _init(options: ReactNativeOptions & {
|
|
18
|
+
apiKey: string;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
shutdown(): void;
|
|
21
|
+
private handleInternalTrackPromise;
|
|
22
|
+
private cancelDestinationFlushes;
|
|
23
|
+
runAttributionStrategy(attributionConfig?: AttributionOptions, isNewSession?: boolean): Promise<void>;
|
|
24
|
+
getUserId(): string | undefined;
|
|
25
|
+
setUserId(userId: string | undefined): void;
|
|
26
|
+
getDeviceId(): string | undefined;
|
|
27
|
+
setDeviceId(deviceId: string): void;
|
|
28
|
+
identify(identify: IIdentify, eventOptions?: EventOptions): import("@amplitude/analytics-core").AmplitudeReturn<Result>;
|
|
29
|
+
reset(): void;
|
|
30
|
+
getSessionId(): number | undefined;
|
|
31
|
+
getIdentity(): {
|
|
32
|
+
userId: string | undefined;
|
|
33
|
+
deviceId: string | undefined;
|
|
34
|
+
userProperties: {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
} | undefined;
|
|
37
|
+
};
|
|
38
|
+
getOptOut(): boolean;
|
|
39
|
+
setSessionId(sessionId: number): void;
|
|
40
|
+
extendSession(): void;
|
|
41
|
+
private setSessionIdInternal;
|
|
42
|
+
process(event: Event): Promise<Result>;
|
|
43
|
+
currentTimeMillis(): number;
|
|
44
|
+
private startNewSessionIfNeeded;
|
|
45
|
+
private shouldStartNewSession;
|
|
46
|
+
private isWithinMinTimeBetweenSessions;
|
|
47
|
+
private inSession;
|
|
48
|
+
private readonly handleAppStateChange;
|
|
49
|
+
private enterForeground;
|
|
50
|
+
private exitForeground;
|
|
51
|
+
}
|
|
52
|
+
export declare const createInstance: () => AmplitudeReactNativeClient;
|
|
53
|
+
declare const _default: AmplitudeReactNativeClient;
|
|
54
|
+
export default _default;
|
|
55
|
+
//# sourceMappingURL=react-native-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native-client.d.ts","sourceRoot":"","sources":["../../../src/analytics/react-native-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EAOb,iBAAiB,EACjB,kBAAkB,EAClB,6BAA6B,IAAI,kBAAkB,EACnD,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,EACN,iBAAiB,EAOjB,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAiBnC,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,GAAG;IAC3D,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAKF,qBAAa,oBACX,SAAQ,aACR,YAAW,iBAAiB,EAAE,eAAe;IAE7C,QAAQ,EAAE,cAAc,CAAgB;IACxC,OAAO,CAAC,qBAAqB,CAAsC;IACnE,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA0B;IAC3D,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IAGtC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,cAAc,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;IAEnD,IAAI,CAAC,MAAM,SAAK,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB;cAQ/C,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAgFtE,QAAQ;IAkBR,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,wBAAwB;IAmB1B,sBAAsB,CAC1B,iBAAiB,CAAC,EAAE,kBAAkB,EACtC,YAAY,UAAQ;IAuBtB,SAAS;IAIT,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IASpC,WAAW;IAIX,WAAW,CAAC,QAAQ,EAAE,MAAM;IAS5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,YAAY;IAUzD,KAAK;IAKL,YAAY;IAIZ,WAAW;;;;;;;IAQX,SAAS;IAIT,YAAY,CAAC,SAAS,EAAE,MAAM;IAU9B,aAAa;IAQb,OAAO,CAAC,oBAAoB;IAuCtB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IA+C5C,iBAAiB;IAIjB,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,8BAA8B;IAMtC,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAWnC;IAEF,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,cAAc;CAGvB;AAED,eAAO,MAAM,cAAc,QAAO,0BA4HjC,CAAC;;AAEF,wBAAgC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Storage } from "@amplitude/analytics-core";
|
|
2
|
+
export declare class MemoryStorage<T> implements Storage<T> {
|
|
3
|
+
private static readonly memoryStorage;
|
|
4
|
+
isEnabled(): Promise<boolean>;
|
|
5
|
+
get(key: string): Promise<T | undefined>;
|
|
6
|
+
getRaw(key: string): Promise<string | undefined>;
|
|
7
|
+
set(key: string, value: T): Promise<void>;
|
|
8
|
+
remove(key: string): Promise<void>;
|
|
9
|
+
reset(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare class LocalStorage<T> extends MemoryStorage<T> {
|
|
12
|
+
}
|
|
13
|
+
export { MemoryStorage as InMemoryStorage };
|
|
14
|
+
//# sourceMappingURL=local-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../../../src/analytics/storage/local-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,2BAA2B,CAAC;AAEpE,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAE7D,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAqB7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAcxC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQhD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAO7B;AAED,qBAAa,YAAY,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;CAAG;AAExD,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AmplitudeReturn, BaseEvent, EventOptions, ReactNativeClient, ReactNativeAttributionOptions, ReactNativeOptions, ReactNativeConfig, ReactNativeTrackingOptions, Event, IdentifyEvent, GroupIdentifyEvent, IdentifyOperation, SpecialEventType, IIdentify, IRevenue, RevenueProperty, ILogger, LogLevel, Plugin, BeforePlugin, EnrichmentPlugin, DestinationPlugin, Result, ServerZoneType, ServerZone, IdentityStorageType, Storage, TransportType, } from "@amplitude/analytics-core";
|
|
2
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/analytics/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,6BAA6B,EAC7B,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,KAAK,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,eAAe,EACf,OAAO,EACP,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,aAAa,GACd,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/analytics/utils/platform.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,QAAO,OAExB,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,OAE3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/analytics/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module experiment-react-native-client
|
|
4
|
+
*/
|
|
5
|
+
import { Client, FetchOptions } from "./types/client";
|
|
6
|
+
import { ExperimentConfig } from "./types/config";
|
|
7
|
+
import { ExperimentUser, ExperimentUserProvider } from "./types/user";
|
|
8
|
+
import { Variant, Variants } from "./types/variant";
|
|
9
|
+
/**
|
|
10
|
+
* The default {@link Client} used to fetch variations from Experiment's
|
|
11
|
+
* servers.
|
|
12
|
+
*
|
|
13
|
+
* @category Core Usage
|
|
14
|
+
*/
|
|
15
|
+
export declare class ExperimentClient implements Client {
|
|
16
|
+
private readonly apiKey;
|
|
17
|
+
private readonly config;
|
|
18
|
+
private readonly logger;
|
|
19
|
+
private readonly variants;
|
|
20
|
+
private readonly flags;
|
|
21
|
+
private readonly flagApi;
|
|
22
|
+
private readonly evaluationApi;
|
|
23
|
+
private readonly engine;
|
|
24
|
+
private user;
|
|
25
|
+
private readonly defaultUserProvider;
|
|
26
|
+
private readonly userSessionExposureTracker;
|
|
27
|
+
private retriesBackoff;
|
|
28
|
+
private readonly poller;
|
|
29
|
+
private isRunning;
|
|
30
|
+
private readonly flagsAndVariantsLoadedPromise;
|
|
31
|
+
private readonly initialFlags;
|
|
32
|
+
private fetchSequenceNumber;
|
|
33
|
+
private storedFetchSequenceNumber;
|
|
34
|
+
private readonly fetchVariantsOptions;
|
|
35
|
+
private readonly stopCallbacks;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new ExperimentClient instance.
|
|
38
|
+
*
|
|
39
|
+
* In most cases you will want to use the `initialize` factory method in
|
|
40
|
+
* {@link Experiment}.
|
|
41
|
+
*
|
|
42
|
+
* @param apiKey The Client key for the Experiment project
|
|
43
|
+
* @param config See {@link ExperimentConfig} for config options
|
|
44
|
+
*/
|
|
45
|
+
constructor(apiKey: string, config: ExperimentConfig);
|
|
46
|
+
/**
|
|
47
|
+
* Call to ensure the completion of the loading variants and flags from localStorage upon initialization.
|
|
48
|
+
*/
|
|
49
|
+
cacheReady(): Promise<ExperimentClient>;
|
|
50
|
+
/**
|
|
51
|
+
* Start the SDK by getting flag configurations from the server and fetching
|
|
52
|
+
* variants for the user. The promise returned by this function resolves when
|
|
53
|
+
* local flag configurations have been updated, and the {@link fetch()}
|
|
54
|
+
* result has been received (if the request was made).
|
|
55
|
+
*
|
|
56
|
+
* To force this function not to fetch variants, set the {@link fetchOnStart}
|
|
57
|
+
* configuration option to `false` when initializing the SDK.
|
|
58
|
+
*
|
|
59
|
+
* Finally, this function will start polling for flag configurations at a
|
|
60
|
+
* fixed interval. To disable polling, set the {@link pollOnStart}
|
|
61
|
+
* configuration option to `false` on initialization.
|
|
62
|
+
*
|
|
63
|
+
* @param user The user to set in the SDK.
|
|
64
|
+
* @see fetchOnStart
|
|
65
|
+
* @see pollOnStart
|
|
66
|
+
* @see fetch
|
|
67
|
+
* @see variant
|
|
68
|
+
*/
|
|
69
|
+
start(user?: ExperimentUser): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Stop background polling and retry work started by the client.
|
|
72
|
+
*/
|
|
73
|
+
stop(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Assign the given user to the SDK and asynchronously fetch all variants
|
|
76
|
+
* from the server. Subsequent calls may omit the user from the argument to
|
|
77
|
+
* use the user from the previous call.
|
|
78
|
+
*
|
|
79
|
+
* If an {@link ExperimentUserProvider} has been set, the argument user will
|
|
80
|
+
* be merged with the provider user, preferring user fields from the argument
|
|
81
|
+
* user and falling back on the provider for fields which are null or
|
|
82
|
+
* undefined.
|
|
83
|
+
*
|
|
84
|
+
* If configured, fetch retries the request in the background on failure.
|
|
85
|
+
* Variants received from a successful retry are stored in local storage for
|
|
86
|
+
* access.
|
|
87
|
+
*
|
|
88
|
+
* If you are using the `initialVariants` config option to preload this SDK
|
|
89
|
+
* from the server, you generally do not need to call `fetch`.
|
|
90
|
+
*
|
|
91
|
+
* @param user The user to fetch variants for.
|
|
92
|
+
* @param options Options for this specific fetch call.
|
|
93
|
+
* @returns Promise that resolves when the request for variants completes.
|
|
94
|
+
* @see ExperimentUser
|
|
95
|
+
* @see ExperimentUserProvider
|
|
96
|
+
*/
|
|
97
|
+
fetch(user?: ExperimentUser, options?: FetchOptions): Promise<ExperimentClient>;
|
|
98
|
+
fetchOrThrow(user?: ExperimentUser, options?: FetchOptions): Promise<ExperimentClient>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns the variant for the provided key.
|
|
101
|
+
*
|
|
102
|
+
* Access the variant from {@link Source}, falling back on the given
|
|
103
|
+
* fallback, then the configured fallbackVariant.
|
|
104
|
+
*
|
|
105
|
+
* If an {@link ExposureTrackingProvider} is configured and trackExposure is
|
|
106
|
+
* true, this function will call the provider with an {@link Exposure}.
|
|
107
|
+
* The exposure event does not count towards your event volume within Amplitude.
|
|
108
|
+
*
|
|
109
|
+
* @param key The key to get the variant for.
|
|
110
|
+
* @param fallback The highest priority fallback.
|
|
111
|
+
* @see ExperimentConfig
|
|
112
|
+
* @see ExposureTrackingProvider
|
|
113
|
+
*/
|
|
114
|
+
variant(key: string, fallback?: string | Variant): Variant;
|
|
115
|
+
/**
|
|
116
|
+
* Track an exposure event for the variant associated with the flag/experiment
|
|
117
|
+
* {@link key}.
|
|
118
|
+
*
|
|
119
|
+
* This method requires that an {@link ExposureTrackingProvider} be
|
|
120
|
+
* configured when this client is initialized, either manually, or through the
|
|
121
|
+
* Amplitude Analytics SDK integration from set up using
|
|
122
|
+
* {@link Experiment.initializeWithAmplitudeAnalytics}.
|
|
123
|
+
*
|
|
124
|
+
* @param key The flag/experiment key to track an exposure for.
|
|
125
|
+
*/
|
|
126
|
+
exposure(key: string): void;
|
|
127
|
+
/**
|
|
128
|
+
* Returns all variants for the user.
|
|
129
|
+
*
|
|
130
|
+
* The primary source of variants is based on the
|
|
131
|
+
* {@link Source} configured in the {@link ExperimentConfig}.
|
|
132
|
+
*
|
|
133
|
+
* @see Source
|
|
134
|
+
* @see ExperimentConfig
|
|
135
|
+
*/
|
|
136
|
+
all(): Variants;
|
|
137
|
+
/**
|
|
138
|
+
* Clear all variants in the cache and storage.
|
|
139
|
+
*/
|
|
140
|
+
clear(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Get a copy of the internal {@link ExperimentUser} object if it is set.
|
|
143
|
+
*
|
|
144
|
+
* @returns a copy of the internal user object if set.
|
|
145
|
+
*/
|
|
146
|
+
getUser(): ExperimentUser;
|
|
147
|
+
/**
|
|
148
|
+
* Copy in and set the user within the experiment client.
|
|
149
|
+
*
|
|
150
|
+
* @param user the user to set within the experiment client.
|
|
151
|
+
*/
|
|
152
|
+
setUser(user: ExperimentUser): void;
|
|
153
|
+
/**
|
|
154
|
+
* Get the user provider set by {@link setUserProvider} or null if the user
|
|
155
|
+
* provider has not been set.
|
|
156
|
+
*
|
|
157
|
+
* @returns The user provider set by {@link setUserProvider} or null.
|
|
158
|
+
* @deprecated use ExperimentConfig.userProvider instead
|
|
159
|
+
*/
|
|
160
|
+
getUserProvider(): ExperimentUserProvider;
|
|
161
|
+
/**
|
|
162
|
+
* Sets a user provider that will inject identity information into the user
|
|
163
|
+
* for {@link fetch()} requests. The user provider will only set user fields
|
|
164
|
+
* in outgoing requests which are null or undefined.
|
|
165
|
+
*
|
|
166
|
+
* See {@link ExperimentUserProvider} for more details
|
|
167
|
+
* @param userProvider
|
|
168
|
+
* @deprecated use ExperimentConfig.userProvider instead
|
|
169
|
+
*/
|
|
170
|
+
setUserProvider(userProvider: ExperimentUserProvider): Client;
|
|
171
|
+
/**
|
|
172
|
+
* Enables or disables tracking of assignment events when fetching variants.
|
|
173
|
+
* @param doTrack Whether to track assignment events.
|
|
174
|
+
*/
|
|
175
|
+
setTracksAssignment(doTrack: boolean): Promise<void>;
|
|
176
|
+
addStopCallback(callback: () => void): void;
|
|
177
|
+
fetchOnIdentityChange(): void;
|
|
178
|
+
private convertInitialFlagsForStorage;
|
|
179
|
+
private mergeInitialFlagsWithStorage;
|
|
180
|
+
private evaluate;
|
|
181
|
+
private variantAndSource;
|
|
182
|
+
/**
|
|
183
|
+
* This function assumes the flag exists and is local evaluation mode. For
|
|
184
|
+
* local evaluation, fallback order goes:
|
|
185
|
+
*
|
|
186
|
+
* 1. Local evaluation
|
|
187
|
+
* 2. Inline function fallback
|
|
188
|
+
* 3. Initial variants
|
|
189
|
+
* 4. Config fallback
|
|
190
|
+
*
|
|
191
|
+
* If there is a default variant and no fallback, return the default variant.
|
|
192
|
+
*/
|
|
193
|
+
private localEvaluationVariantAndSource;
|
|
194
|
+
/**
|
|
195
|
+
* For Source.LocalStorage, fallback order goes:
|
|
196
|
+
*
|
|
197
|
+
* 1. Local Storage
|
|
198
|
+
* 2. Inline function fallback
|
|
199
|
+
* 3. InitialFlags
|
|
200
|
+
* 4. Config fallback
|
|
201
|
+
*
|
|
202
|
+
* If there is a default variant and no fallback, return the default variant.
|
|
203
|
+
*/
|
|
204
|
+
private localStorageVariantAndSource;
|
|
205
|
+
/**
|
|
206
|
+
* For Source.InitialVariants, fallback order goes:
|
|
207
|
+
*
|
|
208
|
+
* 1. Initial variants
|
|
209
|
+
* 2. Local storage
|
|
210
|
+
* 3. Inline function fallback
|
|
211
|
+
* 4. Config fallback
|
|
212
|
+
*
|
|
213
|
+
* If there is a default variant and no fallback, return the default variant.
|
|
214
|
+
*/
|
|
215
|
+
private initialVariantsVariantAndSource;
|
|
216
|
+
private fetchInternal;
|
|
217
|
+
private fetchWithRetries;
|
|
218
|
+
private doFetch;
|
|
219
|
+
private doFlags;
|
|
220
|
+
private pollFlags;
|
|
221
|
+
private storeVariants;
|
|
222
|
+
private startRetries;
|
|
223
|
+
private stopRetries;
|
|
224
|
+
private addContextSync;
|
|
225
|
+
private addContext;
|
|
226
|
+
private addContextOrWait;
|
|
227
|
+
private mergeContext;
|
|
228
|
+
private sourceVariants;
|
|
229
|
+
private secondaryVariants;
|
|
230
|
+
private exposureInternal;
|
|
231
|
+
private static getLogLevel;
|
|
232
|
+
private shouldRetryFetch;
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=experimentClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experimentClient.d.ts","sourceRoot":"","sources":["../../../src/experiment/experimentClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAY,MAAM,gBAAgB,CAAC;AAI5D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAmDpD;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,MAAM;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IACnE,OAAO,CAAC,IAAI,CAAsB;IAClC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAsB;IAC1D,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAE7B;IACd,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAGrB;IACF,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAkB;IAChE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+B;IAC5D,OAAO,CAAC,mBAAmB,CAAK;IAChC,OAAO,CAAC,yBAAyB,CAAK;IACtC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA4C;IACjF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;IAEvD;;;;;;;;OAQG;gBACgB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB;IAsG3D;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKpD;;;;;;;;;;;;;;;;;;OAkBG;IACU,KAAK,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBxD;;OAEG;IACI,IAAI,IAAI,IAAI;IAkBnB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,KAAK,CAChB,IAAI,GAAE,cAA0B,EAChC,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,gBAAgB,CAAC;IAWf,YAAY,CACvB,IAAI,GAAE,cAA0B,EAChC,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,gBAAgB,CAAC;IAO5B;;;;;;;;;;;;;;OAcG;IACI,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO;IAcjE;;;;;;;;;;OAUG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKlC;;;;;;;;OAQG;IACI,GAAG,IAAI,QAAQ;IAkBtB;;OAEG;IACI,KAAK,IAAI,IAAI;IAKpB;;;;OAIG;IACI,OAAO,IAAI,cAAc;IAYhC;;;;OAIG;IACI,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAa1C;;;;;;OAMG;IACI,eAAe,IAAI,sBAAsB;IAIhD;;;;;;;;OAQG;IACI,eAAe,CAAC,YAAY,EAAE,sBAAsB,GAAG,MAAM;IAKpE;;;OAGG;IACU,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1D,eAAe,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAI3C,qBAAqB,IAAI,IAAI;IAIpC,OAAO,CAAC,6BAA6B;IAWrC,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,gBAAgB;IAiBxB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,+BAA+B;IAqDvC;;;;;;;;;OASG;IACH,OAAO,CAAC,4BAA4B;IAoDpC;;;;;;;;;OASG;IACH,OAAO,CAAC,+BAA+B;YAoDzB,aAAa;YAiCb,gBAAgB;YAYhB,OAAO;YAoBP,OAAO;YAYP,SAAS;YAQT,aAAa;IA6B3B,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,cAAc;YAKR,UAAU;YAKV,gBAAgB;IAW9B,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B,OAAO,CAAC,gBAAgB;CAMzB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ExperimentClient } from "./experimentClient";
|
|
2
|
+
import { ExperimentConfig } from "./types/config";
|
|
3
|
+
/**
|
|
4
|
+
* Provides factory methods for storing singleton instances of {@link ExperimentClient}
|
|
5
|
+
* @category Core Usage
|
|
6
|
+
*/
|
|
7
|
+
export declare const Experiment: {
|
|
8
|
+
initialize: (apiKey: string, config?: ExperimentConfig) => ExperimentClient;
|
|
9
|
+
initializeWithAmplitudeAnalytics: (apiKey: string, config?: ExperimentConfig) => ExperimentClient;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/experiment/factory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKtD,OAAO,EAAY,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAsE5D;;;GAGG;AACH,eAAO,MAAM,UAAU;yBA9Db,MAAM,WACL,gBAAgB,KACxB,gBAAgB;+CAwBT,MAAM,WACL,gBAAgB,KACxB,gBAAgB;CAqClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/experiment/gen/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./types/config";
|
|
2
|
+
export { Experiment } from "./factory";
|
|
3
|
+
export { StubExperimentClient } from "./stubClient";
|
|
4
|
+
export { ExperimentClient } from "./experimentClient";
|
|
5
|
+
export * from "./types/client";
|
|
6
|
+
export { Source } from "./types/source";
|
|
7
|
+
export * from "./types/user";
|
|
8
|
+
export * from "./types/variant";
|
|
9
|
+
export * from "./types/exposure";
|
|
10
|
+
export * from "./types/storage";
|
|
11
|
+
export { LogLevel } from "./types/logger";
|
|
12
|
+
export type { Logger } from "./types/logger";
|
|
13
|
+
export { ConsoleLogger } from "./logger/consoleLogger";
|
|
14
|
+
export { LocalStorage, MemoryStorage } from "./storage/local-storage";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/experiment/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TurboModule } from "react-native";
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
getApplicationContext(): Promise<{
|
|
4
|
+
version?: string;
|
|
5
|
+
platform?: string;
|
|
6
|
+
language?: string;
|
|
7
|
+
os?: string;
|
|
8
|
+
device_brand?: string;
|
|
9
|
+
device_manufacturer?: string;
|
|
10
|
+
device_model?: string;
|
|
11
|
+
carrier?: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: Spec | null | undefined;
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=NativeExperimentReactNativeClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeExperimentReactNativeClient.d.ts","sourceRoot":"","sources":["../../../../src/experiment/integration/NativeExperimentReactNativeClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,qBAAqB,IAAI,OAAO,CAAC;QAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ;;AAUD,wBAA2C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventBridge, IdentityStore } from "@amplitude/analytics-connector";
|
|
2
|
+
import { Exposure, ExposureTrackingProvider } from "../types/exposure";
|
|
3
|
+
import { ExperimentUser, ExperimentUserProvider } from "../types/user";
|
|
4
|
+
export declare class ConnectorUserProvider implements ExperimentUserProvider {
|
|
5
|
+
private readonly identityStore;
|
|
6
|
+
constructor(identityStore: IdentityStore);
|
|
7
|
+
identityReady(ms: number): Promise<void>;
|
|
8
|
+
getUser(): Promise<ExperimentUser>;
|
|
9
|
+
getUserSync(): ExperimentUser;
|
|
10
|
+
}
|
|
11
|
+
export declare class ConnectorExposureTrackingProvider implements ExposureTrackingProvider {
|
|
12
|
+
private readonly eventBridge;
|
|
13
|
+
constructor(eventBridge: EventBridge);
|
|
14
|
+
track(exposure: Exposure): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=connector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../../src/experiment/integration/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG5E,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAOvE,qBAAa,qBAAsB,YAAW,sBAAsB;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;gBAClC,aAAa,EAAE,aAAa;IAIlC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BxC,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC;IAIxC,WAAW,IAAI,cAAc;CAc9B;AAED,qBAAa,iCAAkC,YAAW,wBAAwB;IAChF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;gBAE9B,WAAW,EAAE,WAAW;IAIpC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAMhC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ExperimentUser, ExperimentUserProvider } from "../types/user";
|
|
2
|
+
export declare class DefaultUserProvider implements ExperimentUserProvider {
|
|
3
|
+
baseProvider: ExperimentUserProvider | null;
|
|
4
|
+
private readonly applicationContext;
|
|
5
|
+
cachedUser: ExperimentUser;
|
|
6
|
+
cachedApplicationContext?: Record<string, string>;
|
|
7
|
+
private readonly poller;
|
|
8
|
+
constructor(baseProvider?: ExperimentUserProvider | null);
|
|
9
|
+
start(): void;
|
|
10
|
+
stop(): void;
|
|
11
|
+
/**
|
|
12
|
+
* The variant method is not async
|
|
13
|
+
*/
|
|
14
|
+
load(): Promise<void>;
|
|
15
|
+
getApplicationContext(): Promise<Record<string, string>>;
|
|
16
|
+
getUserSync(): ExperimentUser;
|
|
17
|
+
getUser(): Promise<ExperimentUser>;
|
|
18
|
+
private shouldPollUserCache;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=default.d.ts.map
|