@dotcms/experiments 26.8.3-1-next.2478 → 26.8.7-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.esm.js
CHANGED
|
@@ -1654,16 +1654,16 @@ const DotExperimentsContext = /*#__PURE__*/createContext(null);
|
|
|
1654
1654
|
* Similarly, if the assigned variant matches the requested one, it signals not to wait for the variant.
|
|
1655
1655
|
* By default, the hook signals to wait for the variant.
|
|
1656
1656
|
*
|
|
1657
|
-
* @param {Object} data - An object containing the runningExperimentId and viewAs (containing
|
|
1657
|
+
* @param {Object} [data] - An object containing the runningExperimentId and viewAs (containing
|
|
1658
|
+
* variantId). Can be `undefined` while `useEditableDotCMSPage` is still waiting on the UVE editor
|
|
1659
|
+
* to resolve a draft/non-live page - treated the same as "no running experiment" (don't wait).
|
|
1658
1660
|
* @returns {Object} An object with a function `shouldWaitForVariant` that, when called, returns `true` if it should wait for the correct variant, `false` otherwise.
|
|
1659
1661
|
*/
|
|
1660
1662
|
const useExperimentVariant = data => {
|
|
1663
|
+
var _data$viewAs;
|
|
1661
1664
|
const dotExperimentInstance = useContext(DotExperimentsContext);
|
|
1662
|
-
const
|
|
1663
|
-
|
|
1664
|
-
viewAs
|
|
1665
|
-
} = data;
|
|
1666
|
-
const variantId = viewAs == null ? void 0 : viewAs.variantId;
|
|
1665
|
+
const runningExperimentId = data == null ? void 0 : data.runningExperimentId;
|
|
1666
|
+
const variantId = data == null || (_data$viewAs = data.viewAs) == null ? void 0 : _data$viewAs.variantId;
|
|
1667
1667
|
// By default, wait for the variant
|
|
1668
1668
|
const [shouldWaitForVariant, setShouldWaitForVariant] = useState(true);
|
|
1669
1669
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcms/experiments",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.08.07-01",
|
|
4
4
|
"description": "Official JavaScript library to use Experiments with DotCMS.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": ">=18",
|
|
27
27
|
"react-dom": ">=18",
|
|
28
|
-
"@dotcms/client": "26.
|
|
29
|
-
"@dotcms/react": "26.
|
|
30
|
-
"@dotcms/uve": "26.
|
|
31
|
-
"@dotcms/types": "26.
|
|
28
|
+
"@dotcms/client": "26.08.07-01",
|
|
29
|
+
"@dotcms/react": "26.08.07-01",
|
|
30
|
+
"@dotcms/uve": "26.08.07-01",
|
|
31
|
+
"@dotcms/types": "26.08.07-01"
|
|
32
32
|
},
|
|
33
33
|
"module": "./index.esm.js",
|
|
34
34
|
"type": "module",
|
|
@@ -9,9 +9,11 @@ import { DotCMSPageAsset } from '@dotcms/types';
|
|
|
9
9
|
* Similarly, if the assigned variant matches the requested one, it signals not to wait for the variant.
|
|
10
10
|
* By default, the hook signals to wait for the variant.
|
|
11
11
|
*
|
|
12
|
-
* @param {Object} data - An object containing the runningExperimentId and viewAs (containing
|
|
12
|
+
* @param {Object} [data] - An object containing the runningExperimentId and viewAs (containing
|
|
13
|
+
* variantId). Can be `undefined` while `useEditableDotCMSPage` is still waiting on the UVE editor
|
|
14
|
+
* to resolve a draft/non-live page - treated the same as "no running experiment" (don't wait).
|
|
13
15
|
* @returns {Object} An object with a function `shouldWaitForVariant` that, when called, returns `true` if it should wait for the correct variant, `false` otherwise.
|
|
14
16
|
*/
|
|
15
|
-
export declare const useExperimentVariant: (data: DotCMSPageAsset) => {
|
|
17
|
+
export declare const useExperimentVariant: (data: DotCMSPageAsset | undefined) => {
|
|
16
18
|
shouldWaitForVariant: boolean;
|
|
17
19
|
};
|