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 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../src/experiment/integration/default.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAMvE,qBAAa,mBAAoB,YAAW,sBAAsB;IACzD,YAAY,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACnD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IACjD,UAAU,EAAE,cAAc,CAAM;IAChC,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+C;gBAE1D,YAAY,GAAE,sBAAsB,GAAG,IAAW;IAQvD,KAAK,IAAI,IAAI;IAOb,IAAI,IAAI,IAAI;IAInB;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IA6B9D,WAAW,IAAI,cAAc;IAavB,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC;IASxC,OAAO,CAAC,mBAAmB;CAM5B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Logger, LogLevel } from "../types/logger";
|
|
2
|
+
/**
|
|
3
|
+
* Internal logger class that wraps a Logger implementation and handles log level filtering.
|
|
4
|
+
* This class provides a centralized logging mechanism for the Experiment client.
|
|
5
|
+
* @category Logging
|
|
6
|
+
*/
|
|
7
|
+
export declare class AmpLogger implements Logger {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private readonly logLevel;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new AmpLogger instance
|
|
12
|
+
* @param logger The underlying logger implementation to use
|
|
13
|
+
* @param logLevel The minimum log level to output. Messages below this level will be ignored.
|
|
14
|
+
*/
|
|
15
|
+
constructor(logger: Logger, logLevel?: LogLevel);
|
|
16
|
+
/**
|
|
17
|
+
* Log an error message
|
|
18
|
+
* @param message The message to log
|
|
19
|
+
* @param optionalParams Additional parameters to log
|
|
20
|
+
*/
|
|
21
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Log a warning message
|
|
24
|
+
* @param message The message to log
|
|
25
|
+
* @param optionalParams Additional parameters to log
|
|
26
|
+
*/
|
|
27
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Log an informational message
|
|
30
|
+
* @param message The message to log
|
|
31
|
+
* @param optionalParams Additional parameters to log
|
|
32
|
+
*/
|
|
33
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* Log a debug message
|
|
36
|
+
* @param message The message to log
|
|
37
|
+
* @param optionalParams Additional parameters to log
|
|
38
|
+
*/
|
|
39
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
40
|
+
/**
|
|
41
|
+
* Log a verbose message
|
|
42
|
+
* @param message The message to log
|
|
43
|
+
* @param optionalParams Additional parameters to log
|
|
44
|
+
*/
|
|
45
|
+
verbose(message?: any, ...optionalParams: any[]): void;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ampLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ampLogger.d.ts","sourceRoot":"","sources":["../../../../src/experiment/logger/ampLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;GAIG;AACH,qBAAa,SAAU,YAAW,MAAM;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IAEpC;;;;OAIG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAyB;IAK/D;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAMpD;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAMnD;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAMnD;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAMpD;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;CAKvD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Logger } from "../types/logger";
|
|
2
|
+
/**
|
|
3
|
+
* Default console-based logger implementation.
|
|
4
|
+
* This logger uses the browser's console API to output log messages.
|
|
5
|
+
* Log level filtering is handled by the AmpLogger wrapper class.
|
|
6
|
+
* @category Logging
|
|
7
|
+
*/
|
|
8
|
+
export declare class ConsoleLogger implements Logger {
|
|
9
|
+
/**
|
|
10
|
+
* Log an error message
|
|
11
|
+
* @param message The message to log
|
|
12
|
+
* @param optionalParams Additional parameters to log
|
|
13
|
+
*/
|
|
14
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
15
|
+
/**
|
|
16
|
+
* Log a warning message
|
|
17
|
+
* @param message The message to log
|
|
18
|
+
* @param optionalParams Additional parameters to log
|
|
19
|
+
*/
|
|
20
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Log an informational message
|
|
23
|
+
* @param message The message to log
|
|
24
|
+
* @param optionalParams Additional parameters to log
|
|
25
|
+
*/
|
|
26
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
27
|
+
/**
|
|
28
|
+
* Log a debug message
|
|
29
|
+
* @param message The message to log
|
|
30
|
+
* @param optionalParams Additional parameters to log
|
|
31
|
+
*/
|
|
32
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Log a verbose message
|
|
35
|
+
* @param message The message to log
|
|
36
|
+
* @param optionalParams Additional parameters to log
|
|
37
|
+
*/
|
|
38
|
+
verbose(message?: any, ...optionalParams: any[]): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=consoleLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consoleLogger.d.ts","sourceRoot":"","sources":["../../../../src/experiment/logger/consoleLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAIpD;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAInD;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAInD;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAIpD;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;CAGvD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EvaluationFlag, GetVariantsOptions } from "@amplitude/experiment-core";
|
|
2
|
+
import { Storage } from "../types/storage";
|
|
3
|
+
import { Variant } from "../types/variant";
|
|
4
|
+
export declare const getVariantStorage: (deploymentKey: string, instanceName: string, storage: Storage) => LoadStoreCache<Variant>;
|
|
5
|
+
export declare const getFlagStorage: (deploymentKey: string, instanceName: string, storage: Storage) => LoadStoreCache<EvaluationFlag>;
|
|
6
|
+
export declare const getVariantsOptionsStorage: (deploymentKey: string, instanceName: string, storage: Storage) => SingleValueStoreCache<GetVariantsOptions>;
|
|
7
|
+
export declare class SingleValueStoreCache<V> {
|
|
8
|
+
private readonly namespace;
|
|
9
|
+
private readonly legacyNamespaces;
|
|
10
|
+
private readonly storage;
|
|
11
|
+
private value;
|
|
12
|
+
constructor(namespace: string, storage: Storage, legacyNamespaces?: string[]);
|
|
13
|
+
get(): V | undefined;
|
|
14
|
+
put(value: V): void;
|
|
15
|
+
load(): Promise<void>;
|
|
16
|
+
store(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare class LoadStoreCache<V> {
|
|
19
|
+
private readonly namespace;
|
|
20
|
+
private readonly legacyNamespaces;
|
|
21
|
+
private readonly storage;
|
|
22
|
+
private readonly transformer?;
|
|
23
|
+
private cache;
|
|
24
|
+
constructor(namespace: string, storage: Storage, transformer?: (value: unknown) => V | undefined, legacyNamespaces?: string[]);
|
|
25
|
+
get(key: string): V | undefined;
|
|
26
|
+
getAll(): Record<string, V>;
|
|
27
|
+
put(key: string, value: V): void;
|
|
28
|
+
putAll(values: Record<string, V>): void;
|
|
29
|
+
remove(key: string): void;
|
|
30
|
+
clear(): void;
|
|
31
|
+
load(initialValues?: Record<string, V>): Promise<void>;
|
|
32
|
+
store(values?: Record<string, V>): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export declare const transformVariantFromStorage: (storageValue: unknown) => Variant | undefined;
|
|
35
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../src/experiment/storage/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,eAAO,MAAM,iBAAiB,GAC5B,eAAe,MAAM,EACrB,cAAc,MAAM,EACpB,SAAS,OAAO,KACf,cAAc,CAAC,OAAO,CASxB,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,eAAe,MAAM,EACrB,cAAc,MAAM,EACpB,SAAS,OAAO,KACf,cAAc,CAAC,cAAc,CAS/B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,eAAe,MAAM,EACrB,cAAc,MAAM,EACpB,SAAS,OAAO,KACf,qBAAqB,CAAC,kBAAkB,CAY1C,CAAC;AAuBF,qBAAa,qBAAqB,CAAC,CAAC;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAW;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,KAAK,CAAgB;gBAG3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,gBAAgB,GAAE,MAAM,EAAO;IAQ1B,GAAG,IAAI,CAAC,GAAG,SAAS;IAIpB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAIb,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CASpC;AAED,qBAAa,cAAc,CAAC,CAAC;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAW;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAoC;IACjE,OAAO,CAAC,KAAK,CAAyB;gBAGpC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,GAAG,SAAS,EAC/C,gBAAgB,GAAE,MAAM,EAAO;IAQ1B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI/B,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAI3B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAIhC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,IAAI;IAMvC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,KAAK,IAAI,IAAI;IAIP,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA6CtD,KAAK,CAAC,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1E;AAED,eAAO,MAAM,2BAA2B,GACtC,cAAc,OAAO,KACpB,OAAO,GAAG,SA8CZ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Storage } from "../types/storage";
|
|
2
|
+
export declare class MemoryStorage implements Storage {
|
|
3
|
+
private static readonly memoryStorage;
|
|
4
|
+
get(key: string): Promise<string | null>;
|
|
5
|
+
put(key: string, value: string): Promise<void>;
|
|
6
|
+
delete(key: string): Promise<void>;
|
|
7
|
+
reset(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare class LocalStorage extends MemoryStorage {
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=local-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../../../src/experiment/storage/local-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,qBAAa,aAAc,YAAW,OAAO;IAC3C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAA6B;IAE5D,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B;AAED,qBAAa,YAAa,SAAQ,aAAa;CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Client, FetchOptions } from "./types/client";
|
|
2
|
+
import { ExperimentUser, ExperimentUserProvider } from "./types/user";
|
|
3
|
+
import { Variant, Variants } from "./types/variant";
|
|
4
|
+
/**
|
|
5
|
+
* A stub {@link Client} implementation that does nothing for all methods
|
|
6
|
+
*/
|
|
7
|
+
export declare class StubExperimentClient implements Client {
|
|
8
|
+
getUser(): ExperimentUser;
|
|
9
|
+
start(_user?: ExperimentUser): Promise<void>;
|
|
10
|
+
stop(): void;
|
|
11
|
+
setUser(_user: ExperimentUser): void;
|
|
12
|
+
fetch(_user?: ExperimentUser, _options?: FetchOptions): Promise<StubExperimentClient>;
|
|
13
|
+
fetchOrThrow(_user?: ExperimentUser, _options?: FetchOptions): Promise<StubExperimentClient>;
|
|
14
|
+
getUserProvider(): ExperimentUserProvider;
|
|
15
|
+
setUserProvider(_userProvider: ExperimentUserProvider): StubExperimentClient;
|
|
16
|
+
variant(_key: string, _fallback?: string | Variant): Variant;
|
|
17
|
+
all(): Variants;
|
|
18
|
+
clear(): void;
|
|
19
|
+
exposure(_key: string): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=stubClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stubClient.d.ts","sourceRoot":"","sources":["../../../src/experiment/stubClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;GAEG;AACH,qBAAa,oBAAqB,YAAW,MAAM;IAC1C,OAAO,IAAI,cAAc;IAInB,KAAK,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,IAAI,IAAI,IAAI;IAEZ,OAAO,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAE9B,KAAK,CAChB,KAAK,CAAC,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,YAAY,GACtB,OAAO,CAAC,oBAAoB,CAAC;IAInB,YAAY,CACvB,KAAK,CAAC,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,YAAY,GACtB,OAAO,CAAC,oBAAoB,CAAC;IAIzB,eAAe,IAAI,sBAAsB;IAQzC,eAAe,CACpB,aAAa,EAAE,sBAAsB,GACpC,oBAAoB;IAIhB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO;IAI5D,GAAG,IAAI,QAAQ;IAIf,KAAK,IAAI,IAAI;IAEb,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CACpC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
import { HttpClient as CoreHttpClient, HttpRequest, HttpResponse } from "@amplitude/experiment-core";
|
|
6
|
+
import { HttpClient } from "../types/transport";
|
|
7
|
+
/**
|
|
8
|
+
* Wrap the exposed HttpClient in a CoreClient implementation to work with
|
|
9
|
+
* FlagsApi and EvaluationApi.
|
|
10
|
+
*/
|
|
11
|
+
export declare class WrapperClient implements CoreHttpClient {
|
|
12
|
+
private readonly client;
|
|
13
|
+
constructor(client: HttpClient);
|
|
14
|
+
request(request: HttpRequest): Promise<HttpResponse>;
|
|
15
|
+
}
|
|
16
|
+
export declare const FetchHttpClient: HttpClient;
|
|
17
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../src/experiment/transport/http.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,UAAU,IAAI,cAAc,EAC5B,WAAW,EACX,YAAY,EACb,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAsEhE;;;GAGG;AACH,qBAAa,aAAc,YAAW,cAAc;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBACxB,MAAM,EAAE,UAAU;IAIxB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;CAS3D;AAED,eAAO,MAAM,eAAe,EAAE,UAAkC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ExperimentUser, ExperimentUserProvider } from "./user";
|
|
2
|
+
import { Variant, Variants } from "./variant";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for the main client.
|
|
5
|
+
* @category Core Usage
|
|
6
|
+
*/
|
|
7
|
+
export interface Client {
|
|
8
|
+
start(user?: ExperimentUser): Promise<void>;
|
|
9
|
+
stop(): void;
|
|
10
|
+
fetch(user?: ExperimentUser, options?: FetchOptions): Promise<Client>;
|
|
11
|
+
fetchOrThrow(user?: ExperimentUser, options?: FetchOptions): Promise<Client>;
|
|
12
|
+
variant(key: string, fallback?: string | Variant): Variant;
|
|
13
|
+
all(): Variants;
|
|
14
|
+
clear(): void;
|
|
15
|
+
exposure(key: string): void;
|
|
16
|
+
getUser(): ExperimentUser;
|
|
17
|
+
setUser(user: ExperimentUser): void;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated use ExperimentConfig.userProvider instead
|
|
20
|
+
*/
|
|
21
|
+
getUserProvider(): ExperimentUserProvider;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated use ExperimentConfig.userProvider instead
|
|
24
|
+
*/
|
|
25
|
+
setUserProvider(userProvider: ExperimentUserProvider): Client;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Options to modify the behavior of a remote evaluation fetch request.
|
|
29
|
+
*/
|
|
30
|
+
export type FetchOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* Specific flag keys to evaluate and set variants for.
|
|
33
|
+
*/
|
|
34
|
+
flagKeys?: string[];
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/experiment/types/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtE,YAAY,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3D,GAAG,IAAI,QAAQ,CAAC;IAChB,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,IAAI,cAAc,CAAC;IAC1B,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAEpC;;OAEG;IACH,eAAe,IAAI,sBAAsB,CAAC;IAC1C;;OAEG;IACH,eAAe,CAAC,YAAY,EAAE,sBAAsB,GAAG,MAAM,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { ExposureTrackingProvider } from "./exposure";
|
|
2
|
+
import { Logger, LogLevel } from "./logger";
|
|
3
|
+
import { Source } from "./source";
|
|
4
|
+
import { Storage } from "./storage";
|
|
5
|
+
import { HttpClient } from "./transport";
|
|
6
|
+
import { ExperimentUserProvider } from "./user";
|
|
7
|
+
import { Variant, Variants } from "./variant";
|
|
8
|
+
/**
|
|
9
|
+
* @category Configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface ExperimentConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Debug all assignment requests in the UI Debugger and log additional
|
|
14
|
+
* information to the console. This should be false for production builds.
|
|
15
|
+
* @deprecated Use logLevel instead. When debug is true, it sets logLevel to Debug.
|
|
16
|
+
*/
|
|
17
|
+
debug?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The minimum log level to output. Messages below this level will be ignored.
|
|
20
|
+
* Supported levels: Disable, Error, Warn, Info, Debug, Verbose.
|
|
21
|
+
* If the deprecated debug flag is set to true, this will be set to Debug.
|
|
22
|
+
*/
|
|
23
|
+
logLevel?: LogLevel;
|
|
24
|
+
/**
|
|
25
|
+
* Custom logger implementation. If not provided, a default ConsoleLogger will be used.
|
|
26
|
+
* The logger must implement the Logger interface with methods for error, warn, info, debug, and verbose.
|
|
27
|
+
*/
|
|
28
|
+
loggerProvider?: Logger | null;
|
|
29
|
+
/**
|
|
30
|
+
* The name of the instance being initialized. Used for initializing separate
|
|
31
|
+
* instances of experiment or linking the experiment SDK to a specific
|
|
32
|
+
* instance of the amplitude analytics SDK.
|
|
33
|
+
*/
|
|
34
|
+
instanceName?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The default fallback variant for all {@link ExperimentClient.variant}
|
|
37
|
+
* calls.
|
|
38
|
+
*/
|
|
39
|
+
fallbackVariant?: Variant;
|
|
40
|
+
/**
|
|
41
|
+
* Initial values for variants. This is useful for bootstrapping the
|
|
42
|
+
* client with fallbacks and values evaluated from server-side rendering.
|
|
43
|
+
* @see Variants
|
|
44
|
+
*/
|
|
45
|
+
initialVariants?: Variants;
|
|
46
|
+
/**
|
|
47
|
+
* Initial values for flags. This is useful for bootstrapping the
|
|
48
|
+
* client with fallbacks for flag configs.
|
|
49
|
+
*/
|
|
50
|
+
initialFlags?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Determines the primary source of variants and variants before falling back.
|
|
53
|
+
* @see Source
|
|
54
|
+
*/
|
|
55
|
+
source?: Source;
|
|
56
|
+
/**
|
|
57
|
+
* The domain from which to request variants using remote evaluation.
|
|
58
|
+
*/
|
|
59
|
+
serverUrl?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The domain to request flag configurations used in local evaluation from.
|
|
62
|
+
*/
|
|
63
|
+
flagsServerUrl?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The amplitude data center to fetch flags and variants from. If set,
|
|
66
|
+
* automatically sets the {@link serverUrl} and {@link flagsServerUrl}
|
|
67
|
+
* configurations.
|
|
68
|
+
*/
|
|
69
|
+
serverZone?: "US" | "EU";
|
|
70
|
+
/**
|
|
71
|
+
* The request timeout, in milliseconds, when fetching variants.
|
|
72
|
+
*/
|
|
73
|
+
fetchTimeoutMillis?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Set to true to retry fetch requests in the background if the initial
|
|
76
|
+
* requests fails or times out.
|
|
77
|
+
*/
|
|
78
|
+
retryFetchOnFailure?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* If true, automatically tracks exposure events though the
|
|
81
|
+
* `ExperimentAnalyticsProvider`. If no analytics provider is set, this
|
|
82
|
+
* option does nothing.
|
|
83
|
+
*/
|
|
84
|
+
automaticExposureTracking?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Enable or disable local evaluation flag configuration polling on `start()`.
|
|
87
|
+
*/
|
|
88
|
+
pollOnStart?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Explicitly enable or disable calling {@link fetch()} on {@link start()}:
|
|
91
|
+
*
|
|
92
|
+
* - `true`: fetch will always be called on start.
|
|
93
|
+
* - `false`: fetch will never be called on start.
|
|
94
|
+
* - `undefined`: fetch will always be called on start.
|
|
95
|
+
*/
|
|
96
|
+
fetchOnStart?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* This config only matters if you are using the amplitude analytics SDK
|
|
99
|
+
* integration initialized by calling
|
|
100
|
+
* `Experiment.initializeWithAmplitudeAnalytics()`.
|
|
101
|
+
*
|
|
102
|
+
* If true, the `ExperimentClient` will automatically fetch variants when the
|
|
103
|
+
* user's identity changes. The user's identity includes user_id, device_id
|
|
104
|
+
* and any user properties which are `set`, `unset` or `clearAll`ed via a call
|
|
105
|
+
* to `identify()`.
|
|
106
|
+
*
|
|
107
|
+
* Note: Non-idempotent identify operations `setOnce`, `add`, `append`, and
|
|
108
|
+
* `prepend` are not counted towards the user identity changing.
|
|
109
|
+
*/
|
|
110
|
+
automaticFetchOnAmplitudeIdentityChange?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Sets a user provider that will inject identity information into the user
|
|
113
|
+
* for {@link fetch()} requests. The user provider will only set user fields
|
|
114
|
+
* in outgoing requests which are null or undefined.
|
|
115
|
+
*
|
|
116
|
+
* See {@link ExperimentUserProvider} for more details
|
|
117
|
+
*/
|
|
118
|
+
userProvider?: ExperimentUserProvider | null;
|
|
119
|
+
/**
|
|
120
|
+
* Provides the ability to track exposure events through a 3rd party analytics
|
|
121
|
+
* implementation.
|
|
122
|
+
*/
|
|
123
|
+
exposureTrackingProvider?: ExposureTrackingProvider | null;
|
|
124
|
+
/**
|
|
125
|
+
* (Advanced) Use your own http client.
|
|
126
|
+
*/
|
|
127
|
+
httpClient?: HttpClient;
|
|
128
|
+
/**
|
|
129
|
+
* (Advanced) Use your own storage implementation.
|
|
130
|
+
* If not provided, the client will use the built-in shared memory storage implementation.
|
|
131
|
+
*/
|
|
132
|
+
storage?: Storage | null;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
Defaults for Experiment Config options
|
|
136
|
+
|
|
137
|
+
| **Option** | **Default** |
|
|
138
|
+
|------------------|-----------------------------------|
|
|
139
|
+
| **debug** | `false` |
|
|
140
|
+
| **logLevel** | `LogLevel.Error` |
|
|
141
|
+
| **logger** | `null` (ConsoleLogger will be used) |
|
|
142
|
+
| **instanceName** | `$default_instance` |
|
|
143
|
+
| **fallbackVariant** | `null` |
|
|
144
|
+
| **initialVariants** | `null` |
|
|
145
|
+
| **initialFlags** | `undefined` |
|
|
146
|
+
| **source** | `Source.LocalStorage` |
|
|
147
|
+
| **serverUrl** | `"https://api.lab.amplitude.com"` |
|
|
148
|
+
| **flagsServerUrl** | `"https://flag.lab.amplitude.com"` |
|
|
149
|
+
| **serverZone** | `"US"` |
|
|
150
|
+
| **assignmentTimeoutMillis** | `10000` |
|
|
151
|
+
| **retryFailedAssignment** | `true` |
|
|
152
|
+
| **automaticExposureTracking** | `true` |
|
|
153
|
+
| **pollOnStart** | `true` |
|
|
154
|
+
| **fetchOnStart** | `true` |
|
|
155
|
+
| **automaticFetchOnAmplitudeIdentityChange** | `false` |
|
|
156
|
+
| **userProvider** | `null` |
|
|
157
|
+
| **analyticsProvider** | `null` |
|
|
158
|
+
| **exposureTrackingProvider** | `null` |
|
|
159
|
+
|
|
160
|
+
*
|
|
161
|
+
* @category Configuration
|
|
162
|
+
*/
|
|
163
|
+
export declare const Defaults: ExperimentConfig;
|
|
164
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/experiment/types/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,QAAQ,CAAC;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;;;;;;OAYG;IACH,uCAAuC,CAAC,EAAE,OAAO,CAAC;IAElD;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAE7C;;;OAGG;IACH,wBAAwB,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAE3D;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,QAAQ,EAAE,gBAsBtB,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event object for tracking exposures to Amplitude Experiment.
|
|
3
|
+
*
|
|
4
|
+
* This object contains all the required information to send an `$exposure`
|
|
5
|
+
* event through any SDK or CDP to experiment.
|
|
6
|
+
*
|
|
7
|
+
* The resulting exposure event must follow the following definition:
|
|
8
|
+
* ```
|
|
9
|
+
* {
|
|
10
|
+
* "event_type": "$exposure",
|
|
11
|
+
* "event_properties": {
|
|
12
|
+
* "flag_key": "<flagKey>",
|
|
13
|
+
* "variant": "<variant>",
|
|
14
|
+
* "experiment_key": "<expKey>"
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Where `<flagKey>`, `<variant>`, and `<expKey>` are the {@link flag_key},
|
|
20
|
+
* {@link variant}, and {@link experiment_key} variant members on this type:
|
|
21
|
+
*
|
|
22
|
+
* For example, if you're using Segment for analytics:
|
|
23
|
+
*
|
|
24
|
+
* ```
|
|
25
|
+
* analytics.track('$exposure', exposure)
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export type Exposure = {
|
|
29
|
+
/**
|
|
30
|
+
* (Required) The key for the flag the user was exposed to.
|
|
31
|
+
*/
|
|
32
|
+
flag_key: string;
|
|
33
|
+
/**
|
|
34
|
+
* (Optional) The variant the user was exposed to. If null or missing, the
|
|
35
|
+
* event will not be persisted, and will unset the user property.
|
|
36
|
+
*/
|
|
37
|
+
variant?: string;
|
|
38
|
+
/**
|
|
39
|
+
* (Optional) The experiment key used to differentiate between multiple
|
|
40
|
+
* experiments associated with the same flag.
|
|
41
|
+
*/
|
|
42
|
+
experiment_key?: string;
|
|
43
|
+
/**
|
|
44
|
+
* (Optional) Flag, segment, and variant metadata produced as a result of
|
|
45
|
+
* evaluation for the user. Used for system purposes.
|
|
46
|
+
*/
|
|
47
|
+
metadata?: Record<string, unknown>;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Interface for enabling tracking {@link Exposure}s through the
|
|
51
|
+
* {@link ExperimentClient}.
|
|
52
|
+
*
|
|
53
|
+
* If you're using the Amplitude Analytics SDK for tracking you do not need
|
|
54
|
+
* to implement this interface. Simply initialize experiment using the
|
|
55
|
+
* {@link Experiment.initializeWithAmplitudeAnalytics} function.
|
|
56
|
+
*
|
|
57
|
+
* If you're using a 3rd party analytics implementation then you'll need to
|
|
58
|
+
* implement the sending of the analytics event yourself. The implementation
|
|
59
|
+
* should result in the following event getting sent to amplitude:
|
|
60
|
+
*
|
|
61
|
+
* ```
|
|
62
|
+
* {
|
|
63
|
+
* "event_type": "$exposure",
|
|
64
|
+
* "event_properties": {
|
|
65
|
+
* "flag_key": "<flagKey>",
|
|
66
|
+
* "variant": "<variant>",
|
|
67
|
+
* "experiment_key": "<expKey>"
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* For example, if you're using Segment for analytics:
|
|
73
|
+
*
|
|
74
|
+
* ```
|
|
75
|
+
* analytics.track('$exposure', exposure)
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export interface ExposureTrackingProvider {
|
|
79
|
+
/**
|
|
80
|
+
* Called when the {@link ExperimentClient} intends to track an exposure event;
|
|
81
|
+
* either when {@link ExperimentClient.variant} serves a variant (and
|
|
82
|
+
* {@link ExperimentConfig.automaticExposureTracking} is `true`) or if
|
|
83
|
+
* {@link ExperimentClient.exposure} is called.
|
|
84
|
+
*
|
|
85
|
+
* The implementation should result in the following event getting sent to
|
|
86
|
+
* amplitude:
|
|
87
|
+
*
|
|
88
|
+
* ```
|
|
89
|
+
* {
|
|
90
|
+
* "event_type": "$exposure",
|
|
91
|
+
* "event_properties": {
|
|
92
|
+
* "flag_key": "<flagKey>",
|
|
93
|
+
* "variant": "<variant>",
|
|
94
|
+
* "experiment_key": "<expKey>"
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* For example, if you're using Segment for analytics:
|
|
100
|
+
*
|
|
101
|
+
* ```
|
|
102
|
+
* analytics.track('$exposure', exposure)
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
track(exposure: Exposure): void;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=exposure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exposure.d.ts","sourceRoot":"","sources":["../../../../src/experiment/types/exposure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CACjC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log level enumeration for controlling logging verbosity.
|
|
3
|
+
* @category Logging
|
|
4
|
+
*/
|
|
5
|
+
export declare enum LogLevel {
|
|
6
|
+
/**
|
|
7
|
+
* Disable all logging
|
|
8
|
+
*/
|
|
9
|
+
Disable = 0,
|
|
10
|
+
/**
|
|
11
|
+
* Error level logging - only critical errors
|
|
12
|
+
*/
|
|
13
|
+
Error = 1,
|
|
14
|
+
/**
|
|
15
|
+
* Warning level logging - errors and warnings
|
|
16
|
+
*/
|
|
17
|
+
Warn = 2,
|
|
18
|
+
/**
|
|
19
|
+
* Info level logging - errors, warnings, and informational messages
|
|
20
|
+
*/
|
|
21
|
+
Info = 3,
|
|
22
|
+
/**
|
|
23
|
+
* Debug level logging - errors, warnings, info, and debug messages
|
|
24
|
+
*/
|
|
25
|
+
Debug = 4,
|
|
26
|
+
/**
|
|
27
|
+
* Verbose level logging - all messages including verbose details
|
|
28
|
+
*/
|
|
29
|
+
Verbose = 5
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Logger interface that can be implemented to provide custom logging.
|
|
33
|
+
* @category Logging
|
|
34
|
+
*/
|
|
35
|
+
export interface Logger {
|
|
36
|
+
/**
|
|
37
|
+
* Log an error message
|
|
38
|
+
* @param message The message to log
|
|
39
|
+
* @param optionalParams Additional parameters to log
|
|
40
|
+
*/
|
|
41
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* Log a warning message
|
|
44
|
+
* @param message The message to log
|
|
45
|
+
* @param optionalParams Additional parameters to log
|
|
46
|
+
*/
|
|
47
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
48
|
+
/**
|
|
49
|
+
* Log an informational message
|
|
50
|
+
* @param message The message to log
|
|
51
|
+
* @param optionalParams Additional parameters to log
|
|
52
|
+
*/
|
|
53
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Log a debug message
|
|
56
|
+
* @param message The message to log
|
|
57
|
+
* @param optionalParams Additional parameters to log
|
|
58
|
+
*/
|
|
59
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Log a verbose message
|
|
62
|
+
* @param message The message to log
|
|
63
|
+
* @param optionalParams Additional parameters to log
|
|
64
|
+
*/
|
|
65
|
+
verbose(message?: any, ...optionalParams: any[]): void;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/experiment/types/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,QAAQ;IAClB;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,KAAK,IAAI;IACT;;OAEG;IACH,IAAI,IAAI;IACR;;OAEG;IACH,IAAI,IAAI;IACR;;OAEG;IACH,KAAK,IAAI;IACT;;OAEG;IACH,OAAO,IAAI;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErD;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEpD;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEpD;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErD;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CACxD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines the primary source of variants before falling back.
|
|
3
|
+
*
|
|
4
|
+
* @category Source
|
|
5
|
+
*/
|
|
6
|
+
export declare enum Source {
|
|
7
|
+
/**
|
|
8
|
+
* The default way to source variants within your application. Before the
|
|
9
|
+
* assignments are fetched, `getVariant(s)` will fallback to local storage
|
|
10
|
+
* first, then `initialVariants` if local storage is empty. This option
|
|
11
|
+
* effectively falls back to an assignment fetched previously.
|
|
12
|
+
*/
|
|
13
|
+
LocalStorage = "localStorage",
|
|
14
|
+
/**
|
|
15
|
+
* This bootstrap option is used primarily for servers-side rendering using an
|
|
16
|
+
* Experiment server SDK. This bootstrap option always prefers the config
|
|
17
|
+
* `initialVariants` over data in local storage, even if variants are fetched
|
|
18
|
+
* successfully and stored locally.
|
|
19
|
+
*/
|
|
20
|
+
InitialVariants = "initialVariants"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Indicates from which source the variant() function determines the variant
|
|
24
|
+
*
|
|
25
|
+
* @category Source
|
|
26
|
+
*/
|
|
27
|
+
export declare enum VariantSource {
|
|
28
|
+
LocalStorage = "storage",
|
|
29
|
+
InitialVariants = "initial",
|
|
30
|
+
SecondaryLocalStorage = "secondary-storage",
|
|
31
|
+
SecondaryInitialVariants = "secondary-initial",
|
|
32
|
+
FallbackInline = "fallback-inline",
|
|
33
|
+
FallbackConfig = "fallback-config",
|
|
34
|
+
LocalEvaluation = "local-evaluation"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns true if the VariantSource is one of the fallbacks (inline or config)
|
|
38
|
+
*
|
|
39
|
+
* @param source a {@link VariantSource}
|
|
40
|
+
* @returns true if source is {@link VariantSource.FallbackInline} or {@link VariantSource.FallbackConfig}
|
|
41
|
+
*/
|
|
42
|
+
export declare const isFallback: (source: VariantSource | undefined) => boolean;
|
|
43
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../../src/experiment/types/source.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,MAAM;IAChB;;;;;OAKG;IACH,YAAY,iBAAiB;IAE7B;;;;;OAKG;IACH,eAAe,oBAAoB;CACpC;AAED;;;;GAIG;AACH,oBAAY,aAAa;IACvB,YAAY,YAAY;IACxB,eAAe,YAAY;IAC3B,qBAAqB,sBAAsB;IAC3C,wBAAwB,sBAAsB;IAC9C,cAAc,oBAAoB;IAClC,cAAc,oBAAoB;IAClC,eAAe,qBAAqB;CACrC;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,aAAa,GAAG,SAAS,KAAG,OAO9D,CAAC"}
|