@ninetailed/experience.js-react 3.0.2 → 3.0.3-beta.1
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/Experience/ESRLoadingComponent.d.ts +2 -2
- package/lib/Experience/Experience.d.ts +5 -5
- package/lib/Experience/ExperimentsContext.d.ts +1 -1
- package/lib/Experience/ExperimentsProvider.d.ts +1 -1
- package/lib/Experience/TrackExperience.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/Variant.d.ts +1 -1
- package/lib/Experience/useExperience.d.ts +5 -5
- package/lib/Experience/useProvideJoinExperiment.d.ts +3 -3
- package/lib/MergeTag.d.ts +1 -1
- package/lib/NinetailedProvider.d.ts +1 -1
- package/lib/Personalize.d.ts +3 -3
- package/lib/TrackHasSeenComponent.d.ts +1 -1
- package/lib/Variant.d.ts +1 -1
- package/lib/usePersonalize.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { ExperienceBaseProps } from './Experience';
|
|
3
3
|
import { Reference } from '@ninetailed/experience.js';
|
|
4
|
-
|
|
4
|
+
type ESRContextValue = {
|
|
5
5
|
experienceVariantsMap: Record<string, number>;
|
|
6
6
|
};
|
|
7
7
|
export declare const ESRContext: React.Context<ESRContextValue | undefined>;
|
|
8
|
-
|
|
8
|
+
type ESRProviderProps = {
|
|
9
9
|
experienceVariantsMap: Record<string, number>;
|
|
10
10
|
};
|
|
11
11
|
export declare const ESRProvider: React.FC<PropsWithChildren<ESRProviderProps>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Baseline, ExperienceConfiguration, Reference } from '@ninetailed/experience.js';
|
|
3
|
-
export
|
|
3
|
+
export type ExperienceComponent<P> = React.ComponentType<Omit<P, 'id'> & {
|
|
4
4
|
ninetailed?: {
|
|
5
5
|
isPersonalized: boolean;
|
|
6
6
|
audience: {
|
|
@@ -8,18 +8,18 @@ export declare type ExperienceComponent<P> = React.ComponentType<Omit<P, 'id'> &
|
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
}>;
|
|
11
|
-
export
|
|
11
|
+
export type ExperienceBaseProps<P, PassThroughProps extends Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = Baseline<Pick<P, Exclude<keyof P, keyof PassThroughProps>>> & {
|
|
12
12
|
experiences: ExperienceConfiguration<Variant>[];
|
|
13
13
|
component: React.ComponentType<P>;
|
|
14
14
|
passthroughProps?: PassThroughProps;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
17
|
-
export
|
|
16
|
+
export type ExperienceLoadingComponent<P, PassThroughProps extends Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = React.ComponentType<ExperienceBaseProps<P, PassThroughProps, Variant>>;
|
|
17
|
+
export type ExperienceProps<P, PassThroughProps extends Partial<P> = Partial<P>, Variant extends Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference = Pick<P, Exclude<keyof P, keyof PassThroughProps>> & Reference> = ExperienceBaseProps<P, PassThroughProps, Variant> & {
|
|
18
18
|
experiences: ExperienceConfiguration<Variant>[];
|
|
19
19
|
component: React.ComponentType<P>;
|
|
20
20
|
loadingComponent?: ExperienceLoadingComponent<P, PassThroughProps, Variant>;
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
type DefaultExperienceLoadingComponentProps = ExperienceBaseProps<Record<string, unknown>, Record<string, unknown>, Record<string, unknown> & Reference> & {
|
|
23
23
|
unhideAfterMs?: number;
|
|
24
24
|
};
|
|
25
25
|
export declare const DefaultExperienceLoadingComponent: React.FC<DefaultExperienceLoadingComponentProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ExperienceConfiguration, Reference } from '@ninetailed/experience.js';
|
|
3
3
|
import { JoinExperiment } from './useProvideJoinExperiment';
|
|
4
|
-
|
|
4
|
+
type ExperimentsContextValue<Variant extends Reference> = {
|
|
5
5
|
experiments: ExperienceConfiguration<Variant>[];
|
|
6
6
|
joinExperiment: JoinExperiment;
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { ExperienceConfiguration, Reference } from '@ninetailed/experience.js';
|
|
3
|
-
|
|
3
|
+
type ExperimentsProviderProps<Variant extends Reference> = React.PropsWithChildren<{
|
|
4
4
|
experiments: ExperienceConfiguration<Variant>[];
|
|
5
5
|
maximumActiveExperiments?: number;
|
|
6
6
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Profile } from '@ninetailed/experience.js-shared';
|
|
3
3
|
import { ExperienceConfiguration } from '@ninetailed/experience.js';
|
|
4
|
-
|
|
4
|
+
type TrackExperienceProps = {
|
|
5
5
|
experience: ExperienceConfiguration<any>;
|
|
6
6
|
variant: {
|
|
7
7
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Baseline, ExperienceConfiguration, Profile, Reference, VariantRef } from '@ninetailed/experience.js';
|
|
2
|
-
|
|
2
|
+
type Load = {
|
|
3
3
|
status: 'loading';
|
|
4
4
|
loading: boolean;
|
|
5
5
|
hasVariants: boolean;
|
|
@@ -11,7 +11,7 @@ declare type Load = {
|
|
|
11
11
|
profile: null;
|
|
12
12
|
error: null;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type Success<Variant extends Reference> = {
|
|
15
15
|
status: 'success';
|
|
16
16
|
loading: boolean;
|
|
17
17
|
hasVariants: boolean;
|
|
@@ -25,7 +25,7 @@ declare type Success<Variant extends Reference> = {
|
|
|
25
25
|
profile: Profile;
|
|
26
26
|
error: null;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
type Fail = {
|
|
29
29
|
status: 'error';
|
|
30
30
|
loading: boolean;
|
|
31
31
|
hasVariants: boolean;
|
|
@@ -37,10 +37,10 @@ declare type Fail = {
|
|
|
37
37
|
profile: null;
|
|
38
38
|
error: Error;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
type UseExperienceArgs<Variant extends Reference> = {
|
|
41
41
|
baseline: Baseline;
|
|
42
42
|
experiences: ExperienceConfiguration<Variant>[];
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
type UseExperienceResponse<Variant extends Reference> = Load | Success<Variant | VariantRef> | Fail;
|
|
45
45
|
export declare const useExperience: <Variant extends Reference>({ baseline, experiences, }: UseExperienceArgs<Variant>) => UseExperienceResponse<Variant>;
|
|
46
46
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Profile, ExperienceConfiguration, Reference, VariantRef } from '@ninetailed/experience.js';
|
|
2
|
-
export
|
|
2
|
+
export type JoinExperimentArgs = {
|
|
3
3
|
experiences: ExperienceConfiguration[];
|
|
4
4
|
experiment: ExperienceConfiguration<Reference | VariantRef>;
|
|
5
5
|
profile: Profile;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
|
|
7
|
+
export type JoinExperiment = (args: JoinExperimentArgs) => Promise<void>;
|
|
8
|
+
type UseJoinExperimentArgs = {
|
|
9
9
|
experiments: ExperienceConfiguration[];
|
|
10
10
|
maximumActiveExperiments?: number;
|
|
11
11
|
};
|
package/lib/MergeTag.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { AnalyticsPlugin } from 'analytics';
|
|
3
3
|
import { ExperienceConfiguration } from '@ninetailed/experience.js';
|
|
4
4
|
import { Profile, Locale, OnErrorHandler, OnLogHandler } from '@ninetailed/experience.js-shared';
|
|
5
|
-
export
|
|
5
|
+
export type NinetailedProviderProps = {
|
|
6
6
|
clientId: string;
|
|
7
7
|
environment?: string;
|
|
8
8
|
experiments?: ExperienceConfiguration<any>[];
|
package/lib/Personalize.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Variant } from './Variant';
|
|
3
|
-
export
|
|
3
|
+
export type PersonalizedComponent<P> = React.ComponentType<Omit<P, 'id'> & {
|
|
4
4
|
ninetailed?: {
|
|
5
5
|
isPersonalized: boolean;
|
|
6
6
|
audience: {
|
|
@@ -10,10 +10,10 @@ export declare type PersonalizedComponent<P> = React.ComponentType<Omit<P, 'id'>
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
}>;
|
|
13
|
-
|
|
13
|
+
type Baseline<P> = P & {
|
|
14
14
|
id: string;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
type PersonalizeProps<P> = Baseline<P> & {
|
|
17
17
|
variants?: Variant<P>[];
|
|
18
18
|
component: PersonalizedComponent<P> | React.ComponentType<P>;
|
|
19
19
|
loadingComponent?: React.ComponentType;
|
package/lib/Variant.d.ts
CHANGED
package/lib/usePersonalize.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-react",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3-beta.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=16.8.0"
|
|
6
6
|
},
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@analytics/google-analytics": "0.5.3",
|
|
9
9
|
"react-visibility-sensor": "5.1.1",
|
|
10
10
|
"lodash": "4.17.21",
|
|
11
|
-
"@ninetailed/experience.js": "3.0.
|
|
11
|
+
"@ninetailed/experience.js": "3.0.3-beta.1",
|
|
12
12
|
"react-intersection-observer": "8.34.0",
|
|
13
|
-
"@ninetailed/experience.js-shared": "3.0.
|
|
13
|
+
"@ninetailed/experience.js-shared": "3.0.3-beta.1",
|
|
14
14
|
"analytics": "0.8.1"
|
|
15
15
|
},
|
|
16
16
|
"module": "./index.js",
|