@modelnex/sdk 0.5.24 → 0.5.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/index.js +110 -5
- package/dist/index.mjs +110 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ import { ModelNexProvider, ModelNexChatBubble } from '@modelnex/sdk';
|
|
|
27
27
|
export default function AppShell() {
|
|
28
28
|
return (
|
|
29
29
|
<ModelNexProvider
|
|
30
|
+
serverUrl={import.meta.env.DEV ? 'http://localhost:3002' : 'https://api.modelnex.com'}
|
|
30
31
|
websiteId="your-website-id"
|
|
31
32
|
userProfile={{
|
|
32
33
|
type: currentUser.role,
|
|
@@ -41,7 +42,7 @@ export default function AppShell() {
|
|
|
41
42
|
}
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
`websiteId` identifies the integration. `userProfile` is used for tour/workflow targeting and completion tracking.
|
|
45
|
+
`websiteId` identifies the integration. `userProfile` is used for tour/workflow targeting and completion tracking. For local development, pass `serverUrl` explicitly so the SDK does not fall back to the hosted API.
|
|
45
46
|
|
|
46
47
|
## Tour Start Model
|
|
47
48
|
|
|
@@ -82,6 +83,7 @@ Current behavior:
|
|
|
82
83
|
|
|
83
84
|
| Prop | Purpose |
|
|
84
85
|
|------|---------|
|
|
86
|
+
| `serverUrl` | Backend base URL for chat, tags, tours, voice, and recording APIs |
|
|
85
87
|
| `websiteId` | Tenant/integration identifier |
|
|
86
88
|
| `userProfile` | End-user targeting data for tours/workflows |
|
|
87
89
|
| `devMode` | Enables recording/studio tooling for your internal users |
|
package/dist/index.js
CHANGED
|
@@ -2461,6 +2461,7 @@ var import_react13 = require("react");
|
|
|
2461
2461
|
// src/utils/draftPreview.ts
|
|
2462
2462
|
var ACTIVE_DRAFT_PREVIEW_STORAGE_KEY = "modelnex:active-draft-preview";
|
|
2463
2463
|
var PREVIEW_SESSION_SUPPRESSION_STORAGE_KEY = "modelnex:preview-session-suppressed";
|
|
2464
|
+
var SUPPRESSED_DRAFT_PREVIEW_STORAGE_KEY = "modelnex:suppressed-draft-preview";
|
|
2464
2465
|
function getPreviewQueryParamName(experienceType) {
|
|
2465
2466
|
return experienceType === "onboarding" ? "modelnex_test_workflow" : "modelnex_test_tour";
|
|
2466
2467
|
}
|
|
@@ -2510,6 +2511,51 @@ function clearActiveDraftPreview(experienceType) {
|
|
|
2510
2511
|
} catch {
|
|
2511
2512
|
}
|
|
2512
2513
|
}
|
|
2514
|
+
function readSavedDraftPreview(storageKey) {
|
|
2515
|
+
if (typeof window === "undefined") return null;
|
|
2516
|
+
try {
|
|
2517
|
+
const raw = window.sessionStorage.getItem(storageKey);
|
|
2518
|
+
if (!raw) return null;
|
|
2519
|
+
const parsed = JSON.parse(raw);
|
|
2520
|
+
if (!parsed || typeof parsed.id !== "string") return null;
|
|
2521
|
+
if (parsed.experienceType !== "tour" && parsed.experienceType !== "onboarding") return null;
|
|
2522
|
+
return {
|
|
2523
|
+
id: parsed.id,
|
|
2524
|
+
experienceType: parsed.experienceType
|
|
2525
|
+
};
|
|
2526
|
+
} catch {
|
|
2527
|
+
return null;
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
function readSuppressedDraftPreview() {
|
|
2531
|
+
return readSavedDraftPreview(SUPPRESSED_DRAFT_PREVIEW_STORAGE_KEY);
|
|
2532
|
+
}
|
|
2533
|
+
function persistSuppressedDraftPreview(draft) {
|
|
2534
|
+
if (typeof window === "undefined") return;
|
|
2535
|
+
try {
|
|
2536
|
+
window.sessionStorage.setItem(SUPPRESSED_DRAFT_PREVIEW_STORAGE_KEY, JSON.stringify(draft));
|
|
2537
|
+
} catch {
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
function clearSuppressedDraftPreview(draft) {
|
|
2541
|
+
if (typeof window === "undefined") return;
|
|
2542
|
+
try {
|
|
2543
|
+
const suppressedDraft = readSuppressedDraftPreview();
|
|
2544
|
+
if (draft && suppressedDraft) {
|
|
2545
|
+
if (suppressedDraft.id !== draft.id || suppressedDraft.experienceType !== draft.experienceType) {
|
|
2546
|
+
return;
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
window.sessionStorage.removeItem(SUPPRESSED_DRAFT_PREVIEW_STORAGE_KEY);
|
|
2550
|
+
} catch {
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
function isSuppressedDraftPreview(draft) {
|
|
2554
|
+
const suppressedDraft = readSuppressedDraftPreview();
|
|
2555
|
+
return Boolean(
|
|
2556
|
+
suppressedDraft && suppressedDraft.id === draft.id && suppressedDraft.experienceType === draft.experienceType
|
|
2557
|
+
);
|
|
2558
|
+
}
|
|
2513
2559
|
function persistPreviewSessionSuppression() {
|
|
2514
2560
|
if (typeof window === "undefined") return;
|
|
2515
2561
|
try {
|
|
@@ -4090,7 +4136,13 @@ function useTourPlayback({
|
|
|
4090
4136
|
});
|
|
4091
4137
|
}
|
|
4092
4138
|
if (reviewModeRef.current) {
|
|
4093
|
-
|
|
4139
|
+
if (tourRef.current?.id) {
|
|
4140
|
+
persistSuppressedDraftPreview({
|
|
4141
|
+
id: tourRef.current.id,
|
|
4142
|
+
experienceType
|
|
4143
|
+
});
|
|
4144
|
+
}
|
|
4145
|
+
clearActiveDraftPreview();
|
|
4094
4146
|
}
|
|
4095
4147
|
setIsActive(false);
|
|
4096
4148
|
setActiveTour(null);
|
|
@@ -4139,7 +4191,13 @@ function useTourPlayback({
|
|
|
4139
4191
|
});
|
|
4140
4192
|
}
|
|
4141
4193
|
if (reviewModeRef.current) {
|
|
4142
|
-
|
|
4194
|
+
if (endingTourId) {
|
|
4195
|
+
persistSuppressedDraftPreview({
|
|
4196
|
+
id: endingTourId,
|
|
4197
|
+
experienceType
|
|
4198
|
+
});
|
|
4199
|
+
}
|
|
4200
|
+
clearActiveDraftPreview();
|
|
4143
4201
|
}
|
|
4144
4202
|
onTourEnd?.();
|
|
4145
4203
|
}, [experienceType, userProfile, serverUrl, voice, onTourEnd, websiteId, releasePlaybackOwnership]);
|
|
@@ -4175,6 +4233,10 @@ function useTourPlayback({
|
|
|
4175
4233
|
setIsReviewMode(shouldReview);
|
|
4176
4234
|
reviewModeRef.current = shouldReview;
|
|
4177
4235
|
if (shouldReview) {
|
|
4236
|
+
clearSuppressedDraftPreview({
|
|
4237
|
+
id: tour.id,
|
|
4238
|
+
experienceType
|
|
4239
|
+
});
|
|
4178
4240
|
try {
|
|
4179
4241
|
const previewRun = await createPreviewRun(serverUrl, toursApiBaseRef.current, tour.id, {
|
|
4180
4242
|
source: "sdk_test_preview",
|
|
@@ -4215,14 +4277,23 @@ function useTourPlayback({
|
|
|
4215
4277
|
const persistedTourId = activeDraftPreview?.experienceType === experienceType ? activeDraftPreview.id : null;
|
|
4216
4278
|
const tourId = queryTourId || persistedTourId;
|
|
4217
4279
|
if (!tourId) return;
|
|
4280
|
+
const draftPreview = { id: tourId, experienceType };
|
|
4281
|
+
if (!queryTourId && isSuppressedDraftPreview(draftPreview)) {
|
|
4282
|
+
clearActiveDraftPreview(experienceType);
|
|
4283
|
+
return;
|
|
4284
|
+
}
|
|
4218
4285
|
let cancelled = false;
|
|
4219
4286
|
(async () => {
|
|
4220
4287
|
try {
|
|
4221
|
-
|
|
4288
|
+
if (queryTourId) {
|
|
4289
|
+
clearSuppressedDraftPreview(draftPreview);
|
|
4290
|
+
}
|
|
4291
|
+
persistActiveDraftPreview(draftPreview);
|
|
4222
4292
|
const tour = await fetchTourById(serverUrl, toursApiBase, tourId, experienceType, websiteId);
|
|
4223
4293
|
if (cancelled) return;
|
|
4224
4294
|
if (!tour) {
|
|
4225
4295
|
clearActiveDraftPreview(experienceType);
|
|
4296
|
+
persistSuppressedDraftPreview(draftPreview);
|
|
4226
4297
|
console.warn("[ModelNex] Tour fetch failed:", tourId, experienceType, "(Check ModelNex server is running and CORS allows this origin)");
|
|
4227
4298
|
return;
|
|
4228
4299
|
}
|
|
@@ -4476,6 +4547,12 @@ function shouldDiscoverDraftPreview({
|
|
|
4476
4547
|
}) {
|
|
4477
4548
|
return !disabled && !hasPendingPrompt && !isPlaybackActive && !isPreviewDiscoveryInFlight && !isStartingExperience;
|
|
4478
4549
|
}
|
|
4550
|
+
function shouldReplayDraftPreview({
|
|
4551
|
+
hasExplicitQueryParam,
|
|
4552
|
+
isSuppressedPreview
|
|
4553
|
+
}) {
|
|
4554
|
+
return hasExplicitQueryParam || !isSuppressedPreview;
|
|
4555
|
+
}
|
|
4479
4556
|
function shouldDiscoverEligibleTours({
|
|
4480
4557
|
disabled,
|
|
4481
4558
|
hasPendingPrompt,
|
|
@@ -4563,6 +4640,10 @@ function useExperiencePlaybackController({
|
|
|
4563
4640
|
pendingPromptRef.current = null;
|
|
4564
4641
|
if (shouldClearDraftPreviewOnPromptDismiss(prompt)) {
|
|
4565
4642
|
clearActiveDraftPreview(prompt.experienceType);
|
|
4643
|
+
persistSuppressedDraftPreview({
|
|
4644
|
+
id: prompt.tour.id,
|
|
4645
|
+
experienceType: prompt.experienceType
|
|
4646
|
+
});
|
|
4566
4647
|
}
|
|
4567
4648
|
if (!userProfile?.userId) return;
|
|
4568
4649
|
void markTourDismissed(
|
|
@@ -4643,17 +4724,32 @@ function useExperiencePlaybackController({
|
|
|
4643
4724
|
}
|
|
4644
4725
|
const request = previewRequests[0];
|
|
4645
4726
|
if (!request) return;
|
|
4727
|
+
const draftPreview = {
|
|
4728
|
+
id: request.tourId,
|
|
4729
|
+
experienceType: request.experienceType
|
|
4730
|
+
};
|
|
4731
|
+
if (!shouldReplayDraftPreview({
|
|
4732
|
+
hasExplicitQueryParam: Boolean(request.queryParam),
|
|
4733
|
+
isSuppressedPreview: isSuppressedDraftPreview(draftPreview)
|
|
4734
|
+
})) {
|
|
4735
|
+
clearActiveDraftPreview(request.experienceType);
|
|
4736
|
+
return;
|
|
4737
|
+
}
|
|
4646
4738
|
let cancelled = false;
|
|
4647
4739
|
previewDiscoveryInFlightRef.current = true;
|
|
4648
4740
|
previewSessionRef.current = true;
|
|
4649
4741
|
persistPreviewSessionSuppression();
|
|
4650
4742
|
(async () => {
|
|
4651
4743
|
try {
|
|
4652
|
-
|
|
4744
|
+
if (request.queryParam) {
|
|
4745
|
+
clearSuppressedDraftPreview(draftPreview);
|
|
4746
|
+
}
|
|
4747
|
+
persistActiveDraftPreview(draftPreview);
|
|
4653
4748
|
const tour = await fetchTourById(serverUrl, toursApiBase, request.tourId, request.experienceType, websiteId);
|
|
4654
4749
|
if (cancelled) return;
|
|
4655
4750
|
if (!tour) {
|
|
4656
4751
|
clearActiveDraftPreview(request.experienceType);
|
|
4752
|
+
persistSuppressedDraftPreview(draftPreview);
|
|
4657
4753
|
return;
|
|
4658
4754
|
}
|
|
4659
4755
|
if (request.queryParam) {
|
|
@@ -8023,7 +8119,7 @@ function getRecordingDraftStatusMessage(phase, experienceType) {
|
|
|
8023
8119
|
|
|
8024
8120
|
// src/utils/tour-listening.ts
|
|
8025
8121
|
function canStartTourListening(state) {
|
|
8026
|
-
const hasLiveOrPendingPlayback = state.isTourActive || state.isOnboardingActive || state.hasPendingTour || state.hasPendingOnboarding;
|
|
8122
|
+
const hasLiveOrPendingPlayback = state.isTourActive || state.isOnboardingActive || state.hasPendingTour || state.hasPendingOnboarding || Boolean(state.startingExperienceType);
|
|
8027
8123
|
return hasLiveOrPendingPlayback && !state.sttActive && state.sttSupported;
|
|
8028
8124
|
}
|
|
8029
8125
|
function resolveTourListeningExperience(preferredExperience, state) {
|
|
@@ -8937,6 +9033,7 @@ function ModelNexChatBubble({
|
|
|
8937
9033
|
isOnboardingActive: onboardingPlayback.isActive,
|
|
8938
9034
|
hasPendingTour: Boolean(tourPlayback.pendingTour),
|
|
8939
9035
|
hasPendingOnboarding: Boolean(onboardingPlayback.pendingTour),
|
|
9036
|
+
startingExperienceType,
|
|
8940
9037
|
sttActive: sttActiveRef.current,
|
|
8941
9038
|
sttSupported: voice.sttSupported
|
|
8942
9039
|
};
|
|
@@ -8982,6 +9079,7 @@ function ModelNexChatBubble({
|
|
|
8982
9079
|
tourPlayback.pendingTour,
|
|
8983
9080
|
onboardingPlayback.isActive,
|
|
8984
9081
|
onboardingPlayback.pendingTour,
|
|
9082
|
+
startingExperienceType,
|
|
8985
9083
|
voice,
|
|
8986
9084
|
handleVoiceTourInput,
|
|
8987
9085
|
updateTourListenReady,
|
|
@@ -11148,6 +11246,13 @@ var ModelNexProvider = ({
|
|
|
11148
11246
|
const serverUrl = serverUrlProp ?? DEFAULT_MODELNEX_SERVER_URL;
|
|
11149
11247
|
const commandUrl = void 0;
|
|
11150
11248
|
const disableSocket = false;
|
|
11249
|
+
(0, import_react21.useEffect)(() => {
|
|
11250
|
+
if (process.env.NODE_ENV !== "production" && !serverUrlProp) {
|
|
11251
|
+
console.warn(
|
|
11252
|
+
`[ModelNex SDK] ModelNexProvider is using the default server URL (${DEFAULT_MODELNEX_SERVER_URL}). Pass \`serverUrl\` explicitly in local development to avoid accidentally targeting the hosted backend.`
|
|
11253
|
+
);
|
|
11254
|
+
}
|
|
11255
|
+
}, [serverUrlProp]);
|
|
11151
11256
|
const renderedChildren = children;
|
|
11152
11257
|
const [activeAgentActions, setActiveAgentActions] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
|
|
11153
11258
|
const [stagingFields, setStagingFields] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
|
package/dist/index.mjs
CHANGED
|
@@ -2251,6 +2251,7 @@ import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef
|
|
|
2251
2251
|
// src/utils/draftPreview.ts
|
|
2252
2252
|
var ACTIVE_DRAFT_PREVIEW_STORAGE_KEY = "modelnex:active-draft-preview";
|
|
2253
2253
|
var PREVIEW_SESSION_SUPPRESSION_STORAGE_KEY = "modelnex:preview-session-suppressed";
|
|
2254
|
+
var SUPPRESSED_DRAFT_PREVIEW_STORAGE_KEY = "modelnex:suppressed-draft-preview";
|
|
2254
2255
|
function getPreviewQueryParamName(experienceType) {
|
|
2255
2256
|
return experienceType === "onboarding" ? "modelnex_test_workflow" : "modelnex_test_tour";
|
|
2256
2257
|
}
|
|
@@ -2300,6 +2301,51 @@ function clearActiveDraftPreview(experienceType) {
|
|
|
2300
2301
|
} catch {
|
|
2301
2302
|
}
|
|
2302
2303
|
}
|
|
2304
|
+
function readSavedDraftPreview(storageKey) {
|
|
2305
|
+
if (typeof window === "undefined") return null;
|
|
2306
|
+
try {
|
|
2307
|
+
const raw = window.sessionStorage.getItem(storageKey);
|
|
2308
|
+
if (!raw) return null;
|
|
2309
|
+
const parsed = JSON.parse(raw);
|
|
2310
|
+
if (!parsed || typeof parsed.id !== "string") return null;
|
|
2311
|
+
if (parsed.experienceType !== "tour" && parsed.experienceType !== "onboarding") return null;
|
|
2312
|
+
return {
|
|
2313
|
+
id: parsed.id,
|
|
2314
|
+
experienceType: parsed.experienceType
|
|
2315
|
+
};
|
|
2316
|
+
} catch {
|
|
2317
|
+
return null;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
function readSuppressedDraftPreview() {
|
|
2321
|
+
return readSavedDraftPreview(SUPPRESSED_DRAFT_PREVIEW_STORAGE_KEY);
|
|
2322
|
+
}
|
|
2323
|
+
function persistSuppressedDraftPreview(draft) {
|
|
2324
|
+
if (typeof window === "undefined") return;
|
|
2325
|
+
try {
|
|
2326
|
+
window.sessionStorage.setItem(SUPPRESSED_DRAFT_PREVIEW_STORAGE_KEY, JSON.stringify(draft));
|
|
2327
|
+
} catch {
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
function clearSuppressedDraftPreview(draft) {
|
|
2331
|
+
if (typeof window === "undefined") return;
|
|
2332
|
+
try {
|
|
2333
|
+
const suppressedDraft = readSuppressedDraftPreview();
|
|
2334
|
+
if (draft && suppressedDraft) {
|
|
2335
|
+
if (suppressedDraft.id !== draft.id || suppressedDraft.experienceType !== draft.experienceType) {
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
window.sessionStorage.removeItem(SUPPRESSED_DRAFT_PREVIEW_STORAGE_KEY);
|
|
2340
|
+
} catch {
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
function isSuppressedDraftPreview(draft) {
|
|
2344
|
+
const suppressedDraft = readSuppressedDraftPreview();
|
|
2345
|
+
return Boolean(
|
|
2346
|
+
suppressedDraft && suppressedDraft.id === draft.id && suppressedDraft.experienceType === draft.experienceType
|
|
2347
|
+
);
|
|
2348
|
+
}
|
|
2303
2349
|
function persistPreviewSessionSuppression() {
|
|
2304
2350
|
if (typeof window === "undefined") return;
|
|
2305
2351
|
try {
|
|
@@ -3880,7 +3926,13 @@ function useTourPlayback({
|
|
|
3880
3926
|
});
|
|
3881
3927
|
}
|
|
3882
3928
|
if (reviewModeRef.current) {
|
|
3883
|
-
|
|
3929
|
+
if (tourRef.current?.id) {
|
|
3930
|
+
persistSuppressedDraftPreview({
|
|
3931
|
+
id: tourRef.current.id,
|
|
3932
|
+
experienceType
|
|
3933
|
+
});
|
|
3934
|
+
}
|
|
3935
|
+
clearActiveDraftPreview();
|
|
3884
3936
|
}
|
|
3885
3937
|
setIsActive(false);
|
|
3886
3938
|
setActiveTour(null);
|
|
@@ -3929,7 +3981,13 @@ function useTourPlayback({
|
|
|
3929
3981
|
});
|
|
3930
3982
|
}
|
|
3931
3983
|
if (reviewModeRef.current) {
|
|
3932
|
-
|
|
3984
|
+
if (endingTourId) {
|
|
3985
|
+
persistSuppressedDraftPreview({
|
|
3986
|
+
id: endingTourId,
|
|
3987
|
+
experienceType
|
|
3988
|
+
});
|
|
3989
|
+
}
|
|
3990
|
+
clearActiveDraftPreview();
|
|
3933
3991
|
}
|
|
3934
3992
|
onTourEnd?.();
|
|
3935
3993
|
}, [experienceType, userProfile, serverUrl, voice, onTourEnd, websiteId, releasePlaybackOwnership]);
|
|
@@ -3965,6 +4023,10 @@ function useTourPlayback({
|
|
|
3965
4023
|
setIsReviewMode(shouldReview);
|
|
3966
4024
|
reviewModeRef.current = shouldReview;
|
|
3967
4025
|
if (shouldReview) {
|
|
4026
|
+
clearSuppressedDraftPreview({
|
|
4027
|
+
id: tour.id,
|
|
4028
|
+
experienceType
|
|
4029
|
+
});
|
|
3968
4030
|
try {
|
|
3969
4031
|
const previewRun = await createPreviewRun(serverUrl, toursApiBaseRef.current, tour.id, {
|
|
3970
4032
|
source: "sdk_test_preview",
|
|
@@ -4005,14 +4067,23 @@ function useTourPlayback({
|
|
|
4005
4067
|
const persistedTourId = activeDraftPreview?.experienceType === experienceType ? activeDraftPreview.id : null;
|
|
4006
4068
|
const tourId = queryTourId || persistedTourId;
|
|
4007
4069
|
if (!tourId) return;
|
|
4070
|
+
const draftPreview = { id: tourId, experienceType };
|
|
4071
|
+
if (!queryTourId && isSuppressedDraftPreview(draftPreview)) {
|
|
4072
|
+
clearActiveDraftPreview(experienceType);
|
|
4073
|
+
return;
|
|
4074
|
+
}
|
|
4008
4075
|
let cancelled = false;
|
|
4009
4076
|
(async () => {
|
|
4010
4077
|
try {
|
|
4011
|
-
|
|
4078
|
+
if (queryTourId) {
|
|
4079
|
+
clearSuppressedDraftPreview(draftPreview);
|
|
4080
|
+
}
|
|
4081
|
+
persistActiveDraftPreview(draftPreview);
|
|
4012
4082
|
const tour = await fetchTourById(serverUrl, toursApiBase, tourId, experienceType, websiteId);
|
|
4013
4083
|
if (cancelled) return;
|
|
4014
4084
|
if (!tour) {
|
|
4015
4085
|
clearActiveDraftPreview(experienceType);
|
|
4086
|
+
persistSuppressedDraftPreview(draftPreview);
|
|
4016
4087
|
console.warn("[ModelNex] Tour fetch failed:", tourId, experienceType, "(Check ModelNex server is running and CORS allows this origin)");
|
|
4017
4088
|
return;
|
|
4018
4089
|
}
|
|
@@ -4266,6 +4337,12 @@ function shouldDiscoverDraftPreview({
|
|
|
4266
4337
|
}) {
|
|
4267
4338
|
return !disabled && !hasPendingPrompt && !isPlaybackActive && !isPreviewDiscoveryInFlight && !isStartingExperience;
|
|
4268
4339
|
}
|
|
4340
|
+
function shouldReplayDraftPreview({
|
|
4341
|
+
hasExplicitQueryParam,
|
|
4342
|
+
isSuppressedPreview
|
|
4343
|
+
}) {
|
|
4344
|
+
return hasExplicitQueryParam || !isSuppressedPreview;
|
|
4345
|
+
}
|
|
4269
4346
|
function shouldDiscoverEligibleTours({
|
|
4270
4347
|
disabled,
|
|
4271
4348
|
hasPendingPrompt,
|
|
@@ -4353,6 +4430,10 @@ function useExperiencePlaybackController({
|
|
|
4353
4430
|
pendingPromptRef.current = null;
|
|
4354
4431
|
if (shouldClearDraftPreviewOnPromptDismiss(prompt)) {
|
|
4355
4432
|
clearActiveDraftPreview(prompt.experienceType);
|
|
4433
|
+
persistSuppressedDraftPreview({
|
|
4434
|
+
id: prompt.tour.id,
|
|
4435
|
+
experienceType: prompt.experienceType
|
|
4436
|
+
});
|
|
4356
4437
|
}
|
|
4357
4438
|
if (!userProfile?.userId) return;
|
|
4358
4439
|
void markTourDismissed(
|
|
@@ -4433,17 +4514,32 @@ function useExperiencePlaybackController({
|
|
|
4433
4514
|
}
|
|
4434
4515
|
const request = previewRequests[0];
|
|
4435
4516
|
if (!request) return;
|
|
4517
|
+
const draftPreview = {
|
|
4518
|
+
id: request.tourId,
|
|
4519
|
+
experienceType: request.experienceType
|
|
4520
|
+
};
|
|
4521
|
+
if (!shouldReplayDraftPreview({
|
|
4522
|
+
hasExplicitQueryParam: Boolean(request.queryParam),
|
|
4523
|
+
isSuppressedPreview: isSuppressedDraftPreview(draftPreview)
|
|
4524
|
+
})) {
|
|
4525
|
+
clearActiveDraftPreview(request.experienceType);
|
|
4526
|
+
return;
|
|
4527
|
+
}
|
|
4436
4528
|
let cancelled = false;
|
|
4437
4529
|
previewDiscoveryInFlightRef.current = true;
|
|
4438
4530
|
previewSessionRef.current = true;
|
|
4439
4531
|
persistPreviewSessionSuppression();
|
|
4440
4532
|
(async () => {
|
|
4441
4533
|
try {
|
|
4442
|
-
|
|
4534
|
+
if (request.queryParam) {
|
|
4535
|
+
clearSuppressedDraftPreview(draftPreview);
|
|
4536
|
+
}
|
|
4537
|
+
persistActiveDraftPreview(draftPreview);
|
|
4443
4538
|
const tour = await fetchTourById(serverUrl, toursApiBase, request.tourId, request.experienceType, websiteId);
|
|
4444
4539
|
if (cancelled) return;
|
|
4445
4540
|
if (!tour) {
|
|
4446
4541
|
clearActiveDraftPreview(request.experienceType);
|
|
4542
|
+
persistSuppressedDraftPreview(draftPreview);
|
|
4447
4543
|
return;
|
|
4448
4544
|
}
|
|
4449
4545
|
if (request.queryParam) {
|
|
@@ -7812,7 +7908,7 @@ function getRecordingDraftStatusMessage(phase, experienceType) {
|
|
|
7812
7908
|
|
|
7813
7909
|
// src/utils/tour-listening.ts
|
|
7814
7910
|
function canStartTourListening(state) {
|
|
7815
|
-
const hasLiveOrPendingPlayback = state.isTourActive || state.isOnboardingActive || state.hasPendingTour || state.hasPendingOnboarding;
|
|
7911
|
+
const hasLiveOrPendingPlayback = state.isTourActive || state.isOnboardingActive || state.hasPendingTour || state.hasPendingOnboarding || Boolean(state.startingExperienceType);
|
|
7816
7912
|
return hasLiveOrPendingPlayback && !state.sttActive && state.sttSupported;
|
|
7817
7913
|
}
|
|
7818
7914
|
function resolveTourListeningExperience(preferredExperience, state) {
|
|
@@ -8726,6 +8822,7 @@ function ModelNexChatBubble({
|
|
|
8726
8822
|
isOnboardingActive: onboardingPlayback.isActive,
|
|
8727
8823
|
hasPendingTour: Boolean(tourPlayback.pendingTour),
|
|
8728
8824
|
hasPendingOnboarding: Boolean(onboardingPlayback.pendingTour),
|
|
8825
|
+
startingExperienceType,
|
|
8729
8826
|
sttActive: sttActiveRef.current,
|
|
8730
8827
|
sttSupported: voice.sttSupported
|
|
8731
8828
|
};
|
|
@@ -8771,6 +8868,7 @@ function ModelNexChatBubble({
|
|
|
8771
8868
|
tourPlayback.pendingTour,
|
|
8772
8869
|
onboardingPlayback.isActive,
|
|
8773
8870
|
onboardingPlayback.pendingTour,
|
|
8871
|
+
startingExperienceType,
|
|
8774
8872
|
voice,
|
|
8775
8873
|
handleVoiceTourInput,
|
|
8776
8874
|
updateTourListenReady,
|
|
@@ -10937,6 +11035,13 @@ var ModelNexProvider = ({
|
|
|
10937
11035
|
const serverUrl = serverUrlProp ?? DEFAULT_MODELNEX_SERVER_URL;
|
|
10938
11036
|
const commandUrl = void 0;
|
|
10939
11037
|
const disableSocket = false;
|
|
11038
|
+
useEffect19(() => {
|
|
11039
|
+
if (process.env.NODE_ENV !== "production" && !serverUrlProp) {
|
|
11040
|
+
console.warn(
|
|
11041
|
+
`[ModelNex SDK] ModelNexProvider is using the default server URL (${DEFAULT_MODELNEX_SERVER_URL}). Pass \`serverUrl\` explicitly in local development to avoid accidentally targeting the hosted backend.`
|
|
11042
|
+
);
|
|
11043
|
+
}
|
|
11044
|
+
}, [serverUrlProp]);
|
|
10940
11045
|
const renderedChildren = children;
|
|
10941
11046
|
const [activeAgentActions, setActiveAgentActions] = useState15(/* @__PURE__ */ new Set());
|
|
10942
11047
|
const [stagingFields, setStagingFields] = useState15(/* @__PURE__ */ new Set());
|