@uniformdev/mesh-sdk-react 19.3.0 → 19.6.0
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 +132 -55
- package/dist/index.esm.js +2048 -548
- package/dist/index.js +2047 -548
- package/dist/index.mjs +2048 -548
- package/package.json +6 -5
package/dist/index.esm.js
CHANGED
|
@@ -358,7 +358,7 @@ var SelectionField = ({
|
|
|
358
358
|
{
|
|
359
359
|
value: selectedValue,
|
|
360
360
|
loading,
|
|
361
|
-
text: (_a2 = values.find((
|
|
361
|
+
text: (_a2 = values.find((v2) => v2.id === selectedValue)) == null ? void 0 : _a2.name
|
|
362
362
|
}
|
|
363
363
|
) }),
|
|
364
364
|
/* @__PURE__ */ jsx16(
|
|
@@ -457,9 +457,9 @@ var ProductQuery = ({
|
|
|
457
457
|
];
|
|
458
458
|
}, [categoryOptions]);
|
|
459
459
|
const brandOptions = useMemo(() => {
|
|
460
|
-
return (brands == null ? void 0 : brands.map((
|
|
461
|
-
id:
|
|
462
|
-
name:
|
|
460
|
+
return (brands == null ? void 0 : brands.map((b2) => ({
|
|
461
|
+
id: b2.id.toString(),
|
|
462
|
+
name: b2.name
|
|
463
463
|
}))) || [];
|
|
464
464
|
}, [brands]);
|
|
465
465
|
const handleAddProductCategory = (category) => {
|
|
@@ -474,7 +474,7 @@ var ProductQuery = ({
|
|
|
474
474
|
const handleRemoveProductCategory = (category) => {
|
|
475
475
|
var _a2;
|
|
476
476
|
setFormState({
|
|
477
|
-
categories: (_a2 = value == null ? void 0 : value.categories) == null ? void 0 : _a2.filter((
|
|
477
|
+
categories: (_a2 = value == null ? void 0 : value.categories) == null ? void 0 : _a2.filter((c2) => c2 !== category)
|
|
478
478
|
});
|
|
479
479
|
};
|
|
480
480
|
const handleBrandChange = (e) => {
|
|
@@ -895,7 +895,7 @@ var ProductPreviewList = ({
|
|
|
895
895
|
children: products == null ? void 0 : products.map((product, index) => {
|
|
896
896
|
var _a;
|
|
897
897
|
const [category] = (product == null ? void 0 : product.categories) || [];
|
|
898
|
-
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((
|
|
898
|
+
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c2) => c2.id === category.id)) == null ? void 0 : _a.name;
|
|
899
899
|
return /* @__PURE__ */ jsx18("li", { css: productPreviewListItem, children: /* @__PURE__ */ jsxs7(
|
|
900
900
|
"div",
|
|
901
901
|
{
|
|
@@ -1796,7 +1796,7 @@ var EntrySearch = ({
|
|
|
1796
1796
|
ResolvedNoResultsComponent,
|
|
1797
1797
|
{
|
|
1798
1798
|
searchText: textInput || textInput,
|
|
1799
|
-
selectedContentType: (_b = (_a = contentTypes == null ? void 0 : contentTypes.find((
|
|
1799
|
+
selectedContentType: (_b = (_a = contentTypes == null ? void 0 : contentTypes.find((t2) => t2.id === contentTypeSelected)) == null ? void 0 : _a.name) != null ? _b : contentTypeSelected
|
|
1800
1800
|
}
|
|
1801
1801
|
),
|
|
1802
1802
|
!resultsLoading && typeof totalResults !== "undefined" && results && (results == null ? void 0 : results.length) < totalResults && /* @__PURE__ */ jsx21("button", { type: "button", css: entrySearchLoadMoreBtn, onClick: handleLoadMoreClick, children: !loadingMore ? "Load More" : /* @__PURE__ */ jsx21(LoadingIndicator, {}) })
|
|
@@ -1986,7 +1986,7 @@ function ProductSearchRow({
|
|
|
1986
1986
|
var _a;
|
|
1987
1987
|
const { categories, logoIcon } = useProductSearchContext();
|
|
1988
1988
|
const [category] = result.categories || [{ id: "", name: "" }];
|
|
1989
|
-
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((
|
|
1989
|
+
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c2) => c2.id === category.id)) == null ? void 0 : _a.name;
|
|
1990
1990
|
return /* @__PURE__ */ jsx22(
|
|
1991
1991
|
"div",
|
|
1992
1992
|
{
|
|
@@ -2121,7 +2121,7 @@ function ProductSelectedItem({
|
|
|
2121
2121
|
var _a;
|
|
2122
2122
|
const { categories, logoIcon } = useProductSearchContext();
|
|
2123
2123
|
const [category] = selectedItem.categories || [{ id: "", name: "" }];
|
|
2124
|
-
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((
|
|
2124
|
+
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c2) => c2.id === category.id)) == null ? void 0 : _a.name;
|
|
2125
2125
|
return /* @__PURE__ */ jsx23("div", { css: [productSelectedItemContainer], children: /* @__PURE__ */ jsxs12("article", { css: [productSelectedItemDetails], children: [
|
|
2126
2126
|
/* @__PURE__ */ jsxs12("div", { css: [productSelectedItemContent], children: [
|
|
2127
2127
|
selectedItem.thumbnailUrl ? /* @__PURE__ */ jsx23(
|
|
@@ -2267,7 +2267,7 @@ function ProductSearch({
|
|
|
2267
2267
|
} = useAsync(async () => {
|
|
2268
2268
|
return await onGetCategories();
|
|
2269
2269
|
}, [onGetCategories]);
|
|
2270
|
-
const categoryIds = categories == null ? void 0 : categories.map((
|
|
2270
|
+
const categoryIds = categories == null ? void 0 : categories.map((c2) => c2.id).join(",");
|
|
2271
2271
|
const categoryOptions = useMemo2(
|
|
2272
2272
|
() => {
|
|
2273
2273
|
if (!categories) {
|
|
@@ -2641,9 +2641,6 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2641
2641
|
] }) : null;
|
|
2642
2642
|
}
|
|
2643
2643
|
|
|
2644
|
-
// src/components/DataResourceVariablesList.tsx
|
|
2645
|
-
import { Callout as Callout4, Input as Input4 } from "@uniformdev/design-system";
|
|
2646
|
-
|
|
2647
2644
|
// src/hooks/useMeshLocation.ts
|
|
2648
2645
|
import { useMemo as useMemo4, useRef as useRef7 } from "react";
|
|
2649
2646
|
|
|
@@ -2724,52 +2721,22 @@ function useMeshLocation(expectedLocation) {
|
|
|
2724
2721
|
}
|
|
2725
2722
|
|
|
2726
2723
|
// src/components/Variables/InputVariables.tsx
|
|
2727
|
-
import { Input as Input3 } from "@uniformdev/design-system";
|
|
2724
|
+
import { Caption, ErrorMessage, InfoMessage, Input as Input3, WarningMessage } from "@uniformdev/design-system";
|
|
2728
2725
|
import * as React11 from "react";
|
|
2726
|
+
import { v4 as v42 } from "uuid";
|
|
2729
2727
|
|
|
2730
|
-
// src/components/Variables/
|
|
2731
|
-
|
|
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
|
-
|
|
2756
|
-
// src/components/Variables/InsertVariableMenu.tsx
|
|
2757
|
-
import { Icon as Icon5, Menu as Menu2, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
|
|
2728
|
+
// src/components/Variables/SelectVariableMenu.tsx
|
|
2729
|
+
import { Menu as Menu2, MenuItem as MenuItem2, MenuItemSeparator } from "@uniformdev/design-system";
|
|
2758
2730
|
import { useEffect as useEffect6, useRef as useRef8, useState as useState8 } from "react";
|
|
2731
|
+
import { CgUsbC } from "react-icons/cg";
|
|
2759
2732
|
|
|
2760
2733
|
// src/components/Variables/styles/InsertVariableMenu.styles.ts
|
|
2761
2734
|
import { css as css18 } from "@emotion/react";
|
|
2762
|
-
var menuContainer = css18`
|
|
2763
|
-
position: relative;
|
|
2764
|
-
`;
|
|
2765
2735
|
var menuBtn = css18`
|
|
2766
2736
|
background: none;
|
|
2767
2737
|
border: none;
|
|
2768
2738
|
color: var(--gray-300);
|
|
2769
2739
|
padding: 0;
|
|
2770
|
-
position: absolute;
|
|
2771
|
-
bottom: 25%;
|
|
2772
|
-
right: var(--spacing-sm);
|
|
2773
2740
|
`;
|
|
2774
2741
|
var menuItemTextGroup = css18`
|
|
2775
2742
|
align-items: flex-start;
|
|
@@ -2798,7 +2765,7 @@ import { Button as Button2, Callout as Callout3, Input as Input2, useShortcut }
|
|
|
2798
2765
|
import { useForm } from "react-hook-form";
|
|
2799
2766
|
import { z } from "zod";
|
|
2800
2767
|
|
|
2801
|
-
// src/components/Variables/
|
|
2768
|
+
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
2802
2769
|
import { css as css19 } from "@emotion/react";
|
|
2803
2770
|
var variablesFormContainer = css19`
|
|
2804
2771
|
> * {
|
|
@@ -2912,6 +2879,7 @@ function VariablesProvider({
|
|
|
2912
2879
|
const events = React10.useMemo(() => mitt(), []);
|
|
2913
2880
|
const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
2914
2881
|
const contextValue = {
|
|
2882
|
+
flatVariables: flattenVariables(value),
|
|
2915
2883
|
dispatch: (event) => {
|
|
2916
2884
|
if (event.type === "set") {
|
|
2917
2885
|
const { name, ...varValue } = event.variable;
|
|
@@ -2933,7 +2901,8 @@ function VariablesProvider({
|
|
|
2933
2901
|
},
|
|
2934
2902
|
variables: value,
|
|
2935
2903
|
isEditing: typeof editing !== "undefined",
|
|
2936
|
-
events
|
|
2904
|
+
events,
|
|
2905
|
+
canDispatch: true
|
|
2937
2906
|
};
|
|
2938
2907
|
return /* @__PURE__ */ jsxs17(VariablesContext.Provider, { value: contextValue, children: [
|
|
2939
2908
|
children,
|
|
@@ -2952,63 +2921,76 @@ function VariablesProvider({
|
|
|
2952
2921
|
) : null
|
|
2953
2922
|
] });
|
|
2954
2923
|
}
|
|
2955
|
-
function useVariables() {
|
|
2924
|
+
function useVariables(returnEmptyWithoutProvider = false) {
|
|
2956
2925
|
const context = React10.useContext(VariablesContext);
|
|
2957
2926
|
if (!context) {
|
|
2927
|
+
if (returnEmptyWithoutProvider) {
|
|
2928
|
+
return {
|
|
2929
|
+
flatVariables: {},
|
|
2930
|
+
dispatch: () => {
|
|
2931
|
+
throw new Error("No VariablesProvider present");
|
|
2932
|
+
},
|
|
2933
|
+
events: mitt(),
|
|
2934
|
+
isEditing: false,
|
|
2935
|
+
variables: {},
|
|
2936
|
+
canDispatch: false
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2958
2939
|
throw new Error("No VariablesProvider present");
|
|
2959
2940
|
}
|
|
2960
2941
|
return context;
|
|
2961
2942
|
}
|
|
2943
|
+
function flattenVariables(variables) {
|
|
2944
|
+
const flatVariables = {};
|
|
2945
|
+
Object.entries(variables).forEach(([key, value]) => {
|
|
2946
|
+
flatVariables[key] = value.default;
|
|
2947
|
+
});
|
|
2948
|
+
return flatVariables;
|
|
2949
|
+
}
|
|
2962
2950
|
|
|
2963
2951
|
// src/components/Variables/useOnVariableUpdated.ts
|
|
2964
|
-
function useOnVariableUpdated(
|
|
2952
|
+
function useOnVariableUpdated(fn2, disabled) {
|
|
2965
2953
|
const { variables, events } = useVariables();
|
|
2966
2954
|
useEffect5(() => {
|
|
2967
2955
|
if (disabled) {
|
|
2968
2956
|
return;
|
|
2969
2957
|
}
|
|
2970
|
-
events.on("update",
|
|
2971
|
-
return () => events.off("update",
|
|
2972
|
-
}, [disabled, events,
|
|
2958
|
+
events.on("update", fn2);
|
|
2959
|
+
return () => events.off("update", fn2);
|
|
2960
|
+
}, [disabled, events, fn2, variables]);
|
|
2973
2961
|
}
|
|
2974
2962
|
|
|
2975
2963
|
// src/components/Variables/variablesToList.ts
|
|
2976
2964
|
function variablesToList(variables) {
|
|
2977
|
-
return Object.entries(variables || {}).sort(([aKey,
|
|
2965
|
+
return Object.entries(variables || {}).sort(([aKey, a2], [bKey, b2]) => {
|
|
2978
2966
|
var _a, _b;
|
|
2979
|
-
if (
|
|
2980
|
-
return
|
|
2981
|
-
} else if (
|
|
2967
|
+
if (a2.order && b2.order) {
|
|
2968
|
+
return a2.order - b2.order;
|
|
2969
|
+
} else if (a2.order) {
|
|
2982
2970
|
return 1;
|
|
2983
|
-
} else if (
|
|
2971
|
+
} else if (b2.order) {
|
|
2984
2972
|
return -1;
|
|
2985
2973
|
}
|
|
2986
|
-
return ((_a =
|
|
2974
|
+
return ((_a = a2.displayName) != null ? _a : aKey).localeCompare((_b = b2.displayName) != null ? _b : bKey);
|
|
2987
2975
|
}).map(([name, definition]) => ({
|
|
2988
2976
|
name,
|
|
2989
2977
|
...definition
|
|
2990
2978
|
}));
|
|
2991
2979
|
}
|
|
2992
2980
|
|
|
2993
|
-
// src/components/Variables/
|
|
2981
|
+
// src/components/Variables/SelectVariableMenu.tsx
|
|
2994
2982
|
import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs18 } from "@emotion/react/jsx-runtime";
|
|
2995
|
-
var
|
|
2983
|
+
var SelectVariableMenu = ({
|
|
2996
2984
|
onSelectVariable,
|
|
2997
|
-
|
|
2998
|
-
textValue,
|
|
2999
|
-
trigger = "${",
|
|
2985
|
+
onResetVariables,
|
|
3000
2986
|
showAddVariableMenuOption = false,
|
|
3001
|
-
|
|
3002
|
-
|
|
2987
|
+
forceVisible,
|
|
2988
|
+
buttonCss,
|
|
2989
|
+
buttonProps,
|
|
2990
|
+
tip
|
|
3003
2991
|
}) => {
|
|
3004
|
-
const { variables, dispatch, isEditing } = useVariables();
|
|
2992
|
+
const { variables, dispatch, isEditing, canDispatch } = useVariables();
|
|
3005
2993
|
const btnRef = useRef8(null);
|
|
3006
|
-
const tip = `Tip: access this list by typing ${trigger}`;
|
|
3007
|
-
useEffect6(() => {
|
|
3008
|
-
if (textValue === trigger && btnRef.current && btnRef.current.getAttribute("aria-expanded") === "false") {
|
|
3009
|
-
btnRef.current.click();
|
|
3010
|
-
}
|
|
3011
|
-
}, [textValue, btnRef, trigger]);
|
|
3012
2994
|
const [openedAdd, setOpenedAdd] = useState8(false);
|
|
3013
2995
|
useOnVariableUpdated((varName) => {
|
|
3014
2996
|
onSelectVariable == null ? void 0 : onSelectVariable({ name: varName, default: "" });
|
|
@@ -3018,141 +3000,310 @@ var InsertVariableMenu = ({
|
|
|
3018
3000
|
setOpenedAdd(false);
|
|
3019
3001
|
}
|
|
3020
3002
|
}, [isEditing, openedAdd]);
|
|
3021
|
-
if (disabled) {
|
|
3022
|
-
return /* @__PURE__ */ jsx30(Fragment4, { children });
|
|
3023
|
-
}
|
|
3024
3003
|
const variablesList = variablesToList(variables);
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3004
|
+
const menuHasVariableOptions = Object.entries(variables).length || showAddVariableMenuOption;
|
|
3005
|
+
return /* @__PURE__ */ jsxs18(
|
|
3006
|
+
Menu2,
|
|
3007
|
+
{
|
|
3008
|
+
placement: "bottom-start",
|
|
3009
|
+
forceVisible,
|
|
3010
|
+
menuTrigger: /* @__PURE__ */ jsx30(
|
|
3011
|
+
"button",
|
|
3012
|
+
{
|
|
3013
|
+
title: "Insert variable",
|
|
3014
|
+
...buttonProps,
|
|
3015
|
+
ref: btnRef,
|
|
3016
|
+
css: [menuBtn, buttonCss],
|
|
3017
|
+
type: "button",
|
|
3018
|
+
children: /* @__PURE__ */ jsx30(CgUsbC, { size: "1.4rem" })
|
|
3019
|
+
}
|
|
3020
|
+
),
|
|
3021
|
+
menuLabel: "Insert variable",
|
|
3022
|
+
children: [
|
|
3023
|
+
variablesList.map((variable) => {
|
|
3024
|
+
const { name, helpText } = variable;
|
|
3025
|
+
return /* @__PURE__ */ jsxs18(
|
|
3026
|
+
MenuItem2,
|
|
3027
|
+
{
|
|
3028
|
+
id: name,
|
|
3029
|
+
css: menuItemTextGroup,
|
|
3030
|
+
onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
|
|
3031
|
+
children: [
|
|
3032
|
+
/* @__PURE__ */ jsx30("span", { children: name }),
|
|
3033
|
+
helpText ? /* @__PURE__ */ jsx30("small", { css: smallText, children: helpText }) : null
|
|
3034
|
+
]
|
|
3035
|
+
},
|
|
3036
|
+
name
|
|
3037
|
+
);
|
|
3038
|
+
}),
|
|
3039
|
+
showAddVariableMenuOption && canDispatch ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
3040
|
+
variablesList.length ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
3041
|
+
/* @__PURE__ */ jsx30(
|
|
3042
|
+
MenuItem2,
|
|
3043
|
+
{
|
|
3044
|
+
onClick: () => {
|
|
3045
|
+
setOpenedAdd(true);
|
|
3046
|
+
dispatch({ type: "edit", variable: "" });
|
|
3047
3047
|
},
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
},
|
|
3060
|
-
children: "Add Variable"
|
|
3061
|
-
}
|
|
3062
|
-
)
|
|
3063
|
-
] }) : null,
|
|
3064
|
-
Object.entries(variables).length || showAddVariableMenuOption ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
3065
|
-
/* @__PURE__ */ jsx30("i", { css: variablesTipText, children: tip })
|
|
3066
|
-
]
|
|
3067
|
-
}
|
|
3068
|
-
)
|
|
3069
|
-
] });
|
|
3048
|
+
children: "Add Variable"
|
|
3049
|
+
}
|
|
3050
|
+
)
|
|
3051
|
+
] }) : null,
|
|
3052
|
+
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
3053
|
+
onResetVariables ? /* @__PURE__ */ jsx30(MenuItem2, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
|
|
3054
|
+
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ jsx30(MenuItemSeparator, {}) : null,
|
|
3055
|
+
tip ? /* @__PURE__ */ jsx30("i", { css: variablesTipText, children: tip }) : null
|
|
3056
|
+
]
|
|
3057
|
+
}
|
|
3058
|
+
);
|
|
3070
3059
|
};
|
|
3071
3060
|
|
|
3061
|
+
// src/components/Variables/styles/InputVariables.styles.ts
|
|
3062
|
+
import { css as css20 } from "@emotion/react";
|
|
3063
|
+
var menuContainer = css20`
|
|
3064
|
+
position: relative;
|
|
3065
|
+
`;
|
|
3066
|
+
var menuBtn2 = css20`
|
|
3067
|
+
position: absolute;
|
|
3068
|
+
bottom: 25%;
|
|
3069
|
+
right: var(--spacing-sm);
|
|
3070
|
+
`;
|
|
3071
|
+
|
|
3072
|
+
// src/components/Variables/util/variableExpression.ts
|
|
3073
|
+
var variableExpression = /(?<!\\)\${([^}]+)}/g;
|
|
3074
|
+
var variablePrefix = "${";
|
|
3075
|
+
var variableSuffix = "}";
|
|
3076
|
+
|
|
3077
|
+
// src/components/Variables/util/getReferencedVariables.ts
|
|
3078
|
+
function getReferencedVariables(value) {
|
|
3079
|
+
const result = [];
|
|
3080
|
+
for (const match of value.matchAll(variableExpression)) {
|
|
3081
|
+
result.push(match[1]);
|
|
3082
|
+
}
|
|
3083
|
+
return result;
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3086
|
+
// src/components/Variables/util/insertVariableIntoText.ts
|
|
3087
|
+
function insertVariableIntoText({
|
|
3088
|
+
variableName: variableName2,
|
|
3089
|
+
value,
|
|
3090
|
+
selectionStart = null,
|
|
3091
|
+
selectionEnd = null
|
|
3092
|
+
}) {
|
|
3093
|
+
const variableExpression2 = `${variablePrefix}${variableName2}${variableSuffix}`;
|
|
3094
|
+
if (selectionStart !== null && selectionEnd !== null && selectionStart !== selectionEnd) {
|
|
3095
|
+
return `${value.substring(0, selectionStart)}${variableExpression2}${value.substring(selectionEnd)}`;
|
|
3096
|
+
}
|
|
3097
|
+
const hasCursorPosition = selectionStart !== null;
|
|
3098
|
+
let startOffset = 0;
|
|
3099
|
+
if (hasCursorPosition && value.substring(selectionStart - variablePrefix.length, selectionStart) === variablePrefix) {
|
|
3100
|
+
startOffset = variablePrefix.length;
|
|
3101
|
+
}
|
|
3102
|
+
if (hasCursorPosition) {
|
|
3103
|
+
return `${value.substring(0, selectionStart - startOffset)}${variableExpression2}${value.substring(
|
|
3104
|
+
selectionStart
|
|
3105
|
+
)}`;
|
|
3106
|
+
}
|
|
3107
|
+
return `${value}${variableExpression2}`;
|
|
3108
|
+
}
|
|
3109
|
+
|
|
3110
|
+
// src/components/Variables/styles/VariableField.styles.ts
|
|
3111
|
+
import { css as css21 } from "@emotion/react";
|
|
3112
|
+
var labelText = css21`
|
|
3113
|
+
align-items: center;
|
|
3114
|
+
display: flex;
|
|
3115
|
+
gap: var(--spacing-xs);
|
|
3116
|
+
font-weight: var(--fw-regular);
|
|
3117
|
+
margin: 0 0 var(--spacing-xs);
|
|
3118
|
+
`;
|
|
3119
|
+
var variableBindButton = css21`
|
|
3120
|
+
align-items: center;
|
|
3121
|
+
border: none;
|
|
3122
|
+
border-radius: var(--rounded-base);
|
|
3123
|
+
background: none;
|
|
3124
|
+
display: flex;
|
|
3125
|
+
height: 1.2rem;
|
|
3126
|
+
padding: var(--spacing-2xs);
|
|
3127
|
+
transition: background var(--duration-fast) var(--timing-ease-out),
|
|
3128
|
+
color var(--duration-fast) var(--timing-ease-out);
|
|
3129
|
+
width: 1.2rem;
|
|
3130
|
+
|
|
3131
|
+
&:hover,
|
|
3132
|
+
&[aria-pressed='true']:not(:disabled) {
|
|
3133
|
+
background: var(--brand-secondary-3);
|
|
3134
|
+
color: var(--white);
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
&[aria-disabled='true'] {
|
|
3138
|
+
background: none;
|
|
3139
|
+
color: currentColor;
|
|
3140
|
+
}
|
|
3141
|
+
`;
|
|
3142
|
+
|
|
3143
|
+
// src/components/Variables/VariableField.tsx
|
|
3144
|
+
import { jsx as jsx31, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
|
|
3145
|
+
function VariableField({
|
|
3146
|
+
label,
|
|
3147
|
+
selectVariableMenuOptions,
|
|
3148
|
+
children,
|
|
3149
|
+
id,
|
|
3150
|
+
isActive,
|
|
3151
|
+
disableVariables
|
|
3152
|
+
}) {
|
|
3153
|
+
const { variables } = useVariables(true);
|
|
3154
|
+
const varCount = Object.keys(variables).length;
|
|
3155
|
+
const variableSelector = varCount > 0 && (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.onSelectVariable) && !disableVariables ? /* @__PURE__ */ jsx31(
|
|
3156
|
+
SelectVariableMenu,
|
|
3157
|
+
{
|
|
3158
|
+
...selectVariableMenuOptions,
|
|
3159
|
+
buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
|
|
3160
|
+
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
3161
|
+
}
|
|
3162
|
+
) : null;
|
|
3163
|
+
return /* @__PURE__ */ jsxs19("div", { children: [
|
|
3164
|
+
/* @__PURE__ */ jsxs19("label", { htmlFor: id, css: labelText, children: [
|
|
3165
|
+
variableSelector,
|
|
3166
|
+
/* @__PURE__ */ jsx31("span", { children: label })
|
|
3167
|
+
] }),
|
|
3168
|
+
children
|
|
3169
|
+
] });
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3072
3172
|
// src/components/Variables/InputVariables.tsx
|
|
3073
|
-
import { jsx as
|
|
3173
|
+
import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs20 } from "@emotion/react/jsx-runtime";
|
|
3074
3174
|
function InputVariables({
|
|
3175
|
+
id,
|
|
3075
3176
|
"aria-label": ariaLabel,
|
|
3177
|
+
label,
|
|
3076
3178
|
value,
|
|
3077
3179
|
disableVariables,
|
|
3180
|
+
disableReset,
|
|
3181
|
+
disableInlineMenu,
|
|
3078
3182
|
onChange,
|
|
3079
3183
|
onPaste,
|
|
3080
3184
|
showAddVariableMenuOption,
|
|
3081
|
-
|
|
3082
|
-
|
|
3185
|
+
inputWhenNoVariables,
|
|
3186
|
+
caption,
|
|
3187
|
+
errorMessage,
|
|
3188
|
+
warningMessage,
|
|
3189
|
+
infoMessage,
|
|
3083
3190
|
...inputProps
|
|
3084
3191
|
}) {
|
|
3085
3192
|
var _a, _b;
|
|
3086
|
-
const { variables
|
|
3087
|
-
const currentVariables = React11.useRef(variables);
|
|
3088
|
-
const currentDispatch = React11.useRef(dispatch);
|
|
3089
|
-
const currentSetValue = React11.useRef(onChange);
|
|
3193
|
+
const { variables } = useVariables(true);
|
|
3090
3194
|
const inputRef = React11.useRef(null);
|
|
3091
|
-
React11.
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
});
|
|
3195
|
+
const [finalId] = React11.useState(id != null ? id : () => v42());
|
|
3196
|
+
const onPasteHandler = (e) => {
|
|
3197
|
+
var _a2, _b2, _c;
|
|
3198
|
+
if (!onPaste) {
|
|
3199
|
+
return;
|
|
3200
|
+
}
|
|
3201
|
+
const pastedValue = (_a2 = e.clipboardData) == null ? void 0 : _a2.getData("text/plain");
|
|
3202
|
+
if (!pastedValue || !e.currentTarget) {
|
|
3203
|
+
return;
|
|
3204
|
+
}
|
|
3205
|
+
const selectionStart = (_b2 = e.currentTarget.selectionStart) != null ? _b2 : 0;
|
|
3206
|
+
const selectionEnd = (_c = e.currentTarget.selectionEnd) != null ? _c : 0;
|
|
3207
|
+
const newValue = e.currentTarget.value.substring(0, selectionStart) + pastedValue + e.currentTarget.value.substring(selectionEnd);
|
|
3208
|
+
onPaste(newValue);
|
|
3209
|
+
e.preventDefault();
|
|
3107
3210
|
};
|
|
3211
|
+
const currentCursor = (_b = (_a = inputRef.current) == null ? void 0 : _a.selectionStart) != null ? _b : value.length;
|
|
3212
|
+
const forceMenu = value.substring(currentCursor - 2, currentCursor) === variablePrefix;
|
|
3213
|
+
const hasVariablesInValue = getReferencedVariables(value).length > 0;
|
|
3214
|
+
const [hadVariablesInValue, setHadVariablesInValue] = React11.useState(hasVariablesInValue);
|
|
3215
|
+
React11.useEffect(() => {
|
|
3216
|
+
if (hasVariablesInValue) {
|
|
3217
|
+
setHadVariablesInValue(true);
|
|
3218
|
+
}
|
|
3219
|
+
}, [hasVariablesInValue]);
|
|
3220
|
+
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
3221
|
+
const disableInlineVariablesForReals = disableVariablesForReals || disableInlineMenu;
|
|
3108
3222
|
const handleInsertVariable = (variable) => {
|
|
3109
3223
|
var _a2, _b2;
|
|
3224
|
+
const baseValue = inputWhenNoVariables && !hasVariablesInValue ? "" : value;
|
|
3110
3225
|
handleSetValue(
|
|
3111
3226
|
insertVariableIntoText({
|
|
3112
3227
|
variableName: variable.name,
|
|
3113
|
-
value,
|
|
3114
|
-
variablePrefix,
|
|
3115
|
-
variableSuffix,
|
|
3228
|
+
value: baseValue,
|
|
3116
3229
|
selectionEnd: (_a2 = inputRef.current) == null ? void 0 : _a2.selectionEnd,
|
|
3117
3230
|
selectionStart: (_b2 = inputRef.current) == null ? void 0 : _b2.selectionStart
|
|
3118
3231
|
})
|
|
3119
3232
|
);
|
|
3120
3233
|
};
|
|
3121
3234
|
const handleSetValue = (rawValue) => {
|
|
3122
|
-
|
|
3235
|
+
onChange(rawValue);
|
|
3123
3236
|
};
|
|
3124
|
-
const
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3237
|
+
const sharedMenuProps = {
|
|
3238
|
+
onSelectVariable: handleInsertVariable,
|
|
3239
|
+
showAddVariableMenuOption,
|
|
3240
|
+
onResetVariables: hadVariablesInValue && !disableReset ? () => {
|
|
3241
|
+
handleSetValue("");
|
|
3242
|
+
setHadVariablesInValue(false);
|
|
3243
|
+
} : void 0
|
|
3244
|
+
};
|
|
3245
|
+
const input = /* @__PURE__ */ jsxs20("div", { children: [
|
|
3246
|
+
inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx32(
|
|
3247
|
+
InputVariablesShell,
|
|
3248
|
+
{
|
|
3249
|
+
...sharedMenuProps,
|
|
3250
|
+
disabled: disableInlineVariablesForReals,
|
|
3251
|
+
forceVisible: forceMenu || void 0,
|
|
3252
|
+
children: /* @__PURE__ */ jsx32(
|
|
3253
|
+
Input3,
|
|
3254
|
+
{
|
|
3255
|
+
id: finalId,
|
|
3256
|
+
ref: inputRef,
|
|
3257
|
+
label: ariaLabel,
|
|
3258
|
+
showLabel: false,
|
|
3259
|
+
value,
|
|
3260
|
+
onChange: (e) => handleSetValue(e.currentTarget.value),
|
|
3261
|
+
onPaste: onPasteHandler,
|
|
3262
|
+
...inputProps
|
|
3263
|
+
}
|
|
3264
|
+
)
|
|
3265
|
+
}
|
|
3266
|
+
),
|
|
3267
|
+
caption ? /* @__PURE__ */ jsx32(Caption, { children: caption }) : null,
|
|
3268
|
+
errorMessage ? /* @__PURE__ */ jsx32(ErrorMessage, { message: errorMessage }) : null,
|
|
3269
|
+
warningMessage ? /* @__PURE__ */ jsx32(WarningMessage, { message: warningMessage }) : null,
|
|
3270
|
+
infoMessage ? /* @__PURE__ */ jsx32(InfoMessage, { message: infoMessage }) : null
|
|
3271
|
+
] });
|
|
3272
|
+
if (label) {
|
|
3273
|
+
return /* @__PURE__ */ jsx32(
|
|
3274
|
+
VariableField,
|
|
3275
|
+
{
|
|
3276
|
+
label,
|
|
3277
|
+
selectVariableMenuOptions: sharedMenuProps,
|
|
3278
|
+
id: finalId,
|
|
3279
|
+
isActive: hadVariablesInValue,
|
|
3280
|
+
disableVariables: disableVariablesForReals,
|
|
3281
|
+
children: input
|
|
3282
|
+
}
|
|
3283
|
+
);
|
|
3284
|
+
}
|
|
3285
|
+
return input;
|
|
3286
|
+
}
|
|
3287
|
+
function InputVariablesShell({
|
|
3288
|
+
children,
|
|
3289
|
+
disabled,
|
|
3290
|
+
...props
|
|
3291
|
+
}) {
|
|
3292
|
+
if (disabled) {
|
|
3293
|
+
return /* @__PURE__ */ jsx32(Fragment5, { children });
|
|
3294
|
+
}
|
|
3295
|
+
return /* @__PURE__ */ jsxs20("div", { css: menuContainer, children: [
|
|
3296
|
+
children,
|
|
3297
|
+
/* @__PURE__ */ jsx32(SelectVariableMenu, { ...props, tip: "Tip: access this list by typing ${", buttonCss: menuBtn2 })
|
|
3298
|
+
] });
|
|
3148
3299
|
}
|
|
3149
3300
|
|
|
3150
3301
|
// src/components/Variables/VariablesList.tsx
|
|
3151
|
-
import { css as
|
|
3302
|
+
import { css as css23 } from "@emotion/react";
|
|
3152
3303
|
import {
|
|
3153
3304
|
AddListButton,
|
|
3154
3305
|
button,
|
|
3155
|
-
Icon as
|
|
3306
|
+
Icon as Icon5,
|
|
3156
3307
|
Table,
|
|
3157
3308
|
TableBody,
|
|
3158
3309
|
TableCellData,
|
|
@@ -3163,8 +3314,8 @@ import {
|
|
|
3163
3314
|
import { DragDropContext as DragDropContext2, Draggable as Draggable2, Droppable as Droppable2 } from "react-beautiful-dnd";
|
|
3164
3315
|
|
|
3165
3316
|
// src/components/Variables/styles/VariablesList.styles.ts
|
|
3166
|
-
import { css as
|
|
3167
|
-
var tableRow = (isDragging) =>
|
|
3317
|
+
import { css as css22 } from "@emotion/react";
|
|
3318
|
+
var tableRow = (isDragging) => css22`
|
|
3168
3319
|
position: relative;
|
|
3169
3320
|
${isDragging ? `
|
|
3170
3321
|
display: table;
|
|
@@ -3172,7 +3323,7 @@ var tableRow = (isDragging) => css20`
|
|
|
3172
3323
|
top: auto !important;
|
|
3173
3324
|
` : void 0}
|
|
3174
3325
|
`;
|
|
3175
|
-
var tableCellDragIcon =
|
|
3326
|
+
var tableCellDragIcon = css22`
|
|
3176
3327
|
&::after {
|
|
3177
3328
|
content: '';
|
|
3178
3329
|
display: block;
|
|
@@ -3190,7 +3341,7 @@ var tableCellDragIcon = css20`
|
|
|
3190
3341
|
opacity: 1;
|
|
3191
3342
|
}
|
|
3192
3343
|
`;
|
|
3193
|
-
var variableName =
|
|
3344
|
+
var variableName = css22`
|
|
3194
3345
|
border: none;
|
|
3195
3346
|
color: var(--brand-secondary-5);
|
|
3196
3347
|
font-weight: var(--fw-medium);
|
|
@@ -3201,7 +3352,7 @@ var variableName = css20`
|
|
|
3201
3352
|
white-space: nowrap;
|
|
3202
3353
|
max-width: 20ch;
|
|
3203
3354
|
`;
|
|
3204
|
-
var variableValue =
|
|
3355
|
+
var variableValue = css22`
|
|
3205
3356
|
overflow: hidden;
|
|
3206
3357
|
text-overflow: ellipsis;
|
|
3207
3358
|
white-space: nowrap;
|
|
@@ -3209,7 +3360,7 @@ var variableValue = css20`
|
|
|
3209
3360
|
`;
|
|
3210
3361
|
|
|
3211
3362
|
// src/components/Variables/VariablesList.tsx
|
|
3212
|
-
import { Fragment as
|
|
3363
|
+
import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
|
|
3213
3364
|
function VariablesList() {
|
|
3214
3365
|
const { variables, dispatch } = useVariables();
|
|
3215
3366
|
const sorted = variablesToList(variables);
|
|
@@ -3230,23 +3381,23 @@ function VariablesList() {
|
|
|
3230
3381
|
return result;
|
|
3231
3382
|
}
|
|
3232
3383
|
};
|
|
3233
|
-
return /* @__PURE__ */
|
|
3234
|
-
/* @__PURE__ */
|
|
3235
|
-
/* @__PURE__ */
|
|
3236
|
-
/* @__PURE__ */
|
|
3237
|
-
/* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3384
|
+
return /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
3385
|
+
/* @__PURE__ */ jsx33(DragDropContext2, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx33(Droppable2, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ jsxs21(Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
3386
|
+
/* @__PURE__ */ jsx33(TableHead, { children: /* @__PURE__ */ jsxs21(TableRow, { children: [
|
|
3387
|
+
/* @__PURE__ */ jsx33(TableCellHead, { children: "Name" }),
|
|
3388
|
+
/* @__PURE__ */ jsx33(TableCellHead, { children: "Default Value" }),
|
|
3389
|
+
/* @__PURE__ */ jsx33(TableCellHead, {})
|
|
3239
3390
|
] }) }),
|
|
3240
|
-
/* @__PURE__ */
|
|
3391
|
+
/* @__PURE__ */ jsxs21(TableBody, { children: [
|
|
3241
3392
|
sorted.map(({ name, displayName, default: defaultValue }, index) => {
|
|
3242
3393
|
const text = displayName != null ? displayName : name;
|
|
3243
|
-
return /* @__PURE__ */
|
|
3394
|
+
return /* @__PURE__ */ jsx33(
|
|
3244
3395
|
Draggable2,
|
|
3245
3396
|
{
|
|
3246
3397
|
draggableId: name,
|
|
3247
3398
|
index,
|
|
3248
3399
|
isDragDisabled: sorted.length === 1,
|
|
3249
|
-
children: (provided2, snapshot) => /* @__PURE__ */
|
|
3400
|
+
children: (provided2, snapshot) => /* @__PURE__ */ jsxs21(
|
|
3250
3401
|
TableRow,
|
|
3251
3402
|
{
|
|
3252
3403
|
ref: provided2.innerRef,
|
|
@@ -3256,7 +3407,7 @@ function VariablesList() {
|
|
|
3256
3407
|
css: tableRow(snapshot.isDragging),
|
|
3257
3408
|
"data-dragging": snapshot.isDragging,
|
|
3258
3409
|
children: [
|
|
3259
|
-
/* @__PURE__ */
|
|
3410
|
+
/* @__PURE__ */ jsx33(TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: /* @__PURE__ */ jsx33(
|
|
3260
3411
|
"button",
|
|
3261
3412
|
{
|
|
3262
3413
|
css: variableName,
|
|
@@ -3269,21 +3420,21 @@ function VariablesList() {
|
|
|
3269
3420
|
children: text
|
|
3270
3421
|
}
|
|
3271
3422
|
) }),
|
|
3272
|
-
/* @__PURE__ */
|
|
3273
|
-
/* @__PURE__ */
|
|
3423
|
+
/* @__PURE__ */ jsx33(TableCellData, { children: /* @__PURE__ */ jsx33("span", { css: variableValue, title: defaultValue, children: defaultValue }) }),
|
|
3424
|
+
/* @__PURE__ */ jsx33(TableCellData, { align: "right", children: /* @__PURE__ */ jsx33(
|
|
3274
3425
|
"button",
|
|
3275
3426
|
{
|
|
3276
3427
|
type: "button",
|
|
3277
3428
|
title: `delete ${text}`,
|
|
3278
3429
|
css: [
|
|
3279
3430
|
button,
|
|
3280
|
-
|
|
3431
|
+
css23`
|
|
3281
3432
|
background: transparent;
|
|
3282
3433
|
`
|
|
3283
3434
|
],
|
|
3284
3435
|
"aria-controls": text,
|
|
3285
3436
|
onClick: () => dispatch({ type: "remove", variable: name }),
|
|
3286
|
-
children: /* @__PURE__ */
|
|
3437
|
+
children: /* @__PURE__ */ jsx33(Icon5, { icon: "trash", iconColor: "red" })
|
|
3287
3438
|
}
|
|
3288
3439
|
) })
|
|
3289
3440
|
]
|
|
@@ -3296,7 +3447,7 @@ function VariablesList() {
|
|
|
3296
3447
|
provided.placeholder
|
|
3297
3448
|
] })
|
|
3298
3449
|
] }) }) }),
|
|
3299
|
-
/* @__PURE__ */
|
|
3450
|
+
/* @__PURE__ */ jsx33(
|
|
3300
3451
|
AddListButton,
|
|
3301
3452
|
{
|
|
3302
3453
|
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
@@ -3309,28 +3460,90 @@ function VariablesList() {
|
|
|
3309
3460
|
] });
|
|
3310
3461
|
}
|
|
3311
3462
|
|
|
3312
|
-
// src/components/
|
|
3313
|
-
import { jsx as
|
|
3314
|
-
function
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3463
|
+
// src/components/DataResourceDynamicInputProvider.tsx
|
|
3464
|
+
import { jsx as jsx34 } from "@emotion/react/jsx-runtime";
|
|
3465
|
+
function DataResourceDynamicInputProvider({
|
|
3466
|
+
children,
|
|
3467
|
+
dynamicInputs
|
|
3468
|
+
}) {
|
|
3469
|
+
if (dynamicInputs) {
|
|
3470
|
+
return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderRenderer, { dynamicInputs, children });
|
|
3471
|
+
}
|
|
3472
|
+
return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderContextShim, { children });
|
|
3473
|
+
}
|
|
3474
|
+
function DataResourceDynamicInputProviderContextShim(props) {
|
|
3475
|
+
const {
|
|
3476
|
+
metadata: { dynamicInputs }
|
|
3477
|
+
} = useMeshLocation("dataResource");
|
|
3478
|
+
return /* @__PURE__ */ jsx34(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
|
|
3479
|
+
}
|
|
3480
|
+
function DataResourceDynamicInputProviderRenderer({
|
|
3481
|
+
children,
|
|
3482
|
+
dynamicInputs
|
|
3318
3483
|
}) {
|
|
3484
|
+
return /* @__PURE__ */ jsx34(
|
|
3485
|
+
VariablesProvider,
|
|
3486
|
+
{
|
|
3487
|
+
value: convertDynamicInputsToVariables(dynamicInputs),
|
|
3488
|
+
onChange: () => {
|
|
3489
|
+
throw new Error("Cannot change dynamic inputs. Make sure that add variable is disabled.");
|
|
3490
|
+
},
|
|
3491
|
+
editVariableComponent: () => /* @__PURE__ */ jsx34("span", { children: "Cannot edit dynamic inputs." }),
|
|
3492
|
+
children
|
|
3493
|
+
}
|
|
3494
|
+
);
|
|
3495
|
+
}
|
|
3496
|
+
function convertDynamicInputsToVariables(dynamicInputs) {
|
|
3497
|
+
return Object.entries(dynamicInputs).reduce(
|
|
3498
|
+
(acc, [name, input]) => {
|
|
3499
|
+
acc[name] = {
|
|
3500
|
+
type: input.type,
|
|
3501
|
+
default: input.value,
|
|
3502
|
+
helpText: `${input.value}, from ${input.type === "path" ? "URL path" : "query string"}`
|
|
3503
|
+
};
|
|
3504
|
+
return acc;
|
|
3505
|
+
},
|
|
3506
|
+
{}
|
|
3507
|
+
);
|
|
3508
|
+
}
|
|
3509
|
+
|
|
3510
|
+
// src/components/DataResourceVariablesList.tsx
|
|
3511
|
+
import { Callout as Callout4 } from "@uniformdev/design-system";
|
|
3512
|
+
import { jsx as jsx35 } from "@emotion/react/jsx-runtime";
|
|
3513
|
+
function DataResourceVariablesList(props) {
|
|
3319
3514
|
const {
|
|
3320
3515
|
value,
|
|
3321
|
-
metadata: { dataType }
|
|
3516
|
+
metadata: { dataType, dynamicInputs }
|
|
3322
3517
|
} = useMeshLocation("dataResource");
|
|
3518
|
+
return /* @__PURE__ */ jsx35(
|
|
3519
|
+
DataResourceVariablesListExplicit,
|
|
3520
|
+
{
|
|
3521
|
+
...props,
|
|
3522
|
+
value,
|
|
3523
|
+
dataType,
|
|
3524
|
+
dynamicInputs
|
|
3525
|
+
}
|
|
3526
|
+
);
|
|
3527
|
+
}
|
|
3528
|
+
function DataResourceVariablesListExplicit({
|
|
3529
|
+
setVariables,
|
|
3530
|
+
noVariables: NoVariablesComponent,
|
|
3531
|
+
typeRenderers,
|
|
3532
|
+
dataType,
|
|
3533
|
+
dynamicInputs,
|
|
3534
|
+
value
|
|
3535
|
+
}) {
|
|
3323
3536
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
3324
3537
|
if (variableDefinitions.length === 0) {
|
|
3325
3538
|
if (NoVariablesComponent) {
|
|
3326
|
-
return /* @__PURE__ */
|
|
3539
|
+
return /* @__PURE__ */ jsx35(NoVariablesComponent, {});
|
|
3327
3540
|
}
|
|
3328
|
-
return /* @__PURE__ */
|
|
3541
|
+
return /* @__PURE__ */ jsx35(Callout4, { type: "note", children: "No settings are required." });
|
|
3329
3542
|
}
|
|
3330
|
-
return /* @__PURE__ */
|
|
3543
|
+
return /* @__PURE__ */ jsx35(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx35("div", { children: variableDefinitions.map((variableDefinition) => {
|
|
3331
3544
|
var _a, _b, _c;
|
|
3332
3545
|
const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
|
|
3333
|
-
return /* @__PURE__ */
|
|
3546
|
+
return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
|
|
3334
3547
|
VariableRenderer,
|
|
3335
3548
|
{
|
|
3336
3549
|
definition: variableDefinition,
|
|
@@ -3349,36 +3562,29 @@ function DataResourceVariablesList({
|
|
|
3349
3562
|
}
|
|
3350
3563
|
}
|
|
3351
3564
|
) }, variableDefinition.name);
|
|
3352
|
-
}) });
|
|
3565
|
+
}) }) });
|
|
3353
3566
|
}
|
|
3354
3567
|
function TextVariableRenderer({ definition, value, setValue }) {
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
}
|
|
3366
|
-
),
|
|
3367
|
-
definition.default !== "" ? /* @__PURE__ */ jsxs20("small", { children: [
|
|
3368
|
-
"Default value: ",
|
|
3369
|
-
definition.default
|
|
3370
|
-
] }) : null
|
|
3371
|
-
] });
|
|
3568
|
+
var _a;
|
|
3569
|
+
return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
|
|
3570
|
+
InputVariables,
|
|
3571
|
+
{
|
|
3572
|
+
label: definition.displayName || definition.name,
|
|
3573
|
+
value: value != null ? value : "",
|
|
3574
|
+
caption: (_a = definition.helpText) != null ? _a : definition.default !== "" ? `Default value: ${definition.default}` : void 0,
|
|
3575
|
+
onChange: setValue
|
|
3576
|
+
}
|
|
3577
|
+
) });
|
|
3372
3578
|
}
|
|
3373
3579
|
|
|
3374
3580
|
// src/components/Request/RequestBody.tsx
|
|
3375
|
-
import { css as
|
|
3581
|
+
import { css as css25 } from "@emotion/react";
|
|
3376
3582
|
import { InputSelect as InputSelect4, JsonEditor } from "@uniformdev/design-system";
|
|
3377
|
-
import { useState as
|
|
3583
|
+
import { useState as useState10 } from "react";
|
|
3378
3584
|
|
|
3379
3585
|
// src/components/Request/RequestProvider.tsx
|
|
3380
3586
|
import * as React12 from "react";
|
|
3381
|
-
import { jsx as
|
|
3587
|
+
import { jsx as jsx36 } from "@emotion/react/jsx-runtime";
|
|
3382
3588
|
var RequestContext = React12.createContext(null);
|
|
3383
3589
|
function RequestProvider({ value, onChange, children }) {
|
|
3384
3590
|
const contextValue = React12.useMemo(() => {
|
|
@@ -3447,7 +3653,7 @@ function RequestProvider({ value, onChange, children }) {
|
|
|
3447
3653
|
request: value
|
|
3448
3654
|
};
|
|
3449
3655
|
}, [onChange, value]);
|
|
3450
|
-
return /* @__PURE__ */
|
|
3656
|
+
return /* @__PURE__ */ jsx36(RequestContext.Provider, { value: contextValue, children });
|
|
3451
3657
|
}
|
|
3452
3658
|
function useRequest() {
|
|
3453
3659
|
const context = React12.useContext(RequestContext);
|
|
@@ -3458,11 +3664,11 @@ function useRequest() {
|
|
|
3458
3664
|
}
|
|
3459
3665
|
|
|
3460
3666
|
// src/components/Request/styles/Request.styles.ts
|
|
3461
|
-
import { css as
|
|
3462
|
-
var innerContentStyles =
|
|
3667
|
+
import { css as css24 } from "@emotion/react";
|
|
3668
|
+
var innerContentStyles = css24`
|
|
3463
3669
|
background: var(--white);
|
|
3464
3670
|
`;
|
|
3465
|
-
var requestTypeContainer = (bgColor) =>
|
|
3671
|
+
var requestTypeContainer = (bgColor) => css24`
|
|
3466
3672
|
align-items: start;
|
|
3467
3673
|
background: ${bgColor};
|
|
3468
3674
|
display: grid;
|
|
@@ -3471,17 +3677,17 @@ var requestTypeContainer = (bgColor) => css22`
|
|
|
3471
3677
|
`;
|
|
3472
3678
|
|
|
3473
3679
|
// src/components/Request/RequestTypeContainer.tsx
|
|
3474
|
-
import { jsx as
|
|
3680
|
+
import { jsx as jsx37 } from "@emotion/react/jsx-runtime";
|
|
3475
3681
|
var RequestTypeContainer = ({
|
|
3476
3682
|
bgColor = "transparent",
|
|
3477
3683
|
children,
|
|
3478
3684
|
...props
|
|
3479
3685
|
}) => {
|
|
3480
|
-
return /* @__PURE__ */
|
|
3686
|
+
return /* @__PURE__ */ jsx37("div", { css: requestTypeContainer(bgColor), ...props, children });
|
|
3481
3687
|
};
|
|
3482
3688
|
|
|
3483
3689
|
// src/components/Request/RequestBody.tsx
|
|
3484
|
-
import { jsx as
|
|
3690
|
+
import { jsx as jsx38, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
|
|
3485
3691
|
var LANGUAGE_OPTIONS = [
|
|
3486
3692
|
{ label: "Text", value: "plaintext" },
|
|
3487
3693
|
{ label: "JSON", value: "json" },
|
|
@@ -3500,22 +3706,22 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
3500
3706
|
};
|
|
3501
3707
|
function RequestBody() {
|
|
3502
3708
|
const { request, dispatch } = useRequest();
|
|
3503
|
-
const [language, setLanguage] =
|
|
3504
|
-
return /* @__PURE__ */
|
|
3709
|
+
const [language, setLanguage] = useState10("json");
|
|
3710
|
+
return /* @__PURE__ */ jsxs22(
|
|
3505
3711
|
"div",
|
|
3506
3712
|
{
|
|
3507
|
-
css:
|
|
3713
|
+
css: css25`
|
|
3508
3714
|
background: var(--white);
|
|
3509
3715
|
`,
|
|
3510
3716
|
children: [
|
|
3511
|
-
/* @__PURE__ */
|
|
3717
|
+
/* @__PURE__ */ jsx38(
|
|
3512
3718
|
RequestTypeContainer,
|
|
3513
3719
|
{
|
|
3514
3720
|
bgColor: "var(--gray-100)",
|
|
3515
|
-
css:
|
|
3721
|
+
css: css25`
|
|
3516
3722
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
3517
3723
|
`,
|
|
3518
|
-
children: /* @__PURE__ */
|
|
3724
|
+
children: /* @__PURE__ */ jsx38(
|
|
3519
3725
|
InputSelect4,
|
|
3520
3726
|
{
|
|
3521
3727
|
label: "Language",
|
|
@@ -3538,7 +3744,7 @@ function RequestBody() {
|
|
|
3538
3744
|
)
|
|
3539
3745
|
}
|
|
3540
3746
|
),
|
|
3541
|
-
/* @__PURE__ */
|
|
3747
|
+
/* @__PURE__ */ jsx38(
|
|
3542
3748
|
JsonEditor,
|
|
3543
3749
|
{
|
|
3544
3750
|
height: 200,
|
|
@@ -3557,16 +3763,16 @@ function RequestBody() {
|
|
|
3557
3763
|
|
|
3558
3764
|
// src/components/Request/RequestHeaders.tsx
|
|
3559
3765
|
import {
|
|
3560
|
-
Input as
|
|
3766
|
+
Input as Input4,
|
|
3561
3767
|
Table as Table2,
|
|
3562
3768
|
TableBody as TableBody2,
|
|
3563
3769
|
TableCellData as TableCellData2,
|
|
3564
3770
|
TableCellHead as TableCellHead2,
|
|
3565
3771
|
TableHead as TableHead2,
|
|
3566
3772
|
TableRow as TableRow2,
|
|
3567
|
-
WarningMessage
|
|
3773
|
+
WarningMessage as WarningMessage2
|
|
3568
3774
|
} from "@uniformdev/design-system";
|
|
3569
|
-
import { jsx as
|
|
3775
|
+
import { jsx as jsx39, jsxs as jsxs23 } from "@emotion/react/jsx-runtime";
|
|
3570
3776
|
function RequestHeaders({ disableVariables }) {
|
|
3571
3777
|
var _a, _b;
|
|
3572
3778
|
const { dispatch, request } = useRequest();
|
|
@@ -3582,29 +3788,29 @@ function RequestHeaders({ disableVariables }) {
|
|
|
3582
3788
|
index
|
|
3583
3789
|
});
|
|
3584
3790
|
};
|
|
3585
|
-
return /* @__PURE__ */
|
|
3586
|
-
/* @__PURE__ */
|
|
3587
|
-
/* @__PURE__ */
|
|
3588
|
-
/* @__PURE__ */
|
|
3791
|
+
return /* @__PURE__ */ jsx39("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs23(Table2, { children: [
|
|
3792
|
+
/* @__PURE__ */ jsx39(TableHead2, { children: /* @__PURE__ */ jsxs23(TableRow2, { children: [
|
|
3793
|
+
/* @__PURE__ */ jsx39(TableCellHead2, { children: "Name" }),
|
|
3794
|
+
/* @__PURE__ */ jsx39(TableCellHead2, { children: "Value" })
|
|
3589
3795
|
] }) }),
|
|
3590
|
-
/* @__PURE__ */
|
|
3796
|
+
/* @__PURE__ */ jsxs23(TableBody2, { children: [
|
|
3591
3797
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
|
|
3592
|
-
return /* @__PURE__ */
|
|
3593
|
-
/* @__PURE__ */
|
|
3798
|
+
return /* @__PURE__ */ jsxs23(TableRow2, { children: [
|
|
3799
|
+
/* @__PURE__ */ jsxs23(TableCellData2, { width: "50%", children: [
|
|
3594
3800
|
baseHeader.key,
|
|
3595
|
-
/* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
3801
|
+
/* @__PURE__ */ jsx39("br", {}),
|
|
3802
|
+
/* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx39("small", { children: "from data source" }) })
|
|
3597
3803
|
] }),
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
/* @__PURE__ */
|
|
3600
|
-
request.headers.find((
|
|
3804
|
+
/* @__PURE__ */ jsxs23(TableCellData2, { width: "50%", children: [
|
|
3805
|
+
/* @__PURE__ */ jsx39("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
|
|
3806
|
+
request.headers.find((p2) => p2.key === baseHeader.key) ? /* @__PURE__ */ jsx39(WarningMessage2, { message: "overridden below" }) : null
|
|
3601
3807
|
] })
|
|
3602
3808
|
] }, baseHeader.key);
|
|
3603
3809
|
}),
|
|
3604
3810
|
deezHeaders.map((header, index) => {
|
|
3605
|
-
return /* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3607
|
-
|
|
3811
|
+
return /* @__PURE__ */ jsxs23(TableRow2, { children: [
|
|
3812
|
+
/* @__PURE__ */ jsx39(TableCellData2, { width: "50%", children: /* @__PURE__ */ jsx39(
|
|
3813
|
+
Input4,
|
|
3608
3814
|
{
|
|
3609
3815
|
label: header.key,
|
|
3610
3816
|
value: header.key,
|
|
@@ -3623,7 +3829,7 @@ function RequestHeaders({ disableVariables }) {
|
|
|
3623
3829
|
"data-test-id": "header-key"
|
|
3624
3830
|
}
|
|
3625
3831
|
) }),
|
|
3626
|
-
/* @__PURE__ */
|
|
3832
|
+
/* @__PURE__ */ jsx39(TableCellData2, { width: "50%", children: header.key ? /* @__PURE__ */ jsx39(
|
|
3627
3833
|
InputVariables,
|
|
3628
3834
|
{
|
|
3629
3835
|
value: header.value,
|
|
@@ -3641,11 +3847,11 @@ function RequestHeaders({ disableVariables }) {
|
|
|
3641
3847
|
|
|
3642
3848
|
// src/components/Request/RequestMethodSelect.tsx
|
|
3643
3849
|
import { InputSelect as InputSelect5 } from "@uniformdev/design-system";
|
|
3644
|
-
import { jsx as
|
|
3850
|
+
import { jsx as jsx40 } from "@emotion/react/jsx-runtime";
|
|
3645
3851
|
function RequestMethodSelect(props) {
|
|
3646
3852
|
var _a;
|
|
3647
3853
|
const { request, dispatch } = useRequest();
|
|
3648
|
-
return /* @__PURE__ */
|
|
3854
|
+
return /* @__PURE__ */ jsx40(
|
|
3649
3855
|
InputSelect5,
|
|
3650
3856
|
{
|
|
3651
3857
|
...props,
|
|
@@ -3662,16 +3868,16 @@ function RequestMethodSelect(props) {
|
|
|
3662
3868
|
|
|
3663
3869
|
// src/components/Request/RequestParameters.tsx
|
|
3664
3870
|
import {
|
|
3665
|
-
Input as
|
|
3871
|
+
Input as Input5,
|
|
3666
3872
|
Table as Table3,
|
|
3667
3873
|
TableBody as TableBody3,
|
|
3668
3874
|
TableCellData as TableCellData3,
|
|
3669
3875
|
TableCellHead as TableCellHead3,
|
|
3670
3876
|
TableHead as TableHead3,
|
|
3671
3877
|
TableRow as TableRow3,
|
|
3672
|
-
WarningMessage as
|
|
3878
|
+
WarningMessage as WarningMessage3
|
|
3673
3879
|
} from "@uniformdev/design-system";
|
|
3674
|
-
import { jsx as
|
|
3880
|
+
import { jsx as jsx41, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
|
|
3675
3881
|
function RequestParameters({ disableVariables }) {
|
|
3676
3882
|
var _a, _b;
|
|
3677
3883
|
const { dispatch, request } = useRequest();
|
|
@@ -3687,29 +3893,29 @@ function RequestParameters({ disableVariables }) {
|
|
|
3687
3893
|
index
|
|
3688
3894
|
});
|
|
3689
3895
|
};
|
|
3690
|
-
return /* @__PURE__ */
|
|
3691
|
-
/* @__PURE__ */
|
|
3692
|
-
/* @__PURE__ */
|
|
3693
|
-
/* @__PURE__ */
|
|
3896
|
+
return /* @__PURE__ */ jsx41("div", { css: innerContentStyles, children: /* @__PURE__ */ jsxs24(Table3, { children: [
|
|
3897
|
+
/* @__PURE__ */ jsx41(TableHead3, { children: /* @__PURE__ */ jsxs24(TableRow3, { children: [
|
|
3898
|
+
/* @__PURE__ */ jsx41(TableCellHead3, { children: "Name" }),
|
|
3899
|
+
/* @__PURE__ */ jsx41(TableCellHead3, { children: "Value" })
|
|
3694
3900
|
] }) }),
|
|
3695
|
-
/* @__PURE__ */
|
|
3901
|
+
/* @__PURE__ */ jsxs24(TableBody3, { children: [
|
|
3696
3902
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
|
|
3697
|
-
return /* @__PURE__ */
|
|
3698
|
-
/* @__PURE__ */
|
|
3903
|
+
return /* @__PURE__ */ jsxs24(TableRow3, { children: [
|
|
3904
|
+
/* @__PURE__ */ jsxs24(TableCellData3, { width: "50%", children: [
|
|
3699
3905
|
baseParameter.key,
|
|
3700
|
-
/* @__PURE__ */
|
|
3701
|
-
/* @__PURE__ */
|
|
3906
|
+
/* @__PURE__ */ jsx41("br", {}),
|
|
3907
|
+
/* @__PURE__ */ jsx41("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ jsx41("small", { children: "from data source" }) })
|
|
3702
3908
|
] }),
|
|
3703
|
-
/* @__PURE__ */
|
|
3704
|
-
/* @__PURE__ */
|
|
3705
|
-
request.parameters.find((
|
|
3909
|
+
/* @__PURE__ */ jsxs24(TableCellData3, { width: "50%", children: [
|
|
3910
|
+
/* @__PURE__ */ jsx41("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
|
|
3911
|
+
request.parameters.find((p2) => p2.key === baseParameter.key) ? /* @__PURE__ */ jsx41(WarningMessage3, { message: "overridden below" }) : null
|
|
3706
3912
|
] })
|
|
3707
3913
|
] }, baseParameter.key);
|
|
3708
3914
|
}),
|
|
3709
3915
|
deezParameters.map((parameter, index) => {
|
|
3710
|
-
return /* @__PURE__ */
|
|
3711
|
-
/* @__PURE__ */
|
|
3712
|
-
|
|
3916
|
+
return /* @__PURE__ */ jsxs24(TableRow3, { children: [
|
|
3917
|
+
/* @__PURE__ */ jsx41(TableCellData3, { width: "50%", children: /* @__PURE__ */ jsx41(
|
|
3918
|
+
Input5,
|
|
3713
3919
|
{
|
|
3714
3920
|
label: parameter.key,
|
|
3715
3921
|
value: parameter.key,
|
|
@@ -3728,7 +3934,7 @@ function RequestParameters({ disableVariables }) {
|
|
|
3728
3934
|
"data-test-id": "parameter-key"
|
|
3729
3935
|
}
|
|
3730
3936
|
) }),
|
|
3731
|
-
/* @__PURE__ */
|
|
3937
|
+
/* @__PURE__ */ jsx41(TableCellData3, { width: "50%", children: parameter.key ? /* @__PURE__ */ jsx41(
|
|
3732
3938
|
InputVariables,
|
|
3733
3939
|
{
|
|
3734
3940
|
value: parameter.value,
|
|
@@ -3749,7 +3955,7 @@ function RequestParameters({ disableVariables }) {
|
|
|
3749
3955
|
}
|
|
3750
3956
|
|
|
3751
3957
|
// src/components/Request/RequestUrl.tsx
|
|
3752
|
-
import { css as
|
|
3958
|
+
import { css as css26 } from "@emotion/react";
|
|
3753
3959
|
import { useMemo as useMemo7 } from "react";
|
|
3754
3960
|
|
|
3755
3961
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
@@ -3771,7 +3977,7 @@ function decodeVariablesInUrlEncodedString(string, varValues) {
|
|
|
3771
3977
|
}
|
|
3772
3978
|
|
|
3773
3979
|
// src/components/Request/RequestUrl.tsx
|
|
3774
|
-
import { Fragment as
|
|
3980
|
+
import { Fragment as Fragment7, jsx as jsx42, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
|
|
3775
3981
|
function RequestUrl() {
|
|
3776
3982
|
var _a, _b;
|
|
3777
3983
|
const { variables } = useVariables();
|
|
@@ -3781,25 +3987,25 @@ function RequestUrl() {
|
|
|
3781
3987
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
3782
3988
|
return request.parameters;
|
|
3783
3989
|
}
|
|
3784
|
-
return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((
|
|
3990
|
+
return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p2) => p2.key === baseParam.key)).concat(request.parameters);
|
|
3785
3991
|
}, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
|
|
3786
|
-
return /* @__PURE__ */
|
|
3992
|
+
return /* @__PURE__ */ jsxs25(
|
|
3787
3993
|
"small",
|
|
3788
3994
|
{
|
|
3789
|
-
css:
|
|
3995
|
+
css: css26`
|
|
3790
3996
|
display: inline-block;
|
|
3791
3997
|
margin-bottom: var(--spacing-xs);
|
|
3792
3998
|
word-break: break-word;
|
|
3793
3999
|
`,
|
|
3794
4000
|
children: [
|
|
3795
|
-
request.baseRequest ? /* @__PURE__ */
|
|
3796
|
-
/* @__PURE__ */
|
|
4001
|
+
request.baseRequest ? /* @__PURE__ */ jsx42("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
|
|
4002
|
+
/* @__PURE__ */ jsxs25("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
|
|
3797
4003
|
urlEncodeRequestUrl(request.relativeUrl, variables),
|
|
3798
|
-
mergedParameters.length > 0 ? /* @__PURE__ */
|
|
4004
|
+
mergedParameters.length > 0 ? /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
3799
4005
|
"?",
|
|
3800
4006
|
mergedParameters.map((param, index) => {
|
|
3801
4007
|
const encoded = urlEncodeRequestParameter(param, variables);
|
|
3802
|
-
return /* @__PURE__ */
|
|
4008
|
+
return /* @__PURE__ */ jsxs25("span", { children: [
|
|
3803
4009
|
index > 0 ? "&" : null,
|
|
3804
4010
|
encoded.key,
|
|
3805
4011
|
"=",
|
|
@@ -3813,40 +4019,48 @@ function RequestUrl() {
|
|
|
3813
4019
|
);
|
|
3814
4020
|
}
|
|
3815
4021
|
|
|
4022
|
+
// src/components/Request/util/handlePastedUrl.ts
|
|
4023
|
+
function handlePastedUrl(value, currentRequest, dispatch) {
|
|
4024
|
+
var _a, _b, _c;
|
|
4025
|
+
const indexOfQueryString = value.indexOf("?");
|
|
4026
|
+
const hasQueryString = indexOfQueryString >= 0;
|
|
4027
|
+
let relativeUrl = hasQueryString ? value.substring(0, indexOfQueryString) : value;
|
|
4028
|
+
if (((_a = currentRequest.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = currentRequest.baseRequest) == null ? void 0 : _b.baseUrl)) {
|
|
4029
|
+
relativeUrl = relativeUrl.substring((_c = currentRequest.baseRequest) == null ? void 0 : _c.baseUrl.length);
|
|
4030
|
+
}
|
|
4031
|
+
dispatch({ type: "setRelativeUrl", relativeUrl });
|
|
4032
|
+
if (hasQueryString) {
|
|
4033
|
+
for (let index = currentRequest.parameters.length - 1; index >= 0; index--) {
|
|
4034
|
+
dispatch({ type: "removeParameter", index });
|
|
4035
|
+
}
|
|
4036
|
+
try {
|
|
4037
|
+
const query = new URLSearchParams(value.substring(indexOfQueryString));
|
|
4038
|
+
query.forEach((value2, key) => {
|
|
4039
|
+
dispatch({ type: "updateParameter", parameter: { key, value: value2 } });
|
|
4040
|
+
});
|
|
4041
|
+
} catch (e) {
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
|
|
3816
4046
|
// src/components/Request/RequestUrlInput.tsx
|
|
3817
|
-
import { jsx as
|
|
4047
|
+
import { jsx as jsx43 } from "@emotion/react/jsx-runtime";
|
|
3818
4048
|
function RequestUrlInput(props) {
|
|
3819
4049
|
const { request, dispatch } = useRequest();
|
|
3820
|
-
return /* @__PURE__ */
|
|
4050
|
+
return /* @__PURE__ */ jsx43(
|
|
3821
4051
|
InputVariables,
|
|
3822
4052
|
{
|
|
4053
|
+
disableReset: true,
|
|
3823
4054
|
...props,
|
|
3824
4055
|
value: request.relativeUrl,
|
|
3825
4056
|
onPaste: (value) => {
|
|
3826
|
-
|
|
3827
|
-
const indexOfQueryString = value.indexOf("?");
|
|
3828
|
-
if (indexOfQueryString >= 0) {
|
|
3829
|
-
let relativeUrl = value.substring(0, indexOfQueryString);
|
|
3830
|
-
if (((_a = request.baseRequest) == null ? void 0 : _a.baseUrl) && relativeUrl.startsWith((_b = request.baseRequest) == null ? void 0 : _b.baseUrl)) {
|
|
3831
|
-
relativeUrl = relativeUrl.substring((_c = request.baseRequest) == null ? void 0 : _c.baseUrl.length);
|
|
3832
|
-
}
|
|
3833
|
-
dispatch({ type: "setRelativeUrl", relativeUrl });
|
|
3834
|
-
for (let index = request.parameters.length - 1; index >= 0; index--) {
|
|
3835
|
-
dispatch({ type: "removeParameter", index });
|
|
3836
|
-
}
|
|
3837
|
-
try {
|
|
3838
|
-
const query = new URLSearchParams(value.substring(indexOfQueryString));
|
|
3839
|
-
query.forEach((value2, key) => {
|
|
3840
|
-
dispatch({ type: "updateParameter", parameter: { key, value: value2 } });
|
|
3841
|
-
});
|
|
3842
|
-
} catch (e) {
|
|
3843
|
-
}
|
|
3844
|
-
}
|
|
4057
|
+
handlePastedUrl(value, request, dispatch);
|
|
3845
4058
|
},
|
|
3846
4059
|
onChange: (value) => {
|
|
3847
4060
|
dispatch({ type: "setRelativeUrl", relativeUrl: value });
|
|
3848
4061
|
},
|
|
3849
|
-
showAddVariableMenuOption: true
|
|
4062
|
+
showAddVariableMenuOption: true,
|
|
4063
|
+
"data-test-id": "field-url"
|
|
3850
4064
|
}
|
|
3851
4065
|
);
|
|
3852
4066
|
}
|
|
@@ -3855,7 +4069,7 @@ function RequestUrlInput(props) {
|
|
|
3855
4069
|
function useRequestHeader(headerName) {
|
|
3856
4070
|
var _a, _b;
|
|
3857
4071
|
const { request, dispatch } = useRequest();
|
|
3858
|
-
const headerIndex = request.headers.findIndex((
|
|
4072
|
+
const headerIndex = request.headers.findIndex((f2) => f2.key === headerName);
|
|
3859
4073
|
return {
|
|
3860
4074
|
value: (_b = (_a = request.headers[headerIndex]) == null ? void 0 : _a.value) != null ? _b : "",
|
|
3861
4075
|
update: (value) => {
|
|
@@ -3872,7 +4086,7 @@ function useRequestHeader(headerName) {
|
|
|
3872
4086
|
function useRequestParameter(paramName) {
|
|
3873
4087
|
var _a, _b;
|
|
3874
4088
|
const { request, dispatch } = useRequest();
|
|
3875
|
-
const paramIndex = request.parameters.findIndex((
|
|
4089
|
+
const paramIndex = request.parameters.findIndex((f2) => f2.key === paramName);
|
|
3876
4090
|
return {
|
|
3877
4091
|
value: (_b = (_a = request.parameters[paramIndex]) == null ? void 0 : _a.value) != null ? _b : "",
|
|
3878
4092
|
update: (value) => {
|
|
@@ -3886,18 +4100,18 @@ function useRequestParameter(paramName) {
|
|
|
3886
4100
|
}
|
|
3887
4101
|
|
|
3888
4102
|
// src/components/DataSourceEditor.tsx
|
|
3889
|
-
import { jsx as
|
|
4103
|
+
import { jsx as jsx44 } from "@emotion/react/jsx-runtime";
|
|
3890
4104
|
function DataSourceEditor({ onChange, children, editVariableComponent }) {
|
|
3891
4105
|
var _a;
|
|
3892
4106
|
const { value } = useMeshLocation("dataSource");
|
|
3893
4107
|
const currentRequestValue = convertDataSourceToRequestData(value);
|
|
3894
|
-
return /* @__PURE__ */
|
|
4108
|
+
return /* @__PURE__ */ jsx44(
|
|
3895
4109
|
VariablesProvider,
|
|
3896
4110
|
{
|
|
3897
4111
|
value: (_a = value.variables) != null ? _a : {},
|
|
3898
4112
|
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
3899
4113
|
editVariableComponent,
|
|
3900
|
-
children: /* @__PURE__ */
|
|
4114
|
+
children: /* @__PURE__ */ jsx44(
|
|
3901
4115
|
RequestProvider,
|
|
3902
4116
|
{
|
|
3903
4117
|
value: currentRequestValue,
|
|
@@ -3934,7 +4148,7 @@ function convertRequestDataToDataSource(dataSource, requestData) {
|
|
|
3934
4148
|
}
|
|
3935
4149
|
|
|
3936
4150
|
// src/components/DataTypeEditor.tsx
|
|
3937
|
-
import { jsx as
|
|
4151
|
+
import { jsx as jsx45 } from "@emotion/react/jsx-runtime";
|
|
3938
4152
|
function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
3939
4153
|
var _a;
|
|
3940
4154
|
const {
|
|
@@ -3942,13 +4156,13 @@ function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
|
3942
4156
|
metadata: { dataSource }
|
|
3943
4157
|
} = useMeshLocation("dataType");
|
|
3944
4158
|
const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
|
|
3945
|
-
return /* @__PURE__ */
|
|
4159
|
+
return /* @__PURE__ */ jsx45(
|
|
3946
4160
|
VariablesProvider,
|
|
3947
4161
|
{
|
|
3948
4162
|
value: (_a = value.variables) != null ? _a : {},
|
|
3949
4163
|
onChange: (newValue) => onChange((prev) => ({ newValue: { ...prev, variables: newValue } })),
|
|
3950
4164
|
editVariableComponent,
|
|
3951
|
-
children: /* @__PURE__ */
|
|
4165
|
+
children: /* @__PURE__ */ jsx45(
|
|
3952
4166
|
RequestProvider,
|
|
3953
4167
|
{
|
|
3954
4168
|
value: currentRequestValue,
|
|
@@ -3998,10 +4212,10 @@ import { LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniform
|
|
|
3998
4212
|
|
|
3999
4213
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
4000
4214
|
import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
|
|
4001
|
-
import { useEffect as useEffect8, useRef as useRef10, useState as
|
|
4215
|
+
import { useEffect as useEffect8, useRef as useRef10, useState as useState11 } from "react";
|
|
4002
4216
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
4003
|
-
const [error, setError] =
|
|
4004
|
-
const [sdk, setSdk] =
|
|
4217
|
+
const [error, setError] = useState11();
|
|
4218
|
+
const [sdk, setSdk] = useState11();
|
|
4005
4219
|
const initializationInProgress = useRef10(false);
|
|
4006
4220
|
useEffect8(
|
|
4007
4221
|
() => {
|
|
@@ -4036,7 +4250,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
4036
4250
|
};
|
|
4037
4251
|
|
|
4038
4252
|
// src/components/MeshApp.tsx
|
|
4039
|
-
import { jsx as
|
|
4253
|
+
import { jsx as jsx46, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
|
|
4040
4254
|
var MeshApp = ({
|
|
4041
4255
|
children,
|
|
4042
4256
|
loadingComponent,
|
|
@@ -4045,36 +4259,36 @@ var MeshApp = ({
|
|
|
4045
4259
|
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
4046
4260
|
if (initializing || !sdk) {
|
|
4047
4261
|
const LoadingComponent = loadingComponent;
|
|
4048
|
-
return LoadingComponent ? /* @__PURE__ */
|
|
4262
|
+
return LoadingComponent ? /* @__PURE__ */ jsx46(LoadingComponent, {}) : /* @__PURE__ */ jsx46(LoadingIndicator2, {});
|
|
4049
4263
|
}
|
|
4050
4264
|
if (error) {
|
|
4051
4265
|
const ErrorComponent = errorComponent;
|
|
4052
4266
|
if (ErrorComponent) {
|
|
4053
|
-
return /* @__PURE__ */
|
|
4267
|
+
return /* @__PURE__ */ jsx46(ErrorComponent, { error });
|
|
4054
4268
|
}
|
|
4055
4269
|
throw error;
|
|
4056
4270
|
}
|
|
4057
|
-
return /* @__PURE__ */
|
|
4058
|
-
/* @__PURE__ */
|
|
4059
|
-
/* @__PURE__ */
|
|
4271
|
+
return /* @__PURE__ */ jsxs26(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
|
|
4272
|
+
/* @__PURE__ */ jsx46(Theme2, {}),
|
|
4273
|
+
/* @__PURE__ */ jsx46(UniformMeshLocationContextProvider, { children })
|
|
4060
4274
|
] });
|
|
4061
4275
|
};
|
|
4062
4276
|
|
|
4063
4277
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
4064
|
-
import { css as
|
|
4278
|
+
import { css as css27 } from "@emotion/react";
|
|
4065
4279
|
import { Button as Button3, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
|
|
4066
|
-
import { jsx as
|
|
4280
|
+
import { jsx as jsx47, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
|
|
4067
4281
|
var DataRefreshButton = ({
|
|
4068
4282
|
buttonText,
|
|
4069
4283
|
isLoading,
|
|
4070
4284
|
onRefreshData,
|
|
4071
4285
|
...props
|
|
4072
4286
|
}) => {
|
|
4073
|
-
return /* @__PURE__ */
|
|
4074
|
-
!isLoading ? null : /* @__PURE__ */
|
|
4287
|
+
return /* @__PURE__ */ jsxs27(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
4288
|
+
!isLoading ? null : /* @__PURE__ */ jsx47(
|
|
4075
4289
|
LoadingIndicator3,
|
|
4076
4290
|
{
|
|
4077
|
-
css:
|
|
4291
|
+
css: css27`
|
|
4078
4292
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
4079
4293
|
`
|
|
4080
4294
|
}
|
|
@@ -4083,39 +4297,1179 @@ var DataRefreshButton = ({
|
|
|
4083
4297
|
] });
|
|
4084
4298
|
};
|
|
4085
4299
|
|
|
4086
|
-
//
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
var
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4300
|
+
// ../context/dist/api/api.mjs
|
|
4301
|
+
var __defProp2 = Object.defineProperty;
|
|
4302
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4303
|
+
var __publicField = (obj, key, value) => {
|
|
4304
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4305
|
+
return value;
|
|
4306
|
+
};
|
|
4307
|
+
var __accessCheck = (obj, member, msg) => {
|
|
4308
|
+
if (!member.has(obj))
|
|
4309
|
+
throw TypeError("Cannot " + msg);
|
|
4310
|
+
};
|
|
4311
|
+
var __privateGet = (obj, member, getter) => {
|
|
4312
|
+
__accessCheck(obj, member, "read from private field");
|
|
4313
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
4314
|
+
};
|
|
4315
|
+
var __privateAdd = (obj, member, value) => {
|
|
4316
|
+
if (member.has(obj))
|
|
4317
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
4318
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
4319
|
+
};
|
|
4320
|
+
var nullLimitPolicy = async (func) => await func();
|
|
4321
|
+
var ApiClientError = class extends Error {
|
|
4322
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
4323
|
+
super(
|
|
4324
|
+
`${errorMessage}
|
|
4325
|
+
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
4326
|
+
);
|
|
4327
|
+
this.errorMessage = errorMessage;
|
|
4328
|
+
this.fetchMethod = fetchMethod;
|
|
4329
|
+
this.fetchUri = fetchUri;
|
|
4330
|
+
this.statusCode = statusCode;
|
|
4331
|
+
this.statusText = statusText;
|
|
4332
|
+
this.requestId = requestId;
|
|
4333
|
+
Object.setPrototypeOf(this, ApiClientError.prototype);
|
|
4334
|
+
}
|
|
4335
|
+
};
|
|
4336
|
+
var ApiClient = class {
|
|
4337
|
+
constructor(options) {
|
|
4338
|
+
__publicField(this, "options");
|
|
4339
|
+
var _a, _b, _c, _d, _e;
|
|
4340
|
+
if (!options.apiKey && !options.bearerToken) {
|
|
4341
|
+
throw new Error("You must provide an API key or a bearer token");
|
|
4342
|
+
}
|
|
4343
|
+
let leFetch = options.fetch;
|
|
4344
|
+
if (!leFetch) {
|
|
4345
|
+
if (typeof window !== "undefined") {
|
|
4346
|
+
leFetch = window.fetch.bind(window);
|
|
4347
|
+
} else if (typeof fetch !== "undefined") {
|
|
4348
|
+
leFetch = fetch;
|
|
4349
|
+
} else {
|
|
4350
|
+
throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
|
|
4351
|
+
}
|
|
4352
|
+
}
|
|
4353
|
+
this.options = {
|
|
4354
|
+
...options,
|
|
4355
|
+
fetch: leFetch,
|
|
4356
|
+
apiHost: this.ensureApiHost(options.apiHost),
|
|
4357
|
+
apiKey: (_a = options.apiKey) != null ? _a : null,
|
|
4358
|
+
projectId: (_b = options.projectId) != null ? _b : null,
|
|
4359
|
+
bearerToken: (_c = options.bearerToken) != null ? _c : null,
|
|
4360
|
+
limitPolicy: (_d = options.limitPolicy) != null ? _d : nullLimitPolicy,
|
|
4361
|
+
bypassCache: (_e = options.bypassCache) != null ? _e : false
|
|
4362
|
+
};
|
|
4363
|
+
}
|
|
4364
|
+
async apiClient(fetchUri, options) {
|
|
4365
|
+
return this.options.limitPolicy(async () => {
|
|
4366
|
+
var _a;
|
|
4367
|
+
const coreHeaders = this.options.apiKey ? {
|
|
4368
|
+
"x-api-key": this.options.apiKey
|
|
4369
|
+
} : {
|
|
4370
|
+
Authorization: `Bearer ${this.options.bearerToken}`
|
|
4371
|
+
};
|
|
4372
|
+
if (this.options.bypassCache) {
|
|
4373
|
+
coreHeaders["x-bypass-cache"] = "true";
|
|
4374
|
+
}
|
|
4375
|
+
const callApi = () => this.options.fetch(fetchUri.toString(), {
|
|
4376
|
+
...options,
|
|
4377
|
+
headers: {
|
|
4378
|
+
...options == null ? void 0 : options.headers,
|
|
4379
|
+
...coreHeaders
|
|
4380
|
+
}
|
|
4381
|
+
});
|
|
4382
|
+
const apiResponse = await handleRateLimits(callApi);
|
|
4383
|
+
if (!apiResponse.ok) {
|
|
4384
|
+
let message = "";
|
|
4385
|
+
try {
|
|
4386
|
+
const responseText = await apiResponse.text();
|
|
4387
|
+
try {
|
|
4388
|
+
const parsed = JSON.parse(responseText);
|
|
4389
|
+
if (parsed.errorMessage) {
|
|
4390
|
+
message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
|
|
4391
|
+
} else {
|
|
4392
|
+
message = responseText;
|
|
4393
|
+
}
|
|
4394
|
+
} catch (e) {
|
|
4395
|
+
message = responseText;
|
|
4396
|
+
}
|
|
4397
|
+
} catch (e) {
|
|
4398
|
+
message = `General error`;
|
|
4399
|
+
}
|
|
4400
|
+
throw new ApiClientError(
|
|
4401
|
+
message,
|
|
4402
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
4403
|
+
fetchUri.toString(),
|
|
4404
|
+
apiResponse.status,
|
|
4405
|
+
apiResponse.statusText,
|
|
4406
|
+
ApiClient.getRequestId(apiResponse)
|
|
4407
|
+
);
|
|
4408
|
+
}
|
|
4409
|
+
if (options == null ? void 0 : options.expectNoContent) {
|
|
4410
|
+
return null;
|
|
4411
|
+
}
|
|
4412
|
+
return await apiResponse.json();
|
|
4413
|
+
});
|
|
4414
|
+
}
|
|
4415
|
+
createUrl(path, queryParams, hostOverride) {
|
|
4416
|
+
const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
|
|
4417
|
+
Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
|
|
4418
|
+
var _a;
|
|
4419
|
+
if (typeof value !== "undefined" && value !== null) {
|
|
4420
|
+
url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
|
|
4421
|
+
}
|
|
4422
|
+
});
|
|
4423
|
+
return url;
|
|
4424
|
+
}
|
|
4425
|
+
ensureApiHost(apiHost) {
|
|
4426
|
+
if (!apiHost)
|
|
4427
|
+
return "https://uniform.app";
|
|
4428
|
+
if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
|
|
4429
|
+
throw new Error('Your apiHost must start with "http"');
|
|
4430
|
+
}
|
|
4431
|
+
if (apiHost.indexOf("/", 8) > -1) {
|
|
4432
|
+
throw new Error("Your apiHost must not contain a path element after the domain");
|
|
4433
|
+
}
|
|
4434
|
+
if (apiHost.indexOf("?") > -1) {
|
|
4435
|
+
throw new Error("Your apiHost must not contain a query string");
|
|
4436
|
+
}
|
|
4437
|
+
if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
|
|
4438
|
+
apiHost = apiHost.substring(0, apiHost.length - 1);
|
|
4439
|
+
}
|
|
4440
|
+
return apiHost;
|
|
4441
|
+
}
|
|
4442
|
+
static getRequestId(response) {
|
|
4443
|
+
const apigRequestId = response.headers.get("apigw-requestid");
|
|
4444
|
+
if (apigRequestId) {
|
|
4445
|
+
return apigRequestId;
|
|
4446
|
+
}
|
|
4447
|
+
return void 0;
|
|
4448
|
+
}
|
|
4449
|
+
};
|
|
4450
|
+
async function handleRateLimits(callApi) {
|
|
4451
|
+
var _a;
|
|
4452
|
+
const backoffRetries = 5;
|
|
4453
|
+
let backoffRetriesLeft = backoffRetries;
|
|
4454
|
+
let response;
|
|
4455
|
+
while (backoffRetriesLeft > 0) {
|
|
4456
|
+
response = await callApi();
|
|
4457
|
+
if (response.status !== 429) {
|
|
4458
|
+
break;
|
|
4459
|
+
}
|
|
4460
|
+
let resetWait = 0;
|
|
4461
|
+
try {
|
|
4462
|
+
const dateHeader = response.headers.get("date");
|
|
4463
|
+
const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
|
|
4464
|
+
const body = await response.json();
|
|
4465
|
+
const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
|
|
4466
|
+
if (typeof serverTime === "number" && typeof resetTime === "number") {
|
|
4467
|
+
resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
|
|
4468
|
+
}
|
|
4469
|
+
} catch (err) {
|
|
4470
|
+
}
|
|
4471
|
+
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
4472
|
+
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
4473
|
+
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
4474
|
+
backoffRetriesLeft -= 1;
|
|
4475
|
+
}
|
|
4476
|
+
return response;
|
|
4477
|
+
}
|
|
4478
|
+
var _url;
|
|
4479
|
+
var _AggregateClient = class extends ApiClient {
|
|
4480
|
+
constructor(options) {
|
|
4481
|
+
super(options);
|
|
4482
|
+
}
|
|
4483
|
+
/** Fetches all aggregates for a project */
|
|
4484
|
+
async get(options) {
|
|
4485
|
+
const { projectId } = this.options;
|
|
4486
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url), { ...options, projectId });
|
|
4487
|
+
return await this.apiClient(fetchUri);
|
|
4488
|
+
}
|
|
4489
|
+
/** Updates or creates (based on id) an Aggregate */
|
|
4490
|
+
async upsert(body) {
|
|
4491
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
|
|
4492
|
+
await this.apiClient(fetchUri, {
|
|
4493
|
+
method: "PUT",
|
|
4494
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4495
|
+
expectNoContent: true
|
|
4496
|
+
});
|
|
4497
|
+
}
|
|
4498
|
+
/** Deletes an Aggregate */
|
|
4499
|
+
async remove(body) {
|
|
4500
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
|
|
4501
|
+
await this.apiClient(fetchUri, {
|
|
4502
|
+
method: "DELETE",
|
|
4503
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4504
|
+
expectNoContent: true
|
|
4505
|
+
});
|
|
4506
|
+
}
|
|
4507
|
+
};
|
|
4508
|
+
var AggregateClient = _AggregateClient;
|
|
4509
|
+
_url = /* @__PURE__ */ new WeakMap();
|
|
4510
|
+
__privateAdd(AggregateClient, _url, "/api/v2/aggregate");
|
|
4511
|
+
var _url2;
|
|
4512
|
+
var _DimensionClient = class extends ApiClient {
|
|
4513
|
+
constructor(options) {
|
|
4514
|
+
super(options);
|
|
4515
|
+
}
|
|
4516
|
+
/** Fetches the known score dimensions for a project */
|
|
4517
|
+
async get(options) {
|
|
4518
|
+
const { projectId } = this.options;
|
|
4519
|
+
const fetchUri = this.createUrl(__privateGet(_DimensionClient, _url2), { ...options, projectId });
|
|
4520
|
+
return await this.apiClient(fetchUri);
|
|
4521
|
+
}
|
|
4522
|
+
};
|
|
4523
|
+
var DimensionClient = _DimensionClient;
|
|
4524
|
+
_url2 = /* @__PURE__ */ new WeakMap();
|
|
4525
|
+
__privateAdd(DimensionClient, _url2, "/api/v2/dimension");
|
|
4526
|
+
var _url3;
|
|
4527
|
+
var _valueUrl;
|
|
4528
|
+
var _EnrichmentClient = class extends ApiClient {
|
|
4529
|
+
constructor(options) {
|
|
4530
|
+
super(options);
|
|
4531
|
+
}
|
|
4532
|
+
/** Fetches all enrichments and values for a project, grouped by category */
|
|
4533
|
+
async get(options) {
|
|
4534
|
+
const { projectId } = this.options;
|
|
4535
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3), { ...options, projectId });
|
|
4536
|
+
return await this.apiClient(fetchUri);
|
|
4537
|
+
}
|
|
4538
|
+
/** Updates or creates (based on id) an enrichment category */
|
|
4539
|
+
async upsertCategory(body) {
|
|
4540
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3));
|
|
4541
|
+
await this.apiClient(fetchUri, {
|
|
4542
|
+
method: "PUT",
|
|
4543
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4544
|
+
expectNoContent: true
|
|
4545
|
+
});
|
|
4546
|
+
}
|
|
4547
|
+
/** Deletes an enrichment category */
|
|
4548
|
+
async removeCategory(body) {
|
|
4549
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3));
|
|
4550
|
+
await this.apiClient(fetchUri, {
|
|
4551
|
+
method: "DELETE",
|
|
4552
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4553
|
+
expectNoContent: true
|
|
4554
|
+
});
|
|
4555
|
+
}
|
|
4556
|
+
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
4557
|
+
async upsertValue(body) {
|
|
4558
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
|
|
4559
|
+
await this.apiClient(fetchUri, {
|
|
4560
|
+
method: "PUT",
|
|
4561
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4562
|
+
expectNoContent: true
|
|
4563
|
+
});
|
|
4564
|
+
}
|
|
4565
|
+
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
4566
|
+
async removeValue(body) {
|
|
4567
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
|
|
4568
|
+
await this.apiClient(fetchUri, {
|
|
4569
|
+
method: "DELETE",
|
|
4570
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4571
|
+
expectNoContent: true
|
|
4572
|
+
});
|
|
4573
|
+
}
|
|
4574
|
+
};
|
|
4575
|
+
var EnrichmentClient = _EnrichmentClient;
|
|
4576
|
+
_url3 = /* @__PURE__ */ new WeakMap();
|
|
4577
|
+
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
4578
|
+
__privateAdd(EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
4579
|
+
__privateAdd(EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
4580
|
+
var _url4;
|
|
4581
|
+
var _ManifestClient = class extends ApiClient {
|
|
4582
|
+
constructor(options) {
|
|
4583
|
+
super(options);
|
|
4584
|
+
}
|
|
4585
|
+
/** Fetches the Context manifest for a project */
|
|
4586
|
+
async get(options) {
|
|
4587
|
+
const { projectId } = this.options;
|
|
4588
|
+
const fetchUri = this.createUrl(__privateGet(_ManifestClient, _url4), { ...options, projectId });
|
|
4589
|
+
return await this.apiClient(fetchUri);
|
|
4590
|
+
}
|
|
4591
|
+
/** Publishes the Context manifest for a project */
|
|
4592
|
+
async publish() {
|
|
4593
|
+
const { projectId } = this.options;
|
|
4594
|
+
const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
|
|
4595
|
+
await this.apiClient(fetchUri, {
|
|
4596
|
+
method: "POST",
|
|
4597
|
+
expectNoContent: true
|
|
4598
|
+
});
|
|
4599
|
+
}
|
|
4600
|
+
};
|
|
4601
|
+
var ManifestClient = _ManifestClient;
|
|
4602
|
+
_url4 = /* @__PURE__ */ new WeakMap();
|
|
4603
|
+
__privateAdd(ManifestClient, _url4, "/api/v2/manifest");
|
|
4604
|
+
var _url5;
|
|
4605
|
+
var _QuirkClient = class extends ApiClient {
|
|
4606
|
+
constructor(options) {
|
|
4607
|
+
super(options);
|
|
4608
|
+
}
|
|
4609
|
+
/** Fetches all Quirks for a project */
|
|
4610
|
+
async get(options) {
|
|
4611
|
+
const { projectId } = this.options;
|
|
4612
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5), { ...options, projectId });
|
|
4613
|
+
return await this.apiClient(fetchUri);
|
|
4614
|
+
}
|
|
4615
|
+
/** Updates or creates (based on id) a Quirk */
|
|
4616
|
+
async upsert(body) {
|
|
4617
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5));
|
|
4618
|
+
await this.apiClient(fetchUri, {
|
|
4619
|
+
method: "PUT",
|
|
4620
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4621
|
+
expectNoContent: true
|
|
4622
|
+
});
|
|
4623
|
+
}
|
|
4624
|
+
/** Deletes a Quirk */
|
|
4625
|
+
async remove(body) {
|
|
4626
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5));
|
|
4627
|
+
await this.apiClient(fetchUri, {
|
|
4628
|
+
method: "DELETE",
|
|
4629
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4630
|
+
expectNoContent: true
|
|
4631
|
+
});
|
|
4632
|
+
}
|
|
4633
|
+
};
|
|
4634
|
+
var QuirkClient = _QuirkClient;
|
|
4635
|
+
_url5 = /* @__PURE__ */ new WeakMap();
|
|
4636
|
+
__privateAdd(QuirkClient, _url5, "/api/v2/quirk");
|
|
4637
|
+
var _url6;
|
|
4638
|
+
var _SignalClient = class extends ApiClient {
|
|
4639
|
+
constructor(options) {
|
|
4640
|
+
super(options);
|
|
4641
|
+
}
|
|
4642
|
+
/** Fetches all Signals for a project */
|
|
4643
|
+
async get(options) {
|
|
4644
|
+
const { projectId } = this.options;
|
|
4645
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6), { ...options, projectId });
|
|
4646
|
+
return await this.apiClient(fetchUri);
|
|
4647
|
+
}
|
|
4648
|
+
/** Updates or creates (based on id) a Signal */
|
|
4649
|
+
async upsert(body) {
|
|
4650
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6));
|
|
4651
|
+
await this.apiClient(fetchUri, {
|
|
4652
|
+
method: "PUT",
|
|
4653
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4654
|
+
expectNoContent: true
|
|
4655
|
+
});
|
|
4656
|
+
}
|
|
4657
|
+
/** Deletes a Signal */
|
|
4658
|
+
async remove(body) {
|
|
4659
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6));
|
|
4660
|
+
await this.apiClient(fetchUri, {
|
|
4661
|
+
method: "DELETE",
|
|
4662
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4663
|
+
expectNoContent: true
|
|
4664
|
+
});
|
|
4665
|
+
}
|
|
4666
|
+
};
|
|
4667
|
+
var SignalClient = _SignalClient;
|
|
4668
|
+
_url6 = /* @__PURE__ */ new WeakMap();
|
|
4669
|
+
__privateAdd(SignalClient, _url6, "/api/v2/signal");
|
|
4670
|
+
var _url7;
|
|
4671
|
+
var _TestClient = class extends ApiClient {
|
|
4672
|
+
constructor(options) {
|
|
4673
|
+
super(options);
|
|
4674
|
+
}
|
|
4675
|
+
/** Fetches all Tests for a project */
|
|
4676
|
+
async get(options) {
|
|
4677
|
+
const { projectId } = this.options;
|
|
4678
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient, _url7), { ...options, projectId });
|
|
4679
|
+
return await this.apiClient(fetchUri);
|
|
4680
|
+
}
|
|
4681
|
+
/** Updates or creates (based on id) a Test */
|
|
4682
|
+
async upsert(body) {
|
|
4683
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient, _url7));
|
|
4684
|
+
await this.apiClient(fetchUri, {
|
|
4685
|
+
method: "PUT",
|
|
4686
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4687
|
+
expectNoContent: true
|
|
4688
|
+
});
|
|
4689
|
+
}
|
|
4690
|
+
/** Deletes a Test */
|
|
4691
|
+
async remove(body) {
|
|
4692
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient, _url7));
|
|
4693
|
+
await this.apiClient(fetchUri, {
|
|
4694
|
+
method: "DELETE",
|
|
4695
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
4696
|
+
expectNoContent: true
|
|
4697
|
+
});
|
|
4698
|
+
}
|
|
4699
|
+
};
|
|
4700
|
+
var TestClient = _TestClient;
|
|
4701
|
+
_url7 = /* @__PURE__ */ new WeakMap();
|
|
4702
|
+
__privateAdd(TestClient, _url7, "/api/v2/test");
|
|
4703
|
+
|
|
4704
|
+
// ../../node_modules/.pnpm/immer@9.0.21/node_modules/immer/dist/immer.esm.mjs
|
|
4705
|
+
function n(n2) {
|
|
4706
|
+
for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e = 1; e < r2; e++)
|
|
4707
|
+
t2[e - 1] = arguments[e];
|
|
4708
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
4709
|
+
var i2 = Y[n2], o2 = i2 ? "function" == typeof i2 ? i2.apply(null, t2) : i2 : "unknown error nr: " + n2;
|
|
4710
|
+
throw Error("[Immer] " + o2);
|
|
4711
|
+
}
|
|
4712
|
+
throw Error("[Immer] minified error nr: " + n2 + (t2.length ? " " + t2.map(function(n3) {
|
|
4713
|
+
return "'" + n3 + "'";
|
|
4714
|
+
}).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
|
|
4715
|
+
}
|
|
4716
|
+
function r(n2) {
|
|
4717
|
+
return !!n2 && !!n2[Q];
|
|
4718
|
+
}
|
|
4719
|
+
function t(n2) {
|
|
4720
|
+
var r2;
|
|
4721
|
+
return !!n2 && (function(n3) {
|
|
4722
|
+
if (!n3 || "object" != typeof n3)
|
|
4723
|
+
return false;
|
|
4724
|
+
var r3 = Object.getPrototypeOf(n3);
|
|
4725
|
+
if (null === r3)
|
|
4726
|
+
return true;
|
|
4727
|
+
var t2 = Object.hasOwnProperty.call(r3, "constructor") && r3.constructor;
|
|
4728
|
+
return t2 === Object || "function" == typeof t2 && Function.toString.call(t2) === Z;
|
|
4729
|
+
}(n2) || Array.isArray(n2) || !!n2[L] || !!(null === (r2 = n2.constructor) || void 0 === r2 ? void 0 : r2[L]) || s(n2) || v(n2));
|
|
4730
|
+
}
|
|
4731
|
+
function i(n2, r2, t2) {
|
|
4732
|
+
void 0 === t2 && (t2 = false), 0 === o(n2) ? (t2 ? Object.keys : nn)(n2).forEach(function(e) {
|
|
4733
|
+
t2 && "symbol" == typeof e || r2(e, n2[e], n2);
|
|
4734
|
+
}) : n2.forEach(function(t3, e) {
|
|
4735
|
+
return r2(e, t3, n2);
|
|
4736
|
+
});
|
|
4737
|
+
}
|
|
4738
|
+
function o(n2) {
|
|
4739
|
+
var r2 = n2[Q];
|
|
4740
|
+
return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s(n2) ? 2 : v(n2) ? 3 : 0;
|
|
4741
|
+
}
|
|
4742
|
+
function u(n2, r2) {
|
|
4743
|
+
return 2 === o(n2) ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
|
|
4744
|
+
}
|
|
4745
|
+
function a(n2, r2) {
|
|
4746
|
+
return 2 === o(n2) ? n2.get(r2) : n2[r2];
|
|
4747
|
+
}
|
|
4748
|
+
function f(n2, r2, t2) {
|
|
4749
|
+
var e = o(n2);
|
|
4750
|
+
2 === e ? n2.set(r2, t2) : 3 === e ? n2.add(t2) : n2[r2] = t2;
|
|
4751
|
+
}
|
|
4752
|
+
function c(n2, r2) {
|
|
4753
|
+
return n2 === r2 ? 0 !== n2 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
|
|
4754
|
+
}
|
|
4755
|
+
function s(n2) {
|
|
4756
|
+
return X && n2 instanceof Map;
|
|
4757
|
+
}
|
|
4758
|
+
function v(n2) {
|
|
4759
|
+
return q && n2 instanceof Set;
|
|
4760
|
+
}
|
|
4761
|
+
function p(n2) {
|
|
4762
|
+
return n2.o || n2.t;
|
|
4763
|
+
}
|
|
4764
|
+
function l(n2) {
|
|
4765
|
+
if (Array.isArray(n2))
|
|
4766
|
+
return Array.prototype.slice.call(n2);
|
|
4767
|
+
var r2 = rn(n2);
|
|
4768
|
+
delete r2[Q];
|
|
4769
|
+
for (var t2 = nn(r2), e = 0; e < t2.length; e++) {
|
|
4770
|
+
var i2 = t2[e], o2 = r2[i2];
|
|
4771
|
+
false === o2.writable && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
|
|
4772
|
+
}
|
|
4773
|
+
return Object.create(Object.getPrototypeOf(n2), r2);
|
|
4774
|
+
}
|
|
4775
|
+
function d(n2, e) {
|
|
4776
|
+
return void 0 === e && (e = false), y(n2) || r(n2) || !t(n2) || (o(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e && i(n2, function(n3, r2) {
|
|
4777
|
+
return d(r2, true);
|
|
4778
|
+
}, true)), n2;
|
|
4779
|
+
}
|
|
4780
|
+
function h() {
|
|
4781
|
+
n(2);
|
|
4782
|
+
}
|
|
4783
|
+
function y(n2) {
|
|
4784
|
+
return null == n2 || "object" != typeof n2 || Object.isFrozen(n2);
|
|
4785
|
+
}
|
|
4786
|
+
function b(r2) {
|
|
4787
|
+
var t2 = tn[r2];
|
|
4788
|
+
return t2 || n(18, r2), t2;
|
|
4789
|
+
}
|
|
4790
|
+
function _() {
|
|
4791
|
+
return "production" === process.env.NODE_ENV || U || n(0), U;
|
|
4792
|
+
}
|
|
4793
|
+
function j(n2, r2) {
|
|
4794
|
+
r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
|
|
4795
|
+
}
|
|
4796
|
+
function g(n2) {
|
|
4797
|
+
O(n2), n2.p.forEach(S), n2.p = null;
|
|
4798
|
+
}
|
|
4799
|
+
function O(n2) {
|
|
4800
|
+
n2 === U && (U = n2.l);
|
|
4801
|
+
}
|
|
4802
|
+
function w(n2) {
|
|
4803
|
+
return U = { p: [], l: U, h: n2, m: true, _: 0 };
|
|
4804
|
+
}
|
|
4805
|
+
function S(n2) {
|
|
4806
|
+
var r2 = n2[Q];
|
|
4807
|
+
0 === r2.i || 1 === r2.i ? r2.j() : r2.g = true;
|
|
4808
|
+
}
|
|
4809
|
+
function P(r2, e) {
|
|
4810
|
+
e._ = e.p.length;
|
|
4811
|
+
var i2 = e.p[0], o2 = void 0 !== r2 && r2 !== i2;
|
|
4812
|
+
return e.h.O || b("ES5").S(e, r2, o2), o2 ? (i2[Q].P && (g(e), n(4)), t(r2) && (r2 = M(e, r2), e.l || x(e, r2)), e.u && b("Patches").M(i2[Q].t, r2, e.u, e.s)) : r2 = M(e, i2, []), g(e), e.u && e.v(e.u, e.s), r2 !== H ? r2 : void 0;
|
|
4813
|
+
}
|
|
4814
|
+
function M(n2, r2, t2) {
|
|
4815
|
+
if (y(r2))
|
|
4816
|
+
return r2;
|
|
4817
|
+
var e = r2[Q];
|
|
4818
|
+
if (!e)
|
|
4819
|
+
return i(r2, function(i2, o3) {
|
|
4820
|
+
return A(n2, e, r2, i2, o3, t2);
|
|
4821
|
+
}, true), r2;
|
|
4822
|
+
if (e.A !== n2)
|
|
4823
|
+
return r2;
|
|
4824
|
+
if (!e.P)
|
|
4825
|
+
return x(n2, e.t, true), e.t;
|
|
4826
|
+
if (!e.I) {
|
|
4827
|
+
e.I = true, e.A._--;
|
|
4828
|
+
var o2 = 4 === e.i || 5 === e.i ? e.o = l(e.k) : e.o, u2 = o2, a2 = false;
|
|
4829
|
+
3 === e.i && (u2 = new Set(o2), o2.clear(), a2 = true), i(u2, function(r3, i2) {
|
|
4830
|
+
return A(n2, e, o2, r3, i2, t2, a2);
|
|
4831
|
+
}), x(n2, o2, false), t2 && n2.u && b("Patches").N(e, t2, n2.u, n2.s);
|
|
4832
|
+
}
|
|
4833
|
+
return e.o;
|
|
4834
|
+
}
|
|
4835
|
+
function A(e, i2, o2, a2, c2, s2, v2) {
|
|
4836
|
+
if ("production" !== process.env.NODE_ENV && c2 === o2 && n(5), r(c2)) {
|
|
4837
|
+
var p2 = M(e, c2, s2 && i2 && 3 !== i2.i && !u(i2.R, a2) ? s2.concat(a2) : void 0);
|
|
4838
|
+
if (f(o2, a2, p2), !r(p2))
|
|
4839
|
+
return;
|
|
4840
|
+
e.m = false;
|
|
4841
|
+
} else
|
|
4842
|
+
v2 && o2.add(c2);
|
|
4843
|
+
if (t(c2) && !y(c2)) {
|
|
4844
|
+
if (!e.h.D && e._ < 1)
|
|
4845
|
+
return;
|
|
4846
|
+
M(e, c2), i2 && i2.A.l || x(e, c2);
|
|
4847
|
+
}
|
|
4848
|
+
}
|
|
4849
|
+
function x(n2, r2, t2) {
|
|
4850
|
+
void 0 === t2 && (t2 = false), !n2.l && n2.h.D && n2.m && d(r2, t2);
|
|
4851
|
+
}
|
|
4852
|
+
function z2(n2, r2) {
|
|
4853
|
+
var t2 = n2[Q];
|
|
4854
|
+
return (t2 ? p(t2) : n2)[r2];
|
|
4855
|
+
}
|
|
4856
|
+
function I(n2, r2) {
|
|
4857
|
+
if (r2 in n2)
|
|
4858
|
+
for (var t2 = Object.getPrototypeOf(n2); t2; ) {
|
|
4859
|
+
var e = Object.getOwnPropertyDescriptor(t2, r2);
|
|
4860
|
+
if (e)
|
|
4861
|
+
return e;
|
|
4862
|
+
t2 = Object.getPrototypeOf(t2);
|
|
4863
|
+
}
|
|
4864
|
+
}
|
|
4865
|
+
function k(n2) {
|
|
4866
|
+
n2.P || (n2.P = true, n2.l && k(n2.l));
|
|
4867
|
+
}
|
|
4868
|
+
function E(n2) {
|
|
4869
|
+
n2.o || (n2.o = l(n2.t));
|
|
4870
|
+
}
|
|
4871
|
+
function N(n2, r2, t2) {
|
|
4872
|
+
var e = s(r2) ? b("MapSet").F(r2, t2) : v(r2) ? b("MapSet").T(r2, t2) : n2.O ? function(n3, r3) {
|
|
4873
|
+
var t3 = Array.isArray(n3), e2 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _(), P: false, I: false, R: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i2 = e2, o2 = en;
|
|
4874
|
+
t3 && (i2 = [e2], o2 = on);
|
|
4875
|
+
var u2 = Proxy.revocable(i2, o2), a2 = u2.revoke, f2 = u2.proxy;
|
|
4876
|
+
return e2.k = f2, e2.j = a2, f2;
|
|
4877
|
+
}(r2, t2) : b("ES5").J(r2, t2);
|
|
4878
|
+
return (t2 ? t2.A : _()).p.push(e), e;
|
|
4879
|
+
}
|
|
4880
|
+
function R(e) {
|
|
4881
|
+
return r(e) || n(22, e), function n2(r2) {
|
|
4882
|
+
if (!t(r2))
|
|
4883
|
+
return r2;
|
|
4884
|
+
var e2, u2 = r2[Q], c2 = o(r2);
|
|
4885
|
+
if (u2) {
|
|
4886
|
+
if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
|
|
4887
|
+
return u2.t;
|
|
4888
|
+
u2.I = true, e2 = D(r2, c2), u2.I = false;
|
|
4889
|
+
} else
|
|
4890
|
+
e2 = D(r2, c2);
|
|
4891
|
+
return i(e2, function(r3, t2) {
|
|
4892
|
+
u2 && a(u2.t, r3) === t2 || f(e2, r3, n2(t2));
|
|
4893
|
+
}), 3 === c2 ? new Set(e2) : e2;
|
|
4894
|
+
}(e);
|
|
4895
|
+
}
|
|
4896
|
+
function D(n2, r2) {
|
|
4897
|
+
switch (r2) {
|
|
4898
|
+
case 2:
|
|
4899
|
+
return new Map(n2);
|
|
4900
|
+
case 3:
|
|
4901
|
+
return Array.from(n2);
|
|
4902
|
+
}
|
|
4903
|
+
return l(n2);
|
|
4904
|
+
}
|
|
4905
|
+
var G;
|
|
4906
|
+
var U;
|
|
4907
|
+
var W = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x");
|
|
4908
|
+
var X = "undefined" != typeof Map;
|
|
4909
|
+
var q = "undefined" != typeof Set;
|
|
4910
|
+
var B = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect;
|
|
4911
|
+
var H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G);
|
|
4912
|
+
var L = W ? Symbol.for("immer-draftable") : "__$immer_draftable";
|
|
4913
|
+
var Q = W ? Symbol.for("immer-state") : "__$immer_state";
|
|
4914
|
+
var Y = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function(n2) {
|
|
4915
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + n2;
|
|
4916
|
+
}, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function(n2) {
|
|
4917
|
+
return "Cannot apply patch, path doesn't resolve: " + n2;
|
|
4918
|
+
}, 16: 'Sets cannot have "replace" patches.', 17: function(n2) {
|
|
4919
|
+
return "Unsupported patch operation: " + n2;
|
|
4920
|
+
}, 18: function(n2) {
|
|
4921
|
+
return "The plugin for '" + n2 + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + n2 + "()` when initializing your application.";
|
|
4922
|
+
}, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function(n2) {
|
|
4923
|
+
return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + n2 + "'";
|
|
4924
|
+
}, 22: function(n2) {
|
|
4925
|
+
return "'current' expects a draft, got: " + n2;
|
|
4926
|
+
}, 23: function(n2) {
|
|
4927
|
+
return "'original' expects a draft, got: " + n2;
|
|
4928
|
+
}, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" };
|
|
4929
|
+
var Z = "" + Object.prototype.constructor;
|
|
4930
|
+
var nn = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function(n2) {
|
|
4931
|
+
return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
|
|
4932
|
+
} : Object.getOwnPropertyNames;
|
|
4933
|
+
var rn = Object.getOwnPropertyDescriptors || function(n2) {
|
|
4934
|
+
var r2 = {};
|
|
4935
|
+
return nn(n2).forEach(function(t2) {
|
|
4936
|
+
r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
|
|
4937
|
+
}), r2;
|
|
4938
|
+
};
|
|
4939
|
+
var tn = {};
|
|
4940
|
+
var en = { get: function(n2, r2) {
|
|
4941
|
+
if (r2 === Q)
|
|
4942
|
+
return n2;
|
|
4943
|
+
var e = p(n2);
|
|
4944
|
+
if (!u(e, r2))
|
|
4945
|
+
return function(n3, r3, t2) {
|
|
4946
|
+
var e2, i3 = I(r3, t2);
|
|
4947
|
+
return i3 ? "value" in i3 ? i3.value : null === (e2 = i3.get) || void 0 === e2 ? void 0 : e2.call(n3.k) : void 0;
|
|
4948
|
+
}(n2, e, r2);
|
|
4949
|
+
var i2 = e[r2];
|
|
4950
|
+
return n2.I || !t(i2) ? i2 : i2 === z2(n2.t, r2) ? (E(n2), n2.o[r2] = N(n2.A.h, i2, n2)) : i2;
|
|
4951
|
+
}, has: function(n2, r2) {
|
|
4952
|
+
return r2 in p(n2);
|
|
4953
|
+
}, ownKeys: function(n2) {
|
|
4954
|
+
return Reflect.ownKeys(p(n2));
|
|
4955
|
+
}, set: function(n2, r2, t2) {
|
|
4956
|
+
var e = I(p(n2), r2);
|
|
4957
|
+
if (null == e ? void 0 : e.set)
|
|
4958
|
+
return e.set.call(n2.k, t2), true;
|
|
4959
|
+
if (!n2.P) {
|
|
4960
|
+
var i2 = z2(p(n2), r2), o2 = null == i2 ? void 0 : i2[Q];
|
|
4961
|
+
if (o2 && o2.t === t2)
|
|
4962
|
+
return n2.o[r2] = t2, n2.R[r2] = false, true;
|
|
4963
|
+
if (c(t2, i2) && (void 0 !== t2 || u(n2.t, r2)))
|
|
4964
|
+
return true;
|
|
4965
|
+
E(n2), k(n2);
|
|
4966
|
+
}
|
|
4967
|
+
return n2.o[r2] === t2 && (void 0 !== t2 || r2 in n2.o) || Number.isNaN(t2) && Number.isNaN(n2.o[r2]) || (n2.o[r2] = t2, n2.R[r2] = true), true;
|
|
4968
|
+
}, deleteProperty: function(n2, r2) {
|
|
4969
|
+
return void 0 !== z2(n2.t, r2) || r2 in n2.t ? (n2.R[r2] = false, E(n2), k(n2)) : delete n2.R[r2], n2.o && delete n2.o[r2], true;
|
|
4970
|
+
}, getOwnPropertyDescriptor: function(n2, r2) {
|
|
4971
|
+
var t2 = p(n2), e = Reflect.getOwnPropertyDescriptor(t2, r2);
|
|
4972
|
+
return e ? { writable: true, configurable: 1 !== n2.i || "length" !== r2, enumerable: e.enumerable, value: t2[r2] } : e;
|
|
4973
|
+
}, defineProperty: function() {
|
|
4974
|
+
n(11);
|
|
4975
|
+
}, getPrototypeOf: function(n2) {
|
|
4976
|
+
return Object.getPrototypeOf(n2.t);
|
|
4977
|
+
}, setPrototypeOf: function() {
|
|
4978
|
+
n(12);
|
|
4979
|
+
} };
|
|
4980
|
+
var on = {};
|
|
4981
|
+
i(en, function(n2, r2) {
|
|
4982
|
+
on[n2] = function() {
|
|
4983
|
+
return arguments[0] = arguments[0][0], r2.apply(this, arguments);
|
|
4984
|
+
};
|
|
4985
|
+
}), on.deleteProperty = function(r2, t2) {
|
|
4986
|
+
return "production" !== process.env.NODE_ENV && isNaN(parseInt(t2)) && n(13), on.set.call(this, r2, t2, void 0);
|
|
4987
|
+
}, on.set = function(r2, t2, e) {
|
|
4988
|
+
return "production" !== process.env.NODE_ENV && "length" !== t2 && isNaN(parseInt(t2)) && n(14), en.set.call(this, r2[0], t2, e, r2[0]);
|
|
4989
|
+
};
|
|
4990
|
+
var un = function() {
|
|
4991
|
+
function e(r2) {
|
|
4992
|
+
var e2 = this;
|
|
4993
|
+
this.O = B, this.D = true, this.produce = function(r3, i3, o2) {
|
|
4994
|
+
if ("function" == typeof r3 && "function" != typeof i3) {
|
|
4995
|
+
var u2 = i3;
|
|
4996
|
+
i3 = r3;
|
|
4997
|
+
var a2 = e2;
|
|
4998
|
+
return function(n2) {
|
|
4999
|
+
var r4 = this;
|
|
5000
|
+
void 0 === n2 && (n2 = u2);
|
|
5001
|
+
for (var t2 = arguments.length, e3 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
|
|
5002
|
+
e3[o3 - 1] = arguments[o3];
|
|
5003
|
+
return a2.produce(n2, function(n3) {
|
|
5004
|
+
var t3;
|
|
5005
|
+
return (t3 = i3).call.apply(t3, [r4, n3].concat(e3));
|
|
5006
|
+
});
|
|
5007
|
+
};
|
|
5008
|
+
}
|
|
5009
|
+
var f2;
|
|
5010
|
+
if ("function" != typeof i3 && n(6), void 0 !== o2 && "function" != typeof o2 && n(7), t(r3)) {
|
|
5011
|
+
var c2 = w(e2), s2 = N(e2, r3, void 0), v2 = true;
|
|
5012
|
+
try {
|
|
5013
|
+
f2 = i3(s2), v2 = false;
|
|
5014
|
+
} finally {
|
|
5015
|
+
v2 ? g(c2) : O(c2);
|
|
5016
|
+
}
|
|
5017
|
+
return "undefined" != typeof Promise && f2 instanceof Promise ? f2.then(function(n2) {
|
|
5018
|
+
return j(c2, o2), P(n2, c2);
|
|
5019
|
+
}, function(n2) {
|
|
5020
|
+
throw g(c2), n2;
|
|
5021
|
+
}) : (j(c2, o2), P(f2, c2));
|
|
5022
|
+
}
|
|
5023
|
+
if (!r3 || "object" != typeof r3) {
|
|
5024
|
+
if (void 0 === (f2 = i3(r3)) && (f2 = r3), f2 === H && (f2 = void 0), e2.D && d(f2, true), o2) {
|
|
5025
|
+
var p2 = [], l2 = [];
|
|
5026
|
+
b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
|
|
5027
|
+
}
|
|
5028
|
+
return f2;
|
|
5029
|
+
}
|
|
5030
|
+
n(21, r3);
|
|
5031
|
+
}, this.produceWithPatches = function(n2, r3) {
|
|
5032
|
+
if ("function" == typeof n2)
|
|
5033
|
+
return function(r4) {
|
|
5034
|
+
for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
|
|
5035
|
+
i4[o3 - 1] = arguments[o3];
|
|
5036
|
+
return e2.produceWithPatches(r4, function(r5) {
|
|
5037
|
+
return n2.apply(void 0, [r5].concat(i4));
|
|
5038
|
+
});
|
|
5039
|
+
};
|
|
5040
|
+
var t2, i3, o2 = e2.produce(n2, r3, function(n3, r4) {
|
|
5041
|
+
t2 = n3, i3 = r4;
|
|
5042
|
+
});
|
|
5043
|
+
return "undefined" != typeof Promise && o2 instanceof Promise ? o2.then(function(n3) {
|
|
5044
|
+
return [n3, t2, i3];
|
|
5045
|
+
}) : [o2, t2, i3];
|
|
5046
|
+
}, "boolean" == typeof (null == r2 ? void 0 : r2.useProxies) && this.setUseProxies(r2.useProxies), "boolean" == typeof (null == r2 ? void 0 : r2.autoFreeze) && this.setAutoFreeze(r2.autoFreeze);
|
|
5047
|
+
}
|
|
5048
|
+
var i2 = e.prototype;
|
|
5049
|
+
return i2.createDraft = function(e2) {
|
|
5050
|
+
t(e2) || n(8), r(e2) && (e2 = R(e2));
|
|
5051
|
+
var i3 = w(this), o2 = N(this, e2, void 0);
|
|
5052
|
+
return o2[Q].C = true, O(i3), o2;
|
|
5053
|
+
}, i2.finishDraft = function(r2, t2) {
|
|
5054
|
+
var e2 = r2 && r2[Q];
|
|
5055
|
+
"production" !== process.env.NODE_ENV && (e2 && e2.C || n(9), e2.I && n(10));
|
|
5056
|
+
var i3 = e2.A;
|
|
5057
|
+
return j(i3, t2), P(void 0, i3);
|
|
5058
|
+
}, i2.setAutoFreeze = function(n2) {
|
|
5059
|
+
this.D = n2;
|
|
5060
|
+
}, i2.setUseProxies = function(r2) {
|
|
5061
|
+
r2 && !B && n(20), this.O = r2;
|
|
5062
|
+
}, i2.applyPatches = function(n2, t2) {
|
|
5063
|
+
var e2;
|
|
5064
|
+
for (e2 = t2.length - 1; e2 >= 0; e2--) {
|
|
5065
|
+
var i3 = t2[e2];
|
|
5066
|
+
if (0 === i3.path.length && "replace" === i3.op) {
|
|
5067
|
+
n2 = i3.value;
|
|
5068
|
+
break;
|
|
5069
|
+
}
|
|
5070
|
+
}
|
|
5071
|
+
e2 > -1 && (t2 = t2.slice(e2 + 1));
|
|
5072
|
+
var o2 = b("Patches").$;
|
|
5073
|
+
return r(n2) ? o2(n2, t2) : this.produce(n2, function(n3) {
|
|
5074
|
+
return o2(n3, t2);
|
|
5075
|
+
});
|
|
5076
|
+
}, e;
|
|
5077
|
+
}();
|
|
5078
|
+
var an = new un();
|
|
5079
|
+
var fn = an.produce;
|
|
5080
|
+
var cn = an.produceWithPatches.bind(an);
|
|
5081
|
+
var sn = an.setAutoFreeze.bind(an);
|
|
5082
|
+
var vn = an.setUseProxies.bind(an);
|
|
5083
|
+
var pn = an.applyPatches.bind(an);
|
|
5084
|
+
var ln = an.createDraft.bind(an);
|
|
5085
|
+
var dn = an.finishDraft.bind(an);
|
|
5086
|
+
|
|
5087
|
+
// ../canvas/dist/index.mjs
|
|
5088
|
+
var __create = Object.create;
|
|
5089
|
+
var __defProp3 = Object.defineProperty;
|
|
5090
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5091
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5092
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5093
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5094
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
5095
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5096
|
+
};
|
|
5097
|
+
var __copyProps = (to, from, except, desc) => {
|
|
5098
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
5099
|
+
for (let key of __getOwnPropNames(from))
|
|
5100
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
5101
|
+
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
5102
|
+
}
|
|
5103
|
+
return to;
|
|
5104
|
+
};
|
|
5105
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
5106
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
5107
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
5108
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
5109
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
5110
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
|
|
5111
|
+
mod
|
|
5112
|
+
));
|
|
5113
|
+
var __accessCheck2 = (obj, member, msg) => {
|
|
5114
|
+
if (!member.has(obj))
|
|
5115
|
+
throw TypeError("Cannot " + msg);
|
|
5116
|
+
};
|
|
5117
|
+
var __privateGet2 = (obj, member, getter) => {
|
|
5118
|
+
__accessCheck2(obj, member, "read from private field");
|
|
5119
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
5120
|
+
};
|
|
5121
|
+
var __privateAdd2 = (obj, member, value) => {
|
|
5122
|
+
if (member.has(obj))
|
|
5123
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
5124
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
5125
|
+
};
|
|
5126
|
+
var require_retry_operation = __commonJS({
|
|
5127
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
5128
|
+
function RetryOperation(timeouts, options) {
|
|
5129
|
+
if (typeof options === "boolean") {
|
|
5130
|
+
options = { forever: options };
|
|
5131
|
+
}
|
|
5132
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
5133
|
+
this._timeouts = timeouts;
|
|
5134
|
+
this._options = options || {};
|
|
5135
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
5136
|
+
this._fn = null;
|
|
5137
|
+
this._errors = [];
|
|
5138
|
+
this._attempts = 1;
|
|
5139
|
+
this._operationTimeout = null;
|
|
5140
|
+
this._operationTimeoutCb = null;
|
|
5141
|
+
this._timeout = null;
|
|
5142
|
+
this._operationStart = null;
|
|
5143
|
+
this._timer = null;
|
|
5144
|
+
if (this._options.forever) {
|
|
5145
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
5146
|
+
}
|
|
5147
|
+
}
|
|
5148
|
+
module.exports = RetryOperation;
|
|
5149
|
+
RetryOperation.prototype.reset = function() {
|
|
5150
|
+
this._attempts = 1;
|
|
5151
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
5152
|
+
};
|
|
5153
|
+
RetryOperation.prototype.stop = function() {
|
|
5154
|
+
if (this._timeout) {
|
|
5155
|
+
clearTimeout(this._timeout);
|
|
5156
|
+
}
|
|
5157
|
+
if (this._timer) {
|
|
5158
|
+
clearTimeout(this._timer);
|
|
5159
|
+
}
|
|
5160
|
+
this._timeouts = [];
|
|
5161
|
+
this._cachedTimeouts = null;
|
|
5162
|
+
};
|
|
5163
|
+
RetryOperation.prototype.retry = function(err) {
|
|
5164
|
+
if (this._timeout) {
|
|
5165
|
+
clearTimeout(this._timeout);
|
|
5166
|
+
}
|
|
5167
|
+
if (!err) {
|
|
5168
|
+
return false;
|
|
5169
|
+
}
|
|
5170
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
5171
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
5172
|
+
this._errors.push(err);
|
|
5173
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
5174
|
+
return false;
|
|
5175
|
+
}
|
|
5176
|
+
this._errors.push(err);
|
|
5177
|
+
var timeout = this._timeouts.shift();
|
|
5178
|
+
if (timeout === void 0) {
|
|
5179
|
+
if (this._cachedTimeouts) {
|
|
5180
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
5181
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
5182
|
+
} else {
|
|
5183
|
+
return false;
|
|
5184
|
+
}
|
|
5185
|
+
}
|
|
5186
|
+
var self = this;
|
|
5187
|
+
this._timer = setTimeout(function() {
|
|
5188
|
+
self._attempts++;
|
|
5189
|
+
if (self._operationTimeoutCb) {
|
|
5190
|
+
self._timeout = setTimeout(function() {
|
|
5191
|
+
self._operationTimeoutCb(self._attempts);
|
|
5192
|
+
}, self._operationTimeout);
|
|
5193
|
+
if (self._options.unref) {
|
|
5194
|
+
self._timeout.unref();
|
|
5195
|
+
}
|
|
5196
|
+
}
|
|
5197
|
+
self._fn(self._attempts);
|
|
5198
|
+
}, timeout);
|
|
5199
|
+
if (this._options.unref) {
|
|
5200
|
+
this._timer.unref();
|
|
5201
|
+
}
|
|
5202
|
+
return true;
|
|
5203
|
+
};
|
|
5204
|
+
RetryOperation.prototype.attempt = function(fn2, timeoutOps) {
|
|
5205
|
+
this._fn = fn2;
|
|
5206
|
+
if (timeoutOps) {
|
|
5207
|
+
if (timeoutOps.timeout) {
|
|
5208
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
5209
|
+
}
|
|
5210
|
+
if (timeoutOps.cb) {
|
|
5211
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5214
|
+
var self = this;
|
|
5215
|
+
if (this._operationTimeoutCb) {
|
|
5216
|
+
this._timeout = setTimeout(function() {
|
|
5217
|
+
self._operationTimeoutCb();
|
|
5218
|
+
}, self._operationTimeout);
|
|
5219
|
+
}
|
|
5220
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
5221
|
+
this._fn(this._attempts);
|
|
5222
|
+
};
|
|
5223
|
+
RetryOperation.prototype.try = function(fn2) {
|
|
5224
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
5225
|
+
this.attempt(fn2);
|
|
5226
|
+
};
|
|
5227
|
+
RetryOperation.prototype.start = function(fn2) {
|
|
5228
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
5229
|
+
this.attempt(fn2);
|
|
5230
|
+
};
|
|
5231
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
5232
|
+
RetryOperation.prototype.errors = function() {
|
|
5233
|
+
return this._errors;
|
|
5234
|
+
};
|
|
5235
|
+
RetryOperation.prototype.attempts = function() {
|
|
5236
|
+
return this._attempts;
|
|
5237
|
+
};
|
|
5238
|
+
RetryOperation.prototype.mainError = function() {
|
|
5239
|
+
if (this._errors.length === 0) {
|
|
5240
|
+
return null;
|
|
5241
|
+
}
|
|
5242
|
+
var counts = {};
|
|
5243
|
+
var mainError = null;
|
|
5244
|
+
var mainErrorCount = 0;
|
|
5245
|
+
for (var i2 = 0; i2 < this._errors.length; i2++) {
|
|
5246
|
+
var error = this._errors[i2];
|
|
5247
|
+
var message = error.message;
|
|
5248
|
+
var count = (counts[message] || 0) + 1;
|
|
5249
|
+
counts[message] = count;
|
|
5250
|
+
if (count >= mainErrorCount) {
|
|
5251
|
+
mainError = error;
|
|
5252
|
+
mainErrorCount = count;
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
5255
|
+
return mainError;
|
|
5256
|
+
};
|
|
5257
|
+
}
|
|
5258
|
+
});
|
|
5259
|
+
var require_retry = __commonJS({
|
|
5260
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
|
|
5261
|
+
var RetryOperation = require_retry_operation();
|
|
5262
|
+
exports.operation = function(options) {
|
|
5263
|
+
var timeouts = exports.timeouts(options);
|
|
5264
|
+
return new RetryOperation(timeouts, {
|
|
5265
|
+
forever: options && (options.forever || options.retries === Infinity),
|
|
5266
|
+
unref: options && options.unref,
|
|
5267
|
+
maxRetryTime: options && options.maxRetryTime
|
|
5268
|
+
});
|
|
5269
|
+
};
|
|
5270
|
+
exports.timeouts = function(options) {
|
|
5271
|
+
if (options instanceof Array) {
|
|
5272
|
+
return [].concat(options);
|
|
5273
|
+
}
|
|
5274
|
+
var opts = {
|
|
5275
|
+
retries: 10,
|
|
5276
|
+
factor: 2,
|
|
5277
|
+
minTimeout: 1 * 1e3,
|
|
5278
|
+
maxTimeout: Infinity,
|
|
5279
|
+
randomize: false
|
|
5280
|
+
};
|
|
5281
|
+
for (var key in options) {
|
|
5282
|
+
opts[key] = options[key];
|
|
5283
|
+
}
|
|
5284
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
5285
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
5286
|
+
}
|
|
5287
|
+
var timeouts = [];
|
|
5288
|
+
for (var i2 = 0; i2 < opts.retries; i2++) {
|
|
5289
|
+
timeouts.push(this.createTimeout(i2, opts));
|
|
5290
|
+
}
|
|
5291
|
+
if (options && options.forever && !timeouts.length) {
|
|
5292
|
+
timeouts.push(this.createTimeout(i2, opts));
|
|
5293
|
+
}
|
|
5294
|
+
timeouts.sort(function(a2, b2) {
|
|
5295
|
+
return a2 - b2;
|
|
5296
|
+
});
|
|
5297
|
+
return timeouts;
|
|
5298
|
+
};
|
|
5299
|
+
exports.createTimeout = function(attempt, opts) {
|
|
5300
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
5301
|
+
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
5302
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
5303
|
+
return timeout;
|
|
5304
|
+
};
|
|
5305
|
+
exports.wrap = function(obj, options, methods) {
|
|
5306
|
+
if (options instanceof Array) {
|
|
5307
|
+
methods = options;
|
|
5308
|
+
options = null;
|
|
5309
|
+
}
|
|
5310
|
+
if (!methods) {
|
|
5311
|
+
methods = [];
|
|
5312
|
+
for (var key in obj) {
|
|
5313
|
+
if (typeof obj[key] === "function") {
|
|
5314
|
+
methods.push(key);
|
|
5315
|
+
}
|
|
5316
|
+
}
|
|
5317
|
+
}
|
|
5318
|
+
for (var i2 = 0; i2 < methods.length; i2++) {
|
|
5319
|
+
var method = methods[i2];
|
|
5320
|
+
var original = obj[method];
|
|
5321
|
+
obj[method] = function retryWrapper(original2) {
|
|
5322
|
+
var op = exports.operation(options);
|
|
5323
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
5324
|
+
var callback = args.pop();
|
|
5325
|
+
args.push(function(err) {
|
|
5326
|
+
if (op.retry(err)) {
|
|
5327
|
+
return;
|
|
5328
|
+
}
|
|
5329
|
+
if (err) {
|
|
5330
|
+
arguments[0] = op.mainError();
|
|
5331
|
+
}
|
|
5332
|
+
callback.apply(this, arguments);
|
|
5333
|
+
});
|
|
5334
|
+
op.attempt(function() {
|
|
5335
|
+
original2.apply(obj, args);
|
|
5336
|
+
});
|
|
5337
|
+
}.bind(obj, original);
|
|
5338
|
+
obj[method].options = options;
|
|
5339
|
+
}
|
|
5340
|
+
};
|
|
5341
|
+
}
|
|
5342
|
+
});
|
|
5343
|
+
var require_retry2 = __commonJS({
|
|
5344
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
|
|
5345
|
+
module.exports = require_retry();
|
|
5346
|
+
}
|
|
5347
|
+
});
|
|
5348
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
5349
|
+
var _url8;
|
|
5350
|
+
var _DataTypeClient = class extends ApiClient {
|
|
5351
|
+
constructor(options) {
|
|
5352
|
+
super(options);
|
|
5353
|
+
}
|
|
5354
|
+
/** Fetches all DataTypes for a project */
|
|
5355
|
+
async get(options) {
|
|
5356
|
+
const { projectId } = this.options;
|
|
5357
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient, _url8), { ...options, projectId });
|
|
5358
|
+
return await this.apiClient(fetchUri);
|
|
5359
|
+
}
|
|
5360
|
+
/** Updates or creates (based on id) a DataType */
|
|
5361
|
+
async upsert(body) {
|
|
5362
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient, _url8));
|
|
5363
|
+
await this.apiClient(fetchUri, {
|
|
5364
|
+
method: "PUT",
|
|
5365
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
5366
|
+
expectNoContent: true
|
|
5367
|
+
});
|
|
5368
|
+
}
|
|
5369
|
+
/** Deletes a DataType */
|
|
5370
|
+
async remove(body) {
|
|
5371
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient, _url8));
|
|
5372
|
+
await this.apiClient(fetchUri, {
|
|
5373
|
+
method: "DELETE",
|
|
5374
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
5375
|
+
expectNoContent: true
|
|
5376
|
+
});
|
|
5377
|
+
}
|
|
4101
5378
|
};
|
|
5379
|
+
var DataTypeClient = _DataTypeClient;
|
|
5380
|
+
_url8 = /* @__PURE__ */ new WeakMap();
|
|
5381
|
+
__privateAdd2(DataTypeClient, _url8, "/api/v1/data-types");
|
|
5382
|
+
var EDGE_MAX_L2_CACHE_TTL_IN_HOURS = 4 * 7 * 24;
|
|
5383
|
+
function bindVariables({
|
|
5384
|
+
variables,
|
|
5385
|
+
value,
|
|
5386
|
+
errorPrefix = "Variable",
|
|
5387
|
+
handleBinding
|
|
5388
|
+
}) {
|
|
5389
|
+
let boundCount = 0;
|
|
5390
|
+
const errors = [];
|
|
5391
|
+
const defaultHandleBinding = (variableName2, variables2, errors2) => {
|
|
5392
|
+
const variableValue2 = variables2[variableName2];
|
|
5393
|
+
if (variableValue2 === void 0) {
|
|
5394
|
+
errors2.push(`${errorPrefix} "${variableName2}" is not defined`);
|
|
5395
|
+
return "";
|
|
5396
|
+
}
|
|
5397
|
+
return variableValue2;
|
|
5398
|
+
};
|
|
5399
|
+
const result = value.replace(/(?<!\\)\${([^}]+)}/g, (_match, variableName2) => {
|
|
5400
|
+
const variableValue2 = (handleBinding != null ? handleBinding : defaultHandleBinding)(variableName2, variables, errors);
|
|
5401
|
+
boundCount++;
|
|
5402
|
+
return variableValue2;
|
|
5403
|
+
});
|
|
5404
|
+
return { result, boundCount, errors: errors.length > 0 ? errors : void 0 };
|
|
5405
|
+
}
|
|
5406
|
+
function bindVariablesToObject(options) {
|
|
5407
|
+
return bindVariablesToObjectRecursive(options);
|
|
5408
|
+
}
|
|
5409
|
+
function bindVariablesToObjectRecursive({
|
|
5410
|
+
value,
|
|
5411
|
+
recursivePath,
|
|
5412
|
+
...bindVariablesOptions
|
|
5413
|
+
}) {
|
|
5414
|
+
let boundCount = 0;
|
|
5415
|
+
const errors = [];
|
|
5416
|
+
if (typeof value === "string") {
|
|
5417
|
+
return bindVariables({ ...bindVariablesOptions, value });
|
|
5418
|
+
}
|
|
5419
|
+
if (typeof value !== "object" || value === null) {
|
|
5420
|
+
return { boundCount: 0, result: value };
|
|
5421
|
+
}
|
|
5422
|
+
const result = fn(value, (draft) => {
|
|
5423
|
+
Object.entries(draft).forEach(([property, oldValue]) => {
|
|
5424
|
+
const currentObjectPath = recursivePath ? `${recursivePath}.${property}` : property;
|
|
5425
|
+
if (typeof oldValue === "string") {
|
|
5426
|
+
const bindResult = bindVariables({ ...bindVariablesOptions, value: oldValue });
|
|
5427
|
+
if (oldValue !== bindResult.result || bindResult.errors) {
|
|
5428
|
+
boundCount += bindResult.boundCount;
|
|
5429
|
+
draft[property] = bindResult.result;
|
|
5430
|
+
if (bindResult.errors) {
|
|
5431
|
+
errors.push(...bindResult.errors.map((e) => `${currentObjectPath}: ${e}`));
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5434
|
+
return;
|
|
5435
|
+
}
|
|
5436
|
+
const childBind = bindVariablesToObject({
|
|
5437
|
+
...bindVariablesOptions,
|
|
5438
|
+
value: oldValue,
|
|
5439
|
+
recursivePath: currentObjectPath
|
|
5440
|
+
});
|
|
5441
|
+
if (childBind.boundCount || childBind.errors) {
|
|
5442
|
+
boundCount += childBind.boundCount;
|
|
5443
|
+
draft[property] = childBind.result;
|
|
5444
|
+
if (childBind.errors) {
|
|
5445
|
+
errors.push(...childBind.errors.map((e) => `${currentObjectPath}: ${e}`));
|
|
5446
|
+
}
|
|
5447
|
+
}
|
|
5448
|
+
});
|
|
5449
|
+
});
|
|
5450
|
+
return { boundCount, result, errors: errors.length > 0 ? errors : void 0 };
|
|
5451
|
+
}
|
|
4102
5452
|
|
|
4103
|
-
// src/components/ObjectSearch/
|
|
4104
|
-
import {
|
|
4105
|
-
import { useState as useState12 } from "react";
|
|
5453
|
+
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
5454
|
+
import { Container, IconsProvider, ScrollableList, VerticalRhythm } from "@uniformdev/design-system";
|
|
4106
5455
|
|
|
4107
5456
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
4108
|
-
import {
|
|
4109
|
-
|
|
5457
|
+
import {
|
|
5458
|
+
createContext as createContext5,
|
|
5459
|
+
useCallback,
|
|
5460
|
+
useContext as useContext7,
|
|
5461
|
+
useDeferredValue,
|
|
5462
|
+
useMemo as useMemo8,
|
|
5463
|
+
useState as useState12
|
|
5464
|
+
} from "react";
|
|
5465
|
+
import { jsx as jsx48 } from "@emotion/react/jsx-runtime";
|
|
4110
5466
|
var ObjectSearchContext = createContext5({
|
|
4111
5467
|
onSetQuery: () => {
|
|
4112
5468
|
},
|
|
4113
5469
|
onSelectItem: () => {
|
|
4114
5470
|
},
|
|
4115
|
-
query: {
|
|
4116
|
-
|
|
4117
|
-
keyword: ""
|
|
4118
|
-
},
|
|
5471
|
+
query: {},
|
|
5472
|
+
boundQuery: {},
|
|
4119
5473
|
list: {},
|
|
4120
5474
|
onSetList: () => {
|
|
4121
5475
|
},
|
|
@@ -4124,22 +5478,23 @@ var ObjectSearchContext = createContext5({
|
|
|
4124
5478
|
}
|
|
4125
5479
|
});
|
|
4126
5480
|
var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
4127
|
-
const [query, setQuery] =
|
|
5481
|
+
const [query, setQuery] = useState12({
|
|
4128
5482
|
contentType: "",
|
|
4129
5483
|
keyword: ""
|
|
4130
5484
|
});
|
|
5485
|
+
const { flatVariables } = useVariables(true);
|
|
4131
5486
|
const querySearchDeferred = useDeferredValue(query);
|
|
4132
|
-
const [selectedItems, setSelectedItems] =
|
|
4133
|
-
const [list, setList] =
|
|
5487
|
+
const [selectedItems, setSelectedItems] = useState12(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
5488
|
+
const [list, setList] = useState12({});
|
|
4134
5489
|
const onSetQuery = useCallback(
|
|
4135
|
-
(
|
|
4136
|
-
if (Array.isArray(
|
|
5490
|
+
(value2) => {
|
|
5491
|
+
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
4137
5492
|
return setQuery({
|
|
4138
|
-
...
|
|
4139
|
-
contentType:
|
|
5493
|
+
...value2,
|
|
5494
|
+
contentType: value2.contentType[0].id
|
|
4140
5495
|
});
|
|
4141
5496
|
}
|
|
4142
|
-
return setQuery(
|
|
5497
|
+
return setQuery(value2);
|
|
4143
5498
|
},
|
|
4144
5499
|
[setQuery]
|
|
4145
5500
|
);
|
|
@@ -4161,35 +5516,116 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
4161
5516
|
setSelectedItems([]);
|
|
4162
5517
|
}, [setSelectedItems]);
|
|
4163
5518
|
const onSetList = useCallback(
|
|
4164
|
-
(
|
|
4165
|
-
setList(
|
|
5519
|
+
(value2) => {
|
|
5520
|
+
setList(value2);
|
|
4166
5521
|
},
|
|
4167
5522
|
[setList]
|
|
4168
5523
|
);
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
{
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
5524
|
+
const boundQuery = useMemo8(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
5525
|
+
const value = useMemo8(
|
|
5526
|
+
() => ({
|
|
5527
|
+
boundQuery,
|
|
5528
|
+
onSetQuery,
|
|
5529
|
+
query: querySearchDeferred,
|
|
5530
|
+
onSelectItem,
|
|
5531
|
+
selectedListItems: selectedItems,
|
|
5532
|
+
onRemoveAllSelectedItems,
|
|
5533
|
+
list,
|
|
5534
|
+
onSetList
|
|
5535
|
+
}),
|
|
5536
|
+
[
|
|
5537
|
+
boundQuery,
|
|
5538
|
+
onSetQuery,
|
|
5539
|
+
querySearchDeferred,
|
|
5540
|
+
onSelectItem,
|
|
5541
|
+
selectedItems,
|
|
5542
|
+
onRemoveAllSelectedItems,
|
|
5543
|
+
list,
|
|
5544
|
+
onSetList
|
|
5545
|
+
]
|
|
4183
5546
|
);
|
|
5547
|
+
return /* @__PURE__ */ jsx48(ObjectSearchContext.Provider, { value, children });
|
|
4184
5548
|
};
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
5549
|
+
function useObjectSearchContext() {
|
|
5550
|
+
return useContext7(ObjectSearchContext);
|
|
5551
|
+
}
|
|
5552
|
+
function bindQuery(query, inputs) {
|
|
5553
|
+
const { result, errors } = bindVariablesToObject({
|
|
5554
|
+
value: query,
|
|
5555
|
+
variables: inputs,
|
|
5556
|
+
errorPrefix: "Dynamic input"
|
|
5557
|
+
});
|
|
5558
|
+
if (errors == null ? void 0 : errors.length) {
|
|
5559
|
+
console.error(`Error binding query filters to dynamic inputs`, errors);
|
|
5560
|
+
}
|
|
5561
|
+
return result;
|
|
5562
|
+
}
|
|
5563
|
+
|
|
5564
|
+
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
5565
|
+
import { jsx as jsx49, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
|
|
5566
|
+
var ObjectSearchContainer = ({
|
|
5567
|
+
label,
|
|
5568
|
+
enableDynamicInputToResultId,
|
|
5569
|
+
searchFilters,
|
|
5570
|
+
resultList,
|
|
5571
|
+
children
|
|
5572
|
+
}) => {
|
|
5573
|
+
var _a, _b;
|
|
5574
|
+
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
5575
|
+
const { flatVariables } = useVariables(true);
|
|
5576
|
+
const body = /* @__PURE__ */ jsxs28(VerticalRhythm, { children: [
|
|
5577
|
+
searchFilters,
|
|
5578
|
+
!resultList ? null : /* @__PURE__ */ jsx49(ScrollableList, { role: "list", children: resultList })
|
|
5579
|
+
] });
|
|
5580
|
+
const handleSelectedVariableChange = (selectedValue) => {
|
|
5581
|
+
var _a2;
|
|
5582
|
+
if (!selectedValue) {
|
|
5583
|
+
onSelectItem([]);
|
|
5584
|
+
return;
|
|
5585
|
+
}
|
|
5586
|
+
const { result, errors } = bindVariables({
|
|
5587
|
+
value: selectedValue,
|
|
5588
|
+
variables: flatVariables,
|
|
5589
|
+
errorPrefix: "Dynamic input"
|
|
5590
|
+
});
|
|
5591
|
+
if (!result) {
|
|
5592
|
+
onSelectItem([]);
|
|
5593
|
+
return;
|
|
5594
|
+
}
|
|
5595
|
+
const item = (_a2 = list.items) == null ? void 0 : _a2.find((i2) => i2.id === result);
|
|
5596
|
+
onSelectItem([
|
|
5597
|
+
{
|
|
5598
|
+
title: selectedValue,
|
|
5599
|
+
contentType: (errors == null ? void 0 : errors.length) ? errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
|
|
5600
|
+
// spread any matched list item, overriding the above default props
|
|
5601
|
+
...item,
|
|
5602
|
+
// we want to make sure the ID is our dynamic value
|
|
5603
|
+
id: selectedValue
|
|
5604
|
+
}
|
|
5605
|
+
]);
|
|
5606
|
+
};
|
|
5607
|
+
return /* @__PURE__ */ jsx49(IconsProvider, { children: /* @__PURE__ */ jsxs28(VerticalRhythm, { children: [
|
|
5608
|
+
/* @__PURE__ */ jsx49(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx49(
|
|
5609
|
+
InputVariables,
|
|
5610
|
+
{
|
|
5611
|
+
label,
|
|
5612
|
+
value: (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "",
|
|
5613
|
+
onChange: handleSelectedVariableChange,
|
|
5614
|
+
inputWhenNoVariables: body,
|
|
5615
|
+
disableVariables: !enableDynamicInputToResultId
|
|
5616
|
+
}
|
|
5617
|
+
) : body }),
|
|
5618
|
+
children
|
|
5619
|
+
] }) });
|
|
4188
5620
|
};
|
|
4189
5621
|
|
|
5622
|
+
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
5623
|
+
import { InputKeywordSearch as InputKeywordSearch2, InputSelect as InputSelect6 } from "@uniformdev/design-system";
|
|
5624
|
+
import { useState as useState13 } from "react";
|
|
5625
|
+
|
|
4190
5626
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
4191
|
-
import { css as
|
|
4192
|
-
var ObjectSearchFilterContainerLabel =
|
|
5627
|
+
import { css as css28 } from "@emotion/react";
|
|
5628
|
+
var ObjectSearchFilterContainerLabel = css28`
|
|
4193
5629
|
align-items: center;
|
|
4194
5630
|
display: flex;
|
|
4195
5631
|
font-size: var(--fs-sm);
|
|
@@ -4197,21 +5633,21 @@ var ObjectSearchFilterContainerLabel = css26`
|
|
|
4197
5633
|
line-height: 1rem;
|
|
4198
5634
|
margin-bottom: var(--spacing-sm);
|
|
4199
5635
|
`;
|
|
4200
|
-
var ObjectSearchFilterContainer =
|
|
5636
|
+
var ObjectSearchFilterContainer = css28`
|
|
4201
5637
|
display: grid;
|
|
4202
5638
|
gap: var(--spacing-base);
|
|
4203
5639
|
`;
|
|
4204
|
-
var ObjectSearchFilterDropdownAndTextSearch =
|
|
5640
|
+
var ObjectSearchFilterDropdownAndTextSearch = css28`
|
|
4205
5641
|
grid-template-columns: 0.5fr 1fr;
|
|
4206
5642
|
`;
|
|
4207
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
5643
|
+
var ObjectSearchFilterGrid = (gridColumns) => css28`
|
|
4208
5644
|
display: grid;
|
|
4209
5645
|
grid-template-columns: ${gridColumns};
|
|
4210
5646
|
gap: var(--spacing-base);
|
|
4211
5647
|
`;
|
|
4212
5648
|
|
|
4213
5649
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
4214
|
-
import { jsx as
|
|
5650
|
+
import { jsx as jsx50, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
|
|
4215
5651
|
var ObjectSearchFilter = ({
|
|
4216
5652
|
requireContentType,
|
|
4217
5653
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -4221,7 +5657,7 @@ var ObjectSearchFilter = ({
|
|
|
4221
5657
|
selectOptions
|
|
4222
5658
|
}) => {
|
|
4223
5659
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
4224
|
-
const [searchState, setSearchState] =
|
|
5660
|
+
const [searchState, setSearchState] = useState13({
|
|
4225
5661
|
contentType: "",
|
|
4226
5662
|
keyword: ""
|
|
4227
5663
|
});
|
|
@@ -4231,8 +5667,8 @@ var ObjectSearchFilter = ({
|
|
|
4231
5667
|
});
|
|
4232
5668
|
onSetQuery({ ...query, ...value });
|
|
4233
5669
|
};
|
|
4234
|
-
return /* @__PURE__ */
|
|
4235
|
-
/* @__PURE__ */
|
|
5670
|
+
return /* @__PURE__ */ jsxs29("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
|
|
5671
|
+
/* @__PURE__ */ jsx50(
|
|
4236
5672
|
InputSelect6,
|
|
4237
5673
|
{
|
|
4238
5674
|
label: selectLabel,
|
|
@@ -4248,7 +5684,7 @@ var ObjectSearchFilter = ({
|
|
|
4248
5684
|
value: query.contentType
|
|
4249
5685
|
}
|
|
4250
5686
|
),
|
|
4251
|
-
/* @__PURE__ */
|
|
5687
|
+
/* @__PURE__ */ jsx50(
|
|
4252
5688
|
InputKeywordSearch2,
|
|
4253
5689
|
{
|
|
4254
5690
|
inputFieldName: searchInputName,
|
|
@@ -4263,11 +5699,11 @@ var ObjectSearchFilter = ({
|
|
|
4263
5699
|
};
|
|
4264
5700
|
|
|
4265
5701
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
4266
|
-
import { jsx as
|
|
5702
|
+
import { jsx as jsx51, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
|
|
4267
5703
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
4268
|
-
return /* @__PURE__ */
|
|
4269
|
-
/* @__PURE__ */
|
|
4270
|
-
/* @__PURE__ */
|
|
5704
|
+
return /* @__PURE__ */ jsxs30("div", { children: [
|
|
5705
|
+
label ? /* @__PURE__ */ jsx51("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
5706
|
+
/* @__PURE__ */ jsx51("div", { css: ObjectSearchFilterContainer, children })
|
|
4271
5707
|
] });
|
|
4272
5708
|
};
|
|
4273
5709
|
|
|
@@ -4275,9 +5711,9 @@ var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
|
4275
5711
|
import { Popover } from "@uniformdev/design-system";
|
|
4276
5712
|
|
|
4277
5713
|
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
4278
|
-
import { css as
|
|
5714
|
+
import { css as css29 } from "@emotion/react";
|
|
4279
5715
|
import { skeletonLoading } from "@uniformdev/design-system";
|
|
4280
|
-
var ObjectListItemContainer =
|
|
5716
|
+
var ObjectListItemContainer = css29`
|
|
4281
5717
|
align-items: center;
|
|
4282
5718
|
border: 1px solid var(--gray-300);
|
|
4283
5719
|
border-radius: var(--rounded-base);
|
|
@@ -4290,7 +5726,7 @@ var ObjectListItemContainer = css27`
|
|
|
4290
5726
|
display: none;
|
|
4291
5727
|
}
|
|
4292
5728
|
`;
|
|
4293
|
-
var ObjectListItemLoading =
|
|
5729
|
+
var ObjectListItemLoading = css29`
|
|
4294
5730
|
animation: ${skeletonLoading} 1s linear infinite alternate;
|
|
4295
5731
|
border-color: transparent;
|
|
4296
5732
|
min-height: 42px;
|
|
@@ -4314,37 +5750,37 @@ var ObjectListItemLoading = css27`
|
|
|
4314
5750
|
width: 1rem;
|
|
4315
5751
|
}
|
|
4316
5752
|
`;
|
|
4317
|
-
var ObjectListItemHeadingGroup =
|
|
5753
|
+
var ObjectListItemHeadingGroup = css29`
|
|
4318
5754
|
align-items: center;
|
|
4319
5755
|
display: grid;
|
|
4320
5756
|
`;
|
|
4321
|
-
var ObjectListItemTitle =
|
|
5757
|
+
var ObjectListItemTitle = css29`
|
|
4322
5758
|
color: var(--brand-secondary-1);
|
|
4323
5759
|
display: block;
|
|
4324
5760
|
font-size: var(--fs-sm);
|
|
4325
5761
|
`;
|
|
4326
|
-
var ObjectListItemSubtitle =
|
|
5762
|
+
var ObjectListItemSubtitle = css29`
|
|
4327
5763
|
color: var(--gray-500);
|
|
4328
5764
|
display: block;
|
|
4329
5765
|
font-size: var(--fs-xs);
|
|
4330
5766
|
line-height: 1;
|
|
4331
5767
|
`;
|
|
4332
|
-
var ObjectListItemInfoContainer =
|
|
5768
|
+
var ObjectListItemInfoContainer = css29`
|
|
4333
5769
|
align-items: center;
|
|
4334
5770
|
display: flex;
|
|
4335
5771
|
justify-content: center;
|
|
4336
5772
|
`;
|
|
4337
|
-
var ObjectListItemControlledContent =
|
|
5773
|
+
var ObjectListItemControlledContent = css29`
|
|
4338
5774
|
display: flex;
|
|
4339
5775
|
gap: var(--spacing-sm);
|
|
4340
5776
|
`;
|
|
4341
|
-
var ObjectListItemUnControlledContent =
|
|
5777
|
+
var ObjectListItemUnControlledContent = css29`
|
|
4342
5778
|
margin-top: var(--spacing-sm);
|
|
4343
5779
|
grid-column: 1 / -1;
|
|
4344
5780
|
`;
|
|
4345
5781
|
|
|
4346
5782
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
4347
|
-
import { jsx as
|
|
5783
|
+
import { jsx as jsx52, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
|
|
4348
5784
|
var ObjectSearchListItem = ({
|
|
4349
5785
|
id,
|
|
4350
5786
|
title,
|
|
@@ -4353,8 +5789,7 @@ var ObjectSearchListItem = ({
|
|
|
4353
5789
|
popoverData,
|
|
4354
5790
|
onSelect,
|
|
4355
5791
|
isMulti = false,
|
|
4356
|
-
children
|
|
4357
|
-
...props
|
|
5792
|
+
children
|
|
4358
5793
|
}) => {
|
|
4359
5794
|
const { onSelectItem, selectedListItems } = useObjectSearchContext();
|
|
4360
5795
|
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
@@ -4368,20 +5803,20 @@ var ObjectSearchListItem = ({
|
|
|
4368
5803
|
return onSelectItem([selectedItem]);
|
|
4369
5804
|
};
|
|
4370
5805
|
const hideWhenInSelectedList = selectedListItems.some((item) => item.id === id);
|
|
4371
|
-
return /* @__PURE__ */
|
|
4372
|
-
/* @__PURE__ */
|
|
4373
|
-
!image ? null : /* @__PURE__ */
|
|
4374
|
-
/* @__PURE__ */
|
|
4375
|
-
!contentType ? null : /* @__PURE__ */
|
|
4376
|
-
/* @__PURE__ */
|
|
5806
|
+
return /* @__PURE__ */ jsxs31("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, children: [
|
|
5807
|
+
/* @__PURE__ */ jsxs31("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
|
|
5808
|
+
!image ? null : /* @__PURE__ */ jsx52("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
5809
|
+
/* @__PURE__ */ jsxs31("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
5810
|
+
!contentType ? null : /* @__PURE__ */ jsx52("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
5811
|
+
/* @__PURE__ */ jsx52("span", { css: ObjectListItemTitle, children: title })
|
|
4377
5812
|
] })
|
|
4378
5813
|
] }),
|
|
4379
|
-
!popoverData ? null : /* @__PURE__ */
|
|
4380
|
-
!children ? null : /* @__PURE__ */
|
|
5814
|
+
!popoverData ? null : /* @__PURE__ */ jsx52("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ jsx52(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
|
|
5815
|
+
!children ? null : /* @__PURE__ */ jsx52("div", { css: ObjectListItemUnControlledContent, children })
|
|
4381
5816
|
] });
|
|
4382
5817
|
};
|
|
4383
5818
|
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
4384
|
-
return /* @__PURE__ */
|
|
5819
|
+
return /* @__PURE__ */ jsx52("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
4385
5820
|
};
|
|
4386
5821
|
|
|
4387
5822
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
@@ -4389,9 +5824,9 @@ import { Badge, Button as Button4, Popover as Popover2 } from "@uniformdev/desig
|
|
|
4389
5824
|
import { format as timeagoFormat } from "timeago.js";
|
|
4390
5825
|
|
|
4391
5826
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
4392
|
-
import { css as
|
|
5827
|
+
import { css as css30 } from "@emotion/react";
|
|
4393
5828
|
import { button as button2 } from "@uniformdev/design-system";
|
|
4394
|
-
var ButtonStyles =
|
|
5829
|
+
var ButtonStyles = css30`
|
|
4395
5830
|
${button2}
|
|
4396
5831
|
background: transparent;
|
|
4397
5832
|
border: 1px solid var(--brand-secondary-1);
|
|
@@ -4418,20 +5853,20 @@ var ButtonStyles = css28`
|
|
|
4418
5853
|
text-decoration: none;
|
|
4419
5854
|
}
|
|
4420
5855
|
`;
|
|
4421
|
-
var ButtonIcon =
|
|
5856
|
+
var ButtonIcon = css30`
|
|
4422
5857
|
width: 1rem;
|
|
4423
5858
|
height: 1rem;
|
|
4424
5859
|
`;
|
|
4425
5860
|
|
|
4426
5861
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
4427
|
-
import { jsx as
|
|
5862
|
+
import { jsx as jsx53, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
|
|
4428
5863
|
var ObjectSearchResultItemButton = ({
|
|
4429
5864
|
text,
|
|
4430
5865
|
icon,
|
|
4431
5866
|
...props
|
|
4432
5867
|
}) => {
|
|
4433
|
-
return /* @__PURE__ */
|
|
4434
|
-
!icon ? null : /* @__PURE__ */
|
|
5868
|
+
return /* @__PURE__ */ jsxs32("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
5869
|
+
!icon ? null : /* @__PURE__ */ jsx53(Image, { src: icon, css: ButtonIcon }),
|
|
4435
5870
|
text
|
|
4436
5871
|
] });
|
|
4437
5872
|
};
|
|
@@ -4440,15 +5875,15 @@ var LinkButton = ({
|
|
|
4440
5875
|
icon,
|
|
4441
5876
|
...props
|
|
4442
5877
|
}) => {
|
|
4443
|
-
return /* @__PURE__ */
|
|
4444
|
-
!icon ? null : /* @__PURE__ */
|
|
5878
|
+
return /* @__PURE__ */ jsxs32("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
5879
|
+
!icon ? null : /* @__PURE__ */ jsx53(Image, { src: icon, css: ButtonIcon }),
|
|
4445
5880
|
text
|
|
4446
5881
|
] });
|
|
4447
5882
|
};
|
|
4448
5883
|
|
|
4449
5884
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
4450
|
-
import { css as
|
|
4451
|
-
var ObjectSearchResultItemContainer =
|
|
5885
|
+
import { css as css31 } from "@emotion/react";
|
|
5886
|
+
var ObjectSearchResultItemContainer = css31`
|
|
4452
5887
|
align-items: center;
|
|
4453
5888
|
border: 1px solid var(--gray-300);
|
|
4454
5889
|
border-radius: var(--rounded-base);
|
|
@@ -4464,7 +5899,7 @@ var ObjectSearchResultItemContainer = css29`
|
|
|
4464
5899
|
}
|
|
4465
5900
|
}
|
|
4466
5901
|
`;
|
|
4467
|
-
var ObjectSearchDragHandle =
|
|
5902
|
+
var ObjectSearchDragHandle = css31`
|
|
4468
5903
|
border-left: 2px dotted var(--gray-300);
|
|
4469
5904
|
border-right: 2px dotted var(--gray-300);
|
|
4470
5905
|
position: absolute;
|
|
@@ -4473,41 +5908,41 @@ var ObjectSearchDragHandle = css29`
|
|
|
4473
5908
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
4474
5909
|
opacity: 0;
|
|
4475
5910
|
`;
|
|
4476
|
-
var ObjectSearchResultItemSubtitle =
|
|
5911
|
+
var ObjectSearchResultItemSubtitle = css31`
|
|
4477
5912
|
color: var(--gray-500);
|
|
4478
5913
|
display: block;
|
|
4479
5914
|
font-size: var(--fs-xs);
|
|
4480
5915
|
line-height: 1;
|
|
4481
5916
|
`;
|
|
4482
|
-
var ObjectSearchResultItemTitle =
|
|
5917
|
+
var ObjectSearchResultItemTitle = css31`
|
|
4483
5918
|
align-items: center;
|
|
4484
5919
|
color: var(--brand-secondary-1);
|
|
4485
5920
|
display: flex;
|
|
4486
5921
|
gap: var(--spacing-xs);
|
|
4487
5922
|
`;
|
|
4488
|
-
var ObjectSearchResultItemTimeStamp =
|
|
5923
|
+
var ObjectSearchResultItemTimeStamp = css31`
|
|
4489
5924
|
color: var(--gray-500);
|
|
4490
5925
|
font-size: var(--fs-xs);
|
|
4491
5926
|
`;
|
|
4492
|
-
var ObjectSearchAuthorStateGroup =
|
|
5927
|
+
var ObjectSearchAuthorStateGroup = css31`
|
|
4493
5928
|
align-items: center;
|
|
4494
5929
|
display: flex;
|
|
4495
5930
|
gap: var(--spacing-sm);
|
|
4496
5931
|
`;
|
|
4497
|
-
var ObjectSearchUpdateGroup =
|
|
5932
|
+
var ObjectSearchUpdateGroup = css31`
|
|
4498
5933
|
display: grid;
|
|
4499
5934
|
`;
|
|
4500
|
-
var ObjectSearchContentContainer =
|
|
5935
|
+
var ObjectSearchContentContainer = css31`
|
|
4501
5936
|
display: flex;
|
|
4502
5937
|
gap: var(--spacing-base);
|
|
4503
5938
|
`;
|
|
4504
|
-
var ObjectSearchImage =
|
|
5939
|
+
var ObjectSearchImage = css31`
|
|
4505
5940
|
width: 56px;
|
|
4506
5941
|
object-fit: contain;
|
|
4507
5942
|
`;
|
|
4508
5943
|
|
|
4509
5944
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
4510
|
-
import { jsx as
|
|
5945
|
+
import { jsx as jsx54, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
|
|
4511
5946
|
var ObjectSearchResultItem = ({
|
|
4512
5947
|
id,
|
|
4513
5948
|
title,
|
|
@@ -4528,38 +5963,38 @@ var ObjectSearchResultItem = ({
|
|
|
4528
5963
|
const { onSelectItem } = useObjectSearchContext();
|
|
4529
5964
|
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
4530
5965
|
const onRemoveItem = () => {
|
|
4531
|
-
onSelectItem({ id });
|
|
5966
|
+
onSelectItem({ id, title: id });
|
|
4532
5967
|
onRemove == null ? void 0 : onRemove();
|
|
4533
5968
|
};
|
|
4534
|
-
return /* @__PURE__ */
|
|
4535
|
-
disableDnD ? null : /* @__PURE__ */
|
|
4536
|
-
/* @__PURE__ */
|
|
4537
|
-
!imageUrl ? null : /* @__PURE__ */
|
|
4538
|
-
/* @__PURE__ */
|
|
4539
|
-
/* @__PURE__ */
|
|
4540
|
-
/* @__PURE__ */
|
|
5969
|
+
return /* @__PURE__ */ jsxs33("div", { css: ObjectSearchResultItemContainer, children: [
|
|
5970
|
+
disableDnD ? null : /* @__PURE__ */ jsx54("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
5971
|
+
/* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsxs33("div", { css: ObjectSearchContentContainer, children: [
|
|
5972
|
+
!imageUrl ? null : /* @__PURE__ */ jsx54("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
5973
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
5974
|
+
/* @__PURE__ */ jsx54("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
|
|
5975
|
+
/* @__PURE__ */ jsxs33("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
|
|
4541
5976
|
title != null ? title : name,
|
|
4542
|
-
!popoverData ? null : /* @__PURE__ */
|
|
5977
|
+
!popoverData ? null : /* @__PURE__ */ jsx54(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4543
5978
|
] }),
|
|
4544
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */
|
|
4545
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */
|
|
4546
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */
|
|
4547
|
-
!createdAt ? null : /* @__PURE__ */
|
|
4548
|
-
/* @__PURE__ */
|
|
5979
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs33("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
5980
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx54(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
|
|
5981
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs33("div", { css: ObjectSearchUpdateGroup, children: [
|
|
5982
|
+
!createdAt ? null : /* @__PURE__ */ jsxs33("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
5983
|
+
/* @__PURE__ */ jsx54("strong", { children: "Last updated: " }),
|
|
4549
5984
|
timeagoFormat(createdAt)
|
|
4550
5985
|
] }),
|
|
4551
|
-
!publishedAt ? null : /* @__PURE__ */
|
|
4552
|
-
/* @__PURE__ */
|
|
5986
|
+
!publishedAt ? null : /* @__PURE__ */ jsxs33("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
5987
|
+
/* @__PURE__ */ jsx54("strong", { children: "Last published: " }),
|
|
4553
5988
|
timeagoFormat(publishedAt)
|
|
4554
5989
|
] })
|
|
4555
5990
|
] })
|
|
4556
5991
|
] }),
|
|
4557
|
-
/* @__PURE__ */
|
|
5992
|
+
/* @__PURE__ */ jsx54("div", { children })
|
|
4558
5993
|
] })
|
|
4559
5994
|
] }) }),
|
|
4560
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */
|
|
4561
|
-
!editLink ? null : /* @__PURE__ */
|
|
4562
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
5995
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs33("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
5996
|
+
!editLink ? null : /* @__PURE__ */ jsx54(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
5997
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx54(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
4563
5998
|
] })
|
|
4564
5999
|
] });
|
|
4565
6000
|
};
|
|
@@ -4569,38 +6004,39 @@ import { Button as Button5, Counter } from "@uniformdev/design-system";
|
|
|
4569
6004
|
import { DragDropContext as DragDropContext3, Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
|
|
4570
6005
|
|
|
4571
6006
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
4572
|
-
import { css as
|
|
4573
|
-
var ObjectSearchResultListContainer =
|
|
6007
|
+
import { css as css32 } from "@emotion/react";
|
|
6008
|
+
var ObjectSearchResultListContainer = css32`
|
|
4574
6009
|
align-items: center;
|
|
4575
6010
|
display: flex;
|
|
4576
6011
|
gap: var(--spacing-sm);
|
|
4577
6012
|
justify-content: space-between;
|
|
4578
6013
|
`;
|
|
4579
|
-
var ObjectSearchDragContainer =
|
|
6014
|
+
var ObjectSearchDragContainer = css32`
|
|
4580
6015
|
margin: 0 0 var(--spacing-sm);
|
|
4581
6016
|
`;
|
|
4582
|
-
var ObjectSearchResultListCounterContainer =
|
|
6017
|
+
var ObjectSearchResultListCounterContainer = css32`
|
|
4583
6018
|
align-items: center;
|
|
4584
6019
|
display: flex;
|
|
4585
6020
|
gap: var(--spacing-sm);
|
|
4586
6021
|
`;
|
|
4587
|
-
var ObjectSearchResultListTitle =
|
|
6022
|
+
var ObjectSearchResultListTitle = css32`
|
|
4588
6023
|
font-weight: var(--fw-bold);
|
|
4589
6024
|
line-height: 1;
|
|
4590
6025
|
`;
|
|
4591
6026
|
|
|
4592
6027
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4593
|
-
import { Fragment as
|
|
4594
|
-
|
|
6028
|
+
import { Fragment as Fragment8, jsx as jsx55, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
|
|
6029
|
+
function ObjectSearchResultList({
|
|
4595
6030
|
resultLabelText = "Selected",
|
|
4596
6031
|
removeButtonText = "Remove all",
|
|
4597
6032
|
onRemoveAllSelected,
|
|
4598
6033
|
hideRemoveButton = false,
|
|
4599
6034
|
additionalButtons,
|
|
4600
|
-
renderResultComponent = (value) => /* @__PURE__ */
|
|
6035
|
+
renderResultComponent = (value) => /* @__PURE__ */ jsx55(ObjectSearchResultItem, { ...value, disableDnD }),
|
|
4601
6036
|
multiSelectId,
|
|
4602
|
-
disableDnD = false
|
|
4603
|
-
|
|
6037
|
+
disableDnD = false,
|
|
6038
|
+
whenNothingSelected = null
|
|
6039
|
+
}) {
|
|
4604
6040
|
const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useObjectSearchContext();
|
|
4605
6041
|
const handleRemoveAllSelectedItems = () => {
|
|
4606
6042
|
onRemoveAllSelectedItems();
|
|
@@ -4616,16 +6052,16 @@ var ObjectSearchResultList = ({
|
|
|
4616
6052
|
return result;
|
|
4617
6053
|
}
|
|
4618
6054
|
};
|
|
4619
|
-
return /* @__PURE__ */
|
|
4620
|
-
/* @__PURE__ */
|
|
4621
|
-
/* @__PURE__ */
|
|
4622
|
-
/* @__PURE__ */
|
|
6055
|
+
return /* @__PURE__ */ jsxs34(Fragment8, { children: [
|
|
6056
|
+
/* @__PURE__ */ jsxs34("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
6057
|
+
/* @__PURE__ */ jsxs34("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
6058
|
+
/* @__PURE__ */ jsx55("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
4623
6059
|
" ",
|
|
4624
|
-
!selectedListItems.length ? null : /* @__PURE__ */
|
|
6060
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx55(Counter, { count: selectedListItems.length })
|
|
4625
6061
|
] }),
|
|
4626
|
-
/* @__PURE__ */
|
|
6062
|
+
/* @__PURE__ */ jsxs34("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
4627
6063
|
additionalButtons,
|
|
4628
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
6064
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx55(
|
|
4629
6065
|
Button5,
|
|
4630
6066
|
{
|
|
4631
6067
|
buttonType: "ghostDestructive",
|
|
@@ -4637,10 +6073,10 @@ var ObjectSearchResultList = ({
|
|
|
4637
6073
|
)
|
|
4638
6074
|
] })
|
|
4639
6075
|
] }),
|
|
4640
|
-
!selectedListItems.length ?
|
|
4641
|
-
selectedListItems.map((item,
|
|
6076
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx55(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx55(Droppable3, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs34("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
6077
|
+
selectedListItems.map((item, i2) => {
|
|
4642
6078
|
const renderListItem = renderResultComponent(item);
|
|
4643
|
-
return /* @__PURE__ */
|
|
6079
|
+
return /* @__PURE__ */ jsx55(Draggable3, { draggableId: item.id, index: i2, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ jsx55(
|
|
4644
6080
|
"div",
|
|
4645
6081
|
{
|
|
4646
6082
|
css: ObjectSearchDragContainer,
|
|
@@ -4655,12 +6091,12 @@ var ObjectSearchResultList = ({
|
|
|
4655
6091
|
provided.placeholder
|
|
4656
6092
|
] }) }) })
|
|
4657
6093
|
] });
|
|
4658
|
-
}
|
|
6094
|
+
}
|
|
4659
6095
|
|
|
4660
6096
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
4661
|
-
import { Input as
|
|
4662
|
-
import { useEffect as useEffect9, useState as
|
|
4663
|
-
import { jsx as
|
|
6097
|
+
import { Input as Input6, InputKeywordSearch as InputKeywordSearch3, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
|
|
6098
|
+
import { useEffect as useEffect9, useState as useState14 } from "react";
|
|
6099
|
+
import { jsx as jsx56, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
|
|
4664
6100
|
var QueryFilter = ({
|
|
4665
6101
|
requireContentType,
|
|
4666
6102
|
queryFilterTitle = "Configure Query",
|
|
@@ -4669,9 +6105,10 @@ var QueryFilter = ({
|
|
|
4669
6105
|
contentTypeOptions,
|
|
4670
6106
|
searchInputName = "searchText",
|
|
4671
6107
|
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
6108
|
+
searchInputLabel = "Query",
|
|
4672
6109
|
countLabel = "Count",
|
|
4673
6110
|
countValue = 5,
|
|
4674
|
-
sortLabel = "Sort",
|
|
6111
|
+
sortLabel = "Sort By",
|
|
4675
6112
|
sortOptions,
|
|
4676
6113
|
sortOrderLabel = "Sort Order",
|
|
4677
6114
|
sortOrderOptions = [
|
|
@@ -4688,9 +6125,9 @@ var QueryFilter = ({
|
|
|
4688
6125
|
],
|
|
4689
6126
|
children
|
|
4690
6127
|
}) => {
|
|
4691
|
-
var _a, _b;
|
|
6128
|
+
var _a, _b, _c, _d;
|
|
4692
6129
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
4693
|
-
const [queryState, setQueryState] =
|
|
6130
|
+
const [queryState, setQueryState] = useState14({
|
|
4694
6131
|
contentType: "",
|
|
4695
6132
|
keyword: "",
|
|
4696
6133
|
count: countValue != null ? countValue : 5,
|
|
@@ -4704,84 +6141,142 @@ var QueryFilter = ({
|
|
|
4704
6141
|
useEffect9(() => {
|
|
4705
6142
|
onSetQuery(queryState);
|
|
4706
6143
|
}, [onSetQuery, queryState]);
|
|
4707
|
-
return /* @__PURE__ */
|
|
4708
|
-
/* @__PURE__ */
|
|
4709
|
-
/* @__PURE__ */
|
|
4710
|
-
/* @__PURE__ */
|
|
4711
|
-
|
|
4712
|
-
|
|
6144
|
+
return /* @__PURE__ */ jsxs35("fieldset", { children: [
|
|
6145
|
+
/* @__PURE__ */ jsx56("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
6146
|
+
/* @__PURE__ */ jsx56("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
|
|
6147
|
+
/* @__PURE__ */ jsx56(
|
|
6148
|
+
InputVariables,
|
|
6149
|
+
{
|
|
6150
|
+
label: searchInputLabel,
|
|
6151
|
+
value: (_c = queryState.keyword) != null ? _c : "",
|
|
6152
|
+
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
6153
|
+
disableInlineMenu: true,
|
|
6154
|
+
id: "qf_searchText",
|
|
6155
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
6156
|
+
InputKeywordSearch3,
|
|
6157
|
+
{
|
|
6158
|
+
id: "qf_searchText",
|
|
6159
|
+
inputFieldName: searchInputName,
|
|
6160
|
+
placeholder: searchInputPlaceholderText,
|
|
6161
|
+
onSearchTextChanged: (e) => handleFilterChange({ keyword: e }),
|
|
6162
|
+
disabledFieldSubmission: true,
|
|
6163
|
+
onClear: () => handleFilterChange({ keyword: "" }),
|
|
6164
|
+
value: queryState.keyword
|
|
6165
|
+
}
|
|
6166
|
+
)
|
|
6167
|
+
}
|
|
6168
|
+
),
|
|
6169
|
+
/* @__PURE__ */ jsxs35("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
|
|
6170
|
+
/* @__PURE__ */ jsx56(
|
|
6171
|
+
InputVariables,
|
|
4713
6172
|
{
|
|
4714
6173
|
label: contentTypeLabel,
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
6174
|
+
id: "qf_contentType",
|
|
6175
|
+
value: (_d = queryState.contentType) != null ? _d : "",
|
|
6176
|
+
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
6177
|
+
disableInlineMenu: true,
|
|
6178
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
6179
|
+
InputSelect7,
|
|
6180
|
+
{
|
|
6181
|
+
id: "qf_contentType",
|
|
6182
|
+
label: contentTypeLabel,
|
|
6183
|
+
showLabel: false,
|
|
6184
|
+
options: [
|
|
6185
|
+
...!requireContentType ? [{ id: "", label: typeSelectorAllTypesOptionText }] : [],
|
|
6186
|
+
...contentTypeOptions ? contentTypeOptions.map((option) => {
|
|
6187
|
+
var _a2;
|
|
6188
|
+
return { id: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
|
|
6189
|
+
}) : []
|
|
6190
|
+
],
|
|
6191
|
+
onChange: (e) => handleFilterChange({ contentType: e.target.value }),
|
|
6192
|
+
value: queryState.contentType
|
|
6193
|
+
}
|
|
6194
|
+
)
|
|
4725
6195
|
}
|
|
4726
6196
|
),
|
|
4727
|
-
/* @__PURE__ */
|
|
4728
|
-
|
|
6197
|
+
/* @__PURE__ */ jsx56(
|
|
6198
|
+
InputVariables,
|
|
4729
6199
|
{
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
6200
|
+
label: countLabel,
|
|
6201
|
+
id: "qf_count",
|
|
6202
|
+
value: queryState.count.toString(10),
|
|
6203
|
+
onChange: (newCount) => handleFilterChange({ count: newCount }),
|
|
6204
|
+
disableInlineMenu: true,
|
|
6205
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
6206
|
+
Input6,
|
|
6207
|
+
{
|
|
6208
|
+
id: "qf_count",
|
|
6209
|
+
label: countLabel,
|
|
6210
|
+
showLabel: false,
|
|
6211
|
+
type: "number",
|
|
6212
|
+
onChange: (e) => handleFilterChange({ count: e.target.value }),
|
|
6213
|
+
defaultValue: countValue,
|
|
6214
|
+
value: queryState.count
|
|
6215
|
+
}
|
|
6216
|
+
)
|
|
4736
6217
|
}
|
|
4737
6218
|
)
|
|
4738
6219
|
] }),
|
|
4739
|
-
/* @__PURE__ */
|
|
4740
|
-
/* @__PURE__ */
|
|
4741
|
-
|
|
6220
|
+
/* @__PURE__ */ jsxs35("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
|
|
6221
|
+
/* @__PURE__ */ jsx56(
|
|
6222
|
+
InputVariables,
|
|
4742
6223
|
{
|
|
6224
|
+
id: "qf_sortBy",
|
|
4743
6225
|
label: sortLabel,
|
|
4744
|
-
|
|
6226
|
+
value: queryState.sortBy,
|
|
6227
|
+
onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
|
|
6228
|
+
disableInlineMenu: true,
|
|
6229
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
6230
|
+
InputSelect7,
|
|
4745
6231
|
{
|
|
4746
|
-
label:
|
|
4747
|
-
id: ""
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
6232
|
+
label: sortLabel,
|
|
6233
|
+
id: "qf_sortBy",
|
|
6234
|
+
showLabel: false,
|
|
6235
|
+
options: [
|
|
6236
|
+
{
|
|
6237
|
+
label: "Select a sort",
|
|
6238
|
+
id: ""
|
|
6239
|
+
},
|
|
6240
|
+
...sortOptions ? sortOptions.map((option) => {
|
|
6241
|
+
var _a2;
|
|
6242
|
+
return { id: option.id, name: option.name, label: (_a2 = option.label) != null ? _a2 : option.name };
|
|
6243
|
+
}) : []
|
|
6244
|
+
],
|
|
6245
|
+
onChange: (e) => handleFilterChange({ sortBy: e.target.value }),
|
|
6246
|
+
value: queryState.sortBy
|
|
6247
|
+
}
|
|
6248
|
+
)
|
|
4756
6249
|
}
|
|
4757
6250
|
),
|
|
4758
|
-
/* @__PURE__ */
|
|
4759
|
-
|
|
6251
|
+
/* @__PURE__ */ jsx56(
|
|
6252
|
+
InputVariables,
|
|
4760
6253
|
{
|
|
4761
6254
|
label: sortOrderLabel,
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
6255
|
+
id: "qf_sortOrder",
|
|
6256
|
+
value: queryState.sortOrder,
|
|
6257
|
+
onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
|
|
6258
|
+
disableInlineMenu: true,
|
|
6259
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx56(
|
|
6260
|
+
InputSelect7,
|
|
6261
|
+
{
|
|
6262
|
+
label: sortOrderLabel,
|
|
6263
|
+
id: "qf_sortOrder",
|
|
6264
|
+
showLabel: false,
|
|
6265
|
+
options: [
|
|
6266
|
+
...sortOrderOptions ? sortOrderOptions.map((option) => {
|
|
6267
|
+
var _a2;
|
|
6268
|
+
return { value: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
|
|
6269
|
+
}) : []
|
|
6270
|
+
],
|
|
6271
|
+
onChange: (e) => handleFilterChange({ sortOrder: e.target.value }),
|
|
6272
|
+
value: queryState.sortOrder
|
|
6273
|
+
}
|
|
6274
|
+
)
|
|
4780
6275
|
}
|
|
4781
6276
|
)
|
|
4782
6277
|
] }),
|
|
4783
6278
|
children
|
|
4784
|
-
] })
|
|
6279
|
+
] }) })
|
|
4785
6280
|
] });
|
|
4786
6281
|
};
|
|
4787
6282
|
|
|
@@ -4802,7 +6297,7 @@ import {
|
|
|
4802
6297
|
Button as Button6,
|
|
4803
6298
|
Callout as Callout5,
|
|
4804
6299
|
Heading,
|
|
4805
|
-
Input as
|
|
6300
|
+
Input as Input7,
|
|
4806
6301
|
InputComboBox,
|
|
4807
6302
|
InputKeywordSearch as InputKeywordSearch4,
|
|
4808
6303
|
InputSelect as InputSelect8,
|
|
@@ -4839,7 +6334,9 @@ export {
|
|
|
4839
6334
|
Callout5 as Callout,
|
|
4840
6335
|
DamSelectedItem,
|
|
4841
6336
|
DataRefreshButton,
|
|
6337
|
+
DataResourceDynamicInputProvider,
|
|
4842
6338
|
DataResourceVariablesList,
|
|
6339
|
+
DataResourceVariablesListExplicit,
|
|
4843
6340
|
DataSourceEditor,
|
|
4844
6341
|
DataTypeEditor,
|
|
4845
6342
|
DefaultSearchRow,
|
|
@@ -4847,7 +6344,7 @@ export {
|
|
|
4847
6344
|
EntrySearch,
|
|
4848
6345
|
Heading,
|
|
4849
6346
|
icons_exports as Icons,
|
|
4850
|
-
|
|
6347
|
+
Input7 as Input,
|
|
4851
6348
|
InputComboBox,
|
|
4852
6349
|
InputKeywordSearch4 as InputKeywordSearch,
|
|
4853
6350
|
InputSelect8 as InputSelect,
|
|
@@ -4986,5 +6483,8 @@ export {
|
|
|
4986
6483
|
useRequestParameter,
|
|
4987
6484
|
useUniformMeshSdk,
|
|
4988
6485
|
useVariables,
|
|
6486
|
+
variableExpression,
|
|
6487
|
+
variablePrefix,
|
|
6488
|
+
variableSuffix,
|
|
4989
6489
|
variablesToList
|
|
4990
6490
|
};
|