@ninetailed/experience.js-react 3.0.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.
@@ -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
- declare type ESRContextValue = {
4
+ type ESRContextValue = {
5
5
  experienceVariantsMap: Record<string, number>;
6
6
  };
7
7
  export declare const ESRContext: React.Context<ESRContextValue | undefined>;
8
- declare type ESRProviderProps = {
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 declare type ExperienceComponent<P> = React.ComponentType<Omit<P, 'id'> & {
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 declare 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>>> & {
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 declare 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 declare 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> & {
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
- declare type DefaultExperienceLoadingComponentProps = ExperienceBaseProps<Record<string, unknown>, Record<string, unknown>, Record<string, unknown> & Reference> & {
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
- declare type ExperimentsContextValue<Variant extends Reference> = {
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
- declare type ExperimentsProviderProps<Variant extends Reference> = React.PropsWithChildren<{
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
- declare type TrackExperienceProps = {
4
+ type TrackExperienceProps = {
5
5
  experience: ExperienceConfiguration<any>;
6
6
  variant: {
7
7
  id: string;
@@ -1,3 +1,3 @@
1
- export declare type Baseline<P extends object = object> = P & {
1
+ export type Baseline<P extends object = object> = P & {
2
2
  id: string;
3
3
  };
@@ -1,6 +1,6 @@
1
1
  import { Baseline } from './Baseline';
2
2
  import { Variant } from './Variant';
3
- export declare type BaselineWithVariants = {
3
+ export type BaselineWithVariants = {
4
4
  baseline: Baseline;
5
5
  variants: Variant<Record<string, unknown>>[];
6
6
  };
@@ -1,3 +1,3 @@
1
- export declare type Variant<P> = P & {
1
+ export type Variant<P> = P & {
2
2
  id: string;
3
3
  };
@@ -1,5 +1,5 @@
1
1
  import { Baseline, ExperienceConfiguration, Profile, Reference, VariantRef } from '@ninetailed/experience.js';
2
- declare type Load = {
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
- declare type Success<Variant extends Reference> = {
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
- declare type Fail = {
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
- declare type UseExperienceArgs<Variant extends Reference> = {
40
+ type UseExperienceArgs<Variant extends Reference> = {
41
41
  baseline: Baseline;
42
42
  experiences: ExperienceConfiguration<Variant>[];
43
43
  };
44
- declare type UseExperienceResponse<Variant extends Reference> = Load | Success<Variant | VariantRef> | Fail;
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 declare type JoinExperimentArgs = {
2
+ export type JoinExperimentArgs = {
3
3
  experiences: ExperienceConfiguration[];
4
4
  experiment: ExperienceConfiguration<Reference | VariantRef>;
5
5
  profile: Profile;
6
6
  };
7
- export declare type JoinExperiment = (args: JoinExperimentArgs) => Promise<void>;
8
- declare type UseJoinExperimentArgs = {
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
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare type MergeTagProps = {
2
+ type MergeTagProps = {
3
3
  id: string;
4
4
  };
5
5
  export declare const MergeTag: React.FC<React.PropsWithChildren<MergeTagProps>>;
@@ -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 declare type NinetailedProviderProps = {
5
+ export type NinetailedProviderProps = {
6
6
  clientId: string;
7
7
  environment?: string;
8
8
  experiments?: ExperienceConfiguration<any>[];
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Variant } from './Variant';
3
- export declare type PersonalizedComponent<P> = React.ComponentType<Omit<P, 'id'> & {
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
- declare type Baseline<P> = P & {
13
+ type Baseline<P> = P & {
14
14
  id: string;
15
15
  };
16
- declare type PersonalizeProps<P> = Baseline<P> & {
16
+ type PersonalizeProps<P> = Baseline<P> & {
17
17
  variants?: Variant<P>[];
18
18
  component: PersonalizedComponent<P> | React.ComponentType<P>;
19
19
  loadingComponent?: React.ComponentType;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Variant } from './Variant';
3
- declare type TrackHasSeenComponentProps = {
3
+ type TrackHasSeenComponentProps = {
4
4
  variant: Variant<any>;
5
5
  audience: {
6
6
  id: string;
package/lib/Variant.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type Variant<P = unknown> = P & {
1
+ export type Variant<P = unknown> = P & {
2
2
  id: string;
3
3
  audience: {
4
4
  id: string;
@@ -1,5 +1,5 @@
1
1
  import { Variant } from '@ninetailed/experience.js-shared';
2
- declare type Options = {
2
+ type Options = {
3
3
  holdout?: number;
4
4
  };
5
5
  export declare const usePersonalize: <T extends {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js-react",
3
- "version": "3.0.2",
3
+ "version": "3.0.3-beta.0",
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.2",
11
+ "@ninetailed/experience.js": "3.0.3-beta.0",
12
12
  "react-intersection-observer": "8.34.0",
13
- "@ninetailed/experience.js-shared": "3.0.2",
13
+ "@ninetailed/experience.js-shared": "3.0.3-beta.0",
14
14
  "analytics": "0.8.1"
15
15
  },
16
16
  "module": "./index.js",