@ninetailed/experience.js-react 2.2.8 → 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
@@ -2365,7 +2365,8 @@ const TrackExperience = ({
2365
2365
  }
2366
2366
  }, [inView]);
2367
2367
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2368
- ref: ref
2368
+ ref: ref,
2369
+ id: "nt-experience-handle"
2369
2370
  }), children);
2370
2371
  };
2371
2372
 
@@ -2730,9 +2731,10 @@ const useESR = () => {
2730
2731
  const ESRLoadingComponent = _a => {
2731
2732
  var {
2732
2733
  experiences,
2733
- component: Component
2734
+ component: Component,
2735
+ passthroughProps
2734
2736
  } = _a,
2735
- baseline = __rest(_a, ["experiences", "component"]);
2737
+ baseline = __rest(_a, ["experiences", "component", "passthroughProps"]);
2736
2738
 
2737
2739
  const {
2738
2740
  experienceVariantsMap
@@ -2740,26 +2742,61 @@ const ESRLoadingComponent = _a => {
2740
2742
  const experience = experiences.find(experience => has$1(experienceVariantsMap, experience.id));
2741
2743
 
2742
2744
  if (!experience) {
2743
- 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
+ }));
2744
2753
  }
2745
2754
 
2746
2755
  const component = experience.components.find(component => component.baseline.id === baseline.id);
2747
2756
 
2748
2757
  if (!component) {
2749
- 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
+ }));
2750
2766
  }
2751
2767
 
2752
2768
  if (experienceVariantsMap[experience.id] === 0) {
2753
- 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
+ }));
2754
2777
  }
2755
2778
 
2756
2779
  const variant = component.variants[experienceVariantsMap[experience.id] - 1];
2757
2780
 
2758
2781
  if (!variant) {
2759
- 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
+ }));
2760
2790
  }
2761
2791
 
2762
- 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
+ }));
2763
2800
  };
2764
2801
 
2765
2802
  export { DefaultExperienceLoadingComponent, ESRLoadingComponent, ESRProvider, Experience, MergeTag, NinetailedProvider, Personalize, TrackHasSeenComponent, useNinetailed, usePersonalize, useProfile };
package/index.umd.js CHANGED
@@ -1915,7 +1915,8 @@
1915
1915
  }
1916
1916
  }, [inView]);
1917
1917
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
1918
- ref: ref
1918
+ ref: ref,
1919
+ id: "nt-experience-handle"
1919
1920
  }), children);
1920
1921
  };
1921
1922
 
@@ -2276,7 +2277,8 @@
2276
2277
  var ESRLoadingComponent = function ESRLoadingComponent(_a) {
2277
2278
  var experiences = _a.experiences,
2278
2279
  Component = _a.component,
2279
- baseline = __rest(_a, ["experiences", "component"]);
2280
+ passthroughProps = _a.passthroughProps,
2281
+ baseline = __rest(_a, ["experiences", "component", "passthroughProps"]);
2280
2282
 
2281
2283
  var experienceVariantsMap = useESR().experienceVariantsMap;
2282
2284
  var experience = experiences.find(function (experience) {
@@ -2284,7 +2286,14 @@
2284
2286
  });
2285
2287
 
2286
2288
  if (!experience) {
2287
- 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
+ }));
2288
2297
  }
2289
2298
 
2290
2299
  var component = experience.components.find(function (component) {
@@ -2292,20 +2301,48 @@
2292
2301
  });
2293
2302
 
2294
2303
  if (!component) {
2295
- 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
+ }));
2296
2312
  }
2297
2313
 
2298
2314
  if (experienceVariantsMap[experience.id] === 0) {
2299
- 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
+ }));
2300
2323
  }
2301
2324
 
2302
2325
  var variant = component.variants[experienceVariantsMap[experience.id] - 1];
2303
2326
 
2304
2327
  if (!variant) {
2305
- 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
+ }));
2306
2336
  }
2307
2337
 
2308
- 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
+ }));
2309
2346
  };
2310
2347
 
2311
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.8",
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.8",
12
- "analytics": "^0.8.0",
13
- "@ninetailed/experience.js-shared": "2.2.8",
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",