@sanity/personalization-plugin 2.3.0-growthbook.1 → 2.3.0-growthbook.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/dist/index.js
CHANGED
|
@@ -6504,20 +6504,20 @@ const useAddExperimentAction = (props) => {
|
|
|
6504
6504
|
title: experiment.label,
|
|
6505
6505
|
value: experiment.id
|
|
6506
6506
|
})), ExperimentInput = (props) => {
|
|
6507
|
-
const { experiments } = useExperimentContext(), id = sanity.useFormValue(["_id"]),
|
|
6507
|
+
const { experiments } = useExperimentContext(), id = sanity.useFormValue(["_id"]), additionalChangePath = react.useMemo(
|
|
6508
6508
|
() => [...props.path.slice(0, -1), `${props.variantNameOverride}s`],
|
|
6509
6509
|
[props.variantNameOverride, props.path]
|
|
6510
|
-
), subValues = sanity.useFormValue(
|
|
6510
|
+
), subValues = sanity.useFormValue(additionalChangePath), { patch } = sanity.useDocumentOperation(sanity.getPublishedId(id), props.schemaType.name), handleChange = react.useCallback(
|
|
6511
6511
|
(event, onChange) => {
|
|
6512
6512
|
const inputValue = event.currentTarget.value;
|
|
6513
6513
|
if (onChange(inputValue ? sanity.set(inputValue) : sanity.unset()), subValues) {
|
|
6514
6514
|
const patchEvent = {
|
|
6515
|
-
unset: [
|
|
6515
|
+
unset: [additionalChangePath.join(".")]
|
|
6516
6516
|
};
|
|
6517
6517
|
patch.execute([patchEvent]);
|
|
6518
6518
|
}
|
|
6519
6519
|
},
|
|
6520
|
-
[patch, subValues,
|
|
6520
|
+
[patch, subValues, additionalChangePath]
|
|
6521
6521
|
);
|
|
6522
6522
|
return experiments.length ? /* @__PURE__ */ jsxRuntime.jsx(Select, { ...props, listOptions: formatlistOptions(experiments), handleChange }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: [3, 3, 4], radius: 2, shadow: 1, tone: "caution", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { align: "center", size: [2, 2, 3], children: [
|
|
6523
6523
|
"There are no defined ",
|