@ninetailed/experience.js-react 7.5.0-beta.9 → 7.5.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/index.cjs CHANGED
@@ -234,8 +234,10 @@ const selectValueFromProfile = (profile, id) => {
234
234
  }
235
235
  return radash.get(profile, matchingSelector);
236
236
  };
237
+
237
238
  const MergeTag = ({
238
- id
239
+ id,
240
+ fallback
239
241
  }) => {
240
242
  const {
241
243
  loading,
@@ -244,11 +246,10 @@ const MergeTag = ({
244
246
  if (loading || !profile) {
245
247
  return null;
246
248
  }
247
- const value = selectValueFromProfile(profile, id);
248
- // DON'T CHANGE
249
- return jsxRuntime.jsx(jsxRuntime.Fragment, {
249
+ const value = selectValueFromProfile(profile, id) || fallback;
250
+ return value ? jsxRuntime.jsx(jsxRuntime.Fragment, {
250
251
  children: value
251
- });
252
+ }) : null;
252
253
  };
253
254
 
254
255
  const useExperienceSelectionMiddleware = ({
package/index.js CHANGED
@@ -226,8 +226,10 @@ const selectValueFromProfile = (profile, id) => {
226
226
  }
227
227
  return get(profile, matchingSelector);
228
228
  };
229
+
229
230
  const MergeTag = ({
230
- id
231
+ id,
232
+ fallback
231
233
  }) => {
232
234
  const {
233
235
  loading,
@@ -236,11 +238,10 @@ const MergeTag = ({
236
238
  if (loading || !profile) {
237
239
  return null;
238
240
  }
239
- const value = selectValueFromProfile(profile, id);
240
- // DON'T CHANGE
241
- return jsx(Fragment, {
241
+ const value = selectValueFromProfile(profile, id) || fallback;
242
+ return value ? jsx(Fragment, {
242
243
  children: value
243
- });
244
+ }) : null;
244
245
  };
245
246
 
246
247
  const useExperienceSelectionMiddleware = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js-react",
3
- "version": "7.5.0-beta.9",
3
+ "version": "7.5.1",
4
4
  "peerDependencies": {
5
5
  "react": ">=16.8.0"
6
6
  },
@@ -10,8 +10,8 @@
10
10
  "type": "module",
11
11
  "types": "./src/index.d.ts",
12
12
  "dependencies": {
13
- "@ninetailed/experience.js": "7.5.0-beta.9",
14
- "@ninetailed/experience.js-shared": "7.5.0-beta.9",
13
+ "@ninetailed/experience.js": "7.5.1",
14
+ "@ninetailed/experience.js-shared": "7.5.1",
15
15
  "radash": "10.9.0",
16
16
  "react-intersection-observer": "8.34.0",
17
17
  "react-is": "18.2.0"
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+ type MergeTagProps = {
3
+ id: string;
4
+ fallback?: string;
5
+ };
6
+ export declare const MergeTag: ({ id, fallback, }: PropsWithChildren<MergeTagProps>) => JSX.Element | null;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Profile } from '@ninetailed/experience.js-shared';
2
+ export declare const generateSelectors: (id: string) => string[];
3
+ export declare const selectValueFromProfile: (profile: Profile, id: string) => unknown;
@@ -0,0 +1 @@
1
+ export * from './MergeTag';
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Ninetailed, NinetailedPlugin, OnInitProfileId, Storage } from '@ninetailed/experience.js';
3
- import { Profile, Locale, OnErrorHandler, OnLogHandler, NinetailedRequestContext } from '@ninetailed/experience.js-shared';
3
+ import { Locale, OnErrorHandler, OnLogHandler, NinetailedRequestContext } from '@ninetailed/experience.js-shared';
4
4
  export type NinetailedProviderInstantiationProps = {
5
5
  clientId: string;
6
6
  environment?: string;
7
7
  preview?: boolean;
8
8
  url?: string;
9
9
  plugins?: (NinetailedPlugin | NinetailedPlugin[])[];
10
- profile?: Profile;
11
10
  locale?: Locale;
12
11
  requestTimeout?: number;
13
12
  onLog?: OnLogHandler;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import type { Profile } from '@ninetailed/experience.js';
3
- type MergeTagProps = {
4
- id: string;
5
- };
6
- export declare const generateSelectors: (id: string) => string[];
7
- export declare const selectValueFromProfile: (profile: Profile, id: string) => unknown;
8
- export declare const MergeTag: React.FC<React.PropsWithChildren<MergeTagProps>>;
9
- export {};