@ninetailed/experience.js-react 4.4.0-beta.1 → 4.4.0-beta.2
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 +35 -28
- package/index.js +35 -28
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -2062,21 +2062,6 @@ const useExperience = ({
|
|
|
2062
2062
|
}));
|
|
2063
2063
|
};
|
|
2064
2064
|
|
|
2065
|
-
const ExperimentsContext = /*#__PURE__*/React.createContext(undefined);
|
|
2066
|
-
|
|
2067
|
-
const useExperimentsContext = () => {
|
|
2068
|
-
const context = React.useContext(ExperimentsContext);
|
|
2069
|
-
if (context === undefined) {
|
|
2070
|
-
throw new Error('The component using the the context must be a descendant of the ExperimentsProvider');
|
|
2071
|
-
}
|
|
2072
|
-
return context;
|
|
2073
|
-
};
|
|
2074
|
-
|
|
2075
|
-
const useJoinExperiment = () => {
|
|
2076
|
-
const context = useExperimentsContext();
|
|
2077
|
-
return context.joinExperiment;
|
|
2078
|
-
};
|
|
2079
|
-
|
|
2080
2065
|
const DefaultExperienceLoadingComponent = _a => {
|
|
2081
2066
|
var {
|
|
2082
2067
|
component: Component,
|
|
@@ -2143,19 +2128,26 @@ const Experience = _a => {
|
|
|
2143
2128
|
baseline,
|
|
2144
2129
|
experiences
|
|
2145
2130
|
});
|
|
2146
|
-
const joinExperiment = useJoinExperiment();
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2131
|
+
// const joinExperiment = useJoinExperiment();
|
|
2132
|
+
// useEffect(() => {
|
|
2133
|
+
// if (
|
|
2134
|
+
// status === 'success' &&
|
|
2135
|
+
// experience &&
|
|
2136
|
+
// experience.type === 'nt_experiment' &&
|
|
2137
|
+
// variant &&
|
|
2138
|
+
// profile
|
|
2139
|
+
// ) {
|
|
2140
|
+
// joinExperiment({
|
|
2141
|
+
// experiences,
|
|
2142
|
+
// experiment: experience,
|
|
2143
|
+
// variant: {
|
|
2144
|
+
// ...variant,
|
|
2145
|
+
// hidden: 'hidden' in variant ? variant.hidden : false,
|
|
2146
|
+
// },
|
|
2147
|
+
// profile,
|
|
2148
|
+
// });
|
|
2149
|
+
// }
|
|
2150
|
+
// }, [status, experience, variant, profile]);
|
|
2159
2151
|
if (!hasVariants) {
|
|
2160
2152
|
return /*#__PURE__*/React.createElement(Component, Object.assign({}, passthroughProps, baseline, {
|
|
2161
2153
|
key: baseline.id
|
|
@@ -2300,6 +2292,8 @@ const ESRLoadingComponent = _a => {
|
|
|
2300
2292
|
}));
|
|
2301
2293
|
};
|
|
2302
2294
|
|
|
2295
|
+
const ExperimentsContext = /*#__PURE__*/React.createContext(undefined);
|
|
2296
|
+
|
|
2303
2297
|
const EXPERIENCE_TRAIT_PREFIX = 'nt_experiment_';
|
|
2304
2298
|
|
|
2305
2299
|
const debounce = (fn, wait) => {
|
|
@@ -2369,6 +2363,14 @@ const ExperimentsProvider = ({
|
|
|
2369
2363
|
}));
|
|
2370
2364
|
};
|
|
2371
2365
|
|
|
2366
|
+
const useExperimentsContext = () => {
|
|
2367
|
+
const context = React.useContext(ExperimentsContext);
|
|
2368
|
+
if (context === undefined) {
|
|
2369
|
+
throw new Error('The component using the the context must be a descendant of the ExperimentsProvider');
|
|
2370
|
+
}
|
|
2371
|
+
return context;
|
|
2372
|
+
};
|
|
2373
|
+
|
|
2372
2374
|
/**
|
|
2373
2375
|
* @deprecated
|
|
2374
2376
|
*
|
|
@@ -2381,6 +2383,11 @@ const useExperiments = () => {
|
|
|
2381
2383
|
};
|
|
2382
2384
|
};
|
|
2383
2385
|
|
|
2386
|
+
const useJoinExperiment = () => {
|
|
2387
|
+
const context = useExperimentsContext();
|
|
2388
|
+
return context.joinExperiment;
|
|
2389
|
+
};
|
|
2390
|
+
|
|
2384
2391
|
const NinetailedProvider = props => {
|
|
2385
2392
|
const ninetailed = React.useMemo(() => {
|
|
2386
2393
|
if ('ninetailed' in props) {
|
package/index.js
CHANGED
|
@@ -2054,21 +2054,6 @@ const useExperience = ({
|
|
|
2054
2054
|
}));
|
|
2055
2055
|
};
|
|
2056
2056
|
|
|
2057
|
-
const ExperimentsContext = /*#__PURE__*/createContext(undefined);
|
|
2058
|
-
|
|
2059
|
-
const useExperimentsContext = () => {
|
|
2060
|
-
const context = useContext(ExperimentsContext);
|
|
2061
|
-
if (context === undefined) {
|
|
2062
|
-
throw new Error('The component using the the context must be a descendant of the ExperimentsProvider');
|
|
2063
|
-
}
|
|
2064
|
-
return context;
|
|
2065
|
-
};
|
|
2066
|
-
|
|
2067
|
-
const useJoinExperiment = () => {
|
|
2068
|
-
const context = useExperimentsContext();
|
|
2069
|
-
return context.joinExperiment;
|
|
2070
|
-
};
|
|
2071
|
-
|
|
2072
2057
|
const DefaultExperienceLoadingComponent = _a => {
|
|
2073
2058
|
var {
|
|
2074
2059
|
component: Component,
|
|
@@ -2135,19 +2120,26 @@ const Experience = _a => {
|
|
|
2135
2120
|
baseline,
|
|
2136
2121
|
experiences
|
|
2137
2122
|
});
|
|
2138
|
-
const joinExperiment = useJoinExperiment();
|
|
2139
|
-
useEffect(() => {
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2123
|
+
// const joinExperiment = useJoinExperiment();
|
|
2124
|
+
// useEffect(() => {
|
|
2125
|
+
// if (
|
|
2126
|
+
// status === 'success' &&
|
|
2127
|
+
// experience &&
|
|
2128
|
+
// experience.type === 'nt_experiment' &&
|
|
2129
|
+
// variant &&
|
|
2130
|
+
// profile
|
|
2131
|
+
// ) {
|
|
2132
|
+
// joinExperiment({
|
|
2133
|
+
// experiences,
|
|
2134
|
+
// experiment: experience,
|
|
2135
|
+
// variant: {
|
|
2136
|
+
// ...variant,
|
|
2137
|
+
// hidden: 'hidden' in variant ? variant.hidden : false,
|
|
2138
|
+
// },
|
|
2139
|
+
// profile,
|
|
2140
|
+
// });
|
|
2141
|
+
// }
|
|
2142
|
+
// }, [status, experience, variant, profile]);
|
|
2151
2143
|
if (!hasVariants) {
|
|
2152
2144
|
return /*#__PURE__*/createElement$1(Component, Object.assign({}, passthroughProps, baseline, {
|
|
2153
2145
|
key: baseline.id
|
|
@@ -2292,6 +2284,8 @@ const ESRLoadingComponent = _a => {
|
|
|
2292
2284
|
}));
|
|
2293
2285
|
};
|
|
2294
2286
|
|
|
2287
|
+
const ExperimentsContext = /*#__PURE__*/createContext(undefined);
|
|
2288
|
+
|
|
2295
2289
|
const EXPERIENCE_TRAIT_PREFIX = 'nt_experiment_';
|
|
2296
2290
|
|
|
2297
2291
|
const debounce = (fn, wait) => {
|
|
@@ -2361,6 +2355,14 @@ const ExperimentsProvider = ({
|
|
|
2361
2355
|
}));
|
|
2362
2356
|
};
|
|
2363
2357
|
|
|
2358
|
+
const useExperimentsContext = () => {
|
|
2359
|
+
const context = useContext(ExperimentsContext);
|
|
2360
|
+
if (context === undefined) {
|
|
2361
|
+
throw new Error('The component using the the context must be a descendant of the ExperimentsProvider');
|
|
2362
|
+
}
|
|
2363
|
+
return context;
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2364
2366
|
/**
|
|
2365
2367
|
* @deprecated
|
|
2366
2368
|
*
|
|
@@ -2373,6 +2375,11 @@ const useExperiments = () => {
|
|
|
2373
2375
|
};
|
|
2374
2376
|
};
|
|
2375
2377
|
|
|
2378
|
+
const useJoinExperiment = () => {
|
|
2379
|
+
const context = useExperimentsContext();
|
|
2380
|
+
return context.joinExperiment;
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2376
2383
|
const NinetailedProvider = props => {
|
|
2377
2384
|
const ninetailed = useMemo(() => {
|
|
2378
2385
|
if ('ninetailed' in props) {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-react",
|
|
3
|
-
"version": "4.4.0-beta.
|
|
3
|
+
"version": "4.4.0-beta.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=16.8.0"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@analytics/google-analytics": "0.5.3",
|
|
9
9
|
"react-visibility-sensor": "5.1.1",
|
|
10
|
-
"@ninetailed/experience.js": "4.4.0-beta.
|
|
10
|
+
"@ninetailed/experience.js": "4.4.0-beta.2",
|
|
11
11
|
"react-intersection-observer": "8.34.0",
|
|
12
|
-
"@ninetailed/experience.js-shared": "4.4.0-beta.
|
|
12
|
+
"@ninetailed/experience.js-shared": "4.4.0-beta.2",
|
|
13
13
|
"radash": "10.9.0",
|
|
14
14
|
"analytics": "0.8.1"
|
|
15
15
|
},
|