@ninetailed/experience.js 3.0.2-beta.2 → 3.0.3-beta.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/lib/Ninetailed.d.ts +2 -2
- package/lib/analytics/get-analytics-plugin.d.ts +1 -1
- package/lib/experience/isExperienceMatch.d.ts +1 -1
- package/lib/experience/selectDistribution.d.ts +1 -1
- package/lib/experience/selectEligibleExperiences.d.ts +1 -1
- package/lib/experience/selectExperience.d.ts +1 -1
- package/lib/experience/selectVariant.d.ts +1 -1
- package/lib/experience/types/Baseline.d.ts +1 -1
- package/lib/experience/types/BaselineWithVariants.d.ts +1 -1
- package/lib/experience/types/Distribution.d.ts +1 -1
- package/lib/experience/types/ExperienceConfiguration.d.ts +2 -2
- package/lib/experience/types/Reference.d.ts +1 -1
- package/lib/experience/types/VariantRef.d.ts +1 -1
- package/lib/selectVariant.d.ts +5 -5
- package/lib/types.d.ts +17 -17
- package/package.json +3 -3
package/lib/Ninetailed.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare global {
|
|
|
10
10
|
} & unknown;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
type Options = {
|
|
14
14
|
url?: string;
|
|
15
15
|
locale?: Locale;
|
|
16
16
|
plugins?: (AnalyticsPlugin | AnalyticsPlugin[])[];
|
|
@@ -19,7 +19,7 @@ declare type Options = {
|
|
|
19
19
|
onLog?: OnLogHandler;
|
|
20
20
|
onError?: OnErrorHandler;
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
type NinetailedApiClientInstanceOrOptions = NinetailedApiClient | NinetailedApiClientOptions;
|
|
23
23
|
export declare class Ninetailed implements NinetailedInstance {
|
|
24
24
|
private readonly instance;
|
|
25
25
|
private _profileState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnalyticsPlugin } from 'analytics';
|
|
2
2
|
import { Profile, Locale, NinetailedApiClient } from '@ninetailed/experience.js-shared';
|
|
3
3
|
import { NinetailedInstance, FlushResult } from '../types';
|
|
4
|
-
|
|
4
|
+
type AnalyticsPluginNinetailedConfig = {
|
|
5
5
|
apiClient: NinetailedApiClient;
|
|
6
6
|
profile?: Profile;
|
|
7
7
|
locale?: Locale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Profile } from '@ninetailed/experience.js-shared';
|
|
2
2
|
import { ExperienceConfiguration } from './types';
|
|
3
|
-
|
|
3
|
+
type IsExperienceMatchArgs = {
|
|
4
4
|
experience: ExperienceConfiguration<any>;
|
|
5
5
|
activeExperiments: ExperienceConfiguration<any>[];
|
|
6
6
|
profile: Profile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Profile } from '@ninetailed/experience.js-shared';
|
|
2
2
|
import { Distribution, ExperienceConfiguration, Reference } from './types';
|
|
3
|
-
|
|
3
|
+
type SelectDistributionArgs<Variant extends Reference> = {
|
|
4
4
|
experience: ExperienceConfiguration<Variant>;
|
|
5
5
|
profile: Profile;
|
|
6
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExperienceConfiguration, Reference } from './types';
|
|
2
|
-
|
|
2
|
+
type SelectEligibleExperiencesArgs<Variant extends Reference> = {
|
|
3
3
|
experiences: ExperienceConfiguration<Variant>[];
|
|
4
4
|
activeExperiments: ExperienceConfiguration<Variant>[];
|
|
5
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Profile } from '@ninetailed/experience.js-shared';
|
|
2
2
|
import { ExperienceConfiguration, Reference } from './types';
|
|
3
|
-
|
|
3
|
+
type SelectExprienceArgs<Variant extends Reference> = {
|
|
4
4
|
experiences: ExperienceConfiguration<Variant>[];
|
|
5
5
|
activeExperiments: ExperienceConfiguration<Variant>[];
|
|
6
6
|
profile: Profile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Profile } from '@ninetailed/experience.js-shared';
|
|
2
2
|
import { Baseline, ExperienceConfiguration, Reference, VariantRef } from './types';
|
|
3
|
-
|
|
3
|
+
type SelectVariantArgs<Variant extends Reference> = {
|
|
4
4
|
baseline: Baseline;
|
|
5
5
|
experience: ExperienceConfiguration<Variant>;
|
|
6
6
|
profile: Profile;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Reference } from './Reference';
|
|
2
|
-
export
|
|
2
|
+
export type Baseline<P = unknown> = P & Reference;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Baseline } from './Baseline';
|
|
2
2
|
import { Reference } from './Reference';
|
|
3
3
|
import { VariantRef } from './VariantRef';
|
|
4
|
-
export
|
|
4
|
+
export type BaselineWithVariants<Variant extends Reference> = {
|
|
5
5
|
baseline: Baseline;
|
|
6
6
|
variants: (Variant | VariantRef)[];
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaselineWithVariants } from './BaselineWithVariants';
|
|
2
2
|
import { Distribution } from './Distribution';
|
|
3
3
|
import { Reference } from './Reference';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type ExperienceType = 'nt_personalization' | 'nt_experiment';
|
|
5
|
+
export type ExperienceConfiguration<Variant extends Reference = Reference> = {
|
|
6
6
|
id: string;
|
|
7
7
|
type: ExperienceType;
|
|
8
8
|
audience?: {
|
package/lib/selectVariant.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Variant } from '@ninetailed/experience.js-shared';
|
|
2
2
|
import { ProfileState } from './types';
|
|
3
|
-
|
|
3
|
+
type Options = {
|
|
4
4
|
holdout?: number;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type Loading<T> = {
|
|
7
7
|
loading: true;
|
|
8
8
|
variant: Variant<T>;
|
|
9
9
|
audience: {
|
|
@@ -12,7 +12,7 @@ declare type Loading<T> = {
|
|
|
12
12
|
isPersonalized: false;
|
|
13
13
|
error: null;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
type Success<T> = {
|
|
16
16
|
loading: false;
|
|
17
17
|
variant: Variant<T>;
|
|
18
18
|
audience: {
|
|
@@ -21,7 +21,7 @@ declare type Success<T> = {
|
|
|
21
21
|
isPersonalized: boolean;
|
|
22
22
|
error: null;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
type Fail<T> = {
|
|
25
25
|
loading: false;
|
|
26
26
|
variant: Variant<T>;
|
|
27
27
|
audience: {
|
|
@@ -30,7 +30,7 @@ declare type Fail<T> = {
|
|
|
30
30
|
isPersonalized: false;
|
|
31
31
|
error: Error;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
type Result<T> = Loading<T> | Success<T> | Fail<T>;
|
|
34
34
|
export declare const selectVariant: <T extends {
|
|
35
35
|
id: string;
|
|
36
36
|
}>(baseline: T, variants: Variant<T>[], { status, profile, error }: ProfileState, options?: Options) => Result<T>;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { TrackComponentProperties, TrackExperienceProperties } from '@ninetailed/experience.js-plugin-analytics';
|
|
2
2
|
import { Logger, PageviewProperties, Profile, Properties, Traits } from '@ninetailed/experience.js-shared';
|
|
3
3
|
import { AnalyticsPlugin, DetachListeners } from 'analytics';
|
|
4
|
-
|
|
4
|
+
type Loading = {
|
|
5
5
|
status: 'loading';
|
|
6
6
|
profile: null;
|
|
7
7
|
error: null;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type Success = {
|
|
10
10
|
status: 'success';
|
|
11
11
|
profile: Profile;
|
|
12
12
|
error: null;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type Fail = {
|
|
15
15
|
status: 'error';
|
|
16
16
|
profile: null;
|
|
17
17
|
error: Error;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type ProfileState = {
|
|
20
20
|
from: 'api' | 'hydrated';
|
|
21
21
|
} & (Loading | Success | Fail);
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
22
|
+
export type OnIsInitializedCallback = () => void;
|
|
23
|
+
export type OnIsInitialized = (cb: OnIsInitializedCallback) => void;
|
|
24
|
+
export type EventFunctionOptions = {
|
|
25
25
|
plugins?: {
|
|
26
26
|
all: boolean;
|
|
27
27
|
[key: string]: boolean;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type FlushResult = {
|
|
31
31
|
success: boolean;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
export
|
|
33
|
+
export type OnProfileChangeCallback = (profile: ProfileState) => void;
|
|
34
|
+
export type Page = (data?: Partial<PageviewProperties>, options?: EventFunctionOptions) => Promise<FlushResult>;
|
|
35
|
+
export type Track = (event: string, properties?: Properties, options?: EventFunctionOptions) => Promise<FlushResult>;
|
|
36
|
+
export type TrackHasSeenComponent = (properties: TrackComponentProperties) => Promise<void>;
|
|
37
|
+
export type TrackHasSeenExperience = (properties: TrackExperienceProperties) => Promise<void>;
|
|
38
|
+
export type Identify = (uid: string, traits?: Traits, options?: EventFunctionOptions) => Promise<FlushResult>;
|
|
39
|
+
export type Reset = () => void;
|
|
40
|
+
export type Debug = (enable: boolean) => void;
|
|
41
|
+
export type OnProfileChange = (cb: OnProfileChangeCallback) => DetachListeners;
|
|
42
42
|
export interface NinetailedInstance {
|
|
43
43
|
page: Page;
|
|
44
44
|
track: Track;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3-beta.0",
|
|
4
4
|
"module": "./index.js",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@ninetailed/experience.js-shared": "3.0.
|
|
9
|
+
"@ninetailed/experience.js-shared": "3.0.3-beta.0",
|
|
10
10
|
"analytics": "0.8.1",
|
|
11
11
|
"lodash": "4.17.21",
|
|
12
12
|
"murmurhash-js": "1.0.0",
|
|
13
|
-
"@ninetailed/experience.js-plugin-analytics": "3.0.
|
|
13
|
+
"@ninetailed/experience.js-plugin-analytics": "3.0.3-beta.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {}
|
|
16
16
|
}
|