@uniformdev/mesh-sdk-react 18.34.1-alpha.57 → 18.35.1-alpha.26
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.d.ts +21 -66
- package/dist/index.esm.js +166 -119
- package/dist/index.js +224 -185
- package/dist/index.mjs +166 -119
- package/package.json +5 -4
package/dist/index.esm.js
CHANGED
|
@@ -893,7 +893,7 @@ var ProductPreviewList = ({
|
|
|
893
893
|
scrollbarStyles
|
|
894
894
|
],
|
|
895
895
|
children: products == null ? void 0 : products.map((product, index) => {
|
|
896
|
-
var _a
|
|
896
|
+
var _a;
|
|
897
897
|
const [category] = (product == null ? void 0 : product.categories) || [];
|
|
898
898
|
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
899
899
|
return /* @__PURE__ */ jsx18("li", { css: productPreviewListItem, children: /* @__PURE__ */ jsxs7(
|
|
@@ -906,13 +906,13 @@ var ProductPreviewList = ({
|
|
|
906
906
|
"img",
|
|
907
907
|
{
|
|
908
908
|
src: product.thumbnailUrl,
|
|
909
|
-
alt: typeof product.title === "string" ? product.title :
|
|
909
|
+
alt: typeof product.title === "string" ? product.title : `Product ${index}`,
|
|
910
910
|
css: productPreviewListImage,
|
|
911
911
|
"data-test-id": "product-image"
|
|
912
912
|
}
|
|
913
913
|
) : /* @__PURE__ */ jsx18("div", { css: productPreviewListImageDefault }),
|
|
914
914
|
/* @__PURE__ */ jsxs7("h4", { css: productPreviewListTitle, "data-test-id": "product-name", children: [
|
|
915
|
-
product.title
|
|
915
|
+
product.title,
|
|
916
916
|
categoryName && /* @__PURE__ */ jsx18("span", { css: productPreviewListCategoryText, children: categoryName })
|
|
917
917
|
] }),
|
|
918
918
|
product && /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
@@ -925,12 +925,12 @@ var ProductPreviewList = ({
|
|
|
925
925
|
"Price: ",
|
|
926
926
|
product.price
|
|
927
927
|
] }) : null,
|
|
928
|
-
product.editLink
|
|
928
|
+
product.editLink ? /* @__PURE__ */ jsxs7(
|
|
929
929
|
"a",
|
|
930
930
|
{
|
|
931
931
|
css: productPreviewListLinkBtn,
|
|
932
|
-
href:
|
|
933
|
-
title: `Go to ${product.title
|
|
932
|
+
href: product.editLink,
|
|
933
|
+
title: `Go to ${product.title}`,
|
|
934
934
|
target: "_blank",
|
|
935
935
|
rel: "noopener noreferrer",
|
|
936
936
|
"data-test-id": "edit-product-button",
|
|
@@ -2655,18 +2655,6 @@ import { Theme } from "@uniformdev/design-system";
|
|
|
2655
2655
|
import { createContext, useContext as useContext3 } from "react";
|
|
2656
2656
|
import { jsx as jsx26, jsxs as jsxs15 } from "@emotion/react/jsx-runtime";
|
|
2657
2657
|
var UniformMeshSdkContext = createContext(void 0);
|
|
2658
|
-
var UniformMeshSdkContextProvider = ({ children }) => {
|
|
2659
|
-
let value = void 0;
|
|
2660
|
-
if (typeof window !== "undefined" && typeof window.UniformMeshSDK !== "undefined") {
|
|
2661
|
-
value = {
|
|
2662
|
-
sdk: window.UniformMeshSDK
|
|
2663
|
-
};
|
|
2664
|
-
}
|
|
2665
|
-
return /* @__PURE__ */ jsxs15(UniformMeshSdkContext.Provider, { value, children: [
|
|
2666
|
-
/* @__PURE__ */ jsx26(Theme, {}),
|
|
2667
|
-
/* @__PURE__ */ jsx26(UniformMeshLocationContextProvider, { children })
|
|
2668
|
-
] });
|
|
2669
|
-
};
|
|
2670
2658
|
var useUniformMeshSdkContext = () => {
|
|
2671
2659
|
const context = useContext3(UniformMeshSdkContext);
|
|
2672
2660
|
if (!context) {
|
|
@@ -2683,9 +2671,7 @@ function useUniformMeshSdk() {
|
|
|
2683
2671
|
|
|
2684
2672
|
// src/components/UniformMeshLocationContext.tsx
|
|
2685
2673
|
import { jsx as jsx27 } from "@emotion/react/jsx-runtime";
|
|
2686
|
-
var UniformMeshLocationContext = createContext2(
|
|
2687
|
-
void 0
|
|
2688
|
-
);
|
|
2674
|
+
var UniformMeshLocationContext = createContext2(void 0);
|
|
2689
2675
|
var UniformMeshLocationContextProvider = ({
|
|
2690
2676
|
children
|
|
2691
2677
|
}) => {
|
|
@@ -2716,20 +2702,9 @@ var useUniformMeshLocationContext = () => {
|
|
|
2716
2702
|
};
|
|
2717
2703
|
|
|
2718
2704
|
// src/hooks/useMeshLocation.ts
|
|
2719
|
-
var legacyWarned = false;
|
|
2720
2705
|
function useMeshLocation(expectedLocation) {
|
|
2721
2706
|
const { location } = useUniformMeshLocationContext();
|
|
2722
|
-
|
|
2723
|
-
if (expectedLocation === "dataTypeInstance") {
|
|
2724
|
-
effectiveExpected = "dataResource";
|
|
2725
|
-
if (!legacyWarned) {
|
|
2726
|
-
console.warn(
|
|
2727
|
-
"`dataTypeInstance` mesh location is deprecated, please switch to `dataResource` instead."
|
|
2728
|
-
);
|
|
2729
|
-
legacyWarned = true;
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
if (effectiveExpected && location.type !== effectiveExpected) {
|
|
2707
|
+
if (expectedLocation && location.type !== expectedLocation) {
|
|
2733
2708
|
throw new Error(`Expected location type ${expectedLocation} but got ${location.type}`);
|
|
2734
2709
|
}
|
|
2735
2710
|
const backdoorLocation = useRef7(location);
|
|
@@ -2752,9 +2727,35 @@ function useMeshLocation(expectedLocation) {
|
|
|
2752
2727
|
import { Input as Input3 } from "@uniformdev/design-system";
|
|
2753
2728
|
import * as React11 from "react";
|
|
2754
2729
|
|
|
2730
|
+
// src/components/Variables/insertVariableIntoText.ts
|
|
2731
|
+
function insertVariableIntoText({
|
|
2732
|
+
variableName: variableName2,
|
|
2733
|
+
variablePrefix,
|
|
2734
|
+
variableSuffix = "",
|
|
2735
|
+
value,
|
|
2736
|
+
selectionStart = null,
|
|
2737
|
+
selectionEnd = null
|
|
2738
|
+
}) {
|
|
2739
|
+
const variableExpression = `${variablePrefix}${variableName2}${variableSuffix}`;
|
|
2740
|
+
if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
|
|
2741
|
+
return `${value.substring(0, selectionStart)}${variableExpression}${value.substring(selectionEnd)}`;
|
|
2742
|
+
}
|
|
2743
|
+
const hasCursorPosition = selectionStart !== null;
|
|
2744
|
+
let startOffset = 0;
|
|
2745
|
+
if (hasCursorPosition && value.substring(selectionStart - variablePrefix.length, selectionStart) === variablePrefix) {
|
|
2746
|
+
startOffset = variablePrefix.length;
|
|
2747
|
+
}
|
|
2748
|
+
if (hasCursorPosition) {
|
|
2749
|
+
return `${value.substring(0, selectionStart - startOffset)}${variableExpression}${value.substring(
|
|
2750
|
+
selectionStart
|
|
2751
|
+
)}`;
|
|
2752
|
+
}
|
|
2753
|
+
return `${value}${variableExpression}`;
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2755
2756
|
// src/components/Variables/InsertVariableMenu.tsx
|
|
2756
2757
|
import { Icon as Icon5, Menu as Menu2, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
|
|
2757
|
-
import { useEffect as
|
|
2758
|
+
import { useEffect as useEffect6, useRef as useRef8, useState as useState8 } from "react";
|
|
2758
2759
|
|
|
2759
2760
|
// src/components/Variables/styles/InsertVariableMenu.styles.ts
|
|
2760
2761
|
import { css as css18 } from "@emotion/react";
|
|
@@ -2784,7 +2785,11 @@ var variablesTipText = css18`
|
|
|
2784
2785
|
padding: 0 var(--spacing-sm);
|
|
2785
2786
|
`;
|
|
2786
2787
|
|
|
2788
|
+
// src/components/Variables/useOnVariableUpdated.ts
|
|
2789
|
+
import { useEffect as useEffect5 } from "react";
|
|
2790
|
+
|
|
2787
2791
|
// src/components/Variables/VariablesProvider.tsx
|
|
2792
|
+
import mitt from "mitt";
|
|
2788
2793
|
import * as React10 from "react";
|
|
2789
2794
|
|
|
2790
2795
|
// src/components/Variables/VariableEditor.tsx
|
|
@@ -2869,6 +2874,7 @@ function VariablesProvider({
|
|
|
2869
2874
|
children
|
|
2870
2875
|
}) {
|
|
2871
2876
|
const [editing, setEditing] = React10.useState();
|
|
2877
|
+
const events = React10.useMemo(() => mitt(), []);
|
|
2872
2878
|
const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
2873
2879
|
const contextValue = {
|
|
2874
2880
|
dispatch: (event) => {
|
|
@@ -2890,7 +2896,9 @@ function VariablesProvider({
|
|
|
2890
2896
|
throw new Error(`Unknown event ${JSON.stringify(event)}`);
|
|
2891
2897
|
}
|
|
2892
2898
|
},
|
|
2893
|
-
variables: value
|
|
2899
|
+
variables: value,
|
|
2900
|
+
isEditing: typeof editing !== "undefined",
|
|
2901
|
+
events
|
|
2894
2902
|
};
|
|
2895
2903
|
return /* @__PURE__ */ jsxs17(VariablesContext.Provider, { value: contextValue, children: [
|
|
2896
2904
|
children,
|
|
@@ -2901,6 +2909,7 @@ function VariablesProvider({
|
|
|
2901
2909
|
setEditing(void 0);
|
|
2902
2910
|
const { name, ...varValue } = val;
|
|
2903
2911
|
onChange({ ...value, [name]: varValue });
|
|
2912
|
+
events.emit("update", name);
|
|
2904
2913
|
},
|
|
2905
2914
|
onCancel: () => setEditing(void 0),
|
|
2906
2915
|
variable: editing
|
|
@@ -2916,51 +2925,106 @@ function useVariables() {
|
|
|
2916
2925
|
return context;
|
|
2917
2926
|
}
|
|
2918
2927
|
|
|
2928
|
+
// src/components/Variables/useOnVariableUpdated.ts
|
|
2929
|
+
function useOnVariableUpdated(fn, disabled) {
|
|
2930
|
+
const { variables, events } = useVariables();
|
|
2931
|
+
useEffect5(() => {
|
|
2932
|
+
if (disabled) {
|
|
2933
|
+
return;
|
|
2934
|
+
}
|
|
2935
|
+
events.on("update", fn);
|
|
2936
|
+
return () => events.off("update", fn);
|
|
2937
|
+
}, [disabled, events, fn, variables]);
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
// src/components/Variables/variablesToList.ts
|
|
2941
|
+
function variablesToList(variables) {
|
|
2942
|
+
return Object.entries(variables || {}).sort(([aKey, a], [bKey, b]) => {
|
|
2943
|
+
var _a, _b;
|
|
2944
|
+
if (a.order && b.order) {
|
|
2945
|
+
return a.order - b.order;
|
|
2946
|
+
} else if (a.order) {
|
|
2947
|
+
return 1;
|
|
2948
|
+
} else if (b.order) {
|
|
2949
|
+
return -1;
|
|
2950
|
+
}
|
|
2951
|
+
return ((_a = a.displayName) != null ? _a : aKey).localeCompare((_b = b.displayName) != null ? _b : bKey);
|
|
2952
|
+
}).map(([name, definition]) => ({
|
|
2953
|
+
name,
|
|
2954
|
+
...definition
|
|
2955
|
+
}));
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2919
2958
|
// src/components/Variables/InsertVariableMenu.tsx
|
|
2920
2959
|
import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
|
|
2921
2960
|
var InsertVariableMenu = ({
|
|
2922
|
-
|
|
2961
|
+
onSelectVariable,
|
|
2923
2962
|
children,
|
|
2924
2963
|
textValue,
|
|
2925
2964
|
trigger = "${",
|
|
2926
|
-
showAddVariableMenuOption = false
|
|
2965
|
+
showAddVariableMenuOption = false,
|
|
2966
|
+
disabled = false,
|
|
2967
|
+
forceVisible
|
|
2927
2968
|
}) => {
|
|
2928
|
-
const { variables, dispatch } = useVariables();
|
|
2969
|
+
const { variables, dispatch, isEditing } = useVariables();
|
|
2929
2970
|
const btnRef = useRef8(null);
|
|
2930
|
-
const tip =
|
|
2931
|
-
|
|
2971
|
+
const tip = `Tip: access this list by typing ${trigger}`;
|
|
2972
|
+
useEffect6(() => {
|
|
2932
2973
|
if (textValue === trigger && btnRef.current && btnRef.current.getAttribute("aria-expanded") === "false") {
|
|
2933
2974
|
btnRef.current.click();
|
|
2934
2975
|
}
|
|
2935
2976
|
}, [textValue, btnRef, trigger]);
|
|
2977
|
+
const [openedAdd, setOpenedAdd] = useState8(false);
|
|
2978
|
+
useOnVariableUpdated((varName) => {
|
|
2979
|
+
onSelectVariable == null ? void 0 : onSelectVariable({ name: varName, default: "" });
|
|
2980
|
+
}, !openedAdd);
|
|
2981
|
+
useEffect6(() => {
|
|
2982
|
+
if (openedAdd && !isEditing) {
|
|
2983
|
+
setOpenedAdd(false);
|
|
2984
|
+
}
|
|
2985
|
+
}, [isEditing, openedAdd]);
|
|
2986
|
+
if (disabled) {
|
|
2987
|
+
return /* @__PURE__ */ jsx30(Fragment4, { children });
|
|
2988
|
+
}
|
|
2989
|
+
const variablesList = variablesToList(variables);
|
|
2936
2990
|
return /* @__PURE__ */ jsxs18("div", { css: menuContainer, children: [
|
|
2937
2991
|
children,
|
|
2938
2992
|
/* @__PURE__ */ jsxs18(
|
|
2939
2993
|
Menu2,
|
|
2940
2994
|
{
|
|
2941
2995
|
placement: "bottom-start",
|
|
2996
|
+
forceVisible,
|
|
2942
2997
|
menuTrigger: /* @__PURE__ */ jsx30("button", { ref: btnRef, css: menuBtn, type: "button", title: "Insert variable", children: /* @__PURE__ */ jsx30(Icon5, { icon: "usb-c", iconColor: "currentColor" }) }),
|
|
2943
2998
|
menuLabel: "Insert variable",
|
|
2944
2999
|
children: [
|
|
2945
|
-
|
|
2946
|
-
const { helpText } =
|
|
3000
|
+
variablesList.map((variable) => {
|
|
3001
|
+
const { name, helpText } = variable;
|
|
2947
3002
|
return /* @__PURE__ */ jsxs18(
|
|
2948
3003
|
MenuItem2,
|
|
2949
3004
|
{
|
|
2950
|
-
id:
|
|
3005
|
+
id: name,
|
|
2951
3006
|
css: menuItemTextGroup,
|
|
2952
|
-
onClick: () =>
|
|
3007
|
+
onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
|
|
2953
3008
|
children: [
|
|
2954
|
-
/* @__PURE__ */ jsx30("span", { children:
|
|
3009
|
+
/* @__PURE__ */ jsx30("span", { children: name }),
|
|
2955
3010
|
helpText ? /* @__PURE__ */ jsx30("small", { css: smallText, children: helpText }) : null
|
|
2956
3011
|
]
|
|
2957
3012
|
},
|
|
2958
|
-
|
|
3013
|
+
name
|
|
2959
3014
|
);
|
|
2960
3015
|
}),
|
|
2961
3016
|
showAddVariableMenuOption ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
2962
|
-
/* @__PURE__ */ jsx30(MenuItemSeparator, {}),
|
|
2963
|
-
/* @__PURE__ */ jsx30(
|
|
3017
|
+
variablesList.length ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
3018
|
+
/* @__PURE__ */ jsx30(
|
|
3019
|
+
MenuItem2,
|
|
3020
|
+
{
|
|
3021
|
+
onClick: () => {
|
|
3022
|
+
setOpenedAdd(true);
|
|
3023
|
+
dispatch({ type: "edit", variable: "" });
|
|
3024
|
+
},
|
|
3025
|
+
children: "Add Variable"
|
|
3026
|
+
}
|
|
3027
|
+
)
|
|
2964
3028
|
] }) : null,
|
|
2965
3029
|
Object.entries(variables).length || showAddVariableMenuOption ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
2966
3030
|
/* @__PURE__ */ jsx30("i", { css: variablesTipText, children: tip })
|
|
@@ -2975,13 +3039,15 @@ import { jsx as jsx31 } from "@emotion/react/jsx-runtime";
|
|
|
2975
3039
|
function InputVariables({
|
|
2976
3040
|
"aria-label": ariaLabel,
|
|
2977
3041
|
value,
|
|
2978
|
-
|
|
3042
|
+
disableVariables,
|
|
2979
3043
|
onChange,
|
|
2980
3044
|
onPaste,
|
|
2981
|
-
onVariableClick,
|
|
2982
3045
|
showAddVariableMenuOption,
|
|
3046
|
+
variablePrefix = "${",
|
|
3047
|
+
variableSuffix = "}",
|
|
2983
3048
|
...inputProps
|
|
2984
3049
|
}) {
|
|
3050
|
+
var _a, _b;
|
|
2985
3051
|
const { variables, dispatch } = useVariables();
|
|
2986
3052
|
const currentVariables = React11.useRef(variables);
|
|
2987
3053
|
const currentDispatch = React11.useRef(dispatch);
|
|
@@ -2996,21 +3062,40 @@ function InputVariables({
|
|
|
2996
3062
|
React11.useEffect(() => {
|
|
2997
3063
|
currentSetValue.current = onChange;
|
|
2998
3064
|
}, [onChange]);
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3065
|
+
const onPasteHandler = () => {
|
|
3066
|
+
setTimeout(() => {
|
|
3067
|
+
if (!inputRef.current) {
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
onPaste == null ? void 0 : onPaste(inputRef.current.value);
|
|
3071
|
+
});
|
|
3072
|
+
};
|
|
3073
|
+
const handleInsertVariable = (variable) => {
|
|
3074
|
+
var _a2, _b2;
|
|
3075
|
+
handleSetValue(
|
|
3076
|
+
insertVariableIntoText({
|
|
3077
|
+
variableName: variable.name,
|
|
3078
|
+
value,
|
|
3079
|
+
variablePrefix,
|
|
3080
|
+
variableSuffix,
|
|
3081
|
+
selectionEnd: (_a2 = inputRef.current) == null ? void 0 : _a2.selectionEnd,
|
|
3082
|
+
selectionStart: (_b2 = inputRef.current) == null ? void 0 : _b2.selectionStart
|
|
3083
|
+
})
|
|
3084
|
+
);
|
|
3085
|
+
};
|
|
3005
3086
|
const handleSetValue = (rawValue) => {
|
|
3006
3087
|
currentSetValue.current(rawValue);
|
|
3007
3088
|
};
|
|
3089
|
+
const currentCursor = (_b = (_a = inputRef.current) == null ? void 0 : _a.selectionStart) != null ? _b : value.length;
|
|
3090
|
+
const forceMenu = value.substring(currentCursor - 2, currentCursor) === "${";
|
|
3008
3091
|
return /* @__PURE__ */ jsx31(
|
|
3009
3092
|
InsertVariableMenu,
|
|
3010
3093
|
{
|
|
3011
3094
|
showAddVariableMenuOption,
|
|
3012
3095
|
textValue: value,
|
|
3013
|
-
|
|
3096
|
+
onSelectVariable: handleInsertVariable,
|
|
3097
|
+
disabled: disableVariables,
|
|
3098
|
+
forceVisible: forceMenu || void 0,
|
|
3014
3099
|
children: /* @__PURE__ */ jsx31(
|
|
3015
3100
|
Input3,
|
|
3016
3101
|
{
|
|
@@ -3019,6 +3104,7 @@ function InputVariables({
|
|
|
3019
3104
|
showLabel: false,
|
|
3020
3105
|
value,
|
|
3021
3106
|
onChange: (e) => handleSetValue(e.currentTarget.value),
|
|
3107
|
+
onPaste: onPasteHandler,
|
|
3022
3108
|
...inputProps
|
|
3023
3109
|
}
|
|
3024
3110
|
)
|
|
@@ -3087,24 +3173,6 @@ var variableValue = css20`
|
|
|
3087
3173
|
max-width: 20ch;
|
|
3088
3174
|
`;
|
|
3089
3175
|
|
|
3090
|
-
// src/components/Variables/variablesToList.ts
|
|
3091
|
-
function variablesToList(variables) {
|
|
3092
|
-
return Object.entries(variables || {}).sort(([aKey, a], [bKey, b]) => {
|
|
3093
|
-
var _a, _b;
|
|
3094
|
-
if (a.order && b.order) {
|
|
3095
|
-
return a.order - b.order;
|
|
3096
|
-
} else if (a.order) {
|
|
3097
|
-
return 1;
|
|
3098
|
-
} else if (b.order) {
|
|
3099
|
-
return -1;
|
|
3100
|
-
}
|
|
3101
|
-
return ((_a = a.displayName) != null ? _a : aKey).localeCompare((_b = b.displayName) != null ? _b : bKey);
|
|
3102
|
-
}).map(([name, definition]) => ({
|
|
3103
|
-
name,
|
|
3104
|
-
...definition
|
|
3105
|
-
}));
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3108
3176
|
// src/components/Variables/VariablesList.tsx
|
|
3109
3177
|
import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
|
|
3110
3178
|
function VariablesList() {
|
|
@@ -3216,7 +3284,7 @@ function DataResourceVariablesList({
|
|
|
3216
3284
|
const {
|
|
3217
3285
|
value,
|
|
3218
3286
|
metadata: { dataType }
|
|
3219
|
-
} = useMeshLocation("
|
|
3287
|
+
} = useMeshLocation("dataResource");
|
|
3220
3288
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
3221
3289
|
if (variableDefinitions.length === 0) {
|
|
3222
3290
|
if (NoVariablesComponent) {
|
|
@@ -3271,7 +3339,7 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
3271
3339
|
// src/components/Request/RequestBody.tsx
|
|
3272
3340
|
import { css as css23 } from "@emotion/react";
|
|
3273
3341
|
import { InputSelect as InputSelect4, JsonEditor } from "@uniformdev/design-system";
|
|
3274
|
-
import { useState as
|
|
3342
|
+
import { useState as useState9 } from "react";
|
|
3275
3343
|
|
|
3276
3344
|
// src/components/Request/RequestProvider.tsx
|
|
3277
3345
|
import * as React12 from "react";
|
|
@@ -3397,7 +3465,7 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
3397
3465
|
};
|
|
3398
3466
|
function RequestBody() {
|
|
3399
3467
|
const { request, dispatch } = useRequest();
|
|
3400
|
-
const [language, setLanguage] =
|
|
3468
|
+
const [language, setLanguage] = useState9("json");
|
|
3401
3469
|
return /* @__PURE__ */ jsxs21(
|
|
3402
3470
|
"div",
|
|
3403
3471
|
{
|
|
@@ -3525,7 +3593,8 @@ function RequestHeaders({ disableVariables }) {
|
|
|
3525
3593
|
{
|
|
3526
3594
|
value: header.value,
|
|
3527
3595
|
onChange: (value) => handleUpdateParamFromMenu({ key: header.key, value, index }),
|
|
3528
|
-
|
|
3596
|
+
disableVariables,
|
|
3597
|
+
showAddVariableMenuOption: true,
|
|
3529
3598
|
"data-test-id": "header-value"
|
|
3530
3599
|
}
|
|
3531
3600
|
) : null })
|
|
@@ -3633,12 +3702,9 @@ function RequestParameters({ disableVariables }) {
|
|
|
3633
3702
|
value: selectedVariable,
|
|
3634
3703
|
index
|
|
3635
3704
|
}),
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
index
|
|
3640
|
-
}),
|
|
3641
|
-
"data-test-id": "parameter-value"
|
|
3705
|
+
disableVariables,
|
|
3706
|
+
"data-test-id": "parameter-value",
|
|
3707
|
+
showAddVariableMenuOption: true
|
|
3642
3708
|
}
|
|
3643
3709
|
) : null })
|
|
3644
3710
|
] }, index);
|
|
@@ -3649,7 +3715,7 @@ function RequestParameters({ disableVariables }) {
|
|
|
3649
3715
|
|
|
3650
3716
|
// src/components/Request/RequestUrl.tsx
|
|
3651
3717
|
import { css as css24 } from "@emotion/react";
|
|
3652
|
-
import { useMemo as
|
|
3718
|
+
import { useMemo as useMemo7 } from "react";
|
|
3653
3719
|
|
|
3654
3720
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
3655
3721
|
function urlEncodeRequestUrl(url, varValues) {
|
|
@@ -3675,7 +3741,7 @@ function RequestUrl() {
|
|
|
3675
3741
|
var _a, _b;
|
|
3676
3742
|
const { variables } = useVariables();
|
|
3677
3743
|
const { request } = useRequest();
|
|
3678
|
-
const mergedParameters =
|
|
3744
|
+
const mergedParameters = useMemo7(() => {
|
|
3679
3745
|
var _a2;
|
|
3680
3746
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
3681
3747
|
return request.parameters;
|
|
@@ -3745,9 +3811,6 @@ function RequestUrlInput(props) {
|
|
|
3745
3811
|
onChange: (value) => {
|
|
3746
3812
|
dispatch({ type: "setRelativeUrl", relativeUrl: value });
|
|
3747
3813
|
},
|
|
3748
|
-
onVariableClick: (selectedValue) => {
|
|
3749
|
-
dispatch({ type: "setRelativeUrl", relativeUrl: request.relativeUrl.concat(selectedValue) });
|
|
3750
|
-
},
|
|
3751
3814
|
showAddVariableMenuOption: true
|
|
3752
3815
|
}
|
|
3753
3816
|
);
|
|
@@ -3900,12 +3963,12 @@ import { LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniform
|
|
|
3900
3963
|
|
|
3901
3964
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
3902
3965
|
import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
|
|
3903
|
-
import { useEffect as
|
|
3966
|
+
import { useEffect as useEffect8, useRef as useRef10, useState as useState10 } from "react";
|
|
3904
3967
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
3905
|
-
const [error, setError] =
|
|
3906
|
-
const [sdk, setSdk] =
|
|
3968
|
+
const [error, setError] = useState10();
|
|
3969
|
+
const [sdk, setSdk] = useState10();
|
|
3907
3970
|
const initializationInProgress = useRef10(false);
|
|
3908
|
-
|
|
3971
|
+
useEffect8(
|
|
3909
3972
|
() => {
|
|
3910
3973
|
if (typeof window === "undefined" || sdk) {
|
|
3911
3974
|
return;
|
|
@@ -4004,10 +4067,10 @@ var ObjectSearchContainer = ({
|
|
|
4004
4067
|
|
|
4005
4068
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
4006
4069
|
import { InputKeywordSearch as InputKeywordSearch2, InputSelect as InputSelect6 } from "@uniformdev/design-system";
|
|
4007
|
-
import { useState as
|
|
4070
|
+
import { useState as useState12 } from "react";
|
|
4008
4071
|
|
|
4009
4072
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
4010
|
-
import { createContext as createContext5, useCallback, useContext as useContext7, useDeferredValue, useState as
|
|
4073
|
+
import { createContext as createContext5, useCallback, useContext as useContext7, useDeferredValue, useState as useState11 } from "react";
|
|
4011
4074
|
import { jsx as jsx47 } from "@emotion/react/jsx-runtime";
|
|
4012
4075
|
var ObjectSearchContext = createContext5({
|
|
4013
4076
|
onSetQuery: () => {
|
|
@@ -4026,13 +4089,13 @@ var ObjectSearchContext = createContext5({
|
|
|
4026
4089
|
}
|
|
4027
4090
|
});
|
|
4028
4091
|
var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
4029
|
-
const [query, setQuery] =
|
|
4092
|
+
const [query, setQuery] = useState11({
|
|
4030
4093
|
contentType: "",
|
|
4031
4094
|
keyword: ""
|
|
4032
4095
|
});
|
|
4033
4096
|
const querySearchDeferred = useDeferredValue(query);
|
|
4034
|
-
const [selectedItems, setSelectedItems] =
|
|
4035
|
-
const [list, setList] =
|
|
4097
|
+
const [selectedItems, setSelectedItems] = useState11(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
4098
|
+
const [list, setList] = useState11({});
|
|
4036
4099
|
const onSetQuery = useCallback(
|
|
4037
4100
|
(value) => {
|
|
4038
4101
|
if (Array.isArray(value.contentType) && value.contentType.length > 0) {
|
|
@@ -4123,7 +4186,7 @@ var ObjectSearchFilter = ({
|
|
|
4123
4186
|
selectOptions
|
|
4124
4187
|
}) => {
|
|
4125
4188
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
4126
|
-
const [searchState, setSearchState] =
|
|
4189
|
+
const [searchState, setSearchState] = useState12({
|
|
4127
4190
|
contentType: "",
|
|
4128
4191
|
keyword: ""
|
|
4129
4192
|
});
|
|
@@ -4561,7 +4624,7 @@ var ObjectSearchResultList = ({
|
|
|
4561
4624
|
|
|
4562
4625
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
4563
4626
|
import { Input as Input7, InputKeywordSearch as InputKeywordSearch3, InputSelect as InputSelect7 } from "@uniformdev/design-system";
|
|
4564
|
-
import { useEffect as
|
|
4627
|
+
import { useEffect as useEffect9, useState as useState13 } from "react";
|
|
4565
4628
|
import { jsx as jsx54, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
|
|
4566
4629
|
var QueryFilter = ({
|
|
4567
4630
|
requireContentType,
|
|
@@ -4592,7 +4655,7 @@ var QueryFilter = ({
|
|
|
4592
4655
|
}) => {
|
|
4593
4656
|
var _a, _b;
|
|
4594
4657
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
4595
|
-
const [queryState, setQueryState] =
|
|
4658
|
+
const [queryState, setQueryState] = useState13({
|
|
4596
4659
|
contentType: "",
|
|
4597
4660
|
keyword: "",
|
|
4598
4661
|
count: countValue != null ? countValue : 5,
|
|
@@ -4603,7 +4666,7 @@ var QueryFilter = ({
|
|
|
4603
4666
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
4604
4667
|
onSetQuery({ ...query, ...value });
|
|
4605
4668
|
};
|
|
4606
|
-
|
|
4669
|
+
useEffect9(() => {
|
|
4607
4670
|
onSetQuery(queryState);
|
|
4608
4671
|
}, [onSetQuery, queryState]);
|
|
4609
4672
|
return /* @__PURE__ */ jsxs34("fieldset", { children: [
|
|
@@ -4687,12 +4750,6 @@ var QueryFilter = ({
|
|
|
4687
4750
|
] });
|
|
4688
4751
|
};
|
|
4689
4752
|
|
|
4690
|
-
// src/hooks/useUniformMeshLocation.ts
|
|
4691
|
-
function useUniformMeshLocation() {
|
|
4692
|
-
const { location } = useUniformMeshLocationContext();
|
|
4693
|
-
return location;
|
|
4694
|
-
}
|
|
4695
|
-
|
|
4696
4753
|
// src/hooks/index.ts
|
|
4697
4754
|
import { ParameterShellContext, useParameterShell } from "@uniformdev/design-system";
|
|
4698
4755
|
|
|
@@ -4715,7 +4772,6 @@ import {
|
|
|
4715
4772
|
InputKeywordSearch as InputKeywordSearch4,
|
|
4716
4773
|
InputSelect as InputSelect8,
|
|
4717
4774
|
InputToggle,
|
|
4718
|
-
InputKeywordSearch as InputKeywordSearch5,
|
|
4719
4775
|
Label,
|
|
4720
4776
|
LoadingIndicator as LoadingIndicator4,
|
|
4721
4777
|
LoadingOverlay as LoadingOverlay2,
|
|
@@ -4762,7 +4818,6 @@ export {
|
|
|
4762
4818
|
InputSelect8 as InputSelect,
|
|
4763
4819
|
InputToggle,
|
|
4764
4820
|
InputVariables,
|
|
4765
|
-
InputKeywordSearch5 as KeywordSearchInput,
|
|
4766
4821
|
Label,
|
|
4767
4822
|
LinkButton,
|
|
4768
4823
|
LoadingIndicator4 as LoadingIndicator,
|
|
@@ -4818,10 +4873,6 @@ export {
|
|
|
4818
4873
|
TextVariableRenderer,
|
|
4819
4874
|
Textarea,
|
|
4820
4875
|
Theme3 as Theme,
|
|
4821
|
-
UniformMeshLocationContext,
|
|
4822
|
-
UniformMeshLocationContextProvider,
|
|
4823
|
-
UniformMeshSdkContext,
|
|
4824
|
-
UniformMeshSdkContextProvider,
|
|
4825
4876
|
VariableEditor,
|
|
4826
4877
|
VariablesList,
|
|
4827
4878
|
VariablesProvider,
|
|
@@ -4890,7 +4941,6 @@ export {
|
|
|
4890
4941
|
selectedItemTitle,
|
|
4891
4942
|
urlEncodeRequestParameter,
|
|
4892
4943
|
urlEncodeRequestUrl,
|
|
4893
|
-
useInitializeUniformMeshSdk,
|
|
4894
4944
|
useMeshLocation,
|
|
4895
4945
|
useObjectSearchContext,
|
|
4896
4946
|
useParameterShell,
|
|
@@ -4899,10 +4949,7 @@ export {
|
|
|
4899
4949
|
useRequest,
|
|
4900
4950
|
useRequestHeader,
|
|
4901
4951
|
useRequestParameter,
|
|
4902
|
-
useUniformMeshLocation,
|
|
4903
|
-
useUniformMeshLocationContext,
|
|
4904
4952
|
useUniformMeshSdk,
|
|
4905
|
-
useUniformMeshSdkContext,
|
|
4906
4953
|
useVariables,
|
|
4907
4954
|
variablesToList
|
|
4908
4955
|
};
|