@sanity/personalization-plugin 2.2.0-launch-darkly.1 → 2.3.0-launch-darkly.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/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/ExperimentInput.tsx +12 -2
- package/src/fieldExperiments.tsx +5 -1
- package/src/utils/launchDarkly.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useClient, useWorkspace, useFormValue, defineDocumentFieldAction, set, unset, useDocumentOperation, isReference, isImage, isDocumentSchemaType, definePlugin, isObjectInputProps, defineType, defineField } from "sanity";
|
|
3
|
-
import { Stack, Inline, Button, Select as Select$1 } from "@sanity/ui";
|
|
3
|
+
import { Stack, Inline, Button, Select as Select$1, Card, Text } from "@sanity/ui";
|
|
4
4
|
import { uuid } from "@sanity/uuid";
|
|
5
5
|
import { createContext, useState, useMemo, useContext, useCallback, forwardRef, useEffect } from "react";
|
|
6
6
|
import equal from "fast-deep-equal";
|
|
@@ -6510,7 +6510,11 @@ const useAddExperimentAction = (props) => {
|
|
|
6510
6510
|
},
|
|
6511
6511
|
[patch, subValues, aditionalChangePath]
|
|
6512
6512
|
);
|
|
6513
|
-
return experiments.length ? /* @__PURE__ */ jsx(Select, { ...props, listOptions: formatlistOptions(experiments), handleChange }) : /* @__PURE__ */ jsx(
|
|
6513
|
+
return experiments.length ? /* @__PURE__ */ jsx(Select, { ...props, listOptions: formatlistOptions(experiments), handleChange }) : /* @__PURE__ */ jsx(Card, { padding: [3, 3, 4], radius: 2, shadow: 1, tone: "caution", children: /* @__PURE__ */ jsxs(Text, { align: "center", size: [2, 2, 3], children: [
|
|
6514
|
+
"There are no defined ",
|
|
6515
|
+
props.experimentNameOverride,
|
|
6516
|
+
"s"
|
|
6517
|
+
] }) });
|
|
6514
6518
|
}, VariantInput = (props) => {
|
|
6515
6519
|
const defaultValue = useFormValue([props.path[0], "default"]), handleClick = () => {
|
|
6516
6520
|
props.onChange(set(defaultValue, ["value"]));
|
|
@@ -6611,7 +6615,14 @@ const createExperimentType = ({
|
|
|
6611
6615
|
name: experimentId,
|
|
6612
6616
|
type: "string",
|
|
6613
6617
|
components: {
|
|
6614
|
-
input: (props) => /* @__PURE__ */ jsx(
|
|
6618
|
+
input: (props) => /* @__PURE__ */ jsx(
|
|
6619
|
+
ExperimentInput,
|
|
6620
|
+
{
|
|
6621
|
+
...props,
|
|
6622
|
+
experimentNameOverride,
|
|
6623
|
+
variantNameOverride
|
|
6624
|
+
}
|
|
6625
|
+
)
|
|
6615
6626
|
},
|
|
6616
6627
|
hidden: ({ parent }) => !parent?.active
|
|
6617
6628
|
}),
|
|
@@ -6794,7 +6805,7 @@ const createExperimentType = ({
|
|
|
6794
6805
|
label: flag.name,
|
|
6795
6806
|
variants: flag.variations.map((variation) => ({
|
|
6796
6807
|
id: variation.value,
|
|
6797
|
-
label: variation.name
|
|
6808
|
+
label: variation.name ?? variation.value
|
|
6798
6809
|
}))
|
|
6799
6810
|
}));
|
|
6800
6811
|
featureExperiments.push(...experiments), items.length !== limit && (hasMore = !1);
|