@ninetailed/experience.js-react 2.2.9-beta.0 → 3.0.1-beta.3

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.esm.js CHANGED
@@ -2731,9 +2731,10 @@ const useESR = () => {
2731
2731
  const ESRLoadingComponent = _a => {
2732
2732
  var {
2733
2733
  experiences,
2734
- component: Component
2734
+ component: Component,
2735
+ passthroughProps
2735
2736
  } = _a,
2736
- baseline = __rest(_a, ["experiences", "component"]);
2737
+ baseline = __rest(_a, ["experiences", "component", "passthroughProps"]);
2737
2738
 
2738
2739
  const {
2739
2740
  experienceVariantsMap
@@ -2741,26 +2742,61 @@ const ESRLoadingComponent = _a => {
2741
2742
  const experience = experiences.find(experience => has$1(experienceVariantsMap, experience.id));
2742
2743
 
2743
2744
  if (!experience) {
2744
- return /*#__PURE__*/React.createElement(Component, Object.assign({}, baseline));
2745
+ return /*#__PURE__*/React.createElement(Component, Object.assign({}, passthroughProps, baseline, {
2746
+ ninetailed: {
2747
+ isPersonalized: false,
2748
+ audience: {
2749
+ id: 'baseline'
2750
+ }
2751
+ }
2752
+ }));
2745
2753
  }
2746
2754
 
2747
2755
  const component = experience.components.find(component => component.baseline.id === baseline.id);
2748
2756
 
2749
2757
  if (!component) {
2750
- return /*#__PURE__*/React.createElement(Component, Object.assign({}, baseline));
2758
+ return /*#__PURE__*/React.createElement(Component, Object.assign({}, passthroughProps, baseline, {
2759
+ ninetailed: {
2760
+ isPersonalized: false,
2761
+ audience: {
2762
+ id: 'baseline'
2763
+ }
2764
+ }
2765
+ }));
2751
2766
  }
2752
2767
 
2753
2768
  if (experienceVariantsMap[experience.id] === 0) {
2754
- return /*#__PURE__*/React.createElement(Component, Object.assign({}, baseline));
2769
+ return /*#__PURE__*/React.createElement(Component, Object.assign({}, passthroughProps, baseline, {
2770
+ ninetailed: {
2771
+ isPersonalized: false,
2772
+ audience: {
2773
+ id: 'baseline'
2774
+ }
2775
+ }
2776
+ }));
2755
2777
  }
2756
2778
 
2757
2779
  const variant = component.variants[experienceVariantsMap[experience.id] - 1];
2758
2780
 
2759
2781
  if (!variant) {
2760
- return /*#__PURE__*/React.createElement(Component, Object.assign({}, baseline));
2782
+ return /*#__PURE__*/React.createElement(Component, Object.assign({}, passthroughProps, baseline, {
2783
+ ninetailed: {
2784
+ isPersonalized: false,
2785
+ audience: {
2786
+ id: 'baseline'
2787
+ }
2788
+ }
2789
+ }));
2761
2790
  }
2762
2791
 
2763
- return /*#__PURE__*/React.createElement(Component, Object.assign({}, variant));
2792
+ return /*#__PURE__*/React.createElement(Component, Object.assign({}, passthroughProps, variant, {
2793
+ ninetailed: {
2794
+ isPersonalized: false,
2795
+ audience: {
2796
+ id: 'baseline'
2797
+ }
2798
+ }
2799
+ }));
2764
2800
  };
2765
2801
 
2766
2802
  export { DefaultExperienceLoadingComponent, ESRLoadingComponent, ESRProvider, Experience, MergeTag, NinetailedProvider, Personalize, TrackHasSeenComponent, useNinetailed, usePersonalize, useProfile };
package/index.umd.js CHANGED
@@ -2277,7 +2277,8 @@
2277
2277
  var ESRLoadingComponent = function ESRLoadingComponent(_a) {
2278
2278
  var experiences = _a.experiences,
2279
2279
  Component = _a.component,
2280
- baseline = __rest(_a, ["experiences", "component"]);
2280
+ passthroughProps = _a.passthroughProps,
2281
+ baseline = __rest(_a, ["experiences", "component", "passthroughProps"]);
2281
2282
 
2282
2283
  var experienceVariantsMap = useESR().experienceVariantsMap;
2283
2284
  var experience = experiences.find(function (experience) {
@@ -2285,7 +2286,14 @@
2285
2286
  });
2286
2287
 
2287
2288
  if (!experience) {
2288
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, baseline));
2289
+ return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2290
+ ninetailed: {
2291
+ isPersonalized: false,
2292
+ audience: {
2293
+ id: 'baseline'
2294
+ }
2295
+ }
2296
+ }));
2289
2297
  }
2290
2298
 
2291
2299
  var component = experience.components.find(function (component) {
@@ -2293,20 +2301,48 @@
2293
2301
  });
2294
2302
 
2295
2303
  if (!component) {
2296
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, baseline));
2304
+ return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2305
+ ninetailed: {
2306
+ isPersonalized: false,
2307
+ audience: {
2308
+ id: 'baseline'
2309
+ }
2310
+ }
2311
+ }));
2297
2312
  }
2298
2313
 
2299
2314
  if (experienceVariantsMap[experience.id] === 0) {
2300
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, baseline));
2315
+ return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2316
+ ninetailed: {
2317
+ isPersonalized: false,
2318
+ audience: {
2319
+ id: 'baseline'
2320
+ }
2321
+ }
2322
+ }));
2301
2323
  }
2302
2324
 
2303
2325
  var variant = component.variants[experienceVariantsMap[experience.id] - 1];
2304
2326
 
2305
2327
  if (!variant) {
2306
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, baseline));
2328
+ return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2329
+ ninetailed: {
2330
+ isPersonalized: false,
2331
+ audience: {
2332
+ id: 'baseline'
2333
+ }
2334
+ }
2335
+ }));
2307
2336
  }
2308
2337
 
2309
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, variant));
2338
+ return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, variant, {
2339
+ ninetailed: {
2340
+ isPersonalized: false,
2341
+ audience: {
2342
+ id: 'baseline'
2343
+ }
2344
+ }
2345
+ }));
2310
2346
  };
2311
2347
 
2312
2348
  exports.DefaultExperienceLoadingComponent = DefaultExperienceLoadingComponent;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ExperienceLoadingComponent } from './Experience';
2
+ import { ExperienceBaseProps } from './Experience';
3
3
  declare type ESRContextValue = {
4
4
  experienceVariantsMap: Record<string, number>;
5
5
  };
@@ -11,5 +11,5 @@ export declare const ESRProvider: React.FC<ESRProviderProps>;
11
11
  export declare const useESR: () => {
12
12
  experienceVariantsMap: Record<string, number>;
13
13
  };
14
- export declare const ESRLoadingComponent: ExperienceLoadingComponent;
14
+ export declare const ESRLoadingComponent: <P extends Record<string, unknown>>({ experiences, component: Component, passthroughProps, ...baseline }: ExperienceBaseProps<P, Partial<P>>) => JSX.Element;
15
15
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { AnalyticsPlugin } from 'analytics';
3
- import { OnErrorHandler, OnLogHandler, ExperienceConfiguration } from '@ninetailed/experience.js';
4
- import { Profile, Locale } from '@ninetailed/experience.js-shared';
3
+ import { ExperienceConfiguration } from '@ninetailed/experience.js';
4
+ import { Profile, Locale, OnErrorHandler, OnLogHandler } from '@ninetailed/experience.js-shared';
5
5
  export declare type NinetailedProviderProps = {
6
6
  clientId: string;
7
7
  environment?: string;
@@ -8,7 +8,39 @@ export declare const useProfile: () => {
8
8
  loading: boolean;
9
9
  from: "api" | "hydrated";
10
10
  status: "success";
11
- profile: import("@ninetailed/experience.js").Profile;
11
+ profile: {
12
+ id: string;
13
+ random: number;
14
+ audiences: string[];
15
+ traits: import("@ninetailed/experience.js-shared").Traits;
16
+ location: {
17
+ coordinates?: {
18
+ latitude: number;
19
+ longitude: number;
20
+ } | undefined;
21
+ city?: string | undefined;
22
+ postalCode?: string | undefined;
23
+ region?: string | undefined;
24
+ regionCode?: string | undefined;
25
+ country?: string | undefined;
26
+ countryCode?: string | undefined;
27
+ continent?: string | undefined;
28
+ timezone?: string | undefined;
29
+ };
30
+ session: {
31
+ isReturningVisitor: boolean;
32
+ ladingPage: {
33
+ path: string;
34
+ url: string;
35
+ query: Record<string, string>;
36
+ referrer: string;
37
+ search: string;
38
+ };
39
+ count: number;
40
+ activeSessionLength: number;
41
+ averageSessionLength: number;
42
+ };
43
+ };
12
44
  error: null;
13
45
  } | {
14
46
  loading: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js-react",
3
- "version": "2.2.9-beta.0",
3
+ "version": "3.0.1-beta.3",
4
4
  "peerDependencies": {
5
5
  "react": ">=16.8.0"
6
6
  },
@@ -8,15 +8,15 @@
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": "2.2.9-beta.0",
12
- "analytics": "^0.8.0",
13
- "@ninetailed/experience.js-shared": "2.2.9-beta.0",
14
- "uuid": "^8.3.2",
11
+ "@ninetailed/experience.js": "3.0.1-beta.3",
12
+ "@ninetailed/experience.js-shared": "3.0.1-beta.3",
15
13
  "ts-toolbelt": "^9.6.0",
14
+ "diary": "^0.3.1",
15
+ "zod": "^3.18.0",
16
16
  "locale-enum": "^1.1.1",
17
17
  "i18n-iso-countries": "^7.3.0",
18
+ "analytics": "^0.8.0",
18
19
  "murmurhash-js": "^1.0.0",
19
- "diary": "^0.3.1",
20
20
  "react-intersection-observer": "^8.33.1"
21
21
  },
22
22
  "main": "./index.umd.js",