@ninetailed/experience.js-react 7.17.4 → 7.17.6

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.cjs.js CHANGED
@@ -208,7 +208,8 @@ function useFlagWithManualTracking(flagKey, defaultValue) {
208
208
  if (change) {
209
209
  changeRef.current = change;
210
210
  const rawValue = change.value;
211
- const actualValue = rawValue && typeof rawValue === 'object' && rawValue !== null && 'value' in rawValue && typeof rawValue['value'] === 'object' ? rawValue['value'] : rawValue;
211
+ // Unwrap { value: ... } structure if present
212
+ const actualValue = rawValue && typeof rawValue === 'object' && rawValue !== null && 'value' in rawValue ? rawValue['value'] : rawValue;
212
213
  setResult({
213
214
  value: actualValue,
214
215
  status: 'success',
@@ -725,9 +726,23 @@ const ESRLoadingComponent = _a => {
725
726
  }));
726
727
  };
727
728
 
729
+ const EntryAnalytics = _a => {
730
+ var {
731
+ component: Component,
732
+ passthroughProps
733
+ } = _a,
734
+ entry = __rest(_a, ["component", "passthroughProps"]);
735
+ return jsxRuntime.jsx(Experience, Object.assign({}, passthroughProps, entry, {
736
+ id: entry.id,
737
+ component: Component,
738
+ experiences: []
739
+ }));
740
+ };
741
+
728
742
  exports.DefaultExperienceLoadingComponent = DefaultExperienceLoadingComponent;
729
743
  exports.ESRLoadingComponent = ESRLoadingComponent;
730
744
  exports.ESRProvider = ESRProvider;
745
+ exports.EntryAnalytics = EntryAnalytics;
731
746
  exports.Experience = Experience;
732
747
  exports.MergeTag = MergeTag;
733
748
  exports.NinetailedProvider = NinetailedProvider;
package/index.esm.js CHANGED
@@ -76,10 +76,10 @@ function _objectWithoutPropertiesLoose(source, excluded) {
76
76
  return target;
77
77
  }
78
78
 
79
- const _excluded$3 = ["experiences"];
79
+ const _excluded$4 = ["experiences"];
80
80
  function formatProfileForHook(profile) {
81
81
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
82
- const profileStateWithoutExperiences = _objectWithoutPropertiesLoose(profile, _excluded$3);
82
+ const profileStateWithoutExperiences = _objectWithoutPropertiesLoose(profile, _excluded$4);
83
83
  return Object.assign({}, profileStateWithoutExperiences, {
84
84
  loading: profile.status === 'loading'
85
85
  });
@@ -192,7 +192,9 @@ function useFlagWithManualTracking(flagKey, defaultValue) {
192
192
  if (change) {
193
193
  changeRef.current = change;
194
194
  const rawValue = change.value;
195
- const actualValue = rawValue && typeof rawValue === 'object' && rawValue !== null && 'value' in rawValue && typeof rawValue['value'] === 'object' ? rawValue['value'] : rawValue;
195
+
196
+ // Unwrap { value: ... } structure if present
197
+ const actualValue = rawValue && typeof rawValue === 'object' && rawValue !== null && 'value' in rawValue ? rawValue['value'] : rawValue;
196
198
  setResult({
197
199
  value: actualValue,
198
200
  status: 'success',
@@ -286,7 +288,7 @@ const TrackHasSeenComponent = ({
286
288
  });
287
289
  };
288
290
 
289
- const _excluded$2 = ["component", "loadingComponent", "variants", "holdout"];
291
+ const _excluded$3 = ["component", "loadingComponent", "variants", "holdout"];
290
292
  const Personalize = _ref => {
291
293
  let {
292
294
  component: Component,
@@ -294,7 +296,7 @@ const Personalize = _ref => {
294
296
  variants = [],
295
297
  holdout = -1
296
298
  } = _ref,
297
- baseline = _objectWithoutPropertiesLoose(_ref, _excluded$2);
299
+ baseline = _objectWithoutPropertiesLoose(_ref, _excluded$3);
298
300
  const {
299
301
  loading,
300
302
  variant,
@@ -468,7 +470,7 @@ const getObservableElement = element => {
468
470
  return getObservableElement(parentElement);
469
471
  };
470
472
 
471
- const _excluded$1 = ["component", "unhideAfterMs", "passthroughProps"],
473
+ const _excluded$2 = ["component", "unhideAfterMs", "passthroughProps"],
472
474
  _excluded2 = ["experiences", "component", "loadingComponent", "passthroughProps"];
473
475
  const DefaultExperienceLoadingComponent = _ref => {
474
476
  let {
@@ -476,7 +478,7 @@ const DefaultExperienceLoadingComponent = _ref => {
476
478
  unhideAfterMs = 5000,
477
479
  passthroughProps
478
480
  } = _ref,
479
- baseline = _objectWithoutPropertiesLoose(_ref, _excluded$1);
481
+ baseline = _objectWithoutPropertiesLoose(_ref, _excluded$2);
480
482
  const {
481
483
  logger
482
484
  } = useNinetailed();
@@ -620,7 +622,7 @@ const Experience = _ref2 => {
620
622
  });
621
623
  };
622
624
 
623
- const _excluded = ["experiences", "component", "passthroughProps"];
625
+ const _excluded$1 = ["experiences", "component", "passthroughProps"];
624
626
  const ESRContext = /*#__PURE__*/React.createContext(undefined);
625
627
  const ESRProvider = ({
626
628
  experienceVariantsMap,
@@ -648,7 +650,7 @@ const ESRLoadingComponent = _ref => {
648
650
  component: Component,
649
651
  passthroughProps
650
652
  } = _ref,
651
- baseline = _objectWithoutPropertiesLoose(_ref, _excluded);
653
+ baseline = _objectWithoutPropertiesLoose(_ref, _excluded$1);
652
654
  const {
653
655
  experienceVariantsMap
654
656
  } = useESR();
@@ -713,4 +715,18 @@ const ESRLoadingComponent = _ref => {
713
715
  }));
714
716
  };
715
717
 
716
- export { DefaultExperienceLoadingComponent, ESRLoadingComponent, ESRProvider, Experience, MergeTag, NinetailedProvider, Personalize, TrackHasSeenComponent, useExperience, useFlag, useFlagWithManualTracking, useNinetailed, usePersonalize, useProfile };
718
+ const _excluded = ["component", "passthroughProps"];
719
+ const EntryAnalytics = _ref => {
720
+ let {
721
+ component: Component,
722
+ passthroughProps
723
+ } = _ref,
724
+ entry = _objectWithoutPropertiesLoose(_ref, _excluded);
725
+ return /*#__PURE__*/jsx(Experience, Object.assign({}, passthroughProps, entry, {
726
+ id: entry.id,
727
+ component: Component,
728
+ experiences: []
729
+ }));
730
+ };
731
+
732
+ export { DefaultExperienceLoadingComponent, ESRLoadingComponent, ESRProvider, EntryAnalytics, Experience, MergeTag, NinetailedProvider, Personalize, TrackHasSeenComponent, useExperience, useFlag, useFlagWithManualTracking, useNinetailed, usePersonalize, useProfile };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js-react",
3
- "version": "7.17.4",
3
+ "version": "7.17.6",
4
4
  "description": "Ninetailed SDK for React",
5
5
  "dependencies": {
6
- "@ninetailed/experience.js": "7.17.4",
7
- "@ninetailed/experience.js-shared": "7.17.4",
8
- "@ninetailed/experience.js-plugin-analytics": "7.17.4",
6
+ "@ninetailed/experience.js": "7.17.6",
7
+ "@ninetailed/experience.js-shared": "7.17.6",
8
+ "@ninetailed/experience.js-plugin-analytics": "7.17.6",
9
9
  "radash": "10.9.0",
10
10
  "react-is": "18.2.0"
11
11
  },
@@ -0,0 +1,4 @@
1
+ import { Baseline } from '@ninetailed/experience.js';
2
+ import { ExperienceProps } from '../Experience';
3
+ export type EntryAnalyticsProps<P> = Omit<ExperienceProps<P>, 'experiences'> & Baseline<P>;
4
+ export declare const EntryAnalytics: <P>({ component: Component, passthroughProps, ...entry }: EntryAnalyticsProps<P>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export type { EntryAnalyticsProps } from './EntryAnalytics';
2
+ export { EntryAnalytics } from './EntryAnalytics';
@@ -13,3 +13,5 @@ export { MergeTag } from './MergeTag';
13
13
  export { TrackHasSeenComponent } from './TrackHasSeenComponent';
14
14
  export { Experience, ESRProvider, ESRLoadingComponent, DefaultExperienceLoadingComponent, useExperience, } from './Experience';
15
15
  export type { ExperienceProps, ExperienceBaseProps, ExperienceComponent, ExperienceLoadingComponent, } from './Experience';
16
+ export { EntryAnalytics } from './EntryAnalytics';
17
+ export type { EntryAnalyticsProps } from './EntryAnalytics';