@modelnex/sdk 0.5.3 → 0.5.6
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 +73 -17
- package/dist/index.d.mts +4 -48
- package/dist/index.d.ts +4 -48
- package/dist/index.js +398 -466
- package/dist/index.mjs +227 -294
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-N65UEB6X.mjs";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
|
-
import React8, { useState as useState15, useCallback as useCallback14, useEffect as
|
|
6
|
+
import React8, { useState as useState15, useCallback as useCallback14, useEffect as useEffect19, useMemo as useMemo5 } from "react";
|
|
7
7
|
|
|
8
8
|
// src/context.ts
|
|
9
9
|
import { createContext } from "react";
|
|
@@ -2040,7 +2040,7 @@ function useBuiltinActions(registerAction, unregisterAction, tagStore, serverUrl
|
|
|
2040
2040
|
|
|
2041
2041
|
// src/hooks/useRunCommand.ts
|
|
2042
2042
|
import { useCallback as useCallback5, useContext as useContext2 } from "react";
|
|
2043
|
-
var DEFAULT_SERVER_URL = "
|
|
2043
|
+
var DEFAULT_SERVER_URL = "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
2044
2044
|
function searchTaggedElementsForQuery(store, query, limit = 8) {
|
|
2045
2045
|
const allTags = store.getAllTags();
|
|
2046
2046
|
if (allTags.length === 0) return [];
|
|
@@ -2087,33 +2087,8 @@ function useRunCommand(serverUrlOverride) {
|
|
|
2087
2087
|
);
|
|
2088
2088
|
}
|
|
2089
2089
|
|
|
2090
|
-
// src/hooks/useRegisterAction.ts
|
|
2091
|
-
import { useEffect as useEffect9, useContext as useContext3, useRef as useRef7 } from "react";
|
|
2092
|
-
function useRegisterAction(action) {
|
|
2093
|
-
const ctx = useContext3(ModelNexContext);
|
|
2094
|
-
const registerAction = ctx?.registerAction;
|
|
2095
|
-
const unregisterAction = ctx?.unregisterAction;
|
|
2096
|
-
const actionRef = useRef7(action);
|
|
2097
|
-
actionRef.current = action;
|
|
2098
|
-
useEffect9(() => {
|
|
2099
|
-
if (!registerAction || !unregisterAction) return;
|
|
2100
|
-
const current = actionRef.current;
|
|
2101
|
-
const agentAction = {
|
|
2102
|
-
id: current.id,
|
|
2103
|
-
description: current.description,
|
|
2104
|
-
schema: current.schema,
|
|
2105
|
-
execute: current.execute
|
|
2106
|
-
};
|
|
2107
|
-
registerAction(agentAction);
|
|
2108
|
-
const id = current.id;
|
|
2109
|
-
return () => {
|
|
2110
|
-
unregisterAction(id);
|
|
2111
|
-
};
|
|
2112
|
-
}, [action.id, action.description, action.schema, action.execute, registerAction, unregisterAction]);
|
|
2113
|
-
}
|
|
2114
|
-
|
|
2115
2090
|
// src/ui-state.tsx
|
|
2116
|
-
import { createContext as createContext2, useContext as
|
|
2091
|
+
import { createContext as createContext2, useContext as useContext3, useState as useState5, useCallback as useCallback6, useMemo as useMemo2 } from "react";
|
|
2117
2092
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2118
2093
|
var UIStateContext = createContext2(null);
|
|
2119
2094
|
function UIStateProvider({
|
|
@@ -2130,13 +2105,13 @@ function UIStateProvider({
|
|
|
2130
2105
|
return /* @__PURE__ */ jsx2(UIStateContext.Provider, { value, children });
|
|
2131
2106
|
}
|
|
2132
2107
|
function useUIState() {
|
|
2133
|
-
const ctx =
|
|
2108
|
+
const ctx = useContext3(UIStateContext);
|
|
2134
2109
|
if (!ctx) throw new Error("useUIState must be used within UIStateProvider");
|
|
2135
2110
|
return [ctx.state, ctx.setState];
|
|
2136
2111
|
}
|
|
2137
2112
|
|
|
2138
2113
|
// src/viewport.ts
|
|
2139
|
-
import { useEffect as
|
|
2114
|
+
import { useEffect as useEffect10, useRef as useRef7, useState as useState6 } from "react";
|
|
2140
2115
|
var visibleIds = /* @__PURE__ */ new Set();
|
|
2141
2116
|
var listeners = /* @__PURE__ */ new Set();
|
|
2142
2117
|
function updateVisibility(id, visible) {
|
|
@@ -2145,9 +2120,9 @@ function updateVisibility(id, visible) {
|
|
|
2145
2120
|
listeners.forEach((fn) => fn());
|
|
2146
2121
|
}
|
|
2147
2122
|
function useViewportTrack(id) {
|
|
2148
|
-
const ref =
|
|
2123
|
+
const ref = useRef7(null);
|
|
2149
2124
|
const [, setTick] = useState6(0);
|
|
2150
|
-
|
|
2125
|
+
useEffect10(() => {
|
|
2151
2126
|
const el = ref.current;
|
|
2152
2127
|
if (!el) return;
|
|
2153
2128
|
const obs = new IntersectionObserver(
|
|
@@ -2162,7 +2137,7 @@ function useViewportTrack(id) {
|
|
|
2162
2137
|
updateVisibility(id, false);
|
|
2163
2138
|
};
|
|
2164
2139
|
}, [id]);
|
|
2165
|
-
|
|
2140
|
+
useEffect10(() => {
|
|
2166
2141
|
const fn = () => setTick((t) => t + 1);
|
|
2167
2142
|
listeners.add(fn);
|
|
2168
2143
|
return () => {
|
|
@@ -2173,7 +2148,7 @@ function useViewportTrack(id) {
|
|
|
2173
2148
|
}
|
|
2174
2149
|
function useVisibleIds() {
|
|
2175
2150
|
const [ids, setIds] = useState6([]);
|
|
2176
|
-
|
|
2151
|
+
useEffect10(() => {
|
|
2177
2152
|
const fn = () => setIds(Array.from(visibleIds));
|
|
2178
2153
|
fn();
|
|
2179
2154
|
listeners.add(fn);
|
|
@@ -2190,21 +2165,22 @@ function useAgentViewport(options = {}) {
|
|
|
2190
2165
|
}
|
|
2191
2166
|
|
|
2192
2167
|
// src/chat-bubble.tsx
|
|
2193
|
-
import { useState as useState13, useRef as
|
|
2168
|
+
import { useState as useState13, useRef as useRef13, useEffect as useEffect17, useContext as useContext5, useCallback as useCallback12, useMemo as useMemo3 } from "react";
|
|
2194
2169
|
import { createPortal, flushSync } from "react-dom";
|
|
2195
2170
|
|
|
2196
2171
|
// src/hooks/useExperiencePlaybackController.ts
|
|
2197
|
-
import { useCallback as useCallback8, useEffect as
|
|
2172
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef9, useState as useState8 } from "react";
|
|
2198
2173
|
|
|
2199
2174
|
// src/utils/draftPreview.ts
|
|
2200
2175
|
var ACTIVE_DRAFT_PREVIEW_STORAGE_KEY = "modelnex:active-draft-preview";
|
|
2201
2176
|
function getPreviewQueryParamName(experienceType) {
|
|
2202
|
-
return experienceType === "onboarding" ? "
|
|
2177
|
+
return experienceType === "onboarding" ? "modelnex_test_workflow" : "modelnex_test_tour";
|
|
2203
2178
|
}
|
|
2204
2179
|
function buildDraftPreviewUrl(currentUrl, draft) {
|
|
2205
2180
|
const url = new URL(currentUrl);
|
|
2206
2181
|
url.searchParams.delete("modelnex_test_tour");
|
|
2207
2182
|
url.searchParams.delete("modelnex_test_onboarding");
|
|
2183
|
+
url.searchParams.delete("modelnex_test_workflow");
|
|
2208
2184
|
url.searchParams.set(getPreviewQueryParamName(draft.experienceType), draft.id);
|
|
2209
2185
|
return url.toString();
|
|
2210
2186
|
}
|
|
@@ -2350,12 +2326,10 @@ function getStartPolicy(tour) {
|
|
|
2350
2326
|
function getNotificationType(tour) {
|
|
2351
2327
|
return tour.notificationType ?? "bubble_card";
|
|
2352
2328
|
}
|
|
2353
|
-
function isTourEligible(tour, userProfile
|
|
2329
|
+
function isTourEligible(tour, userProfile) {
|
|
2354
2330
|
switch (normalizeTrigger(tour.trigger)) {
|
|
2355
2331
|
case "first_visit":
|
|
2356
2332
|
return !!userProfile.isNewUser;
|
|
2357
|
-
case "feature_launch":
|
|
2358
|
-
return !!tour.featureKey && !!tourFacts?.features?.includes(tour.featureKey);
|
|
2359
2333
|
case "manual":
|
|
2360
2334
|
return false;
|
|
2361
2335
|
default:
|
|
@@ -2364,7 +2338,7 @@ function isTourEligible(tour, userProfile, tourFacts) {
|
|
|
2364
2338
|
}
|
|
2365
2339
|
|
|
2366
2340
|
// src/hooks/useTourPlayback.ts
|
|
2367
|
-
import { useState as useState7, useRef as
|
|
2341
|
+
import { useState as useState7, useRef as useRef8, useCallback as useCallback7, useEffect as useEffect11, useContext as useContext4 } from "react";
|
|
2368
2342
|
|
|
2369
2343
|
// src/utils/retryLookup.ts
|
|
2370
2344
|
var defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -2869,7 +2843,6 @@ function useTourPlayback({
|
|
|
2869
2843
|
socketId,
|
|
2870
2844
|
websiteId,
|
|
2871
2845
|
userProfile,
|
|
2872
|
-
tourFacts,
|
|
2873
2846
|
voice,
|
|
2874
2847
|
appName = "this app",
|
|
2875
2848
|
extractedElements,
|
|
@@ -2892,35 +2865,35 @@ function useTourPlayback({
|
|
|
2892
2865
|
const [reviewStatusMessage, setReviewStatusMessage] = useState7(null);
|
|
2893
2866
|
const [pendingTour, setPendingTour] = useState7(null);
|
|
2894
2867
|
const [serverState, setServerState] = useState7(null);
|
|
2895
|
-
const ctx =
|
|
2868
|
+
const ctx = useContext4(ModelNexContext);
|
|
2896
2869
|
const devMode = ctx?.devMode;
|
|
2897
|
-
const tourRef =
|
|
2898
|
-
const stepIndexRef =
|
|
2899
|
-
const skipRequestedRef =
|
|
2900
|
-
const advanceRequestedRef =
|
|
2901
|
-
const textInputResolveRef =
|
|
2902
|
-
const voiceInputResolveRef =
|
|
2903
|
-
const askOrFillRef =
|
|
2904
|
-
const pendingManualWaitCleanupRef =
|
|
2905
|
-
const llmRespondingRef =
|
|
2906
|
-
const interruptedForQuestionRef =
|
|
2907
|
-
const pendingInputBufRef =
|
|
2908
|
-
const activeExecutionTokenRef =
|
|
2909
|
-
const commandInFlightRef =
|
|
2910
|
-
const reviewModeRef =
|
|
2911
|
-
const previewRunIdRef =
|
|
2912
|
-
const toursApiBaseRef =
|
|
2913
|
-
const pendingTourRef =
|
|
2914
|
-
const pendingTourOptionsRef =
|
|
2915
|
-
const showCaptionsRef =
|
|
2916
|
-
const runIdRef =
|
|
2917
|
-
const turnIdRef =
|
|
2918
|
-
const socketRef =
|
|
2919
|
-
const socketIdRef =
|
|
2920
|
-
const commandUrlRef =
|
|
2921
|
-
const onStepChangeRef =
|
|
2922
|
-
const isActiveRef =
|
|
2923
|
-
const activeCommandBatchIdRef =
|
|
2870
|
+
const tourRef = useRef8(null);
|
|
2871
|
+
const stepIndexRef = useRef8(0);
|
|
2872
|
+
const skipRequestedRef = useRef8(false);
|
|
2873
|
+
const advanceRequestedRef = useRef8(false);
|
|
2874
|
+
const textInputResolveRef = useRef8(null);
|
|
2875
|
+
const voiceInputResolveRef = useRef8(null);
|
|
2876
|
+
const askOrFillRef = useRef8(null);
|
|
2877
|
+
const pendingManualWaitCleanupRef = useRef8(null);
|
|
2878
|
+
const llmRespondingRef = useRef8(false);
|
|
2879
|
+
const interruptedForQuestionRef = useRef8(false);
|
|
2880
|
+
const pendingInputBufRef = useRef8(null);
|
|
2881
|
+
const activeExecutionTokenRef = useRef8(0);
|
|
2882
|
+
const commandInFlightRef = useRef8(false);
|
|
2883
|
+
const reviewModeRef = useRef8(false);
|
|
2884
|
+
const previewRunIdRef = useRef8(null);
|
|
2885
|
+
const toursApiBaseRef = useRef8(toursApiBase);
|
|
2886
|
+
const pendingTourRef = useRef8(null);
|
|
2887
|
+
const pendingTourOptionsRef = useRef8(null);
|
|
2888
|
+
const showCaptionsRef = useRef8(showCaptions);
|
|
2889
|
+
const runIdRef = useRef8(null);
|
|
2890
|
+
const turnIdRef = useRef8(null);
|
|
2891
|
+
const socketRef = useRef8(null);
|
|
2892
|
+
const socketIdRef = useRef8(socketId);
|
|
2893
|
+
const commandUrlRef = useRef8(commandUrl);
|
|
2894
|
+
const onStepChangeRef = useRef8(onStepChange);
|
|
2895
|
+
const isActiveRef = useRef8(false);
|
|
2896
|
+
const activeCommandBatchIdRef = useRef8(null);
|
|
2924
2897
|
socketIdRef.current = socketId;
|
|
2925
2898
|
commandUrlRef.current = commandUrl;
|
|
2926
2899
|
onStepChangeRef.current = onStepChange;
|
|
@@ -2930,7 +2903,7 @@ function useTourPlayback({
|
|
|
2930
2903
|
toursApiBaseRef.current = toursApiBase;
|
|
2931
2904
|
pendingTourRef.current = pendingTour;
|
|
2932
2905
|
showCaptionsRef.current = showCaptions;
|
|
2933
|
-
|
|
2906
|
+
useEffect11(() => {
|
|
2934
2907
|
if (disabled) return;
|
|
2935
2908
|
if (typeof window === "undefined") return;
|
|
2936
2909
|
import("socket.io-client").then((ioModule) => {
|
|
@@ -3547,12 +3520,12 @@ function useTourPlayback({
|
|
|
3547
3520
|
turnIdRef.current = null;
|
|
3548
3521
|
};
|
|
3549
3522
|
}, [serverUrl, websiteId, userProfile, disabled, devMode, experienceType]);
|
|
3550
|
-
|
|
3523
|
+
useEffect11(() => {
|
|
3551
3524
|
if (!showCaptions || !isReviewMode) {
|
|
3552
3525
|
removeCaption();
|
|
3553
3526
|
}
|
|
3554
3527
|
}, [showCaptions, isReviewMode]);
|
|
3555
|
-
|
|
3528
|
+
useEffect11(() => {
|
|
3556
3529
|
if (!socketRef.current?.connected || !isActiveRef.current) return;
|
|
3557
3530
|
socketRef.current.emit("tour:client_state", {
|
|
3558
3531
|
runId: runIdRef.current,
|
|
@@ -3723,13 +3696,13 @@ function useTourPlayback({
|
|
|
3723
3696
|
tourContext: tour
|
|
3724
3697
|
});
|
|
3725
3698
|
}, [serverUrl, websiteId]);
|
|
3726
|
-
|
|
3699
|
+
useEffect11(() => {
|
|
3727
3700
|
if (!enableAutoDiscovery) return;
|
|
3728
3701
|
if (disabled) return;
|
|
3729
3702
|
if (typeof window === "undefined") return;
|
|
3730
3703
|
const params = new URLSearchParams(window.location.search);
|
|
3731
|
-
const queryParam = experienceType === "onboarding" ? "
|
|
3732
|
-
const queryTourId = params.get(queryParam);
|
|
3704
|
+
const queryParam = experienceType === "onboarding" ? "modelnex_test_workflow" : "modelnex_test_tour";
|
|
3705
|
+
const queryTourId = experienceType === "onboarding" ? params.get("modelnex_test_workflow") || params.get("modelnex_test_onboarding") : params.get(queryParam);
|
|
3733
3706
|
const activeDraftPreview = readActiveDraftPreview();
|
|
3734
3707
|
const persistedTourId = activeDraftPreview?.experienceType === experienceType ? activeDraftPreview.id : null;
|
|
3735
3708
|
const tourId = queryTourId || persistedTourId;
|
|
@@ -3751,6 +3724,9 @@ function useTourPlayback({
|
|
|
3751
3724
|
if (queryTourId) {
|
|
3752
3725
|
const loc = new URL(window.location.href);
|
|
3753
3726
|
loc.searchParams.delete(queryParam);
|
|
3727
|
+
if (experienceType === "onboarding") {
|
|
3728
|
+
loc.searchParams.delete("modelnex_test_onboarding");
|
|
3729
|
+
}
|
|
3754
3730
|
window.history.replaceState({}, "", loc.toString());
|
|
3755
3731
|
}
|
|
3756
3732
|
const previewOptions = { reviewMode: true, reviewMetadata: { trigger: "query_param" } };
|
|
@@ -3769,13 +3745,13 @@ function useTourPlayback({
|
|
|
3769
3745
|
cancelled = true;
|
|
3770
3746
|
};
|
|
3771
3747
|
}, [serverUrl, toursApiBase, disabled, websiteId, experienceType, enableAutoDiscovery]);
|
|
3772
|
-
|
|
3748
|
+
useEffect11(() => {
|
|
3773
3749
|
if (!enableAutoDiscovery) return;
|
|
3774
3750
|
if (disabled) return;
|
|
3775
3751
|
if (!websiteId || !userProfile) return;
|
|
3776
3752
|
if (typeof window !== "undefined") {
|
|
3777
3753
|
const params = new URLSearchParams(window.location.search);
|
|
3778
|
-
if (params.has("modelnex_test_tour") || params.has("modelnex_test_onboarding") || readActiveDraftPreview()) return;
|
|
3754
|
+
if (params.has("modelnex_test_tour") || params.has("modelnex_test_workflow") || params.has("modelnex_test_onboarding") || readActiveDraftPreview()) return;
|
|
3779
3755
|
}
|
|
3780
3756
|
let cancelled = false;
|
|
3781
3757
|
const checkTours = async () => {
|
|
@@ -3783,7 +3759,7 @@ function useTourPlayback({
|
|
|
3783
3759
|
if (cancelled) return;
|
|
3784
3760
|
for (const tour of tours) {
|
|
3785
3761
|
if (cancelled) break;
|
|
3786
|
-
if (!isTourEligible(tour, userProfile
|
|
3762
|
+
if (!isTourEligible(tour, userProfile)) {
|
|
3787
3763
|
continue;
|
|
3788
3764
|
}
|
|
3789
3765
|
const startPolicy = getStartPolicy(tour);
|
|
@@ -3810,8 +3786,8 @@ function useTourPlayback({
|
|
|
3810
3786
|
cancelled = true;
|
|
3811
3787
|
clearTimeout(timer);
|
|
3812
3788
|
};
|
|
3813
|
-
}, [websiteId, serverUrl, toursApiBase, disabled, experienceType, userProfile,
|
|
3814
|
-
|
|
3789
|
+
}, [websiteId, serverUrl, toursApiBase, disabled, experienceType, userProfile, enableAutoDiscovery]);
|
|
3790
|
+
useEffect11(() => {
|
|
3815
3791
|
if (!disabled || !isActiveRef.current) return;
|
|
3816
3792
|
stopTour();
|
|
3817
3793
|
}, [disabled, stopTour]);
|
|
@@ -3941,7 +3917,7 @@ function useTourPlayback({
|
|
|
3941
3917
|
handleVoiceInput(text.trim());
|
|
3942
3918
|
}
|
|
3943
3919
|
}, [handleVoiceInput]);
|
|
3944
|
-
|
|
3920
|
+
useEffect11(() => {
|
|
3945
3921
|
return () => {
|
|
3946
3922
|
removeHighlight();
|
|
3947
3923
|
removeCaption();
|
|
@@ -3982,7 +3958,6 @@ function useExperiencePlaybackController({
|
|
|
3982
3958
|
socketId,
|
|
3983
3959
|
websiteId,
|
|
3984
3960
|
userProfile,
|
|
3985
|
-
tourFacts,
|
|
3986
3961
|
voice,
|
|
3987
3962
|
appName,
|
|
3988
3963
|
extractedElements,
|
|
@@ -3995,10 +3970,10 @@ function useExperiencePlaybackController({
|
|
|
3995
3970
|
const [activeExperienceType, setActiveExperienceType] = useState8(initialExperienceType);
|
|
3996
3971
|
const [startingExperienceType, setStartingExperienceType] = useState8(null);
|
|
3997
3972
|
const [pendingPrompt, setPendingPrompt] = useState8(null);
|
|
3998
|
-
const pendingPromptRef =
|
|
3999
|
-
const queuedStartRef =
|
|
4000
|
-
const bufferedVoiceInputsRef =
|
|
4001
|
-
const previewDiscoveryInFlightRef =
|
|
3973
|
+
const pendingPromptRef = useRef9(null);
|
|
3974
|
+
const queuedStartRef = useRef9(null);
|
|
3975
|
+
const bufferedVoiceInputsRef = useRef9([]);
|
|
3976
|
+
const previewDiscoveryInFlightRef = useRef9(false);
|
|
4002
3977
|
pendingPromptRef.current = pendingPrompt;
|
|
4003
3978
|
const playback = useTourPlayback({
|
|
4004
3979
|
serverUrl,
|
|
@@ -4007,7 +3982,6 @@ function useExperiencePlaybackController({
|
|
|
4007
3982
|
socketId,
|
|
4008
3983
|
websiteId,
|
|
4009
3984
|
userProfile,
|
|
4010
|
-
tourFacts,
|
|
4011
3985
|
voice,
|
|
4012
3986
|
appName,
|
|
4013
3987
|
extractedElements,
|
|
@@ -4075,12 +4049,12 @@ function useExperiencePlaybackController({
|
|
|
4075
4049
|
}
|
|
4076
4050
|
playback.handleVoiceInput(trimmed);
|
|
4077
4051
|
}, [activeExperienceType, playback]);
|
|
4078
|
-
|
|
4052
|
+
useEffect12(() => {
|
|
4079
4053
|
if (playback.isActive && startingExperienceType !== null) {
|
|
4080
4054
|
setStartingExperienceType(null);
|
|
4081
4055
|
}
|
|
4082
4056
|
}, [playback.isActive, startingExperienceType]);
|
|
4083
|
-
|
|
4057
|
+
useEffect12(() => {
|
|
4084
4058
|
const queuedStart = queuedStartRef.current;
|
|
4085
4059
|
if (!queuedStart) return;
|
|
4086
4060
|
if (playback.isActive) return;
|
|
@@ -4088,23 +4062,23 @@ function useExperiencePlaybackController({
|
|
|
4088
4062
|
queuedStartRef.current = null;
|
|
4089
4063
|
playback.startTour(queuedStart.tour, queuedStart.options);
|
|
4090
4064
|
}, [activeExperienceType, playback]);
|
|
4091
|
-
|
|
4065
|
+
useEffect12(() => {
|
|
4092
4066
|
if (!playback.isActive) return;
|
|
4093
4067
|
const readyInputs = bufferedVoiceInputsRef.current.filter((item) => item.experienceType === activeExperienceType);
|
|
4094
4068
|
if (readyInputs.length === 0) return;
|
|
4095
4069
|
bufferedVoiceInputsRef.current = bufferedVoiceInputsRef.current.filter((item) => item.experienceType !== activeExperienceType);
|
|
4096
4070
|
readyInputs.forEach((item) => playback.handleVoiceInput(item.transcript));
|
|
4097
4071
|
}, [activeExperienceType, playback]);
|
|
4098
|
-
|
|
4072
|
+
useEffect12(() => {
|
|
4099
4073
|
if (disabled) return;
|
|
4100
4074
|
if (typeof window === "undefined") return;
|
|
4101
4075
|
if (previewDiscoveryInFlightRef.current) return;
|
|
4102
4076
|
const params = new URLSearchParams(window.location.search);
|
|
4103
4077
|
const activeDraftPreview = readActiveDraftPreview();
|
|
4104
4078
|
const previewRequests = [];
|
|
4105
|
-
const onboardingPreviewId = params.get("modelnex_test_onboarding");
|
|
4079
|
+
const onboardingPreviewId = params.get("modelnex_test_workflow") || params.get("modelnex_test_onboarding");
|
|
4106
4080
|
if (onboardingPreviewId) {
|
|
4107
|
-
previewRequests.push({ experienceType: "onboarding", queryParam: "
|
|
4081
|
+
previewRequests.push({ experienceType: "onboarding", queryParam: "modelnex_test_workflow", tourId: onboardingPreviewId });
|
|
4108
4082
|
}
|
|
4109
4083
|
const tourPreviewId = params.get("modelnex_test_tour");
|
|
4110
4084
|
if (tourPreviewId) {
|
|
@@ -4155,7 +4129,7 @@ function useExperiencePlaybackController({
|
|
|
4155
4129
|
previewDiscoveryInFlightRef.current = false;
|
|
4156
4130
|
};
|
|
4157
4131
|
}, [disabled, queueExperienceStart, serverUrl, toursApiBase, websiteId]);
|
|
4158
|
-
|
|
4132
|
+
useEffect12(() => {
|
|
4159
4133
|
if (disabled) return;
|
|
4160
4134
|
if (!websiteId || !userProfile) return;
|
|
4161
4135
|
if (playback.isActive || pendingPromptRef.current || previewDiscoveryInFlightRef.current) return;
|
|
@@ -4171,7 +4145,7 @@ function useExperiencePlaybackController({
|
|
|
4171
4145
|
for (const { experienceType, tours } of toursByExperience) {
|
|
4172
4146
|
for (const tour of tours) {
|
|
4173
4147
|
if (cancelled) return;
|
|
4174
|
-
if (!isTourEligible(tour, userProfile
|
|
4148
|
+
if (!isTourEligible(tour, userProfile)) continue;
|
|
4175
4149
|
const startPolicy = getStartPolicy(tour);
|
|
4176
4150
|
if (startPolicy === "manual_only") {
|
|
4177
4151
|
continue;
|
|
@@ -4198,7 +4172,7 @@ function useExperiencePlaybackController({
|
|
|
4198
4172
|
cancelled = true;
|
|
4199
4173
|
clearTimeout(timer);
|
|
4200
4174
|
};
|
|
4201
|
-
}, [disabled, playback.isActive, queueExperienceStart, serverUrl, toursApiBase,
|
|
4175
|
+
}, [disabled, playback.isActive, queueExperienceStart, serverUrl, toursApiBase, userProfile, websiteId]);
|
|
4202
4176
|
return {
|
|
4203
4177
|
activeExperienceType,
|
|
4204
4178
|
startingExperienceType,
|
|
@@ -4212,7 +4186,7 @@ function useExperiencePlaybackController({
|
|
|
4212
4186
|
}
|
|
4213
4187
|
|
|
4214
4188
|
// src/hooks/useVoice.ts
|
|
4215
|
-
import { useState as useState9, useRef as
|
|
4189
|
+
import { useState as useState9, useRef as useRef10, useCallback as useCallback9, useEffect as useEffect13 } from "react";
|
|
4216
4190
|
|
|
4217
4191
|
// src/utils/webrtc-aec.ts
|
|
4218
4192
|
function isWebRtcAecSupported() {
|
|
@@ -4584,32 +4558,32 @@ function useVoice(serverUrl) {
|
|
|
4584
4558
|
const [isSpeaking, setIsSpeaking] = useState9(false);
|
|
4585
4559
|
const [isListening, setIsListening] = useState9(false);
|
|
4586
4560
|
const [isMuted, setIsMuted] = useState9(false);
|
|
4587
|
-
const audioRef =
|
|
4588
|
-
const audioBlobUrlRef =
|
|
4589
|
-
const speakResolveRef =
|
|
4590
|
-
const recognitionRef =
|
|
4591
|
-
const isMutedRef =
|
|
4592
|
-
const sttCallbacksRef =
|
|
4593
|
-
const stripIndicesRef =
|
|
4594
|
-
const accumulatedRef =
|
|
4595
|
-
const interimDebounceRef =
|
|
4596
|
-
const lastInterimRef =
|
|
4597
|
-
const lastDeliveredRef =
|
|
4598
|
-
const isSpeakingRef =
|
|
4599
|
-
const speechEndTimeRef =
|
|
4600
|
-
const recentTtsRef =
|
|
4601
|
-
const prefetchedSpeechRef =
|
|
4602
|
-
const nearEndTimeoutRef =
|
|
4603
|
-
const queuePromiseRef =
|
|
4604
|
-
const queueSeqRef =
|
|
4605
|
-
const lastStopSeqRef =
|
|
4606
|
-
const listeningSessionIdRef =
|
|
4607
|
-
const listeningStartedAtRef =
|
|
4608
|
-
const loopbackRef =
|
|
4609
|
-
const aecActiveRef =
|
|
4610
|
-
const mediaRecorderRef =
|
|
4611
|
-
const micStreamRef =
|
|
4612
|
-
const sttSocketRef =
|
|
4561
|
+
const audioRef = useRef10(null);
|
|
4562
|
+
const audioBlobUrlRef = useRef10(null);
|
|
4563
|
+
const speakResolveRef = useRef10(null);
|
|
4564
|
+
const recognitionRef = useRef10(null);
|
|
4565
|
+
const isMutedRef = useRef10(false);
|
|
4566
|
+
const sttCallbacksRef = useRef10(null);
|
|
4567
|
+
const stripIndicesRef = useRef10({});
|
|
4568
|
+
const accumulatedRef = useRef10([]);
|
|
4569
|
+
const interimDebounceRef = useRef10(null);
|
|
4570
|
+
const lastInterimRef = useRef10("");
|
|
4571
|
+
const lastDeliveredRef = useRef10("");
|
|
4572
|
+
const isSpeakingRef = useRef10(false);
|
|
4573
|
+
const speechEndTimeRef = useRef10(0);
|
|
4574
|
+
const recentTtsRef = useRef10([]);
|
|
4575
|
+
const prefetchedSpeechRef = useRef10(/* @__PURE__ */ new Map());
|
|
4576
|
+
const nearEndTimeoutRef = useRef10(null);
|
|
4577
|
+
const queuePromiseRef = useRef10(Promise.resolve());
|
|
4578
|
+
const queueSeqRef = useRef10(0);
|
|
4579
|
+
const lastStopSeqRef = useRef10(0);
|
|
4580
|
+
const listeningSessionIdRef = useRef10(null);
|
|
4581
|
+
const listeningStartedAtRef = useRef10(0);
|
|
4582
|
+
const loopbackRef = useRef10(null);
|
|
4583
|
+
const aecActiveRef = useRef10(false);
|
|
4584
|
+
const mediaRecorderRef = useRef10(null);
|
|
4585
|
+
const micStreamRef = useRef10(null);
|
|
4586
|
+
const sttSocketRef = useRef10(null);
|
|
4613
4587
|
const stopLiveSttTransport = useCallback9(() => {
|
|
4614
4588
|
const socket = sttSocketRef.current;
|
|
4615
4589
|
sttSocketRef.current = null;
|
|
@@ -4639,10 +4613,10 @@ function useVoice(serverUrl) {
|
|
|
4639
4613
|
}
|
|
4640
4614
|
mediaRecorderRef.current = null;
|
|
4641
4615
|
}, []);
|
|
4642
|
-
|
|
4616
|
+
useEffect13(() => {
|
|
4643
4617
|
isMutedRef.current = isMuted;
|
|
4644
4618
|
}, [isMuted]);
|
|
4645
|
-
|
|
4619
|
+
useEffect13(() => {
|
|
4646
4620
|
isSpeakingRef.current = isSpeaking;
|
|
4647
4621
|
}, [isSpeaking]);
|
|
4648
4622
|
const webSpeechSupported = typeof window !== "undefined" && !!(window.SpeechRecognition || window.webkitSpeechRecognition);
|
|
@@ -5304,7 +5278,7 @@ function useVoice(serverUrl) {
|
|
|
5304
5278
|
return next;
|
|
5305
5279
|
});
|
|
5306
5280
|
}, []);
|
|
5307
|
-
|
|
5281
|
+
useEffect13(() => {
|
|
5308
5282
|
return () => {
|
|
5309
5283
|
stopSpeaking();
|
|
5310
5284
|
stopListening();
|
|
@@ -5333,18 +5307,18 @@ function useVoice(serverUrl) {
|
|
|
5333
5307
|
}
|
|
5334
5308
|
|
|
5335
5309
|
// src/hooks/useAudioLevel.ts
|
|
5336
|
-
import { useState as useState10, useEffect as
|
|
5310
|
+
import { useState as useState10, useEffect as useEffect14, useRef as useRef11 } from "react";
|
|
5337
5311
|
var BAR_COUNT = 9;
|
|
5338
5312
|
var SENSITIVITY = 2.8;
|
|
5339
5313
|
var FLOOR = 0.08;
|
|
5340
5314
|
function useAudioLevel(active) {
|
|
5341
5315
|
const [levels, setLevels] = useState10(() => Array(BAR_COUNT).fill(FLOOR));
|
|
5342
|
-
const streamRef =
|
|
5343
|
-
const ctxRef =
|
|
5344
|
-
const analyserRef =
|
|
5345
|
-
const rafRef =
|
|
5346
|
-
const timeDataRef =
|
|
5347
|
-
|
|
5316
|
+
const streamRef = useRef11(null);
|
|
5317
|
+
const ctxRef = useRef11(null);
|
|
5318
|
+
const analyserRef = useRef11(null);
|
|
5319
|
+
const rafRef = useRef11(0);
|
|
5320
|
+
const timeDataRef = useRef11(null);
|
|
5321
|
+
useEffect14(() => {
|
|
5348
5322
|
if (!active || typeof window === "undefined") {
|
|
5349
5323
|
setLevels(Array(BAR_COUNT).fill(FLOOR));
|
|
5350
5324
|
return;
|
|
@@ -5416,7 +5390,7 @@ function useAudioLevel(active) {
|
|
|
5416
5390
|
}
|
|
5417
5391
|
|
|
5418
5392
|
// src/hooks/useRecordingMode.ts
|
|
5419
|
-
import { useState as useState11, useRef as
|
|
5393
|
+
import { useState as useState11, useRef as useRef12, useCallback as useCallback10, useEffect as useEffect15 } from "react";
|
|
5420
5394
|
|
|
5421
5395
|
// src/utils/tourStepTypes.ts
|
|
5422
5396
|
function isAskDrivenInputStepType(stepType) {
|
|
@@ -5706,22 +5680,22 @@ function useRecordingMode({
|
|
|
5706
5680
|
const [captureEvents, setCaptureEvents] = useState11([]);
|
|
5707
5681
|
const [capturedTranscript, setCapturedTranscript] = useState11("");
|
|
5708
5682
|
const [isVoiceCaptureActive, setIsVoiceCaptureActive] = useState11(false);
|
|
5709
|
-
const stepsRef =
|
|
5683
|
+
const stepsRef = useRef12([]);
|
|
5710
5684
|
stepsRef.current = steps;
|
|
5711
|
-
const captureEventsRef =
|
|
5685
|
+
const captureEventsRef = useRef12([]);
|
|
5712
5686
|
const safeSpeak = useCallback10((text) => {
|
|
5713
5687
|
void voice.speak(text).catch((err) => {
|
|
5714
5688
|
console.warn("[Recording] Voice playback unavailable:", err);
|
|
5715
5689
|
});
|
|
5716
5690
|
}, [voice]);
|
|
5717
5691
|
captureEventsRef.current = captureEvents;
|
|
5718
|
-
const pendingClicksRef =
|
|
5719
|
-
const shouldKeepVoiceCaptureRef =
|
|
5720
|
-
const resumeVoiceAfterNarrationRef =
|
|
5721
|
-
const lastAutoNoteRef =
|
|
5722
|
-
const lastHoverKeyRef =
|
|
5723
|
-
const lastHoverAtRef =
|
|
5724
|
-
const selectedStepTypeRef =
|
|
5692
|
+
const pendingClicksRef = useRef12([]);
|
|
5693
|
+
const shouldKeepVoiceCaptureRef = useRef12(false);
|
|
5694
|
+
const resumeVoiceAfterNarrationRef = useRef12(false);
|
|
5695
|
+
const lastAutoNoteRef = useRef12("");
|
|
5696
|
+
const lastHoverKeyRef = useRef12("");
|
|
5697
|
+
const lastHoverAtRef = useRef12(0);
|
|
5698
|
+
const selectedStepTypeRef = useRef12("ask_or_fill");
|
|
5725
5699
|
selectedStepTypeRef.current = selectedStepType;
|
|
5726
5700
|
const isRecording = phase !== "idle";
|
|
5727
5701
|
const stepCount = steps.length;
|
|
@@ -5873,7 +5847,7 @@ function useRecordingMode({
|
|
|
5873
5847
|
setPolishedNarration(transcript);
|
|
5874
5848
|
setPhase("reviewing");
|
|
5875
5849
|
}, []);
|
|
5876
|
-
const pendingNarrationRef =
|
|
5850
|
+
const pendingNarrationRef = useRef12("");
|
|
5877
5851
|
const startNarration = useCallback10(() => {
|
|
5878
5852
|
resumeVoiceAfterNarrationRef.current = shouldKeepVoiceCaptureRef.current && isVoiceCaptureActive;
|
|
5879
5853
|
if (isVoiceCaptureActive) {
|
|
@@ -6057,7 +6031,7 @@ function useRecordingMode({
|
|
|
6057
6031
|
setPolishedNarration("");
|
|
6058
6032
|
safeSpeak("Recording cancelled.");
|
|
6059
6033
|
}, [safeSpeak, stopBackgroundVoiceCapture]);
|
|
6060
|
-
|
|
6034
|
+
useEffect15(() => {
|
|
6061
6035
|
if (!isRecording || typeof document === "undefined") return;
|
|
6062
6036
|
const handleMouseMove = (event) => {
|
|
6063
6037
|
const target = event.target;
|
|
@@ -6236,12 +6210,12 @@ function useRecordingMode({
|
|
|
6236
6210
|
pendingClicksRef.current = [];
|
|
6237
6211
|
setPhase("idle");
|
|
6238
6212
|
const savedStepCount = Array.isArray(data?.tour?.steps) ? data.tour.steps.length : 0;
|
|
6239
|
-
const itemLabel = experienceType === "onboarding" ? "
|
|
6240
|
-
safeSpeak(`${itemLabel === "tour" ? "Tour" : "
|
|
6213
|
+
const itemLabel = experienceType === "onboarding" ? "workflow" : "tour";
|
|
6214
|
+
safeSpeak(`${itemLabel === "tour" ? "Tour" : "Workflow"} "${tourName}" saved as a draft with ${savedStepCount} generated steps. Review and preview it before publishing.`);
|
|
6241
6215
|
return data.id ?? null;
|
|
6242
6216
|
} catch (err) {
|
|
6243
6217
|
console.error("[Recording] Failed to save tour:", err);
|
|
6244
|
-
safeSpeak(`Failed to save the ${experienceType === "onboarding" ? "
|
|
6218
|
+
safeSpeak(`Failed to save the ${experienceType === "onboarding" ? "workflow" : "tour"}. Please try again.`);
|
|
6245
6219
|
setPhase("active");
|
|
6246
6220
|
return null;
|
|
6247
6221
|
}
|
|
@@ -6255,7 +6229,7 @@ function useRecordingMode({
|
|
|
6255
6229
|
shouldKeepVoiceCaptureRef.current = true;
|
|
6256
6230
|
startBackgroundVoiceCapture();
|
|
6257
6231
|
}, [isVoiceCaptureActive, startBackgroundVoiceCapture, stopBackgroundVoiceCapture]);
|
|
6258
|
-
|
|
6232
|
+
useEffect15(() => {
|
|
6259
6233
|
if (!isRecording) return;
|
|
6260
6234
|
if (phase === "active" && shouldKeepVoiceCaptureRef.current && !isVoiceCaptureActive) {
|
|
6261
6235
|
startBackgroundVoiceCapture();
|
|
@@ -6326,7 +6300,7 @@ function useRecordingMode({
|
|
|
6326
6300
|
}
|
|
6327
6301
|
|
|
6328
6302
|
// src/components/RecordingOverlay.tsx
|
|
6329
|
-
import { useEffect as
|
|
6303
|
+
import { useEffect as useEffect16, useState as useState12, useCallback as useCallback11 } from "react";
|
|
6330
6304
|
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
6331
6305
|
function buildFingerprint(el) {
|
|
6332
6306
|
const tag = el.tagName.toLowerCase();
|
|
@@ -7258,7 +7232,7 @@ function RecordingOverlay({
|
|
|
7258
7232
|
setShowPopover(true);
|
|
7259
7233
|
}
|
|
7260
7234
|
}, []);
|
|
7261
|
-
|
|
7235
|
+
useEffect16(() => {
|
|
7262
7236
|
if (!isSelecting) return;
|
|
7263
7237
|
document.addEventListener("mousemove", handleMouseMove, true);
|
|
7264
7238
|
document.addEventListener("click", handleClick, true);
|
|
@@ -7270,7 +7244,7 @@ function RecordingOverlay({
|
|
|
7270
7244
|
document.body.style.cursor = prev;
|
|
7271
7245
|
};
|
|
7272
7246
|
}, [isSelecting, handleMouseMove, handleClick]);
|
|
7273
|
-
|
|
7247
|
+
useEffect16(() => {
|
|
7274
7248
|
if (isSelecting) {
|
|
7275
7249
|
setShowPopover(false);
|
|
7276
7250
|
setPendingElement(null);
|
|
@@ -7786,7 +7760,7 @@ function shouldIgnoreTourGestureStart(target) {
|
|
|
7786
7760
|
}
|
|
7787
7761
|
function useMediaQuery(query) {
|
|
7788
7762
|
const [matches, setMatches] = useState13(false);
|
|
7789
|
-
|
|
7763
|
+
useEffect17(() => {
|
|
7790
7764
|
const media = window.matchMedia(query);
|
|
7791
7765
|
if (media.matches !== matches) setMatches(media.matches);
|
|
7792
7766
|
const listener = () => setMatches(media.matches);
|
|
@@ -7859,7 +7833,7 @@ var GLOBAL_STYLES = `
|
|
|
7859
7833
|
`;
|
|
7860
7834
|
function Tooltip({ children, title }) {
|
|
7861
7835
|
const [show, setShow] = useState13(false);
|
|
7862
|
-
const ref =
|
|
7836
|
+
const ref = useRef13(null);
|
|
7863
7837
|
const handleShow = () => setShow(true);
|
|
7864
7838
|
const handleHide = () => setShow(false);
|
|
7865
7839
|
return /* @__PURE__ */ jsxs3(
|
|
@@ -7939,7 +7913,7 @@ function AgentTraces({ debug, command, defaultExpanded = true }) {
|
|
|
7939
7913
|
const [expandedSteps, setExpandedSteps] = useState13(/* @__PURE__ */ new Set());
|
|
7940
7914
|
const traces = debug.traces ?? [];
|
|
7941
7915
|
const hasTraceContent = traces.length > 0 || debug.llmInput || (debug.llmOutput?.length ?? 0) > 0 || (debug.actions?.length ?? 0) > 0;
|
|
7942
|
-
|
|
7916
|
+
useEffect17(() => {
|
|
7943
7917
|
setExpandedSteps(new Set(traces.map((t) => t.step)));
|
|
7944
7918
|
}, [debug]);
|
|
7945
7919
|
const toggleStep = (step) => {
|
|
@@ -8126,11 +8100,6 @@ var RecordIcon = () => /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16",
|
|
|
8126
8100
|
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "8" }),
|
|
8127
8101
|
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "3", fill: "currentColor" })
|
|
8128
8102
|
] });
|
|
8129
|
-
var MapIcon = () => /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
8130
|
-
/* @__PURE__ */ jsx4("polygon", { points: "3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21" }),
|
|
8131
|
-
/* @__PURE__ */ jsx4("line", { x1: "9", y1: "3", x2: "9", y2: "18" }),
|
|
8132
|
-
/* @__PURE__ */ jsx4("line", { x1: "15", y1: "6", x2: "15", y2: "21" })
|
|
8133
|
-
] });
|
|
8134
8103
|
var BookOpenIcon = () => /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
8135
8104
|
/* @__PURE__ */ jsx4("path", { d: "M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" }),
|
|
8136
8105
|
/* @__PURE__ */ jsx4("path", { d: "M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" })
|
|
@@ -8139,17 +8108,17 @@ function ModelNexChatBubble({
|
|
|
8139
8108
|
placeholder = "Ask me to do something...",
|
|
8140
8109
|
defaultCommand = "List my documents",
|
|
8141
8110
|
className = "",
|
|
8142
|
-
onCommand,
|
|
8143
8111
|
welcomeMessage = "Hi! I can help you navigate and manage your documents. Try asking me to open a document, go to templates, or filter by status.",
|
|
8144
8112
|
agentName = "ModelNex AI",
|
|
8145
8113
|
appName = "this app",
|
|
8146
|
-
recordingExperienceType = "tour",
|
|
8147
8114
|
theme
|
|
8148
8115
|
}) {
|
|
8116
|
+
const onCommand = void 0;
|
|
8117
|
+
const recordingExperienceType = "tour";
|
|
8149
8118
|
const noop = useCallback12(() => void 0, []);
|
|
8150
8119
|
const noopAsync = useCallback12(async () => void 0, []);
|
|
8151
8120
|
const runCommand = useRunCommand();
|
|
8152
|
-
const ctx =
|
|
8121
|
+
const ctx = useContext5(ModelNexContext);
|
|
8153
8122
|
const [hydrated, setHydrated] = useState13(false);
|
|
8154
8123
|
const [expanded, setExpanded] = useState13(false);
|
|
8155
8124
|
const [input, setInput] = useState13("");
|
|
@@ -8157,10 +8126,10 @@ function ModelNexChatBubble({
|
|
|
8157
8126
|
const setMessages = ctx?.setChatMessages ?? (() => {
|
|
8158
8127
|
});
|
|
8159
8128
|
const [loading, setLoading] = useState13(false);
|
|
8160
|
-
const messagesEndRef =
|
|
8161
|
-
const abortControllerRef =
|
|
8162
|
-
const panelRef =
|
|
8163
|
-
const serverUrl = ctx?.serverUrl ?? "
|
|
8129
|
+
const messagesEndRef = useRef13(null);
|
|
8130
|
+
const abortControllerRef = useRef13(null);
|
|
8131
|
+
const panelRef = useRef13(null);
|
|
8132
|
+
const serverUrl = ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8164
8133
|
const voice = useVoice(serverUrl);
|
|
8165
8134
|
const audioLevels = useAudioLevel(voice.isListening);
|
|
8166
8135
|
const recordingMode = ctx?.recordingMode ?? false;
|
|
@@ -8190,7 +8159,6 @@ function ModelNexChatBubble({
|
|
|
8190
8159
|
socketId: ctx?.socketId,
|
|
8191
8160
|
websiteId: ctx?.websiteId,
|
|
8192
8161
|
userProfile: ctx?.userProfile,
|
|
8193
|
-
tourFacts: ctx?.tourFacts,
|
|
8194
8162
|
voice,
|
|
8195
8163
|
appName,
|
|
8196
8164
|
tagStore: ctx?.tagStore,
|
|
@@ -8238,7 +8206,7 @@ function ModelNexChatBubble({
|
|
|
8238
8206
|
const tourPlayback = useMemo3(() => createPlaybackView("tour"), [createPlaybackView]);
|
|
8239
8207
|
const onboardingPlayback = useMemo3(() => createPlaybackView("onboarding"), [createPlaybackView]);
|
|
8240
8208
|
const tourReviewToggle = getReviewModeToggleConfig(tourPlayback.playbackState);
|
|
8241
|
-
const lastAutoTaggedUrlRef =
|
|
8209
|
+
const lastAutoTaggedUrlRef = useRef13(null);
|
|
8242
8210
|
const handleAutoTag = useCallback12(async () => {
|
|
8243
8211
|
if (!ctx) return;
|
|
8244
8212
|
const { extractedElements, tagStore, commandUrl, serverUrl: serverUrl2, websiteId } = ctx;
|
|
@@ -8248,7 +8216,7 @@ function ModelNexChatBubble({
|
|
|
8248
8216
|
if (lastAutoTaggedUrlRef.current === currentUrl || localStorage.getItem(storageKey)) {
|
|
8249
8217
|
return;
|
|
8250
8218
|
}
|
|
8251
|
-
const baseUrl = commandUrl ?? serverUrl2 ?? "
|
|
8219
|
+
const baseUrl = commandUrl ?? serverUrl2 ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8252
8220
|
const url = baseUrl.startsWith("/") ? `${window.location.origin}${baseUrl}/agent/auto-tag` : `${baseUrl}/agent/auto-tag`;
|
|
8253
8221
|
const elements = extractedElements.map((el) => ({
|
|
8254
8222
|
fingerprint: el.fingerprint,
|
|
@@ -8293,7 +8261,7 @@ function ModelNexChatBubble({
|
|
|
8293
8261
|
console.warn("[ModelNex] Auto-tag error:", err);
|
|
8294
8262
|
}
|
|
8295
8263
|
}, [ctx]);
|
|
8296
|
-
|
|
8264
|
+
useEffect17(() => {
|
|
8297
8265
|
if (devMode && ctx?.extractedElements.length) {
|
|
8298
8266
|
const timer = setTimeout(handleAutoTag, 1e3);
|
|
8299
8267
|
return () => clearTimeout(timer);
|
|
@@ -8301,7 +8269,7 @@ function ModelNexChatBubble({
|
|
|
8301
8269
|
}, [devMode, handleAutoTag, ctx?.extractedElements.length, window.location.pathname]);
|
|
8302
8270
|
const onboardingReviewToggle = getReviewModeToggleConfig(onboardingPlayback.playbackState);
|
|
8303
8271
|
const pendingNotificationType = (onboardingPlayback.pendingTour || tourPlayback.pendingTour)?.notificationType ?? "bubble_card";
|
|
8304
|
-
|
|
8272
|
+
useEffect17(() => {
|
|
8305
8273
|
setHydrated(true);
|
|
8306
8274
|
try {
|
|
8307
8275
|
setExpanded(sessionStorage.getItem(BUBBLE_EXPANDED_STORAGE_KEY) === "true");
|
|
@@ -8309,12 +8277,12 @@ function ModelNexChatBubble({
|
|
|
8309
8277
|
setExpanded(false);
|
|
8310
8278
|
}
|
|
8311
8279
|
}, []);
|
|
8312
|
-
const sttActiveRef =
|
|
8280
|
+
const sttActiveRef = useRef13(false);
|
|
8313
8281
|
const [tourListenReady, setTourListenReady] = useState13(false);
|
|
8314
8282
|
const [tourSttError, setTourSttError] = useState13(null);
|
|
8315
|
-
const previousTourActiveRef =
|
|
8316
|
-
const tourListenReadyRef =
|
|
8317
|
-
const tourSttErrorRef =
|
|
8283
|
+
const previousTourActiveRef = useRef13(false);
|
|
8284
|
+
const tourListenReadyRef = useRef13(false);
|
|
8285
|
+
const tourSttErrorRef = useRef13(null);
|
|
8318
8286
|
const updateTourListenReady = useCallback12((next) => {
|
|
8319
8287
|
if (tourListenReadyRef.current === next) return;
|
|
8320
8288
|
tourListenReadyRef.current = next;
|
|
@@ -8329,7 +8297,7 @@ function ModelNexChatBubble({
|
|
|
8329
8297
|
() => buildTranscriptPreviewLines(tourLiveTranscript, { maxCharsPerLine: 36, maxLines: 2 }),
|
|
8330
8298
|
[tourLiveTranscript]
|
|
8331
8299
|
);
|
|
8332
|
-
|
|
8300
|
+
useEffect17(() => {
|
|
8333
8301
|
const shouldShowFloatingTranscript = (tourPlayback.isActive || onboardingPlayback.isActive) && tourListenReady && voice.isListening;
|
|
8334
8302
|
if (shouldShowFloatingTranscript) {
|
|
8335
8303
|
showFloatingLiveTranscript({
|
|
@@ -8351,7 +8319,7 @@ function ModelNexChatBubble({
|
|
|
8351
8319
|
tourPlayback.isActive,
|
|
8352
8320
|
voice.isListening
|
|
8353
8321
|
]);
|
|
8354
|
-
|
|
8322
|
+
useEffect17(() => () => {
|
|
8355
8323
|
hideFloatingLiveTranscript();
|
|
8356
8324
|
}, []);
|
|
8357
8325
|
const setExpandedState = useCallback12((next, opts) => {
|
|
@@ -8366,13 +8334,13 @@ function ModelNexChatBubble({
|
|
|
8366
8334
|
} catch {
|
|
8367
8335
|
}
|
|
8368
8336
|
}, [tourPlayback.isActive, onboardingPlayback.isActive]);
|
|
8369
|
-
|
|
8337
|
+
useEffect17(() => {
|
|
8370
8338
|
if ((onboardingPlayback.pendingTour || tourPlayback.pendingTour) && !recordingMode && pendingNotificationType === "bubble_card") {
|
|
8371
8339
|
setExpandedState(true);
|
|
8372
8340
|
}
|
|
8373
8341
|
}, [onboardingPlayback.pendingTour, tourPlayback.pendingTour, recordingMode, pendingNotificationType, setExpandedState]);
|
|
8374
|
-
const preferredListeningExperienceRef =
|
|
8375
|
-
const playbackVoiceRoutingRef =
|
|
8342
|
+
const preferredListeningExperienceRef = useRef13(null);
|
|
8343
|
+
const playbackVoiceRoutingRef = useRef13({
|
|
8376
8344
|
activeExperienceType,
|
|
8377
8345
|
isActive: activePlayback.isActive,
|
|
8378
8346
|
isReviewMode: activePlayback.isReviewMode,
|
|
@@ -8380,7 +8348,7 @@ function ModelNexChatBubble({
|
|
|
8380
8348
|
playbackState: activePlayback.playbackState,
|
|
8381
8349
|
handleVoiceInput: playbackController.handleVoiceInput
|
|
8382
8350
|
});
|
|
8383
|
-
|
|
8351
|
+
useEffect17(() => {
|
|
8384
8352
|
playbackVoiceRoutingRef.current = {
|
|
8385
8353
|
activeExperienceType,
|
|
8386
8354
|
isActive: activePlayback.isActive,
|
|
@@ -8468,7 +8436,7 @@ function ModelNexChatBubble({
|
|
|
8468
8436
|
updateTourListenReady,
|
|
8469
8437
|
updateTourSttError
|
|
8470
8438
|
]);
|
|
8471
|
-
|
|
8439
|
+
useEffect17(() => {
|
|
8472
8440
|
const isPlaybackActive = isTourListeningSessionActive({
|
|
8473
8441
|
isTourActive: tourPlayback.isActive,
|
|
8474
8442
|
isOnboardingActive: onboardingPlayback.isActive,
|
|
@@ -8491,12 +8459,12 @@ function ModelNexChatBubble({
|
|
|
8491
8459
|
}
|
|
8492
8460
|
}
|
|
8493
8461
|
}, [tourPlayback.isActive, onboardingPlayback.isActive, setExpandedState, startingExperienceType, updateTourSttError]);
|
|
8494
|
-
|
|
8462
|
+
useEffect17(() => {
|
|
8495
8463
|
if (!tourPlayback.isReviewMode && !onboardingPlayback.isReviewMode) {
|
|
8496
8464
|
setReviewDraft("");
|
|
8497
8465
|
}
|
|
8498
8466
|
}, [tourPlayback.isReviewMode, onboardingPlayback.isReviewMode]);
|
|
8499
|
-
|
|
8467
|
+
useEffect17(() => {
|
|
8500
8468
|
if (!isTourListeningSessionActive({
|
|
8501
8469
|
isTourActive: tourPlayback.isActive,
|
|
8502
8470
|
isOnboardingActive: onboardingPlayback.isActive,
|
|
@@ -8505,12 +8473,12 @@ function ModelNexChatBubble({
|
|
|
8505
8473
|
preferredListeningExperienceRef.current = null;
|
|
8506
8474
|
}
|
|
8507
8475
|
}, [tourPlayback.isActive, onboardingPlayback.isActive, startingExperienceType]);
|
|
8508
|
-
|
|
8476
|
+
useEffect17(() => {
|
|
8509
8477
|
if (recordingMode) {
|
|
8510
8478
|
setExpandedState(false);
|
|
8511
8479
|
}
|
|
8512
8480
|
}, [recordingMode, setExpandedState]);
|
|
8513
|
-
|
|
8481
|
+
useEffect17(() => {
|
|
8514
8482
|
const isPlaybackActive = isTourListeningSessionActive({
|
|
8515
8483
|
isTourActive: tourPlayback.isActive,
|
|
8516
8484
|
isOnboardingActive: onboardingPlayback.isActive,
|
|
@@ -8524,7 +8492,7 @@ function ModelNexChatBubble({
|
|
|
8524
8492
|
}
|
|
8525
8493
|
updateTourListenReady(Boolean(voice.isListening && sttActiveRef.current));
|
|
8526
8494
|
}, [tourPlayback.isActive, onboardingPlayback.isActive, voice.isListening, startingExperienceType, updateTourListenReady]);
|
|
8527
|
-
|
|
8495
|
+
useEffect17(() => {
|
|
8528
8496
|
const isPlaybackActive = isTourListeningSessionActive({
|
|
8529
8497
|
isTourActive: tourPlayback.isActive,
|
|
8530
8498
|
isOnboardingActive: onboardingPlayback.isActive,
|
|
@@ -8539,7 +8507,7 @@ function ModelNexChatBubble({
|
|
|
8539
8507
|
voice.stopListening();
|
|
8540
8508
|
}
|
|
8541
8509
|
}, [tourPlayback.isActive, onboardingPlayback.isActive, voice, startingExperienceType, updateTourListenReady, updateTourSttError]);
|
|
8542
|
-
|
|
8510
|
+
useEffect17(() => {
|
|
8543
8511
|
const isPlaybackActive = isTourListeningSessionActive({
|
|
8544
8512
|
isTourActive: tourPlayback.isActive,
|
|
8545
8513
|
isOnboardingActive: onboardingPlayback.isActive,
|
|
@@ -8585,7 +8553,7 @@ function ModelNexChatBubble({
|
|
|
8585
8553
|
);
|
|
8586
8554
|
}
|
|
8587
8555
|
}, [voiceInputMode, voice, recordingMode, recording]);
|
|
8588
|
-
|
|
8556
|
+
useEffect17(() => {
|
|
8589
8557
|
const panel = panelRef.current;
|
|
8590
8558
|
if (!panel) return;
|
|
8591
8559
|
const stopKeyPropagation = (e) => {
|
|
@@ -8609,7 +8577,7 @@ function ModelNexChatBubble({
|
|
|
8609
8577
|
const tourCompletionRatio = tourPlayback.totalSteps > 0 ? Math.min(tourPlayback.currentStepIndex / tourPlayback.totalSteps, 1) : 0;
|
|
8610
8578
|
const tourCurrentStep = tourPlayback.activeTour?.steps?.[tourPlayback.currentStepIndex] || null;
|
|
8611
8579
|
const scrollToBottom = () => messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
8612
|
-
|
|
8580
|
+
useEffect17(() => {
|
|
8613
8581
|
if (messages.length > 0) scrollToBottom();
|
|
8614
8582
|
}, [messages, loading]);
|
|
8615
8583
|
const runAgent = async () => {
|
|
@@ -8652,7 +8620,7 @@ function ModelNexChatBubble({
|
|
|
8652
8620
|
}
|
|
8653
8621
|
};
|
|
8654
8622
|
const stopAgent = async () => {
|
|
8655
|
-
const baseUrl = ctx?.commandUrl ?? ctx?.serverUrl ?? "
|
|
8623
|
+
const baseUrl = ctx?.commandUrl ?? ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8656
8624
|
const abortUrl = baseUrl.startsWith("/") ? `${window.location.origin}${baseUrl}/agent/abort` : `${baseUrl}/agent/abort`;
|
|
8657
8625
|
try {
|
|
8658
8626
|
await fetch(abortUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ socketId: ctx?.socketId }) });
|
|
@@ -8789,9 +8757,9 @@ function ModelNexChatBubble({
|
|
|
8789
8757
|
animation: "modelnex-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
8790
8758
|
},
|
|
8791
8759
|
children: [
|
|
8792
|
-
/* @__PURE__ */ jsx4("div", { style: { fontSize: "12px", fontWeight: 800, letterSpacing: "0.1em", textTransform: "uppercase", color: "var(--modelnex-accent, #4f46e5)", marginBottom: "12px" }, children: mc.title || (onboardingPlayback.pendingTour ? "
|
|
8760
|
+
/* @__PURE__ */ jsx4("div", { style: { fontSize: "12px", fontWeight: 800, letterSpacing: "0.1em", textTransform: "uppercase", color: "var(--modelnex-accent, #4f46e5)", marginBottom: "12px" }, children: mc.title || (onboardingPlayback.pendingTour ? "Workflow" : "Available Tour") }),
|
|
8793
8761
|
/* @__PURE__ */ jsx4("div", { style: { fontSize: "26px", lineHeight: 1.2, fontWeight: 700, color: mc.textColor || "var(--modelnex-fg, #09090b)", marginBottom: "12px" }, children: pt?.name }),
|
|
8794
|
-
/* @__PURE__ */ jsx4("div", { style: { fontSize: "15px", color: mc.textColor ? mc.textColor : "var(--modelnex-fg-muted, #52525b)", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.6, marginBottom: "24px" }, children: mc.description || (pt?.trigger === "first_visit" ? "Start a short guided tour to help you get started with the platform." : pt?.featureKey ? `We noticed you're exploring ${pt.featureKey}. Would you like a quick walkthrough?` : "A helpful walkthrough is available to guide you through this section.") }),
|
|
8762
|
+
/* @__PURE__ */ jsx4("div", { style: { fontSize: "15px", color: mc.textColor ? mc.textColor : "var(--modelnex-fg-muted, #52525b)", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.6, marginBottom: "24px" }, children: mc.description || (pt?.trigger === "first_visit" ? onboardingPlayback.pendingTour ? "Start a short workflow to help you get started with the platform." : "Start a short guided tour to help you get started with the platform." : pt?.featureKey ? `We noticed you're exploring ${pt.featureKey}. Would you like a quick walkthrough?` : "A helpful walkthrough is available to guide you through this section.") }),
|
|
8795
8763
|
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "12px", justifyContent: "flex-end" }, children: [
|
|
8796
8764
|
/* @__PURE__ */ jsx4(
|
|
8797
8765
|
"button",
|
|
@@ -8865,7 +8833,7 @@ function ModelNexChatBubble({
|
|
|
8865
8833
|
/* @__PURE__ */ jsx4("span", { style: { fontSize: "14px", fontWeight: 800, color: recordingMode ? "#dc2626" : "var(--modelnex-fg, #18181b)", display: "flex", alignItems: "center", gap: "6px" }, children: recordingMode ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
8866
8834
|
/* @__PURE__ */ jsx4("span", { style: { animation: "modelnex-bubble-pulse 1s infinite", color: "#dc2626" }, children: "\u25CF" }),
|
|
8867
8835
|
"REC"
|
|
8868
|
-
] }) : onboardingPlayback.isActive ? /* @__PURE__ */ jsx4("span", { style: { fontSize: "11px", textTransform: "uppercase", letterSpacing: "0.08em", color: PANEL_THEME.accent, fontWeight: 800 }, children: "
|
|
8836
|
+
] }) : onboardingPlayback.isActive ? /* @__PURE__ */ jsx4("span", { style: { fontSize: "11px", textTransform: "uppercase", letterSpacing: "0.08em", color: PANEL_THEME.accent, fontWeight: 800 }, children: "Workflow" }) : tourPlayback.isActive ? /* @__PURE__ */ jsx4("span", { style: { fontSize: "11px", textTransform: "uppercase", letterSpacing: "0.08em", color: TOUR_THEME.accent, fontWeight: 800 }, children: "Product Tour" }) : /* @__PURE__ */ jsxs3("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
|
|
8869
8837
|
/* @__PURE__ */ jsx4(BotIcon, {}),
|
|
8870
8838
|
/* @__PURE__ */ jsx4("span", { children: agentName })
|
|
8871
8839
|
] }) }),
|
|
@@ -8893,62 +8861,33 @@ function ModelNexChatBubble({
|
|
|
8893
8861
|
children: voice.isMuted ? /* @__PURE__ */ jsx4(VolumeMuteIcon, {}) : /* @__PURE__ */ jsx4(VolumeIcon, {})
|
|
8894
8862
|
}
|
|
8895
8863
|
) }),
|
|
8896
|
-
devMode && /* @__PURE__ */
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
{
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
) }),
|
|
8924
|
-
(!recordingMode || activeRecordingExperienceType === "onboarding") && /* @__PURE__ */ jsx4(Tooltip, { title: recordingMode ? "Stop & Save Onboarding" : "Record Onboarding", children: /* @__PURE__ */ jsx4(
|
|
8925
|
-
"button",
|
|
8926
|
-
{
|
|
8927
|
-
onClick: () => {
|
|
8928
|
-
if (recordingMode) {
|
|
8929
|
-
recording.cancelSelection();
|
|
8930
|
-
setShowStopModal(true);
|
|
8931
|
-
} else {
|
|
8932
|
-
startRecordingSession("onboarding");
|
|
8933
|
-
}
|
|
8934
|
-
},
|
|
8935
|
-
style: {
|
|
8936
|
-
padding: "6px",
|
|
8937
|
-
borderRadius: "8px",
|
|
8938
|
-
border: "none",
|
|
8939
|
-
display: "flex",
|
|
8940
|
-
alignItems: "center",
|
|
8941
|
-
gap: "4px",
|
|
8942
|
-
background: recordingMode && activeRecordingExperienceType === "onboarding" ? "#fff" : "transparent",
|
|
8943
|
-
boxShadow: recordingMode && activeRecordingExperienceType === "onboarding" ? "0 1px 3px rgba(0,0,0,0.1)" : "none",
|
|
8944
|
-
cursor: "pointer",
|
|
8945
|
-
color: recordingMode && activeRecordingExperienceType === "onboarding" ? "#dc2626" : "#71717a"
|
|
8946
|
-
},
|
|
8947
|
-
"aria-label": recordingMode ? "Stop recording" : "Record onboarding",
|
|
8948
|
-
children: /* @__PURE__ */ jsx4(BookOpenIcon, {})
|
|
8949
|
-
}
|
|
8950
|
-
) })
|
|
8951
|
-
] }),
|
|
8864
|
+
devMode && /* @__PURE__ */ jsx4("div", { style: { display: "flex", background: "var(--modelnex-bg-secondary, #f4f4f5)", borderRadius: "12px", padding: "2px", gap: "2px", marginRight: "4px" }, children: (!recordingMode || activeRecordingExperienceType === "onboarding") && /* @__PURE__ */ jsx4(Tooltip, { title: recordingMode ? "Stop & Save Workflow" : "Record Workflow", children: /* @__PURE__ */ jsx4(
|
|
8865
|
+
"button",
|
|
8866
|
+
{
|
|
8867
|
+
onClick: () => {
|
|
8868
|
+
if (recordingMode) {
|
|
8869
|
+
recording.cancelSelection();
|
|
8870
|
+
setShowStopModal(true);
|
|
8871
|
+
} else {
|
|
8872
|
+
startRecordingSession("onboarding");
|
|
8873
|
+
}
|
|
8874
|
+
},
|
|
8875
|
+
style: {
|
|
8876
|
+
padding: "6px",
|
|
8877
|
+
borderRadius: "8px",
|
|
8878
|
+
border: "none",
|
|
8879
|
+
display: "flex",
|
|
8880
|
+
alignItems: "center",
|
|
8881
|
+
gap: "4px",
|
|
8882
|
+
background: recordingMode && activeRecordingExperienceType === "onboarding" ? "#fff" : "transparent",
|
|
8883
|
+
boxShadow: recordingMode && activeRecordingExperienceType === "onboarding" ? "0 1px 3px rgba(0,0,0,0.1)" : "none",
|
|
8884
|
+
cursor: "pointer",
|
|
8885
|
+
color: recordingMode && activeRecordingExperienceType === "onboarding" ? "#dc2626" : "#71717a"
|
|
8886
|
+
},
|
|
8887
|
+
"aria-label": recordingMode ? "Stop recording" : "Record workflow",
|
|
8888
|
+
children: /* @__PURE__ */ jsx4(BookOpenIcon, {})
|
|
8889
|
+
}
|
|
8890
|
+
) }) }),
|
|
8952
8891
|
/* @__PURE__ */ jsx4(Tooltip, { title: "Minimize", children: /* @__PURE__ */ jsx4(
|
|
8953
8892
|
"button",
|
|
8954
8893
|
{
|
|
@@ -9010,7 +8949,7 @@ function ModelNexChatBubble({
|
|
|
9010
8949
|
background: "linear-gradient(135deg, rgba(59,130,246,0.08) 0%, rgba(59,130,246,0.03) 100%)"
|
|
9011
8950
|
},
|
|
9012
8951
|
children: [
|
|
9013
|
-
/* @__PURE__ */ jsx4("div", { style: { fontSize: "13px", fontWeight: 600, color: "var(--modelnex-fg, #18181b)", marginBottom: "6px" }, children: onboardingPlayback.pendingTour ? "Suggested
|
|
8952
|
+
/* @__PURE__ */ jsx4("div", { style: { fontSize: "13px", fontWeight: 600, color: "var(--modelnex-fg, #18181b)", marginBottom: "6px" }, children: onboardingPlayback.pendingTour ? "Suggested workflow" : "Suggested tour" }),
|
|
9014
8953
|
/* @__PURE__ */ jsx4("div", { style: { fontSize: "14px", color: "var(--modelnex-fg, #27272a)", marginBottom: "6px" }, children: (onboardingPlayback.pendingTour || tourPlayback.pendingTour)?.name }),
|
|
9015
8954
|
/* @__PURE__ */ jsx4("div", { style: { fontSize: "12px", color: "#52525b", lineHeight: 1.45, marginBottom: "12px" }, children: (onboardingPlayback.pendingTour || tourPlayback.pendingTour)?.trigger === "first_visit" ? "Start a short walkthrough for this user now?" : (onboardingPlayback.pendingTour || tourPlayback.pendingTour)?.featureKey ? `A walkthrough is available for ${(onboardingPlayback.pendingTour || tourPlayback.pendingTour)?.featureKey}.` : "A walkthrough is available for this user." }),
|
|
9016
8955
|
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
@@ -9024,7 +8963,7 @@ function ModelNexChatBubble({
|
|
|
9024
8963
|
startTourListening(preferredExperience);
|
|
9025
8964
|
}, children: [
|
|
9026
8965
|
"Start ",
|
|
9027
|
-
onboardingPlayback.pendingTour ? "
|
|
8966
|
+
onboardingPlayback.pendingTour ? "workflow" : "tour"
|
|
9028
8967
|
] }),
|
|
9029
8968
|
/* @__PURE__ */ jsx4("button", { className: "btn btn-secondary btn-sm", onClick: onboardingPlayback.pendingTour ? onboardingPlayback.dismissPendingTour : tourPlayback.dismissPendingTour, children: "Not now" })
|
|
9030
8969
|
] })
|
|
@@ -9104,7 +9043,7 @@ function ModelNexChatBubble({
|
|
|
9104
9043
|
showStopModal && /* @__PURE__ */ jsxs3("div", { style: { padding: "14px", borderBottom: "1px solid var(--modelnex-border, #e4e4e7)", background: "rgba(220,38,38,0.04)", flexShrink: 0 }, children: [
|
|
9105
9044
|
/* @__PURE__ */ jsxs3("div", { style: { fontSize: "13px", fontWeight: 600, color: "#dc2626", marginBottom: "8px" }, children: [
|
|
9106
9045
|
"Save captured ",
|
|
9107
|
-
activeRecordingExperienceType === "onboarding" ? "
|
|
9046
|
+
activeRecordingExperienceType === "onboarding" ? "workflow" : "tour",
|
|
9108
9047
|
" (",
|
|
9109
9048
|
recording.captureEventCount > 0 ? recording.captureEventCount - 1 : 0,
|
|
9110
9049
|
" interactions, ",
|
|
@@ -9118,7 +9057,7 @@ function ModelNexChatBubble({
|
|
|
9118
9057
|
{
|
|
9119
9058
|
value: recordingTourName,
|
|
9120
9059
|
onChange: (e) => setRecordingTourName(e.target.value),
|
|
9121
|
-
placeholder: activeRecordingExperienceType === "onboarding" ? "
|
|
9060
|
+
placeholder: activeRecordingExperienceType === "onboarding" ? "Workflow name (e.g. New User Activation)" : "Tour name (e.g. Admin Setup Tour)",
|
|
9122
9061
|
disabled: Boolean(savedDraft) || isGeneratingDraft,
|
|
9123
9062
|
style: { width: "100%", padding: "7px 10px", borderRadius: "6px", border: "1px solid #e4e4e7", fontSize: "13px", marginBottom: "6px", boxSizing: "border-box" }
|
|
9124
9063
|
}
|
|
@@ -9216,7 +9155,7 @@ function ModelNexChatBubble({
|
|
|
9216
9155
|
/* @__PURE__ */ jsx4("div", { style: { fontSize: "13px", fontWeight: 600, color: "#16a34a", marginBottom: "6px" }, children: "Draft saved" }),
|
|
9217
9156
|
/* @__PURE__ */ jsxs3("div", { style: { fontSize: "12px", color: "#52525b", marginBottom: "10px", lineHeight: 1.45 }, children: [
|
|
9218
9157
|
"Launch a live preview of the AI ",
|
|
9219
|
-
savedDraft.experienceType === "onboarding" ? "
|
|
9158
|
+
savedDraft.experienceType === "onboarding" ? "workflow" : "tour",
|
|
9220
9159
|
" now, or close this panel and review it later."
|
|
9221
9160
|
] }),
|
|
9222
9161
|
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "6px", flexWrap: "wrap" }, children: [
|
|
@@ -9908,7 +9847,7 @@ function ModelNexChatBubble({
|
|
|
9908
9847
|
}
|
|
9909
9848
|
|
|
9910
9849
|
// src/onboarding-panel.tsx
|
|
9911
|
-
import { useCallback as useCallback13, useContext as
|
|
9850
|
+
import { useCallback as useCallback13, useContext as useContext6, useEffect as useEffect18, useMemo as useMemo4, useRef as useRef14, useState as useState14 } from "react";
|
|
9912
9851
|
import { createPortal as createPortal2 } from "react-dom";
|
|
9913
9852
|
|
|
9914
9853
|
// src/hooks/useOnboardingPlayback.ts
|
|
@@ -9938,8 +9877,8 @@ function ModelNexOnboardingPanel({
|
|
|
9938
9877
|
appName = "this app",
|
|
9939
9878
|
title = "Getting Started"
|
|
9940
9879
|
}) {
|
|
9941
|
-
const ctx =
|
|
9942
|
-
const serverUrl = ctx?.serverUrl ?? "
|
|
9880
|
+
const ctx = useContext6(ModelNexContext);
|
|
9881
|
+
const serverUrl = ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
9943
9882
|
const voice = useVoice(serverUrl);
|
|
9944
9883
|
const audioLevels = useAudioLevel(voice.isListening);
|
|
9945
9884
|
const [input, setInput] = useState14("");
|
|
@@ -9949,7 +9888,7 @@ function ModelNexOnboardingPanel({
|
|
|
9949
9888
|
const [liveTranscript, setLiveTranscript] = useState14("");
|
|
9950
9889
|
const [voiceEnabled, setVoiceEnabled] = useState14(false);
|
|
9951
9890
|
const [sttError, setSttError] = useState14(null);
|
|
9952
|
-
const voiceEnabledRef =
|
|
9891
|
+
const voiceEnabledRef = useRef14(false);
|
|
9953
9892
|
const playback = useOnboardingPlayback({
|
|
9954
9893
|
serverUrl,
|
|
9955
9894
|
commandUrl: ctx?.commandUrl,
|
|
@@ -9969,20 +9908,20 @@ function ModelNexOnboardingPanel({
|
|
|
9969
9908
|
voiceEnabledRef.current = false;
|
|
9970
9909
|
}
|
|
9971
9910
|
});
|
|
9972
|
-
const playbackVoiceRoutingRef =
|
|
9911
|
+
const playbackVoiceRoutingRef = useRef14({
|
|
9973
9912
|
isReviewMode: false,
|
|
9974
9913
|
playbackState: playback.playbackState,
|
|
9975
9914
|
handleVoiceInput: playback.handleVoiceInput
|
|
9976
9915
|
});
|
|
9977
9916
|
const reviewToggle = getReviewModeToggleConfig(playback.playbackState);
|
|
9978
|
-
|
|
9917
|
+
useEffect18(() => {
|
|
9979
9918
|
playbackVoiceRoutingRef.current = {
|
|
9980
9919
|
isReviewMode: playback.isReviewMode,
|
|
9981
9920
|
playbackState: playback.playbackState,
|
|
9982
9921
|
handleVoiceInput: playback.handleVoiceInput
|
|
9983
9922
|
};
|
|
9984
9923
|
}, [playback.isReviewMode, playback.playbackState, playback.handleVoiceInput]);
|
|
9985
|
-
|
|
9924
|
+
useEffect18(() => {
|
|
9986
9925
|
if (playback.isActive && !playback.isReviewMode) {
|
|
9987
9926
|
setOpen(true);
|
|
9988
9927
|
}
|
|
@@ -10034,7 +9973,7 @@ function ModelNexOnboardingPanel({
|
|
|
10034
9973
|
}
|
|
10035
9974
|
);
|
|
10036
9975
|
}, [playback.isActive, voice]);
|
|
10037
|
-
|
|
9976
|
+
useEffect18(() => {
|
|
10038
9977
|
if (!playback.isActive || voiceEnabledRef.current || !voice.sttSupported) return;
|
|
10039
9978
|
const startOnGesture = (event) => {
|
|
10040
9979
|
if (shouldIgnorePanelGestureStart(event.target)) {
|
|
@@ -10049,7 +9988,7 @@ function ModelNexOnboardingPanel({
|
|
|
10049
9988
|
window.removeEventListener("keydown", startOnGesture, true);
|
|
10050
9989
|
};
|
|
10051
9990
|
}, [playback.isActive, voice.sttSupported, startVoiceListening]);
|
|
10052
|
-
|
|
9991
|
+
useEffect18(() => {
|
|
10053
9992
|
if (!playback.isActive && voiceEnabledRef.current) {
|
|
10054
9993
|
voiceEnabledRef.current = false;
|
|
10055
9994
|
setVoiceEnabled(false);
|
|
@@ -10069,7 +10008,7 @@ function ModelNexOnboardingPanel({
|
|
|
10069
10008
|
() => buildTranscriptPreviewLines(liveTranscript, { maxCharsPerLine: 34, maxLines: 2 }),
|
|
10070
10009
|
[liveTranscript]
|
|
10071
10010
|
);
|
|
10072
|
-
|
|
10011
|
+
useEffect18(() => {
|
|
10073
10012
|
if (voiceEnabled && voice.isListening) {
|
|
10074
10013
|
showFloatingLiveTranscript({
|
|
10075
10014
|
levels: audioLevels,
|
|
@@ -10083,7 +10022,7 @@ function ModelNexOnboardingPanel({
|
|
|
10083
10022
|
}
|
|
10084
10023
|
hideFloatingLiveTranscript();
|
|
10085
10024
|
}, [audioLevels, liveTranscriptLines, voiceEnabled, voice.isListening]);
|
|
10086
|
-
|
|
10025
|
+
useEffect18(() => () => {
|
|
10087
10026
|
hideFloatingLiveTranscript();
|
|
10088
10027
|
}, []);
|
|
10089
10028
|
const actionButtonStyle = {
|
|
@@ -10118,7 +10057,7 @@ function ModelNexOnboardingPanel({
|
|
|
10118
10057
|
{
|
|
10119
10058
|
role: "dialog",
|
|
10120
10059
|
"aria-modal": "true",
|
|
10121
|
-
"aria-label": mc.title || "Start
|
|
10060
|
+
"aria-label": mc.title || "Start workflow",
|
|
10122
10061
|
style: {
|
|
10123
10062
|
width: "min(460px, 100%)",
|
|
10124
10063
|
borderRadius: "18px",
|
|
@@ -10129,9 +10068,9 @@ function ModelNexOnboardingPanel({
|
|
|
10129
10068
|
padding: "24px"
|
|
10130
10069
|
},
|
|
10131
10070
|
children: [
|
|
10132
|
-
/* @__PURE__ */ jsx5("div", { style: { fontSize: "12px", fontWeight: 700, letterSpacing: "0.04em", textTransform: "uppercase", color: PANEL_THEME2.accent, marginBottom: "10px" }, children: mc.title || "Suggested
|
|
10071
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: "12px", fontWeight: 700, letterSpacing: "0.04em", textTransform: "uppercase", color: PANEL_THEME2.accent, marginBottom: "10px" }, children: mc.title || "Suggested workflow" }),
|
|
10133
10072
|
/* @__PURE__ */ jsx5("div", { style: { fontSize: "24px", lineHeight: 1.15, fontWeight: 650, marginBottom: "10px" }, children: playback.pendingTour.name }),
|
|
10134
|
-
/* @__PURE__ */ jsx5("div", { style: { fontSize: "14px", color: mc.textColor ? mc.textColor : "#52525b", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.5, marginBottom: "18px" }, children: mc.description || (playback.pendingTour.trigger === "first_visit" ? "Start
|
|
10073
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: "14px", color: mc.textColor ? mc.textColor : "#52525b", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.5, marginBottom: "18px" }, children: mc.description || (playback.pendingTour.trigger === "first_visit" ? "Start this workflow for the user now?" : playback.pendingTour.featureKey ? `A workflow is available for ${playback.pendingTour.featureKey}.` : "A workflow is available for this user.") }),
|
|
10135
10074
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "10px", justifyContent: "flex-end" }, children: [
|
|
10136
10075
|
/* @__PURE__ */ jsx5(
|
|
10137
10076
|
"button",
|
|
@@ -10165,7 +10104,7 @@ function ModelNexOnboardingPanel({
|
|
|
10165
10104
|
cursor: "pointer",
|
|
10166
10105
|
fontWeight: 700
|
|
10167
10106
|
},
|
|
10168
|
-
children: mc.buttonText || "Start
|
|
10107
|
+
children: mc.buttonText || "Start workflow"
|
|
10169
10108
|
}
|
|
10170
10109
|
)
|
|
10171
10110
|
] })
|
|
@@ -10198,11 +10137,11 @@ function ModelNexOnboardingPanel({
|
|
|
10198
10137
|
},
|
|
10199
10138
|
children: [
|
|
10200
10139
|
/* @__PURE__ */ jsxs4("div", { style: { padding: "16px 18px", borderBottom: `1px solid ${PANEL_THEME2.border}`, background: PANEL_THEME2.hero }, children: [
|
|
10201
|
-
/* @__PURE__ */ jsx5("div", { style: { fontSize: "11px", textTransform: "uppercase", letterSpacing: "0.08em", color: PANEL_THEME2.accent, fontWeight: 700 }, children: "Suggested
|
|
10140
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: "11px", textTransform: "uppercase", letterSpacing: "0.08em", color: PANEL_THEME2.accent, fontWeight: 700 }, children: "Suggested workflow" }),
|
|
10202
10141
|
/* @__PURE__ */ jsx5("div", { style: { fontSize: "18px", fontWeight: 700, marginTop: "4px" }, children: playback.pendingTour.name })
|
|
10203
10142
|
] }),
|
|
10204
10143
|
/* @__PURE__ */ jsxs4("div", { style: { padding: "16px 18px" }, children: [
|
|
10205
|
-
/* @__PURE__ */ jsx5("div", { style: { fontSize: "14px", color: "#52525b", lineHeight: 1.5, marginBottom: "14px" }, children: playback.pendingTour.trigger === "first_visit" ? "Start
|
|
10144
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: "14px", color: "#52525b", lineHeight: 1.5, marginBottom: "14px" }, children: playback.pendingTour.trigger === "first_visit" ? "Start this workflow for the user now?" : playback.pendingTour.featureKey ? `A workflow is available for ${playback.pendingTour.featureKey}.` : "A workflow is available for this user." }),
|
|
10206
10145
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
10207
10146
|
/* @__PURE__ */ jsx5(
|
|
10208
10147
|
"button",
|
|
@@ -10212,7 +10151,7 @@ function ModelNexOnboardingPanel({
|
|
|
10212
10151
|
startVoiceListening();
|
|
10213
10152
|
},
|
|
10214
10153
|
style: { ...actionButtonStyle, flex: 1, padding: "11px 14px" },
|
|
10215
|
-
children: "Start
|
|
10154
|
+
children: "Start workflow"
|
|
10216
10155
|
}
|
|
10217
10156
|
),
|
|
10218
10157
|
/* @__PURE__ */ jsx5(
|
|
@@ -10274,7 +10213,7 @@ function ModelNexOnboardingPanel({
|
|
|
10274
10213
|
fontSize: "18px"
|
|
10275
10214
|
}, children: "\u{1F3AF}" }),
|
|
10276
10215
|
/* @__PURE__ */ jsxs4("div", { children: [
|
|
10277
|
-
/* @__PURE__ */ jsx5("div", { style: { fontSize: "13px", fontWeight: 700, color: "#172033", marginBottom: "2px" }, children: "
|
|
10216
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: "13px", fontWeight: 700, color: "#172033", marginBottom: "2px" }, children: "Workflow" }),
|
|
10278
10217
|
/* @__PURE__ */ jsx5("div", { style: { fontSize: "12px", color: "#6b7280" }, children: "Ready \u2014 onboarding will appear here when available." })
|
|
10279
10218
|
] })
|
|
10280
10219
|
]
|
|
@@ -10330,7 +10269,7 @@ function ModelNexOnboardingPanel({
|
|
|
10330
10269
|
/* @__PURE__ */ jsxs4("div", { style: { padding: "16px 18px", borderBottom: `1px solid ${PANEL_THEME2.border}`, background: PANEL_THEME2.hero }, children: [
|
|
10331
10270
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", gap: "12px", alignItems: "center" }, children: [
|
|
10332
10271
|
/* @__PURE__ */ jsxs4("div", { children: [
|
|
10333
|
-
/* @__PURE__ */ jsx5("div", { style: { fontSize: "11px", textTransform: "uppercase", letterSpacing: "0.08em", color: PANEL_THEME2.accent, fontWeight: 700 }, children: "
|
|
10272
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: "11px", textTransform: "uppercase", letterSpacing: "0.08em", color: PANEL_THEME2.accent, fontWeight: 700 }, children: "Workflow" }),
|
|
10334
10273
|
/* @__PURE__ */ jsx5("div", { style: { fontSize: "18px", fontWeight: 700 }, children: title })
|
|
10335
10274
|
] }),
|
|
10336
10275
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "6px", alignItems: "center" }, children: [
|
|
@@ -10597,9 +10536,9 @@ function ModelNexOnboardingPanel({
|
|
|
10597
10536
|
}
|
|
10598
10537
|
|
|
10599
10538
|
// src/hooks/useActionHighlight.ts
|
|
10600
|
-
import { useContext as
|
|
10539
|
+
import { useContext as useContext7 } from "react";
|
|
10601
10540
|
function useActionHighlight() {
|
|
10602
|
-
const context =
|
|
10541
|
+
const context = useContext7(ModelNexContext);
|
|
10603
10542
|
if (!context) throw new Error("useActionHighlight must be used within ModelNexProvider");
|
|
10604
10543
|
return {
|
|
10605
10544
|
enabled: context.highlightActions,
|
|
@@ -10679,18 +10618,17 @@ function TourProgressPanel({ tour, currentStepIndex, onSkip, voiceOnly }) {
|
|
|
10679
10618
|
}
|
|
10680
10619
|
|
|
10681
10620
|
// src/index.ts
|
|
10682
|
-
var DEFAULT_SERVER_URL2 = "https://
|
|
10621
|
+
var DEFAULT_SERVER_URL2 = "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
10683
10622
|
var ModelNexProvider = ({
|
|
10684
10623
|
children,
|
|
10685
|
-
serverUrl = DEFAULT_SERVER_URL2,
|
|
10686
|
-
commandUrl,
|
|
10687
|
-
disableSocket,
|
|
10688
10624
|
websiteId,
|
|
10689
10625
|
userProfile,
|
|
10690
|
-
tourFacts,
|
|
10691
|
-
toursApiBase,
|
|
10692
10626
|
devMode
|
|
10693
10627
|
}) => {
|
|
10628
|
+
const serverUrl = DEFAULT_SERVER_URL2;
|
|
10629
|
+
const commandUrl = void 0;
|
|
10630
|
+
const disableSocket = false;
|
|
10631
|
+
const toursApiBase = void 0;
|
|
10694
10632
|
const renderedChildren = children;
|
|
10695
10633
|
const [activeAgentActions, setActiveAgentActions] = useState15(/* @__PURE__ */ new Set());
|
|
10696
10634
|
const [stagingFields, setStagingFields] = useState15(/* @__PURE__ */ new Set());
|
|
@@ -10720,7 +10658,7 @@ var ModelNexProvider = ({
|
|
|
10720
10658
|
useBuiltinActions(registerAction, unregisterAction, tagStore, serverUrl, websiteId);
|
|
10721
10659
|
const CHAT_STORAGE_KEY = "modelnex-chat-messages";
|
|
10722
10660
|
const [chatMessages, setChatMessagesRaw] = useState15([]);
|
|
10723
|
-
|
|
10661
|
+
useEffect19(() => {
|
|
10724
10662
|
try {
|
|
10725
10663
|
const stored = sessionStorage.getItem(CHAT_STORAGE_KEY);
|
|
10726
10664
|
if (stored) {
|
|
@@ -10753,22 +10691,20 @@ var ModelNexProvider = ({
|
|
|
10753
10691
|
websiteId
|
|
10754
10692
|
});
|
|
10755
10693
|
useFieldHighlight(stagingFields, executedFields, setExecutedFields);
|
|
10756
|
-
|
|
10694
|
+
useEffect19(() => {
|
|
10757
10695
|
document.body.classList.toggle("modelnex-highlight-actions", highlightActions);
|
|
10758
10696
|
return () => {
|
|
10759
10697
|
document.body.classList.remove("modelnex-highlight-actions");
|
|
10760
10698
|
};
|
|
10761
10699
|
}, [highlightActions]);
|
|
10762
10700
|
const [mounted, setMounted] = useState15(false);
|
|
10763
|
-
|
|
10701
|
+
useEffect19(() => {
|
|
10764
10702
|
setMounted(true);
|
|
10765
10703
|
}, []);
|
|
10766
10704
|
const value = useMemo5(
|
|
10767
10705
|
() => ({
|
|
10768
10706
|
serverUrl,
|
|
10769
10707
|
commandUrl: commandUrl ?? serverUrl,
|
|
10770
|
-
registerAction,
|
|
10771
|
-
unregisterAction,
|
|
10772
10708
|
activeAgentActions,
|
|
10773
10709
|
stagingFields,
|
|
10774
10710
|
highlightActions,
|
|
@@ -10783,14 +10719,12 @@ var ModelNexProvider = ({
|
|
|
10783
10719
|
setChatMessages,
|
|
10784
10720
|
websiteId,
|
|
10785
10721
|
userProfile,
|
|
10786
|
-
tourFacts,
|
|
10787
|
-
toursApiBase,
|
|
10788
10722
|
voiceMuted,
|
|
10789
10723
|
setVoiceMuted,
|
|
10790
10724
|
socketId,
|
|
10791
10725
|
devMode
|
|
10792
10726
|
}),
|
|
10793
|
-
[serverUrl, commandUrl, registerAction, unregisterAction, activeAgentActions, stagingFields, highlightActions, studioMode, recordingMode, extractedElements, tagStore, chatMessages, websiteId, userProfile,
|
|
10727
|
+
[serverUrl, commandUrl, registerAction, unregisterAction, activeAgentActions, stagingFields, highlightActions, studioMode, recordingMode, extractedElements, tagStore, chatMessages, websiteId, userProfile, voiceMuted, socketId, devMode]
|
|
10794
10728
|
);
|
|
10795
10729
|
return React8.createElement(
|
|
10796
10730
|
ModelNexContext.Provider,
|
|
@@ -10834,7 +10768,6 @@ export {
|
|
|
10834
10768
|
useExperiencePlayback,
|
|
10835
10769
|
useOnboardingPlayback,
|
|
10836
10770
|
useRecordingMode,
|
|
10837
|
-
useRegisterAction,
|
|
10838
10771
|
useRunCommand,
|
|
10839
10772
|
useTagStore,
|
|
10840
10773
|
useTourPlayback,
|