New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@amplitude/experiment-js-client

Package Overview
Dependencies
Maintainers
17
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/experiment-js-client - npm Package Compare versions

Comparing version 1.4.0-alpha.10 to 1.4.0

CHANGELOG.md

34

dist/types/src/config.d.ts

@@ -1,2 +0,4 @@

import { ExperimentAnalyticsProvider, ExperimentUserProvider } from './types/provider';
import { ExperimentAnalyticsProvider } from './types/analytics';
import { ExposureTrackingProvider } from './types/exposure';
import { ExperimentUserProvider } from './types/provider';
import { Source } from './types/source';

@@ -49,2 +51,22 @@ import { Variant, Variants } from './types/variant';

/**
* If true, automatically tracks exposure events though the
* `ExperimentAnalyticsProvider`. If no analytics provider is set, this
* option does nothing.
*/
automaticExposureTracking?: boolean;
/**
* This config only matters if you are using the amplitude analytics SDK
* integration initialized by calling
* `Experiment.initializeWithAmplitudeAnalytics()`.
*
* If true, the `ExperimentClient` will automatically fetch variants when the
* user's identity changes. The user's identity includes user_id, device_id
* and any user properties which are `set`, `unset` or `clearAll`ed via a call
* to `identify()`.
*
* Note: Non-idempotent identify operations `setOnce`, `add`, `append`, and
* `prepend` are not counted towards the user identity changing.
*/
automaticFetchOnAmplitudeIdentityChange?: boolean;
/**
* Sets a user provider that will inject identity information into the user

@@ -60,4 +82,11 @@ * for {@link fetch()} requests. The user provider will only set user fields

* generated by the client (e.g. {@link ExposureEvent}).
*
* @deprecated Use exposureTrackingProvider instead
*/
analyticsProvider?: ExperimentAnalyticsProvider;
/**
* Provides the ability to track exposure events through a 3rd party analytics
* implementation.
*/
exposureTrackingProvider?: ExposureTrackingProvider;
}

@@ -77,4 +106,7 @@ /**

| **retryFailedAssignment** | `true` |
| **automaticExposureTracking** | `true` |
| **automaticFetchOnAmplitudeIdentityChange** | `false` |
| **userProvider** | `null` |
| **analyticsProvider** | `null` |
| **exposureTrackingProvider** | `null` |

@@ -81,0 +113,0 @@ *

@@ -27,2 +27,4 @@ /**

private userProvider;
private analyticsProvider;
private exposureTrackingProvider;
/**

@@ -77,4 +79,15 @@ * Creates a new ExperimentClient instance.

variant(key: string, fallback?: string | Variant): Variant;
private variantAndSource;
/**
* Track an exposure event for the variant associated with the flag/experiment
* {@link key}.
*
* This method requires that an {@link ExperimentAnalyticsProvider} be
* configured when this client is initialized, either manually, or through the
* Amplitude Analytics SDK integration from set up using
* {@link Experiment.initializeWithAmplitudeAnalytics}.
*
* @param key The flag/experiment key to track an exposure for.
*/
exposure(key: string): void;
/**
* Returns all variants for the user.

@@ -119,2 +132,3 @@ *

setUserProvider(userProvider: ExperimentUserProvider): Client;
private variantAndSource;
private fetchInternal;

@@ -127,6 +141,8 @@ private doFetch;

private addContext;
private addContextOrWait;
private convertVariant;
private sourceVariants;
private secondaryVariants;
private exposureInternal;
private debug;
}

4

dist/types/src/index.d.ts

@@ -13,5 +13,7 @@ /**

export { Client } from './types/client';
export { ExperimentUserProvider, ExperimentAnalyticsProvider, } from './types/provider';
export { ExperimentAnalyticsProvider, ExperimentAnalyticsEvent, } from './types/analytics';
export { ExperimentUserProvider } from './types/provider';
export { Source } from './types/source';
export { ExperimentUser } from './types/user';
export { Variant, Variants } from './types/variant';
export { Exposure, ExposureTrackingProvider } from './types/exposure';

@@ -1,3 +0,3 @@

import { ExperimentAnalyticsEvent } from '../types/analytics';
import { ExperimentUserProvider, ExperimentAnalyticsProvider } from '../types/provider';
import { ExperimentAnalyticsEvent, ExperimentAnalyticsProvider } from '../types/analytics';
import { ExperimentUserProvider } from '../types/provider';
import { ExperimentUser } from '../types/user';

@@ -32,3 +32,3 @@ declare type AmplitudeIdentify = {

/**
* @deprecated Update your version of the amplitude analytics SDK to X.X.X+ and for seamless
* @deprecated Update your version of the amplitude analytics-js SDK to 8.17.0+ and for seamless
* integration with the amplitude analytics SDK.

@@ -44,7 +44,7 @@ */

/**
* @deprecated Update your version of the amplitude analytics SDK to X.X.X+ and for seamless
* @deprecated Update your version of the amplitude analytics-js SDK to 8.17.0+ and for seamless
* integration with the amplitude analytics SDK.
*/
export declare class AmplitudeAnalyticsProvider implements ExperimentAnalyticsProvider {
private amplitudeInstance;
private readonly amplitudeInstance;
constructor(amplitudeInstance: AmplitudeInstance);

@@ -51,0 +51,0 @@ track(event: ExperimentAnalyticsEvent): void;

@@ -1,2 +0,2 @@

import { ApplicationContextProvider } from '@amplitude/amplitude-core';
import { ApplicationContextProvider } from '@amplitude/analytics-connector';
import { ExperimentUserProvider } from '../types/provider';

@@ -3,0 +3,0 @@ import { ExperimentUser } from '../types/user';

@@ -16,2 +16,3 @@ import { Client } from './types/client';

all(): Variants;
exposure(key: string): void;
}

@@ -9,2 +9,4 @@ import { VariantSource } from './source';

* @category Analytics
*
* @deprecated use ExposureTrackingProvider instead
*/

@@ -59,5 +61,37 @@ export interface ExperimentAnalyticsEvent {

/**
* Provides a analytics implementation for standard experiment events generated
* by the client (e.g. {@link ExposureEvent}).
* @category Provider
*
* @deprecated use ExposureTrackingProvider instead
*/
export interface ExperimentAnalyticsProvider {
/**
* Wraps an analytics event track call. This is typically called by the
* experiment client after setting user properties to track an
* "[Experiment] Exposure" event
* @param event see {@link ExperimentAnalyticsEvent}
*/
track(event: ExperimentAnalyticsEvent): void;
/**
* Wraps an analytics identify or set user property call. This is typically
* called by the experiment client before sending an
* "[Experiment] Exposure" event.
* @param event see {@link ExperimentAnalyticsEvent}
*/
setUserProperty?(event: ExperimentAnalyticsEvent): void;
/**
* Wraps an analytics unset user property call. This is typically
* called by the experiment client when a user has been evaluated to use
* a fallback variant.
* @param event see {@link ExperimentAnalyticsEvent}
*/
unsetUserProperty?(event: ExperimentAnalyticsEvent): void;
}
/**
* Event for tracking a user's exposure to a variant. This event will not count
* towards your analytics event volume.
*
* @deprecated use ExposureTrackingProvider instead
*/
export declare const exposureEvent: (user: ExperimentUser, key: string, variant: Variant, source: VariantSource) => ExperimentAnalyticsEvent;

@@ -12,2 +12,3 @@ import { ExperimentUserProvider } from './provider';

all(): Variants;
exposure(key: string): void;
getUser(): ExperimentUser;

@@ -14,0 +15,0 @@ setUser(user: ExperimentUser): void;

@@ -1,2 +0,1 @@

import { ExperimentAnalyticsEvent } from './analytics';
import { ExperimentUser } from './user';

@@ -12,29 +11,1 @@ /**

}
/**
* Provides a analytics implementation for standard experiment events generated
* by the client (e.g. {@link ExposureEvent}).
* @category Provider
*/
export interface ExperimentAnalyticsProvider {
/**
* Wraps an analytics event track call. This is typically called by the
* experiment client after setting user properties to track an
* "[Experiment] Exposure" event
* @param event see {@link ExperimentAnalyticsEvent}
*/
track(event: ExperimentAnalyticsEvent): void;
/**
* Wraps an analytics identify or set user property call. This is typically
* called by the experiment client before sending an
* "[Experiment] Exposure" event.
* @param event see {@link ExperimentAnalyticsEvent}
*/
setUserProperty?(event: ExperimentAnalyticsEvent): void;
/**
* Wraps an analytics unset user property call. This is typically
* called by the experiment client when a user has been evaluated to use
* a fallback variant.
* @param event see {@link ExperimentAnalyticsEvent}
*/
unsetUserProperty?(event: ExperimentAnalyticsEvent): void;
}
{
"name": "@amplitude/experiment-js-client",
"version": "1.4.0-alpha.10",
"version": "1.4.0",
"description": "Javascript Client SDK for Amplitude Experiment",

@@ -31,5 +31,5 @@ "main": "dist/experiment.umd.js",

"dependencies": {
"@amplitude/analytics-connector": "^1.4.0",
"base64-js": "1.5.1",
"unfetch": "4.1.0",
"@amplitude/amplitude-core": "1.0.0-alpha.0"
"unfetch": "4.1.0"
},

@@ -40,3 +40,3 @@ "devDependencies": {

},
"gitHead": "0a910f04a64dafcf37b68be45ed7dca58fdd6acf"
"gitHead": "7574b2a856d5f9a62ce72bb2c5de01505bf902f5"
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc