@ninetailed/experience.js 2.0.0-beta.2 → 2.0.0-beta.23

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.
@@ -46,11 +46,12 @@ export interface NinetailedInstance {
46
46
  debug: Debug;
47
47
  profileState: ProfileState;
48
48
  onProfileChange: OnProfileChange;
49
+ plugins: AnalyticsPlugin[];
49
50
  }
50
51
  export declare class Ninetailed implements NinetailedInstance {
51
52
  private readonly instance;
52
- private readonly plugins;
53
53
  private _profileState;
54
+ readonly plugins: AnalyticsPlugin[];
54
55
  constructor({ clientId, environment, }: {
55
56
  clientId: string;
56
57
  environment?: string;
@@ -1,3 +1,3 @@
1
- export declare const log: any;
2
1
  export declare const enable: () => void;
3
- export declare const disable: () => any;
2
+ export declare const disable: () => void;
3
+ export declare const log: (...msg: any[]) => void;
@@ -3,6 +3,8 @@ export { selectBaselineWithVariants as selectExperienceBaselineWithVariants } fr
3
3
  export { selectVariants as selectExperienceVariants } from './selectVariants';
4
4
  export { selectHasVariants as selectHasExperienceVariants } from './selectHasVariants';
5
5
  export { selectActiveExperiments } from './selectActiveExperiments';
6
- export { selectEglibleExperiences } from './selectEglibleExperiences';
6
+ export { selectEligibleExperiences } from './selectEligibleExperiences';
7
7
  export { selectExperience } from './selectExperience';
8
8
  export { selectVariant as selectExperienceVariant } from './selectVariant';
9
+ export { isExperienceMatch } from './isExperienceMatch';
10
+ export { selectDistribution } from './selectDistribution';
@@ -0,0 +1,9 @@
1
+ import { Profile } from '@ninetailed/experience.js-shared';
2
+ import { ExperienceConfiguration } from './types';
3
+ declare type IsExperienceMatchArgs = {
4
+ experience: ExperienceConfiguration;
5
+ activeExperiments: ExperienceConfiguration[];
6
+ profile: Profile;
7
+ };
8
+ export declare const isExperienceMatch: ({ experience, activeExperiments, profile }: IsExperienceMatchArgs) => boolean;
9
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Profile } from '@ninetailed/experience.js-shared';
2
+ import { Distribution, ExperienceConfiguration } from './types';
3
+ declare type SelectDistributionArgs = {
4
+ experience: ExperienceConfiguration;
5
+ profile: Profile;
6
+ };
7
+ export declare const selectDistribution: ({ experience, profile, }: SelectDistributionArgs) => Distribution;
8
+ export {};
@@ -1,12 +1,12 @@
1
1
  import { ExperienceConfiguration } from './types';
2
- declare type SelectEglibleExperiencesArgs = {
2
+ declare type SelectEligibleExperiencesArgs = {
3
3
  experiences: ExperienceConfiguration[];
4
4
  activeExperiments: ExperienceConfiguration[];
5
5
  };
6
6
  /**
7
- * We can use any personalization as eglible experience
7
+ * We can use any personalization as eligible experience
8
8
  * When going for an experiment we can only select a active experiment when 1 or more experiments are active
9
9
  * If the profile is not in any active experiments, we can select any expermiment
10
10
  */
11
- export declare const selectEglibleExperiences: ({ experiences, activeExperiments, }: SelectEglibleExperiencesArgs) => ExperienceConfiguration[];
11
+ export declare const selectEligibleExperiences: ({ experiences, activeExperiments, }: SelectEligibleExperiencesArgs) => ExperienceConfiguration[];
12
12
  export {};
@@ -1,6 +1,5 @@
1
1
  import { Profile } from '@ninetailed/experience.js-shared';
2
- import { Variant } from './types';
3
- import { Baseline, ExperienceConfiguration } from './types';
2
+ import { Baseline, ExperienceConfiguration, Variant } from './types';
4
3
  declare type SelectVariantArgs = {
5
4
  baseline: Baseline;
6
5
  experience: ExperienceConfiguration;
@@ -0,0 +1,5 @@
1
+ export declare type Distribution = {
2
+ index: number;
3
+ start: number;
4
+ end: number;
5
+ };
@@ -1,16 +1,13 @@
1
1
  import { BaselineWithVariants } from './BaselineWithVariants';
2
+ import { Distribution } from './Distribution';
2
3
  export declare type ExperienceType = 'nt_personalization' | 'nt_experiment';
3
4
  export declare type ExperienceConfiguration = {
4
5
  id: string;
5
6
  type: ExperienceType;
6
- audience: {
7
+ audience?: {
7
8
  id: string;
8
9
  };
9
10
  trafficAllocation: number;
10
- distribution: {
11
- index: number;
12
- start: number;
13
- end: number;
14
- }[];
11
+ distribution: Distribution[];
15
12
  components: BaselineWithVariants[];
16
13
  };
@@ -1,4 +1,5 @@
1
1
  export type { Baseline } from './Baseline';
2
2
  export type { Variant } from './Variant';
3
3
  export type { BaselineWithVariants } from './BaselineWithVariants';
4
- export type { ExperienceConfiguration, ExperienceType } from './ExperienceConfiguration';
4
+ export type { Distribution } from './Distribution';
5
+ export type { ExperienceConfiguration, ExperienceType, } from './ExperienceConfiguration';
@@ -0,0 +1,4 @@
1
+ import { Profile } from '@ninetailed/experience.js-shared';
2
+ import { ExperienceConfiguration } from './types';
3
+ export declare const getTrafficRandom: (profile: Profile, experience: ExperienceConfiguration) => number;
4
+ export declare const getDistributionRandom: (profile: Profile, experience: ExperienceConfiguration) => number;
package/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.23",
4
4
  "main": "./index.umd.js",
5
5
  "module": "./index.esm.js",
6
6
  "typings": "./index.d.ts",
7
7
  "dependencies": {
8
8
  "analytics": "^0.8.0",
9
- "@ninetailed/experience.js-shared": "2.0.0-beta.2",
9
+ "@ninetailed/experience.js-shared": "2.0.0-beta.23",
10
10
  "uuid": "^8.3.2",
11
11
  "ts-toolbelt": "^9.6.0",
12
12
  "locale-enum": "^1.1.1",
13
13
  "i18n-iso-countries": "^7.3.0",
14
- "lodash": "^4.17.21"
14
+ "lodash": "^4.17.21",
15
+ "loglevel": "^1.8.0",
16
+ "murmurhash-js": "^1.0.0"
15
17
  },
16
18
  "peerDependencies": {}
17
19
  }