@ninetailed/experience.js 1.0.0-beta.0 → 1.0.0-beta.14
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/index.d.ts +1 -0
- package/index.esm.js +922 -510
- package/index.umd.js +277 -318
- package/lib/Ninetailed.d.ts +15 -3
- package/lib/analytics/get-analytics-plugin.d.ts +3 -2
- package/lib/analytics/utility/apiClient.d.ts +5 -3
- package/lib/selectVariant.d.ts +5 -4
- package/lib/types.d.ts +0 -5
- package/package.json +2 -2
package/lib/Ninetailed.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { PageData, AnalyticsPlugin, DetachListeners } from 'analytics';
|
|
2
|
-
import { Locale, Traits, Profile } from '@ninetailed/experience.js-shared';
|
|
2
|
+
import { Locale, Traits, Profile, Variant } from '@ninetailed/experience.js-shared';
|
|
3
3
|
import { ProfileState } from './types';
|
|
4
4
|
declare type Options = {
|
|
5
5
|
url?: string;
|
|
6
6
|
locale?: Locale;
|
|
7
|
-
plugins?: AnalyticsPlugin[];
|
|
7
|
+
plugins?: (AnalyticsPlugin | AnalyticsPlugin[])[];
|
|
8
8
|
profile?: Profile;
|
|
9
9
|
};
|
|
10
10
|
declare type EventFunctionOptions = {
|
|
@@ -16,6 +16,13 @@ declare type EventFunctionOptions = {
|
|
|
16
16
|
declare type OnProfileChangeCallback = (profile: ProfileState) => void;
|
|
17
17
|
export declare type Page = (data?: PageData, options?: EventFunctionOptions) => Promise<void>;
|
|
18
18
|
export declare type Track = (event: string, payload?: unknown, options?: EventFunctionOptions) => Promise<void>;
|
|
19
|
+
export declare type TrackHasSeenComponent = (payload: {
|
|
20
|
+
variant: Variant<unknown>;
|
|
21
|
+
audience: {
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
24
|
+
isPersonalized: boolean;
|
|
25
|
+
}) => Promise<void>;
|
|
19
26
|
export declare type Identify = (uid: string, traits?: Traits, options?: EventFunctionOptions) => Promise<void>;
|
|
20
27
|
export declare type Reset = () => void;
|
|
21
28
|
export declare type Debug = (enable: boolean) => void;
|
|
@@ -23,6 +30,7 @@ export declare type OnProfileChange = (cb: OnProfileChangeCallback) => DetachLis
|
|
|
23
30
|
export interface NinetailedInstance {
|
|
24
31
|
page: Page;
|
|
25
32
|
track: Track;
|
|
33
|
+
trackHasSeenComponent: TrackHasSeenComponent;
|
|
26
34
|
identify: Identify;
|
|
27
35
|
reset: Reset;
|
|
28
36
|
debug: Debug;
|
|
@@ -33,9 +41,13 @@ export declare class Ninetailed implements NinetailedInstance {
|
|
|
33
41
|
private readonly instance;
|
|
34
42
|
private readonly plugins;
|
|
35
43
|
private _profileState;
|
|
36
|
-
constructor(
|
|
44
|
+
constructor({ clientId, environment }: {
|
|
45
|
+
clientId: string;
|
|
46
|
+
environment?: string;
|
|
47
|
+
}, { plugins, url, profile, locale }?: Options);
|
|
37
48
|
page: (data?: PageData, options?: EventFunctionOptions) => Promise<any>;
|
|
38
49
|
track: (event: string, payload?: unknown, options?: EventFunctionOptions) => Promise<any>;
|
|
50
|
+
trackHasSeenComponent: TrackHasSeenComponent;
|
|
39
51
|
identify: (uid: string, traits?: Traits, options?: EventFunctionOptions) => Promise<any>;
|
|
40
52
|
reset: () => any;
|
|
41
53
|
debug: (enabled: boolean) => any;
|
|
@@ -6,7 +6,8 @@ declare global {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
declare type AnalyticsPluginNinetailedConfig = {
|
|
9
|
-
|
|
9
|
+
clientId: string;
|
|
10
|
+
environment?: string;
|
|
10
11
|
url?: string;
|
|
11
12
|
profile?: Profile;
|
|
12
13
|
locale?: Locale;
|
|
@@ -18,5 +19,5 @@ export declare const NINETAILED_TRACKER_EVENTS: {
|
|
|
18
19
|
profile: string;
|
|
19
20
|
};
|
|
20
21
|
export declare const PLUGIN_NAME = "ninetailed";
|
|
21
|
-
export declare const ninetailedPlugin: ({
|
|
22
|
+
export declare const ninetailedPlugin: ({ clientId, environment, url, profile, locale, }: AnalyticsPluginNinetailedConfig) => AnalyticsPlugin;
|
|
22
23
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AudienceSignals, IngestProfileEventsRequestBody, Profile, Session } from '@ninetailed/experience.js-shared';
|
|
2
2
|
declare type NinetailedApiClientOptions = {
|
|
3
|
-
|
|
3
|
+
clientId: string;
|
|
4
|
+
environment: string;
|
|
4
5
|
url?: string;
|
|
5
6
|
};
|
|
6
7
|
declare type ProfileOptions = IngestProfileEventsRequestBody;
|
|
@@ -11,9 +12,10 @@ declare type ProfileResponse = {
|
|
|
11
12
|
sessions: Session[];
|
|
12
13
|
};
|
|
13
14
|
export declare class NinetailedApiClient {
|
|
14
|
-
private readonly
|
|
15
|
+
private readonly clientId;
|
|
16
|
+
private readonly environment;
|
|
15
17
|
private readonly url;
|
|
16
|
-
constructor({
|
|
18
|
+
constructor({ clientId, environment, url, }: NinetailedApiClientOptions);
|
|
17
19
|
profile(options: ProfileOptions): Promise<ProfileResponse>;
|
|
18
20
|
}
|
|
19
21
|
export {};
|
package/lib/selectVariant.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Variant } from '@ninetailed/experience.js-shared';
|
|
2
|
+
import { ProfileState } from './types';
|
|
2
3
|
declare type Options = {
|
|
3
4
|
holdout?: number;
|
|
4
5
|
};
|
|
5
6
|
declare type Loading<T> = {
|
|
6
7
|
loading: true;
|
|
7
|
-
variant: T
|
|
8
|
+
variant: Variant<T>;
|
|
8
9
|
audience: {
|
|
9
10
|
id: 'baseline';
|
|
10
11
|
};
|
|
@@ -13,7 +14,7 @@ declare type Loading<T> = {
|
|
|
13
14
|
};
|
|
14
15
|
declare type Success<T> = {
|
|
15
16
|
loading: false;
|
|
16
|
-
variant: T
|
|
17
|
+
variant: Variant<T>;
|
|
17
18
|
audience: {
|
|
18
19
|
id: string;
|
|
19
20
|
};
|
|
@@ -22,7 +23,7 @@ declare type Success<T> = {
|
|
|
22
23
|
};
|
|
23
24
|
declare type Fail<T> = {
|
|
24
25
|
loading: false;
|
|
25
|
-
variant: T
|
|
26
|
+
variant: Variant<T>;
|
|
26
27
|
audience: {
|
|
27
28
|
id: 'baseline';
|
|
28
29
|
};
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.14",
|
|
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": "1.0.0-beta.
|
|
9
|
+
"@ninetailed/experience.js-shared": "1.0.0-beta.14",
|
|
10
10
|
"uuid": "^8.3.2",
|
|
11
11
|
"ts-toolbelt": "^9.6.0",
|
|
12
12
|
"locale-enum": "^1.1.1",
|