@uniformdev/mesh-sdk-react 20.72.4-alpha.6 → 20.73.1-alpha.13
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.mts +67 -5
- package/dist/index.d.ts +67 -5
- package/dist/index.esm.js +229 -123
- package/dist/index.js +464 -354
- package/dist/index.mjs +229 -123
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -249,6 +249,40 @@ var SvgPlus = (props) => /* @__PURE__ */ jsx14(
|
|
|
249
249
|
);
|
|
250
250
|
var Plus_default = SvgPlus;
|
|
251
251
|
|
|
252
|
+
// src/hooks/createDelegationFetch.ts
|
|
253
|
+
import { CSRF_HEADER_NAME, CSRF_HEADER_VALUE, DELEGATION_EXPIRED_CODE } from "@uniformdev/mesh-sdk";
|
|
254
|
+
async function isDelegationExpiredResponse(response) {
|
|
255
|
+
if (response.status !== 401) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
try {
|
|
259
|
+
const body = await response.clone().json();
|
|
260
|
+
return typeof body.code === "string" && body.code === DELEGATION_EXPIRED_CODE;
|
|
261
|
+
} catch (e) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function createDelegationFetch(options) {
|
|
266
|
+
var _a, _b;
|
|
267
|
+
const fetchFn = (_a = options.fetch) != null ? _a : fetch;
|
|
268
|
+
const isExpired = (_b = options.isDelegationExpired) != null ? _b : isDelegationExpiredResponse;
|
|
269
|
+
return async (input3, init) => {
|
|
270
|
+
const headers = new Headers(init == null ? void 0 : init.headers);
|
|
271
|
+
headers.set(CSRF_HEADER_NAME, CSRF_HEADER_VALUE);
|
|
272
|
+
const initWithCsrf = { ...init, headers };
|
|
273
|
+
const response = await fetchFn(input3, initWithCsrf);
|
|
274
|
+
if (!await isExpired(response)) {
|
|
275
|
+
return response;
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
await options.reacquire();
|
|
279
|
+
} catch (e) {
|
|
280
|
+
return response;
|
|
281
|
+
}
|
|
282
|
+
return fetchFn(input3, initWithCsrf);
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
252
286
|
// src/hooks/useConnectedDataAsVariables.tsx
|
|
253
287
|
import { useMemo } from "react";
|
|
254
288
|
function useConnectedDataAsVariables(connectedData) {
|
|
@@ -283,12 +317,28 @@ function useDelegation() {
|
|
|
283
317
|
return ctx;
|
|
284
318
|
}
|
|
285
319
|
|
|
320
|
+
// src/hooks/useDelegationFetch.ts
|
|
321
|
+
import { useMemo as useMemo2 } from "react";
|
|
322
|
+
function useDelegationFetch(options) {
|
|
323
|
+
const { reacquire } = useDelegation();
|
|
324
|
+
const fetchImpl = options == null ? void 0 : options.fetch;
|
|
325
|
+
const isDelegationExpired = options == null ? void 0 : options.isDelegationExpired;
|
|
326
|
+
return useMemo2(
|
|
327
|
+
() => createDelegationFetch({
|
|
328
|
+
reacquire,
|
|
329
|
+
fetch: fetchImpl,
|
|
330
|
+
isDelegationExpired
|
|
331
|
+
}),
|
|
332
|
+
[reacquire, fetchImpl, isDelegationExpired]
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
286
336
|
// src/hooks/useDynamicInputsAsVariables.tsx
|
|
287
337
|
import { LOCALE_DYNAMIC_INPUT_NAME } from "@uniformdev/canvas";
|
|
288
|
-
import { useMemo as
|
|
338
|
+
import { useMemo as useMemo3 } from "react";
|
|
289
339
|
import { Fragment, jsx as jsx15 } from "@emotion/react/jsx-runtime";
|
|
290
340
|
function useDynamicInputsAsVariables(dynamicInputs) {
|
|
291
|
-
return
|
|
341
|
+
return useMemo3(() => {
|
|
292
342
|
const result = Object.entries(dynamicInputs).reduce(
|
|
293
343
|
(acc, [name2, input3]) => {
|
|
294
344
|
const source = `from ${name2 === LOCALE_DYNAMIC_INPUT_NAME ? "current locale" : input3.type === "path" ? "URL path" : "query string"}`;
|
|
@@ -323,10 +373,10 @@ Current preview value: ${input3.value || "not provided"}`
|
|
|
323
373
|
}
|
|
324
374
|
|
|
325
375
|
// src/hooks/useMeshLocation.ts
|
|
326
|
-
import { useMemo as
|
|
376
|
+
import { useMemo as useMemo5, useRef } from "react";
|
|
327
377
|
|
|
328
378
|
// src/components/UniformMeshLocationContext.tsx
|
|
329
|
-
import { createContext as createContext3, useContext as useContext3, useMemo as
|
|
379
|
+
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo4, useState } from "react";
|
|
330
380
|
|
|
331
381
|
// src/components/UniformMeshSdkContext.tsx
|
|
332
382
|
import { Theme } from "@uniformdev/design-system";
|
|
@@ -355,7 +405,7 @@ var UniformMeshLocationContextProvider = ({
|
|
|
355
405
|
}) => {
|
|
356
406
|
const sdk = useUniformMeshSdk();
|
|
357
407
|
const [location, setLocation] = useState(sdk.getCurrentLocation());
|
|
358
|
-
|
|
408
|
+
useMemo4(() => {
|
|
359
409
|
const valueChangeListener = (event) => {
|
|
360
410
|
setLocation((old) => ({ ...old, value: event.newValue }));
|
|
361
411
|
};
|
|
@@ -387,7 +437,7 @@ function useMeshLocation(expectedLocation) {
|
|
|
387
437
|
}
|
|
388
438
|
const backdoorLocation = useRef(location);
|
|
389
439
|
backdoorLocation.current = location;
|
|
390
|
-
const stabilizedSetValueProxy =
|
|
440
|
+
const stabilizedSetValueProxy = useMemo5(
|
|
391
441
|
() => (dispatch) => {
|
|
392
442
|
const { newValue, options } = dispatch(backdoorLocation.current.value);
|
|
393
443
|
backdoorLocation.current.setValue(newValue, options);
|
|
@@ -704,7 +754,7 @@ import {
|
|
|
704
754
|
createCommand,
|
|
705
755
|
SKIP_DOM_SELECTION_TAG
|
|
706
756
|
} from "lexical";
|
|
707
|
-
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as
|
|
757
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo7, useRef as useRef3, useState as useState4 } from "react";
|
|
708
758
|
import { createPortal } from "react-dom";
|
|
709
759
|
|
|
710
760
|
// src/components/Variables/toolbox/SelectVariableMenu.styles.ts
|
|
@@ -738,7 +788,7 @@ var variablesTipText = css`
|
|
|
738
788
|
|
|
739
789
|
// src/components/Variables/VariablesProvider.tsx
|
|
740
790
|
import mitt from "mitt";
|
|
741
|
-
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect3, useMemo as
|
|
791
|
+
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect3, useMemo as useMemo6, useState as useState3 } from "react";
|
|
742
792
|
|
|
743
793
|
// src/components/Variables/util/useVariableEditTransaction.ts
|
|
744
794
|
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -940,7 +990,7 @@ function VariablesProvider({
|
|
|
940
990
|
}) {
|
|
941
991
|
const [editing, setEditing] = useState3();
|
|
942
992
|
const [editingContext, setEditingContext] = useState3();
|
|
943
|
-
const events =
|
|
993
|
+
const events = useMemo6(
|
|
944
994
|
() => mitt(),
|
|
945
995
|
[]
|
|
946
996
|
);
|
|
@@ -948,7 +998,7 @@ function VariablesProvider({
|
|
|
948
998
|
throw new Error("onChange must be provided when readOnly is false");
|
|
949
999
|
}
|
|
950
1000
|
const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
951
|
-
const valueBasedContextValue =
|
|
1001
|
+
const valueBasedContextValue = useMemo6(
|
|
952
1002
|
() => ({
|
|
953
1003
|
flatVariables: flattenVariables(value),
|
|
954
1004
|
dispatch: (event) => {
|
|
@@ -992,7 +1042,7 @@ function VariablesProvider({
|
|
|
992
1042
|
isEditing: typeof editing !== "undefined",
|
|
993
1043
|
variables: value
|
|
994
1044
|
});
|
|
995
|
-
const contextValue =
|
|
1045
|
+
const contextValue = useMemo6(() => {
|
|
996
1046
|
return {
|
|
997
1047
|
...valueBasedContextValue,
|
|
998
1048
|
editVariableTxn,
|
|
@@ -1200,7 +1250,7 @@ function useVariablesMenu({
|
|
|
1200
1250
|
[canDispatch, enableEditingVariables, readOnly]
|
|
1201
1251
|
);
|
|
1202
1252
|
const canAddVariable = canDispatch && showAddVariableMenuOption && !readOnly;
|
|
1203
|
-
const { groupedVariables, menuOptions } =
|
|
1253
|
+
const { groupedVariables, menuOptions } = useMemo7(() => {
|
|
1204
1254
|
const groupedVariables2 = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
|
|
1205
1255
|
if (canAddVariable) {
|
|
1206
1256
|
groupedVariables2.unshift({
|
|
@@ -1287,7 +1337,7 @@ function VariablesPlugin({
|
|
|
1287
1337
|
filterVariable,
|
|
1288
1338
|
getEditorContext
|
|
1289
1339
|
});
|
|
1290
|
-
const { filteredGroupedVariables, filteredMenuOptions } =
|
|
1340
|
+
const { filteredGroupedVariables, filteredMenuOptions } = useMemo7(() => {
|
|
1291
1341
|
if (!queryString) {
|
|
1292
1342
|
return {
|
|
1293
1343
|
filteredGroupedVariables: groupedVariables,
|
|
@@ -2067,7 +2117,7 @@ var inputMultiLine = (lines) => css5`
|
|
|
2067
2117
|
|
|
2068
2118
|
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
2069
2119
|
import { hasReferencedVariables } from "@uniformdev/canvas";
|
|
2070
|
-
import { useEffect as useEffect7, useMemo as
|
|
2120
|
+
import { useEffect as useEffect7, useMemo as useMemo8, useState as useState5 } from "react";
|
|
2071
2121
|
function useInputVariablesState({
|
|
2072
2122
|
value,
|
|
2073
2123
|
onChange,
|
|
@@ -2099,7 +2149,7 @@ function useInputVariablesState({
|
|
|
2099
2149
|
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
|
|
2100
2150
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
2101
2151
|
const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
|
|
2102
|
-
const sharedMenuProps =
|
|
2152
|
+
const sharedMenuProps = useMemo8(
|
|
2103
2153
|
() => ({
|
|
2104
2154
|
menuTooltip,
|
|
2105
2155
|
showAddVariableMenuOption,
|
|
@@ -2297,7 +2347,7 @@ import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
|
2297
2347
|
import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
|
|
2298
2348
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
2299
2349
|
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
2300
|
-
import { useMemo as
|
|
2350
|
+
import { useEffect as useEffect10, useMemo as useMemo9, useRef as useRef5, useState as useState6 } from "react";
|
|
2301
2351
|
|
|
2302
2352
|
// src/components/Variables/composer/DisablePlugin.tsx
|
|
2303
2353
|
import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -2324,6 +2374,13 @@ function SingleLineTextPlugin() {
|
|
|
2324
2374
|
return null;
|
|
2325
2375
|
}
|
|
2326
2376
|
|
|
2377
|
+
// src/components/Variables/toolbox/useVariablesComposerFlushPending.ts
|
|
2378
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
2379
|
+
var VariablesComposerFlushPendingContext = createContext5(false);
|
|
2380
|
+
function useVariablesComposerFlushPending() {
|
|
2381
|
+
return useContext5(VariablesComposerFlushPendingContext);
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2327
2384
|
// src/components/Variables/toolbox/VariablesComposer.tsx
|
|
2328
2385
|
import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs10 } from "@emotion/react/jsx-runtime";
|
|
2329
2386
|
function VariablesComposer(props) {
|
|
@@ -2338,7 +2395,8 @@ function VariablesComposer(props) {
|
|
|
2338
2395
|
...variablesPluginProps
|
|
2339
2396
|
} = props;
|
|
2340
2397
|
const [lastEmittedValue, setLastEmittedValue] = useState6(value);
|
|
2341
|
-
const
|
|
2398
|
+
const [flushPending, setFlushPending] = useState6(false);
|
|
2399
|
+
const editorConfig = useMemo9(
|
|
2342
2400
|
() => ({
|
|
2343
2401
|
namespace: "uniform",
|
|
2344
2402
|
onError(error) {
|
|
@@ -2352,6 +2410,24 @@ function VariablesComposer(props) {
|
|
|
2352
2410
|
);
|
|
2353
2411
|
const editorState = useRef5(void 0);
|
|
2354
2412
|
const updateTimeout = useRef5(void 0);
|
|
2413
|
+
const flushDepsRef = useRef5({ onChange, lastEmittedValue });
|
|
2414
|
+
flushDepsRef.current = { onChange, lastEmittedValue };
|
|
2415
|
+
useEffect10(
|
|
2416
|
+
() => () => {
|
|
2417
|
+
if (!updateTimeout.current) {
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2420
|
+
clearTimeout(updateTimeout.current);
|
|
2421
|
+
const { onChange: emit, lastEmittedValue: lastEmitted } = flushDepsRef.current;
|
|
2422
|
+
const valueToEmit = editorState.current ? serializeVariablesEditorState(editorState.current) : void 0;
|
|
2423
|
+
const shouldEmit = editorState.current != null && valueToEmit !== lastEmitted;
|
|
2424
|
+
if (!shouldEmit) {
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
queueMicrotask(() => emit(valueToEmit));
|
|
2428
|
+
},
|
|
2429
|
+
[]
|
|
2430
|
+
);
|
|
2355
2431
|
if (typeof document === "undefined") return null;
|
|
2356
2432
|
return /* @__PURE__ */ jsxs10(LexicalComposer, { initialConfig: editorConfig, children: [
|
|
2357
2433
|
/* @__PURE__ */ jsx26(
|
|
@@ -2363,6 +2439,7 @@ function VariablesComposer(props) {
|
|
|
2363
2439
|
if (updateTimeout.current) {
|
|
2364
2440
|
clearTimeout(updateTimeout.current);
|
|
2365
2441
|
}
|
|
2442
|
+
setFlushPending(true);
|
|
2366
2443
|
updateTimeout.current = window.setTimeout(() => {
|
|
2367
2444
|
if (editorState.current) {
|
|
2368
2445
|
const valueToEmit = serializeVariablesEditorState(editorState.current);
|
|
@@ -2371,6 +2448,8 @@ function VariablesComposer(props) {
|
|
|
2371
2448
|
onChange(valueToEmit);
|
|
2372
2449
|
}
|
|
2373
2450
|
}
|
|
2451
|
+
setFlushPending(false);
|
|
2452
|
+
updateTimeout.current = void 0;
|
|
2374
2453
|
}, 400);
|
|
2375
2454
|
}
|
|
2376
2455
|
}
|
|
@@ -2380,7 +2459,7 @@ function VariablesComposer(props) {
|
|
|
2380
2459
|
/* @__PURE__ */ jsx26(VariablesPlugin, { ...variablesPluginProps }),
|
|
2381
2460
|
/* @__PURE__ */ jsx26(DisablePlugin, { disabled }),
|
|
2382
2461
|
/* @__PURE__ */ jsx26(Fragment5, { children: autoFocus ? /* @__PURE__ */ jsx26(AutoFocusPlugin, {}) : null }),
|
|
2383
|
-
/* @__PURE__ */ jsx26(
|
|
2462
|
+
/* @__PURE__ */ jsx26(VariablesComposerFlushPendingContext.Provider, { value: flushPending, children })
|
|
2384
2463
|
] });
|
|
2385
2464
|
}
|
|
2386
2465
|
|
|
@@ -2405,18 +2484,27 @@ import {
|
|
|
2405
2484
|
CUT_COMMAND,
|
|
2406
2485
|
PASTE_COMMAND as PASTE_COMMAND2
|
|
2407
2486
|
} from "lexical";
|
|
2408
|
-
import { useEffect as
|
|
2487
|
+
import { useEffect as useEffect11 } from "react";
|
|
2409
2488
|
import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs11 } from "@emotion/react/jsx-runtime";
|
|
2410
2489
|
function VariablesComposerInput({
|
|
2411
2490
|
css: css24,
|
|
2412
2491
|
placeholder,
|
|
2413
2492
|
...contentEditableProps
|
|
2414
2493
|
}) {
|
|
2494
|
+
const flushPending = useVariablesComposerFlushPending();
|
|
2415
2495
|
return /* @__PURE__ */ jsxs11("div", { children: [
|
|
2416
2496
|
/* @__PURE__ */ jsx27(
|
|
2417
2497
|
PlainTextPlugin,
|
|
2418
2498
|
{
|
|
2419
|
-
contentEditable: /* @__PURE__ */ jsx27(
|
|
2499
|
+
contentEditable: /* @__PURE__ */ jsx27(
|
|
2500
|
+
ContentEditable,
|
|
2501
|
+
{
|
|
2502
|
+
...contentEditableProps,
|
|
2503
|
+
"data-flush-pending": flushPending,
|
|
2504
|
+
placeholder: null,
|
|
2505
|
+
"aria-placeholder": void 0
|
|
2506
|
+
}
|
|
2507
|
+
),
|
|
2420
2508
|
placeholder: placeholder ? /* @__PURE__ */ jsx27(Fragment6, { children: placeholder }) : null,
|
|
2421
2509
|
ErrorBoundary: LexicalErrorBoundary
|
|
2422
2510
|
}
|
|
@@ -2427,7 +2515,7 @@ function VariablesComposerInput({
|
|
|
2427
2515
|
}
|
|
2428
2516
|
function RichishCopyAndPastePlugin() {
|
|
2429
2517
|
const [editor] = useLexicalComposerContext9();
|
|
2430
|
-
|
|
2518
|
+
useEffect11(() => {
|
|
2431
2519
|
return mergeRegister4(
|
|
2432
2520
|
editor.registerCommand(
|
|
2433
2521
|
COPY_COMMAND,
|
|
@@ -2682,7 +2770,7 @@ function InputVariablesOverlayMenu({
|
|
|
2682
2770
|
import { CgUsbC as CgUsbC2 } from "@react-icons/all-files/cg/CgUsbC";
|
|
2683
2771
|
import { bindVariablesToObject } from "@uniformdev/canvas";
|
|
2684
2772
|
import { HorizontalRhythm as HorizontalRhythm5, Menu as Menu2 } from "@uniformdev/design-system";
|
|
2685
|
-
import { useMemo as
|
|
2773
|
+
import { useMemo as useMemo10 } from "react";
|
|
2686
2774
|
import { jsx as jsx29, jsxs as jsxs13 } from "@emotion/react/jsx-runtime";
|
|
2687
2775
|
function ParameterConnectionIndicator({
|
|
2688
2776
|
children,
|
|
@@ -2693,7 +2781,7 @@ function ParameterConnectionIndicator({
|
|
|
2693
2781
|
overrideMenuButtonParentMargin,
|
|
2694
2782
|
renderMenuInPortal = false
|
|
2695
2783
|
}) {
|
|
2696
|
-
const hasVariablesInValue =
|
|
2784
|
+
const hasVariablesInValue = useMemo10(() => {
|
|
2697
2785
|
let result = false;
|
|
2698
2786
|
bindVariablesToObject({
|
|
2699
2787
|
value,
|
|
@@ -2744,7 +2832,7 @@ import { useCallback as useCallback4 } from "react";
|
|
|
2744
2832
|
import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
|
|
2745
2833
|
import { mergeRegister as mergeRegister5 } from "@lexical/utils";
|
|
2746
2834
|
import { $getNodeByKey as $getNodeByKey3, COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH3 } from "lexical";
|
|
2747
|
-
import { useEffect as
|
|
2835
|
+
import { useEffect as useEffect12, useRef as useRef6 } from "react";
|
|
2748
2836
|
function OnDisconnectPlugin({
|
|
2749
2837
|
onDisconnect
|
|
2750
2838
|
}) {
|
|
@@ -2752,7 +2840,7 @@ function OnDisconnectPlugin({
|
|
|
2752
2840
|
const { variables } = useVariables(true);
|
|
2753
2841
|
const variablesRef = useRef6(variables);
|
|
2754
2842
|
variablesRef.current = variables;
|
|
2755
|
-
|
|
2843
|
+
useEffect12(() => {
|
|
2756
2844
|
return mergeRegister5(
|
|
2757
2845
|
editor.registerCommand(
|
|
2758
2846
|
DISCONNECT_VARIABLE_COMMAND,
|
|
@@ -3665,7 +3753,7 @@ function RequestParameters({
|
|
|
3665
3753
|
|
|
3666
3754
|
// src/components/Request/RequestUrl.tsx
|
|
3667
3755
|
import { css as css13 } from "@emotion/react";
|
|
3668
|
-
import { useMemo as
|
|
3756
|
+
import { useMemo as useMemo12 } from "react";
|
|
3669
3757
|
|
|
3670
3758
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
3671
3759
|
function urlEncodeRequestUrl(url, varValues) {
|
|
@@ -3691,7 +3779,7 @@ function RequestUrl() {
|
|
|
3691
3779
|
var _a, _b;
|
|
3692
3780
|
const { variables } = useVariables();
|
|
3693
3781
|
const { request } = useRequest();
|
|
3694
|
-
const mergedParameters =
|
|
3782
|
+
const mergedParameters = useMemo12(() => {
|
|
3695
3783
|
var _a2;
|
|
3696
3784
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
3697
3785
|
return request.parameters;
|
|
@@ -3936,7 +4024,7 @@ function convertRequestDataToDataType(dataType, requestData) {
|
|
|
3936
4024
|
|
|
3937
4025
|
// src/components/Delegation/DelegationGate.tsx
|
|
3938
4026
|
import { Callout as Callout3, LoadingOverlay } from "@uniformdev/design-system";
|
|
3939
|
-
import { useEffect as
|
|
4027
|
+
import { useEffect as useEffect13 } from "react";
|
|
3940
4028
|
|
|
3941
4029
|
// src/components/Delegation/styles/DelegationGate.style.ts
|
|
3942
4030
|
import { css as css14 } from "@emotion/react";
|
|
@@ -3954,7 +4042,7 @@ function DefaultDelegationDisabled() {
|
|
|
3954
4042
|
return /* @__PURE__ */ jsx46(Callout3, { type: "caution", title: "Feature unavailable", children: "This app requires permissions that are not currently enabled. Please contact your Uniform administrator to enable identity delegation for this integration." });
|
|
3955
4043
|
}
|
|
3956
4044
|
function DefaultDelegationError({ error }) {
|
|
3957
|
-
|
|
4045
|
+
useEffect13(() => {
|
|
3958
4046
|
console.error("Delegation connection failed", error);
|
|
3959
4047
|
}, [error]);
|
|
3960
4048
|
return /* @__PURE__ */ jsx46(Callout3, { type: "error", title: "Connection error", children: /* @__PURE__ */ jsx46("p", { children: "Failed to connect to Uniform. Try again, or contact your administrator if the problem persists." }) });
|
|
@@ -3989,9 +4077,15 @@ function DelegationGate({
|
|
|
3989
4077
|
}
|
|
3990
4078
|
|
|
3991
4079
|
// src/components/Delegation/DelegationProvider.tsx
|
|
3992
|
-
import { useCallback as useCallback5, useEffect as
|
|
4080
|
+
import { useCallback as useCallback5, useEffect as useEffect14, useMemo as useMemo13, useRef as useRef7, useState as useState11 } from "react";
|
|
3993
4081
|
import { jsx as jsx47 } from "@emotion/react/jsx-runtime";
|
|
3994
|
-
var
|
|
4082
|
+
var DelegationDisabledError = class extends Error {
|
|
4083
|
+
constructor() {
|
|
4084
|
+
super("Identity delegation is not enabled for this integration.");
|
|
4085
|
+
this.name = "DelegationDisabledError";
|
|
4086
|
+
}
|
|
4087
|
+
};
|
|
4088
|
+
var DEFAULT_REVALIDATE_AFTER_MS = 30 * 1e3;
|
|
3995
4089
|
function DelegationProvider({
|
|
3996
4090
|
sdk,
|
|
3997
4091
|
onSessionToken,
|
|
@@ -4002,58 +4096,68 @@ function DelegationProvider({
|
|
|
4002
4096
|
}) {
|
|
4003
4097
|
const [status, setStatus] = useState11("idle");
|
|
4004
4098
|
const [error, setError] = useState11(null);
|
|
4005
|
-
const acquiringRef = useRef7(false);
|
|
4006
4099
|
const mountedRef = useRef7(true);
|
|
4007
4100
|
const statusRef = useRef7("idle");
|
|
4008
4101
|
statusRef.current = status;
|
|
4009
|
-
const
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4102
|
+
const acquirePromiseRef = useRef7(null);
|
|
4103
|
+
const acquire = useCallback5(() => {
|
|
4104
|
+
if (acquirePromiseRef.current) {
|
|
4105
|
+
return acquirePromiseRef.current;
|
|
4106
|
+
}
|
|
4107
|
+
const run = (async () => {
|
|
4108
|
+
if (statusRef.current !== "active") {
|
|
4109
|
+
setStatus("acquiring");
|
|
4110
|
+
}
|
|
4111
|
+
setError(null);
|
|
4112
|
+
try {
|
|
4113
|
+
const isActive = await checkActive();
|
|
4114
|
+
if (isActive) {
|
|
4115
|
+
if (mountedRef.current) {
|
|
4116
|
+
setStatus("active");
|
|
4117
|
+
}
|
|
4118
|
+
return;
|
|
4119
|
+
}
|
|
4120
|
+
if (!mountedRef.current) {
|
|
4121
|
+
return;
|
|
4122
|
+
}
|
|
4123
|
+
const sessionToken = await sdk.getSessionToken();
|
|
4124
|
+
if (!mountedRef.current) {
|
|
4125
|
+
return;
|
|
4126
|
+
}
|
|
4127
|
+
if (!sessionToken) {
|
|
4128
|
+
if (mountedRef.current) {
|
|
4129
|
+
setStatus("disabled");
|
|
4130
|
+
}
|
|
4131
|
+
throw new DelegationDisabledError();
|
|
4132
|
+
}
|
|
4133
|
+
await onSessionToken(sessionToken);
|
|
4019
4134
|
if (mountedRef.current) {
|
|
4020
4135
|
setStatus("active");
|
|
4021
4136
|
}
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
return;
|
|
4030
|
-
}
|
|
4031
|
-
if (!sessionToken) {
|
|
4032
|
-
setStatus("disabled");
|
|
4033
|
-
return;
|
|
4034
|
-
}
|
|
4035
|
-
await onSessionToken(sessionToken);
|
|
4036
|
-
if (mountedRef.current) {
|
|
4037
|
-
setStatus("active");
|
|
4038
|
-
}
|
|
4039
|
-
} catch (err) {
|
|
4040
|
-
if (mountedRef.current) {
|
|
4041
|
-
setError(err instanceof Error ? err : new Error(String(err)));
|
|
4042
|
-
setStatus("error");
|
|
4137
|
+
} catch (err) {
|
|
4138
|
+
const error2 = err instanceof Error ? err : new Error(String(err));
|
|
4139
|
+
if (mountedRef.current && !(err instanceof DelegationDisabledError)) {
|
|
4140
|
+
setError(error2);
|
|
4141
|
+
setStatus("error");
|
|
4142
|
+
}
|
|
4143
|
+
throw error2;
|
|
4043
4144
|
}
|
|
4044
|
-
}
|
|
4045
|
-
|
|
4046
|
-
|
|
4145
|
+
})();
|
|
4146
|
+
acquirePromiseRef.current = run.finally(() => {
|
|
4147
|
+
acquirePromiseRef.current = null;
|
|
4148
|
+
});
|
|
4149
|
+
return acquirePromiseRef.current;
|
|
4047
4150
|
}, [sdk, onSessionToken, checkActive]);
|
|
4048
|
-
|
|
4151
|
+
useEffect14(() => {
|
|
4049
4152
|
mountedRef.current = true;
|
|
4050
|
-
void acquire()
|
|
4153
|
+
void acquire().catch(() => {
|
|
4154
|
+
});
|
|
4051
4155
|
return () => {
|
|
4052
4156
|
mountedRef.current = false;
|
|
4053
4157
|
};
|
|
4054
4158
|
}, [acquire]);
|
|
4055
4159
|
const revalidate = useCallback5(async () => {
|
|
4056
|
-
if (
|
|
4160
|
+
if (acquirePromiseRef.current) {
|
|
4057
4161
|
return;
|
|
4058
4162
|
}
|
|
4059
4163
|
if (statusRef.current !== "active") {
|
|
@@ -4065,12 +4169,13 @@ function DelegationProvider({
|
|
|
4065
4169
|
return;
|
|
4066
4170
|
}
|
|
4067
4171
|
if (!isActive) {
|
|
4068
|
-
void acquire()
|
|
4172
|
+
void acquire().catch(() => {
|
|
4173
|
+
});
|
|
4069
4174
|
}
|
|
4070
4175
|
} catch (e) {
|
|
4071
4176
|
}
|
|
4072
4177
|
}, [checkActive, acquire]);
|
|
4073
|
-
|
|
4178
|
+
useEffect14(() => {
|
|
4074
4179
|
if (!revalidateOnFocus) {
|
|
4075
4180
|
return;
|
|
4076
4181
|
}
|
|
@@ -4096,10 +4201,7 @@ function DelegationProvider({
|
|
|
4096
4201
|
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
4097
4202
|
};
|
|
4098
4203
|
}, [revalidateOnFocus, revalidateAfterMs, revalidate]);
|
|
4099
|
-
const
|
|
4100
|
-
void acquire();
|
|
4101
|
-
}, [acquire]);
|
|
4102
|
-
const value = useMemo12(() => ({ status, error, reacquire }), [status, error, reacquire]);
|
|
4204
|
+
const value = useMemo13(() => ({ status, error, reacquire: acquire }), [status, error, acquire]);
|
|
4103
4205
|
return /* @__PURE__ */ jsx47(DelegationContext.Provider, { value, children });
|
|
4104
4206
|
}
|
|
4105
4207
|
|
|
@@ -4108,12 +4210,12 @@ import { IconsProvider, LoadingIndicator as LoadingIndicator2, Theme as Theme2 }
|
|
|
4108
4210
|
|
|
4109
4211
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
4110
4212
|
import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
|
|
4111
|
-
import { useEffect as
|
|
4213
|
+
import { useEffect as useEffect15, useRef as useRef8, useState as useState12 } from "react";
|
|
4112
4214
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
4113
4215
|
const [error, setError] = useState12();
|
|
4114
4216
|
const [sdk, setSdk] = useState12();
|
|
4115
4217
|
const initializationInProgress = useRef8(false);
|
|
4116
|
-
|
|
4218
|
+
useEffect15(
|
|
4117
4219
|
() => {
|
|
4118
4220
|
if (typeof window === "undefined" || sdk) {
|
|
4119
4221
|
return;
|
|
@@ -4201,15 +4303,15 @@ import { Callout as Callout4, Container, ScrollableList, VerticalRhythm as Verti
|
|
|
4201
4303
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
4202
4304
|
import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
|
|
4203
4305
|
import {
|
|
4204
|
-
createContext as
|
|
4306
|
+
createContext as createContext7,
|
|
4205
4307
|
useCallback as useCallback6,
|
|
4206
|
-
useContext as
|
|
4308
|
+
useContext as useContext7,
|
|
4207
4309
|
useDeferredValue,
|
|
4208
|
-
useMemo as
|
|
4310
|
+
useMemo as useMemo14,
|
|
4209
4311
|
useState as useState13
|
|
4210
4312
|
} from "react";
|
|
4211
4313
|
import { jsx as jsx50 } from "@emotion/react/jsx-runtime";
|
|
4212
|
-
var ObjectSearchContext =
|
|
4314
|
+
var ObjectSearchContext = createContext7({
|
|
4213
4315
|
onSetQuery: () => {
|
|
4214
4316
|
},
|
|
4215
4317
|
onSelectItem: () => {
|
|
@@ -4274,8 +4376,8 @@ var ObjectSearchProvider = ({
|
|
|
4274
4376
|
},
|
|
4275
4377
|
[setList]
|
|
4276
4378
|
);
|
|
4277
|
-
const boundQuery =
|
|
4278
|
-
const value =
|
|
4379
|
+
const boundQuery = useMemo14(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
4380
|
+
const value = useMemo14(
|
|
4279
4381
|
() => ({
|
|
4280
4382
|
boundQuery,
|
|
4281
4383
|
onSetQuery,
|
|
@@ -4302,7 +4404,7 @@ var ObjectSearchProvider = ({
|
|
|
4302
4404
|
return /* @__PURE__ */ jsx50(ObjectSearchContext.Provider, { value, children });
|
|
4303
4405
|
};
|
|
4304
4406
|
function useObjectSearchContext() {
|
|
4305
|
-
return
|
|
4407
|
+
return useContext7(ObjectSearchContext);
|
|
4306
4408
|
}
|
|
4307
4409
|
function bindQuery(query, inputs) {
|
|
4308
4410
|
const { result, errors } = bindVariablesToObject2({
|
|
@@ -4554,7 +4656,7 @@ var DefaultResultList = () => {
|
|
|
4554
4656
|
|
|
4555
4657
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
4556
4658
|
import { DebouncedInputKeywordSearch, InputSelect as InputSelect3 } from "@uniformdev/design-system";
|
|
4557
|
-
import { useMemo as
|
|
4659
|
+
import { useMemo as useMemo15, useState as useState14 } from "react";
|
|
4558
4660
|
|
|
4559
4661
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
4560
4662
|
import { css as css18 } from "@emotion/react";
|
|
@@ -4598,7 +4700,7 @@ var ObjectSearchFilter = ({
|
|
|
4598
4700
|
});
|
|
4599
4701
|
onSetQuery({ ...query, ...value });
|
|
4600
4702
|
};
|
|
4601
|
-
const memoizedSelectOptions =
|
|
4703
|
+
const memoizedSelectOptions = useMemo15(() => {
|
|
4602
4704
|
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
4603
4705
|
return [];
|
|
4604
4706
|
}
|
|
@@ -5010,7 +5112,7 @@ function ObjectSearchResultList({
|
|
|
5010
5112
|
|
|
5011
5113
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
5012
5114
|
import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input4, InputSelect as InputSelect4, VerticalRhythm as VerticalRhythm4 } from "@uniformdev/design-system";
|
|
5013
|
-
import { useEffect as
|
|
5115
|
+
import { useEffect as useEffect16, useState as useState15 } from "react";
|
|
5014
5116
|
import { jsx as jsx59, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
|
|
5015
5117
|
var QueryFilter = ({
|
|
5016
5118
|
requireContentType,
|
|
@@ -5050,7 +5152,7 @@ var QueryFilter = ({
|
|
|
5050
5152
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
5051
5153
|
onSetQuery({ ...query, ...value });
|
|
5052
5154
|
};
|
|
5053
|
-
|
|
5155
|
+
useEffect16(() => {
|
|
5054
5156
|
onSetQuery(queryState);
|
|
5055
5157
|
}, []);
|
|
5056
5158
|
return /* @__PURE__ */ jsxs29("fieldset", { children: [
|
|
@@ -5176,7 +5278,7 @@ var QueryFilter = ({
|
|
|
5176
5278
|
};
|
|
5177
5279
|
|
|
5178
5280
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
5179
|
-
import { useEffect as
|
|
5281
|
+
import { useEffect as useEffect17, useMemo as useMemo16, useRef as useRef9 } from "react";
|
|
5180
5282
|
import { jsx as jsx60 } from "@emotion/react/jsx-runtime";
|
|
5181
5283
|
function ParamTypeDynamicDataProvider(props) {
|
|
5182
5284
|
const { children } = props;
|
|
@@ -5185,7 +5287,7 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
5185
5287
|
} = useMeshLocation("paramType");
|
|
5186
5288
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
5187
5289
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
5188
|
-
const variables =
|
|
5290
|
+
const variables = useMemo16(
|
|
5189
5291
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
5190
5292
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
5191
5293
|
);
|
|
@@ -5200,7 +5302,7 @@ var JsonMeshVariableEditor = ({
|
|
|
5200
5302
|
}) => {
|
|
5201
5303
|
const sillyRef = useRef9(false);
|
|
5202
5304
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
5203
|
-
|
|
5305
|
+
useEffect17(() => {
|
|
5204
5306
|
if (sillyRef.current) {
|
|
5205
5307
|
return;
|
|
5206
5308
|
}
|
|
@@ -5700,7 +5802,7 @@ var DateEditor = ({
|
|
|
5700
5802
|
|
|
5701
5803
|
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
5702
5804
|
import { Input as Input6 } from "@uniformdev/design-system";
|
|
5703
|
-
import { useEffect as
|
|
5805
|
+
import { useEffect as useEffect18, useState as useState17 } from "react";
|
|
5704
5806
|
import { useDebounce as useDebounce3 } from "react-use";
|
|
5705
5807
|
|
|
5706
5808
|
// src/components/SearchAndFilter/editors/shared/ErrorContainer.tsx
|
|
@@ -5750,7 +5852,7 @@ var DateRangeEditor = ({
|
|
|
5750
5852
|
500,
|
|
5751
5853
|
[minDateValue, maxDateValue]
|
|
5752
5854
|
);
|
|
5753
|
-
|
|
5855
|
+
useEffect18(() => {
|
|
5754
5856
|
if (!minDateValue || !maxDateValue) {
|
|
5755
5857
|
return;
|
|
5756
5858
|
}
|
|
@@ -5826,7 +5928,7 @@ import {
|
|
|
5826
5928
|
getComboBoxSelectedSelectableGroups,
|
|
5827
5929
|
InputComboBox
|
|
5828
5930
|
} from "@uniformdev/design-system";
|
|
5829
|
-
import { useMemo as
|
|
5931
|
+
import { useMemo as useMemo17 } from "react";
|
|
5830
5932
|
|
|
5831
5933
|
// src/components/SearchAndFilter/editors/shared/readOnlyAttributes.tsx
|
|
5832
5934
|
var readOnlyAttributes = {
|
|
@@ -5847,7 +5949,7 @@ var FilterMultiChoiceEditor = ({
|
|
|
5847
5949
|
}) => {
|
|
5848
5950
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5849
5951
|
const isClearable = !readOnly || !disabled;
|
|
5850
|
-
const { groupedOptions, selectedOptions } =
|
|
5952
|
+
const { groupedOptions, selectedOptions } = useMemo17(
|
|
5851
5953
|
() => convertComboBoxGroupsToSelectableGroups({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
5852
5954
|
[options, value]
|
|
5853
5955
|
);
|
|
@@ -5884,7 +5986,7 @@ import {
|
|
|
5884
5986
|
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups2,
|
|
5885
5987
|
InputComboBox as InputComboBox2
|
|
5886
5988
|
} from "@uniformdev/design-system";
|
|
5887
|
-
import { useMemo as
|
|
5989
|
+
import { useMemo as useMemo18 } from "react";
|
|
5888
5990
|
import { jsx as jsx65 } from "@emotion/react/jsx-runtime";
|
|
5889
5991
|
var FilterSingleChoiceEditor = ({
|
|
5890
5992
|
options,
|
|
@@ -5895,7 +5997,7 @@ var FilterSingleChoiceEditor = ({
|
|
|
5895
5997
|
valueTestId
|
|
5896
5998
|
}) => {
|
|
5897
5999
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5898
|
-
const { groupedOptions, selectedOptions } =
|
|
6000
|
+
const { groupedOptions, selectedOptions } = useMemo18(
|
|
5899
6001
|
() => convertComboBoxGroupsToSelectableGroups2({
|
|
5900
6002
|
options: options != null ? options : [],
|
|
5901
6003
|
selectedItems: new Set(value ? [String(value)] : void 0),
|
|
@@ -5964,7 +6066,7 @@ var NumberEditor = ({
|
|
|
5964
6066
|
|
|
5965
6067
|
// src/components/SearchAndFilter/editors/NumberRangeEditor.tsx
|
|
5966
6068
|
import { Input as Input8 } from "@uniformdev/design-system";
|
|
5967
|
-
import { useEffect as
|
|
6069
|
+
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
5968
6070
|
import { useDebounce as useDebounce5 } from "react-use";
|
|
5969
6071
|
import { Fragment as Fragment13, jsx as jsx67, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
|
|
5970
6072
|
var NumberRangeEditor = ({
|
|
@@ -5989,7 +6091,7 @@ var NumberRangeEditor = ({
|
|
|
5989
6091
|
500,
|
|
5990
6092
|
[minValue, maxValue]
|
|
5991
6093
|
);
|
|
5992
|
-
|
|
6094
|
+
useEffect19(() => {
|
|
5993
6095
|
if (!maxValue && !minValue) {
|
|
5994
6096
|
return;
|
|
5995
6097
|
}
|
|
@@ -6056,7 +6158,7 @@ import {
|
|
|
6056
6158
|
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups2,
|
|
6057
6159
|
InputComboBox as InputComboBox3
|
|
6058
6160
|
} from "@uniformdev/design-system";
|
|
6059
|
-
import { useMemo as
|
|
6161
|
+
import { useMemo as useMemo19 } from "react";
|
|
6060
6162
|
|
|
6061
6163
|
// src/components/SearchAndFilter/editors/shared/CustomOptions.tsx
|
|
6062
6164
|
import { StatusBullet } from "@uniformdev/design-system";
|
|
@@ -6082,7 +6184,7 @@ var StatusMultiEditor = ({
|
|
|
6082
6184
|
valueTestId
|
|
6083
6185
|
}) => {
|
|
6084
6186
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
6085
|
-
const { groupedOptions, selectedOptions } =
|
|
6187
|
+
const { groupedOptions, selectedOptions } = useMemo19(
|
|
6086
6188
|
() => convertComboBoxGroupsToSelectableGroups3({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
6087
6189
|
[options, value]
|
|
6088
6190
|
);
|
|
@@ -6117,7 +6219,7 @@ import {
|
|
|
6117
6219
|
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups4,
|
|
6118
6220
|
InputComboBox as InputComboBox4
|
|
6119
6221
|
} from "@uniformdev/design-system";
|
|
6120
|
-
import { useMemo as
|
|
6222
|
+
import { useMemo as useMemo20 } from "react";
|
|
6121
6223
|
import { jsx as jsx70 } from "@emotion/react/jsx-runtime";
|
|
6122
6224
|
var StatusSingleEditor = ({
|
|
6123
6225
|
options,
|
|
@@ -6128,7 +6230,7 @@ var StatusSingleEditor = ({
|
|
|
6128
6230
|
valueTestId
|
|
6129
6231
|
}) => {
|
|
6130
6232
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
6131
|
-
const { groupedOptions, selectedOptions } =
|
|
6233
|
+
const { groupedOptions, selectedOptions } = useMemo20(
|
|
6132
6234
|
() => convertComboBoxGroupsToSelectableGroups4({
|
|
6133
6235
|
options: options != null ? options : [],
|
|
6134
6236
|
selectedItems: new Set(value ? [value] : void 0),
|
|
@@ -6197,7 +6299,7 @@ import {
|
|
|
6197
6299
|
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups3,
|
|
6198
6300
|
InputCreatableComboBox
|
|
6199
6301
|
} from "@uniformdev/design-system";
|
|
6200
|
-
import { useMemo as
|
|
6302
|
+
import { useMemo as useMemo21 } from "react";
|
|
6201
6303
|
import { jsx as jsx72 } from "@emotion/react/jsx-runtime";
|
|
6202
6304
|
var TextMultiChoiceEditor = ({
|
|
6203
6305
|
value,
|
|
@@ -6208,7 +6310,7 @@ var TextMultiChoiceEditor = ({
|
|
|
6208
6310
|
}) => {
|
|
6209
6311
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
6210
6312
|
const isClearable = !readOnly || !disabled;
|
|
6211
|
-
const { groupedOptions, selectedOptions } =
|
|
6313
|
+
const { groupedOptions, selectedOptions } = useMemo21(() => {
|
|
6212
6314
|
var _a;
|
|
6213
6315
|
const coercedValue = typeof value === "string" ? [value] : value != null ? value : [];
|
|
6214
6316
|
const options = (_a = coercedValue.map((v) => ({ label: v, value: v }))) != null ? _a : [];
|
|
@@ -6560,19 +6662,19 @@ import { CgClose } from "@react-icons/all-files/cg/CgClose";
|
|
|
6560
6662
|
import { hasReferencedVariables as hasReferencedVariables2 } from "@uniformdev/canvas";
|
|
6561
6663
|
import { Icon as Icon3, InputKeywordSearch } from "@uniformdev/design-system";
|
|
6562
6664
|
import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
|
|
6563
|
-
import { useEffect as
|
|
6665
|
+
import { useEffect as useEffect21, useRef as useRef10, useState as useState22 } from "react";
|
|
6564
6666
|
import { useDebounce as useDebounce7 } from "react-use";
|
|
6565
6667
|
import { v4 as v42 } from "uuid";
|
|
6566
6668
|
|
|
6567
6669
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
6568
6670
|
import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
|
|
6569
6671
|
import {
|
|
6570
|
-
createContext as
|
|
6672
|
+
createContext as createContext8,
|
|
6571
6673
|
useCallback as useCallback7,
|
|
6572
|
-
useContext as
|
|
6674
|
+
useContext as useContext8,
|
|
6573
6675
|
useDeferredValue as useDeferredValue2,
|
|
6574
|
-
useEffect as
|
|
6575
|
-
useMemo as
|
|
6676
|
+
useEffect as useEffect20,
|
|
6677
|
+
useMemo as useMemo22,
|
|
6576
6678
|
useState as useState21
|
|
6577
6679
|
} from "react";
|
|
6578
6680
|
|
|
@@ -6650,7 +6752,7 @@ var bindableFiltersMapper = {
|
|
|
6650
6752
|
|
|
6651
6753
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
6652
6754
|
import { jsx as jsx75 } from "@emotion/react/jsx-runtime";
|
|
6653
|
-
var SearchAndFilterContext =
|
|
6755
|
+
var SearchAndFilterContext = createContext8({
|
|
6654
6756
|
searchTerm: "",
|
|
6655
6757
|
setSearchTerm: () => {
|
|
6656
6758
|
},
|
|
@@ -6726,13 +6828,13 @@ var SearchAndFilterProvider = ({
|
|
|
6726
6828
|
},
|
|
6727
6829
|
[filters, onChange]
|
|
6728
6830
|
);
|
|
6729
|
-
const validFilterQuery =
|
|
6831
|
+
const validFilterQuery = useMemo22(() => {
|
|
6730
6832
|
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
6731
6833
|
if (hasValidFilters) {
|
|
6732
6834
|
return filters;
|
|
6733
6835
|
}
|
|
6734
6836
|
}, [filters]);
|
|
6735
|
-
|
|
6837
|
+
useEffect20(() => {
|
|
6736
6838
|
if (filterVisibility) {
|
|
6737
6839
|
const handleEscKeyFilterClose = (e) => {
|
|
6738
6840
|
if (e.key === "Escape") {
|
|
@@ -6770,7 +6872,7 @@ var SearchAndFilterProvider = ({
|
|
|
6770
6872
|
);
|
|
6771
6873
|
};
|
|
6772
6874
|
var useSearchAndFilter = () => {
|
|
6773
|
-
const value =
|
|
6875
|
+
const value = useContext8(SearchAndFilterContext);
|
|
6774
6876
|
return { ...value };
|
|
6775
6877
|
};
|
|
6776
6878
|
|
|
@@ -6801,7 +6903,7 @@ var FilterControls = ({
|
|
|
6801
6903
|
300,
|
|
6802
6904
|
[localSearchTerm]
|
|
6803
6905
|
);
|
|
6804
|
-
|
|
6906
|
+
useEffect21(() => {
|
|
6805
6907
|
if (searchTerm === "") {
|
|
6806
6908
|
setLocalSearchTerm("");
|
|
6807
6909
|
setIdToResetInputVariables(`data-resource-search-term-input-${v42()}`);
|
|
@@ -6882,7 +6984,7 @@ import {
|
|
|
6882
6984
|
Menu as Menu3,
|
|
6883
6985
|
SelectableMenuItem
|
|
6884
6986
|
} from "@uniformdev/design-system";
|
|
6885
|
-
import { useMemo as
|
|
6987
|
+
import { useMemo as useMemo23 } from "react";
|
|
6886
6988
|
|
|
6887
6989
|
// src/components/SearchAndFilter/util/isFilterBindable.ts
|
|
6888
6990
|
function isFilterBindable(filter, operator) {
|
|
@@ -6910,7 +7012,7 @@ var FilterItem = ({
|
|
|
6910
7012
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
6911
7013
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
6912
7014
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
6913
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } =
|
|
7015
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo23(() => {
|
|
6914
7016
|
var _a2;
|
|
6915
7017
|
const currentSelectedFilterGroup = filterOptions.find((item) => {
|
|
6916
7018
|
var _a3;
|
|
@@ -7078,7 +7180,7 @@ import { Icon as Icon5 } from "@uniformdev/design-system";
|
|
|
7078
7180
|
|
|
7079
7181
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
7080
7182
|
import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
7081
|
-
import React8, { useEffect as
|
|
7183
|
+
import React8, { useEffect as useEffect22 } from "react";
|
|
7082
7184
|
import { jsx as jsx78, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
|
|
7083
7185
|
var SearchAndFilterOptionsContainer2 = ({
|
|
7084
7186
|
buttonRow,
|
|
@@ -7111,7 +7213,7 @@ var FilterMenu = ({
|
|
|
7111
7213
|
}) => {
|
|
7112
7214
|
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
7113
7215
|
const innerMenuRef = React8.useRef(null);
|
|
7114
|
-
|
|
7216
|
+
useEffect22(() => {
|
|
7115
7217
|
var _a;
|
|
7116
7218
|
if (filterVisibility) {
|
|
7117
7219
|
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
@@ -7460,10 +7562,10 @@ var SearchAndFilter = ({
|
|
|
7460
7562
|
|
|
7461
7563
|
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
7462
7564
|
import { InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
7463
|
-
import { createContext as
|
|
7565
|
+
import { createContext as createContext9, useState as useState23 } from "react";
|
|
7464
7566
|
import { useDebounce as useDebounce8 } from "react-use";
|
|
7465
7567
|
import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
|
|
7466
|
-
var SearchOnlyContext =
|
|
7568
|
+
var SearchOnlyContext = createContext9({
|
|
7467
7569
|
searchTerm: "",
|
|
7468
7570
|
setSearchTerm: () => {
|
|
7469
7571
|
}
|
|
@@ -7871,7 +7973,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
7871
7973
|
|
|
7872
7974
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
7873
7975
|
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
7874
|
-
import { useEffect as
|
|
7976
|
+
import { useEffect as useEffect23, useRef as useRef11 } from "react";
|
|
7875
7977
|
function useContentDataResourceLocaleInfo({
|
|
7876
7978
|
locale,
|
|
7877
7979
|
defaultLocale,
|
|
@@ -7884,7 +7986,7 @@ function useContentDataResourceLocaleInfo({
|
|
|
7884
7986
|
const { flatVariables } = useVariables();
|
|
7885
7987
|
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : defaultLocale != null ? defaultLocale : "";
|
|
7886
7988
|
const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7887
|
-
|
|
7989
|
+
useEffect23(() => {
|
|
7888
7990
|
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7889
7991
|
setLocaleRef.current(effectiveLocale);
|
|
7890
7992
|
}
|
|
@@ -7951,6 +8053,7 @@ export {
|
|
|
7951
8053
|
DateEditor,
|
|
7952
8054
|
DateRangeEditor,
|
|
7953
8055
|
DelegationContext,
|
|
8056
|
+
DelegationDisabledError,
|
|
7954
8057
|
DelegationGate,
|
|
7955
8058
|
DelegationProvider,
|
|
7956
8059
|
DrawerContent,
|
|
@@ -8054,8 +8157,10 @@ export {
|
|
|
8054
8157
|
VariablesProvider,
|
|
8055
8158
|
bindableFiltersMapper,
|
|
8056
8159
|
convertConnectedDataToVariable,
|
|
8160
|
+
createDelegationFetch,
|
|
8057
8161
|
createLocationValidator,
|
|
8058
8162
|
filterMapper,
|
|
8163
|
+
isDelegationExpiredResponse,
|
|
8059
8164
|
prettifyBindExpression,
|
|
8060
8165
|
readOnlyAttributes,
|
|
8061
8166
|
serializeVariablesEditorSerializedState,
|
|
@@ -8066,6 +8171,7 @@ export {
|
|
|
8066
8171
|
useConnectedDataAsVariables,
|
|
8067
8172
|
useContentDataResourceLocaleInfo,
|
|
8068
8173
|
useDelegation,
|
|
8174
|
+
useDelegationFetch,
|
|
8069
8175
|
useDynamicInputsAsVariables,
|
|
8070
8176
|
useMeshLocation,
|
|
8071
8177
|
useObjectSearchContext,
|