@kizenapps/engine 1.9.2 → 1.9.3
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/README.md +1 -4
- package/dist/{chunk-RA63N62U.js → chunk-3DIQOQD4.js} +3 -3
- package/dist/{chunk-RA63N62U.js.map → chunk-3DIQOQD4.js.map} +1 -1
- package/dist/{chunk-NM7AUY5F.js → chunk-CDGV5N5I.js} +4 -4
- package/dist/{chunk-NM7AUY5F.js.map → chunk-CDGV5N5I.js.map} +1 -1
- package/dist/{chunk-TURP3EK7.js → chunk-DEQQUMNQ.js} +3 -3
- package/dist/{chunk-TURP3EK7.js.map → chunk-DEQQUMNQ.js.map} +1 -1
- package/dist/{chunk-Z3KVUTUF.js → chunk-I6M7IOUN.js} +6 -6
- package/dist/{chunk-Z3KVUTUF.js.map → chunk-I6M7IOUN.js.map} +1 -1
- package/dist/{chunk-YFOCC5GA.js → chunk-KOHHWIU2.js} +3 -3
- package/dist/{chunk-YFOCC5GA.js.map → chunk-KOHHWIU2.js.map} +1 -1
- package/dist/{chunk-COJQSTZX.js → chunk-LBQKIZYB.js} +3 -3
- package/dist/{chunk-COJQSTZX.js.map → chunk-LBQKIZYB.js.map} +1 -1
- package/dist/{chunk-WTE3FFSZ.js → chunk-QL5TKJNY.js} +5 -5
- package/dist/{chunk-WTE3FFSZ.js.map → chunk-QL5TKJNY.js.map} +1 -1
- package/dist/{chunk-3PYBDXBN.js → chunk-Z5EJLAOV.js} +3 -3
- package/dist/{chunk-3PYBDXBN.js.map → chunk-Z5EJLAOV.js.map} +1 -1
- package/dist/{chunk-PL4TAA6U.js → chunk-ZJEUSM6D.js} +3 -3
- package/dist/{chunk-PL4TAA6U.js.map → chunk-ZJEUSM6D.js.map} +1 -1
- package/dist/communication.js +2 -2
- package/dist/contexts/base.js +4 -4
- package/dist/contexts/floatingFrame.js +5 -5
- package/dist/contexts/recordDetail.js +5 -5
- package/dist/index.js +4 -4
- package/dist/react.d.ts +1 -1
- package/dist/react.js +77 -31
- package/dist/react.js.map +1 -1
- package/dist/util.js +6 -6
- package/dist/workers/calendarSource.worker.js +6 -6
- package/dist/workers/floatingFrame.worker.js +7 -7
- package/dist/workers/generic.worker.js +6 -6
- package/dist/workers/recordDetail.worker.js +7 -7
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runScript, getPluginSafeHTML, getStableHash, readNavigationContext, clearNavigationContext, runExpression, isFlagEnabled } from './chunk-
|
|
1
|
+
import { runScript, getPluginSafeHTML, getStableHash, readNavigationContext, clearNavigationContext, runExpression, isFlagEnabled } from './chunk-I6M7IOUN.js';
|
|
2
2
|
import './chunk-LGJYUPYZ.js';
|
|
3
|
-
import { generateExecutionKey } from './chunk-
|
|
4
|
-
import { buildIframeURLWithProxy, unwrapProxyMessage, getAllNestedInputsFromConfig, getActionFieldKey, getFieldFromAction, getActionMenuFieldKey } from './chunk-
|
|
5
|
-
import { runFrameScriptEventName, runBlockScriptEventName } from './chunk-
|
|
6
|
-
import { QUERY_KEYS, ROUTE_CHANGE_INTERNAL_EVENT, IFRAME_PREFIX, ROUTE_CHANGE_IFRAME_EVENT } from './chunk-
|
|
3
|
+
import { generateExecutionKey } from './chunk-Z5EJLAOV.js';
|
|
4
|
+
import { buildIframeURLWithProxy, unwrapProxyMessage, getAllNestedInputsFromConfig, getActionFieldKey, getFieldFromAction, getActionMenuFieldKey } from './chunk-DEQQUMNQ.js';
|
|
5
|
+
import { runFrameScriptEventName, runBlockScriptEventName } from './chunk-LBQKIZYB.js';
|
|
6
|
+
import { QUERY_KEYS, ROUTE_CHANGE_INTERNAL_EVENT, IFRAME_PREFIX, ROUTE_CHANGE_IFRAME_EVENT } from './chunk-ZJEUSM6D.js';
|
|
7
7
|
import './chunk-5WRI5ZAA.js';
|
|
8
8
|
import { QueryClient, useQueries, useQueryClient, QueryClientContext, QueryClientProvider } from '@tanstack/react-query';
|
|
9
9
|
import { createContext, useContext, useState, useCallback, useMemo, useRef, useEffect, useImperativeHandle } from 'react';
|
|
@@ -2440,9 +2440,28 @@ var SetupAssistantContext = createContext(null);
|
|
|
2440
2440
|
var SetupAssistantProvider = SetupAssistantContext.Provider;
|
|
2441
2441
|
var getUsableValue = (type, value) => {
|
|
2442
2442
|
if (type === "custom_object") {
|
|
2443
|
+
if (Array.isArray(value)) {
|
|
2444
|
+
return value[0]?.id;
|
|
2445
|
+
}
|
|
2443
2446
|
return value?.id;
|
|
2444
2447
|
}
|
|
2445
2448
|
};
|
|
2449
|
+
var getStateAccessorKey = (accessor) => {
|
|
2450
|
+
if (accessor.startsWith("{{") && accessor.endsWith("}}")) {
|
|
2451
|
+
return accessor.slice(2, -2).trim();
|
|
2452
|
+
}
|
|
2453
|
+
return void 0;
|
|
2454
|
+
};
|
|
2455
|
+
var interpolateValueFromState = (accessor, consideredState) => {
|
|
2456
|
+
const stateKey = getStateAccessorKey(accessor);
|
|
2457
|
+
if (stateKey !== void 0) {
|
|
2458
|
+
return getUsableValue(
|
|
2459
|
+
consideredState[stateKey]?.type,
|
|
2460
|
+
consideredState[stateKey]?.value
|
|
2461
|
+
);
|
|
2462
|
+
}
|
|
2463
|
+
return accessor;
|
|
2464
|
+
};
|
|
2446
2465
|
var doesValueExist = (field, value) => {
|
|
2447
2466
|
if (field.type === "custom_object") {
|
|
2448
2467
|
if (field.allow_multiple) {
|
|
@@ -2501,6 +2520,24 @@ var getNestedFieldsFromConfig = (config) => {
|
|
|
2501
2520
|
);
|
|
2502
2521
|
return [...objects, ...recursiveFields];
|
|
2503
2522
|
};
|
|
2523
|
+
var resolveInferredObjectId = ({
|
|
2524
|
+
objectIdAccessor,
|
|
2525
|
+
forceObjectId,
|
|
2526
|
+
resolvedObjects,
|
|
2527
|
+
state
|
|
2528
|
+
}) => {
|
|
2529
|
+
if (forceObjectId !== void 0) {
|
|
2530
|
+
return forceObjectId;
|
|
2531
|
+
}
|
|
2532
|
+
const accessorKey = getStateAccessorKey(objectIdAccessor);
|
|
2533
|
+
if (accessorKey !== void 0) {
|
|
2534
|
+
const resolvedObjectId = resolvedObjects?.[accessorKey]?.id;
|
|
2535
|
+
if (resolvedObjectId !== void 0) {
|
|
2536
|
+
return resolvedObjectId;
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
return interpolateValueFromState(objectIdAccessor, state);
|
|
2540
|
+
};
|
|
2504
2541
|
var SetupAssistantController = ({
|
|
2505
2542
|
children,
|
|
2506
2543
|
config,
|
|
@@ -2600,24 +2637,11 @@ var SetupAssistantController = ({
|
|
|
2600
2637
|
},
|
|
2601
2638
|
[onStateChange]
|
|
2602
2639
|
);
|
|
2603
|
-
const interpolateValueFromState = useCallback(
|
|
2604
|
-
(accessor, consideredState) => {
|
|
2605
|
-
if (accessor.startsWith("{{") && accessor.endsWith("}}")) {
|
|
2606
|
-
const stateKey = accessor.slice(2, -2).trim();
|
|
2607
|
-
return getUsableValue(
|
|
2608
|
-
consideredState[stateKey]?.type,
|
|
2609
|
-
consideredState[stateKey]?.value
|
|
2610
|
-
);
|
|
2611
|
-
}
|
|
2612
|
-
return accessor;
|
|
2613
|
-
},
|
|
2614
|
-
[]
|
|
2615
|
-
);
|
|
2616
2640
|
const interpolateValue = useCallback(
|
|
2617
2641
|
(accessor) => {
|
|
2618
2642
|
return interpolateValueFromState(accessor, state);
|
|
2619
2643
|
},
|
|
2620
|
-
[state
|
|
2644
|
+
[state]
|
|
2621
2645
|
);
|
|
2622
2646
|
const { clientObject } = useAppState();
|
|
2623
2647
|
const getPotentialMatch = useCallback(
|
|
@@ -2637,6 +2661,7 @@ var SetupAssistantController = ({
|
|
|
2637
2661
|
);
|
|
2638
2662
|
const handleInferObjects = useCallback(async () => {
|
|
2639
2663
|
const objectsToInfer = getNestedObjectsFromConfig(config);
|
|
2664
|
+
const matchedObjects = {};
|
|
2640
2665
|
for (const inferrableObject of objectsToInfer) {
|
|
2641
2666
|
if (!inferrableObject.match_hint) {
|
|
2642
2667
|
continue;
|
|
@@ -2647,6 +2672,7 @@ var SetupAssistantController = ({
|
|
|
2647
2672
|
id: potentialMatch[0].id,
|
|
2648
2673
|
objectName: potentialMatch[0].object_name
|
|
2649
2674
|
};
|
|
2675
|
+
matchedObjects[inferrableObject.key] = value2;
|
|
2650
2676
|
setState((prev) => {
|
|
2651
2677
|
const result = {
|
|
2652
2678
|
...prev,
|
|
@@ -2659,23 +2685,32 @@ var SetupAssistantController = ({
|
|
|
2659
2685
|
});
|
|
2660
2686
|
}
|
|
2661
2687
|
}
|
|
2688
|
+
return matchedObjects;
|
|
2662
2689
|
}, [config, setState, getPotentialMatch]);
|
|
2663
2690
|
const getInferrableFields = useCallback(() => {
|
|
2664
2691
|
return getNestedFieldsFromConfig(config);
|
|
2665
2692
|
}, [config]);
|
|
2666
2693
|
const handleInferFields = useCallback(
|
|
2667
|
-
async (objectIdFilter, forceObjectId) => {
|
|
2694
|
+
async (objectIdFilter, forceObjectId, resolvedObjects) => {
|
|
2668
2695
|
const fieldsToInfer = getInferrableFields();
|
|
2669
2696
|
const objectResults = {};
|
|
2670
2697
|
for (const inferrableField of fieldsToInfer) {
|
|
2671
2698
|
if (!inferrableField.object_id) {
|
|
2672
2699
|
continue;
|
|
2673
2700
|
}
|
|
2674
|
-
|
|
2675
|
-
if (objectIdFilter && !inferrableField.object_id.includes(objectIdFilter)) {
|
|
2701
|
+
if (objectIdFilter && getStateAccessorKey(inferrableField.object_id) !== objectIdFilter) {
|
|
2676
2702
|
continue;
|
|
2677
2703
|
}
|
|
2678
|
-
|
|
2704
|
+
const objectId = resolveInferredObjectId({
|
|
2705
|
+
objectIdAccessor: inferrableField.object_id,
|
|
2706
|
+
forceObjectId,
|
|
2707
|
+
resolvedObjects,
|
|
2708
|
+
state: inferenceState.current
|
|
2709
|
+
});
|
|
2710
|
+
if (!objectId) {
|
|
2711
|
+
continue;
|
|
2712
|
+
}
|
|
2713
|
+
if (!objectResults[objectId]) {
|
|
2679
2714
|
try {
|
|
2680
2715
|
objectResults[objectId] = await getCustomObjectDetails(objectId);
|
|
2681
2716
|
} catch {
|
|
@@ -2706,7 +2741,7 @@ var SetupAssistantController = ({
|
|
|
2706
2741
|
}
|
|
2707
2742
|
}
|
|
2708
2743
|
},
|
|
2709
|
-
[
|
|
2744
|
+
[getInferrableFields, setState, getCustomObjectDetails]
|
|
2710
2745
|
);
|
|
2711
2746
|
const handleReinferObjectByKey = useCallback(
|
|
2712
2747
|
async (key) => {
|
|
@@ -2714,7 +2749,13 @@ var SetupAssistantController = ({
|
|
|
2714
2749
|
const matchingObject = objectsToInfer.find((obj) => obj.key === key);
|
|
2715
2750
|
if (matchingObject?.match_hint) {
|
|
2716
2751
|
let matchedObjectId = "";
|
|
2717
|
-
|
|
2752
|
+
let potentialMatch;
|
|
2753
|
+
try {
|
|
2754
|
+
potentialMatch = await getPotentialMatch(matchingObject.match_hint);
|
|
2755
|
+
} catch (ex) {
|
|
2756
|
+
console.warn("Failed to re-infer object for key:", key, ex);
|
|
2757
|
+
return;
|
|
2758
|
+
}
|
|
2718
2759
|
const match = potentialMatch?.[0];
|
|
2719
2760
|
if (match) {
|
|
2720
2761
|
matchedObjectId = match.id;
|
|
@@ -2732,7 +2773,7 @@ var SetupAssistantController = ({
|
|
|
2732
2773
|
return result;
|
|
2733
2774
|
});
|
|
2734
2775
|
if (matchedObjectId) {
|
|
2735
|
-
void handleInferFields(
|
|
2776
|
+
void handleInferFields(key, matchedObjectId);
|
|
2736
2777
|
}
|
|
2737
2778
|
}
|
|
2738
2779
|
}
|
|
@@ -2740,16 +2781,21 @@ var SetupAssistantController = ({
|
|
|
2740
2781
|
[config, setState, handleInferFields, getPotentialMatch]
|
|
2741
2782
|
);
|
|
2742
2783
|
const handleConfigInference = useCallback(async () => {
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2784
|
+
try {
|
|
2785
|
+
const inferredObjects = await handleInferObjects();
|
|
2786
|
+
await handleInferFields(void 0, void 0, inferredObjects);
|
|
2787
|
+
} catch (ex) {
|
|
2788
|
+
console.warn("Failed to infer setup assistant config:", ex);
|
|
2789
|
+
} finally {
|
|
2790
|
+
setInferencePending(false);
|
|
2791
|
+
}
|
|
2746
2792
|
}, [handleInferObjects, handleInferFields]);
|
|
2747
2793
|
const getNestedFields = useCallback(() => {
|
|
2748
2794
|
return getNestedFieldsFromConfig(config);
|
|
2749
2795
|
}, [config]);
|
|
2750
2796
|
const reInferFieldsForObject = useCallback(
|
|
2751
|
-
(objectKey) => {
|
|
2752
|
-
return handleInferFields(objectKey);
|
|
2797
|
+
(objectKey, forceObjectId) => {
|
|
2798
|
+
return handleInferFields(objectKey, forceObjectId);
|
|
2753
2799
|
},
|
|
2754
2800
|
[handleInferFields]
|
|
2755
2801
|
);
|