@modelnex/sdk 0.5.22 → 0.5.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +25 -1
- package/dist/index.mjs +25 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2460,6 +2460,7 @@ var import_react13 = require("react");
|
|
|
2460
2460
|
|
|
2461
2461
|
// src/utils/draftPreview.ts
|
|
2462
2462
|
var ACTIVE_DRAFT_PREVIEW_STORAGE_KEY = "modelnex:active-draft-preview";
|
|
2463
|
+
var PREVIEW_SESSION_SUPPRESSION_STORAGE_KEY = "modelnex:preview-session-suppressed";
|
|
2463
2464
|
function getPreviewQueryParamName(experienceType) {
|
|
2464
2465
|
return experienceType === "onboarding" ? "modelnex_test_workflow" : "modelnex_test_tour";
|
|
2465
2466
|
}
|
|
@@ -2509,6 +2510,21 @@ function clearActiveDraftPreview(experienceType) {
|
|
|
2509
2510
|
} catch {
|
|
2510
2511
|
}
|
|
2511
2512
|
}
|
|
2513
|
+
function persistPreviewSessionSuppression() {
|
|
2514
|
+
if (typeof window === "undefined") return;
|
|
2515
|
+
try {
|
|
2516
|
+
window.sessionStorage.setItem(PREVIEW_SESSION_SUPPRESSION_STORAGE_KEY, "true");
|
|
2517
|
+
} catch {
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
function readPreviewSessionSuppression() {
|
|
2521
|
+
if (typeof window === "undefined") return false;
|
|
2522
|
+
try {
|
|
2523
|
+
return window.sessionStorage.getItem(PREVIEW_SESSION_SUPPRESSION_STORAGE_KEY) === "true";
|
|
2524
|
+
} catch {
|
|
2525
|
+
return false;
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2512
2528
|
|
|
2513
2529
|
// src/utils/tourDiscovery.ts
|
|
2514
2530
|
async function fetchTours(serverUrl, toursApiBase, websiteId, userType, userId, experienceType = "tour") {
|
|
@@ -4448,6 +4464,9 @@ function useTourPlayback({
|
|
|
4448
4464
|
|
|
4449
4465
|
// src/hooks/useExperiencePlaybackController.ts
|
|
4450
4466
|
var EXPERIENCE_PRIORITY = ["onboarding", "tour"];
|
|
4467
|
+
function shouldClearDraftPreviewOnPromptDismiss(prompt) {
|
|
4468
|
+
return Boolean(prompt?.options?.reviewMode);
|
|
4469
|
+
}
|
|
4451
4470
|
function shouldDiscoverDraftPreview({
|
|
4452
4471
|
disabled,
|
|
4453
4472
|
hasPendingPrompt,
|
|
@@ -4492,7 +4511,7 @@ function useExperiencePlaybackController({
|
|
|
4492
4511
|
const queuedStartRef = (0, import_react13.useRef)(null);
|
|
4493
4512
|
const bufferedVoiceInputsRef = (0, import_react13.useRef)([]);
|
|
4494
4513
|
const previewDiscoveryInFlightRef = (0, import_react13.useRef)(false);
|
|
4495
|
-
const previewSessionRef = (0, import_react13.useRef)(
|
|
4514
|
+
const previewSessionRef = (0, import_react13.useRef)(readPreviewSessionSuppression());
|
|
4496
4515
|
pendingPromptRef.current = pendingPrompt;
|
|
4497
4516
|
const playback = useTourPlayback({
|
|
4498
4517
|
serverUrl,
|
|
@@ -4517,6 +4536,7 @@ function useExperiencePlaybackController({
|
|
|
4517
4536
|
setStartingExperienceType(experienceType);
|
|
4518
4537
|
if (options?.reviewMode) {
|
|
4519
4538
|
previewSessionRef.current = true;
|
|
4539
|
+
persistPreviewSessionSuppression();
|
|
4520
4540
|
}
|
|
4521
4541
|
if (activeExperienceType !== experienceType) {
|
|
4522
4542
|
queuedStartRef.current = { tour, experienceType, options };
|
|
@@ -4541,6 +4561,9 @@ function useExperiencePlaybackController({
|
|
|
4541
4561
|
if (experienceType && prompt.experienceType !== experienceType) return;
|
|
4542
4562
|
setPendingPrompt(null);
|
|
4543
4563
|
pendingPromptRef.current = null;
|
|
4564
|
+
if (shouldClearDraftPreviewOnPromptDismiss(prompt)) {
|
|
4565
|
+
clearActiveDraftPreview(prompt.experienceType);
|
|
4566
|
+
}
|
|
4544
4567
|
if (!userProfile?.userId) return;
|
|
4545
4568
|
void markTourDismissed(
|
|
4546
4569
|
serverUrl,
|
|
@@ -4623,6 +4646,7 @@ function useExperiencePlaybackController({
|
|
|
4623
4646
|
let cancelled = false;
|
|
4624
4647
|
previewDiscoveryInFlightRef.current = true;
|
|
4625
4648
|
previewSessionRef.current = true;
|
|
4649
|
+
persistPreviewSessionSuppression();
|
|
4626
4650
|
(async () => {
|
|
4627
4651
|
try {
|
|
4628
4652
|
persistActiveDraftPreview({ id: request.tourId, experienceType: request.experienceType });
|
package/dist/index.mjs
CHANGED
|
@@ -2250,6 +2250,7 @@ import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef
|
|
|
2250
2250
|
|
|
2251
2251
|
// src/utils/draftPreview.ts
|
|
2252
2252
|
var ACTIVE_DRAFT_PREVIEW_STORAGE_KEY = "modelnex:active-draft-preview";
|
|
2253
|
+
var PREVIEW_SESSION_SUPPRESSION_STORAGE_KEY = "modelnex:preview-session-suppressed";
|
|
2253
2254
|
function getPreviewQueryParamName(experienceType) {
|
|
2254
2255
|
return experienceType === "onboarding" ? "modelnex_test_workflow" : "modelnex_test_tour";
|
|
2255
2256
|
}
|
|
@@ -2299,6 +2300,21 @@ function clearActiveDraftPreview(experienceType) {
|
|
|
2299
2300
|
} catch {
|
|
2300
2301
|
}
|
|
2301
2302
|
}
|
|
2303
|
+
function persistPreviewSessionSuppression() {
|
|
2304
|
+
if (typeof window === "undefined") return;
|
|
2305
|
+
try {
|
|
2306
|
+
window.sessionStorage.setItem(PREVIEW_SESSION_SUPPRESSION_STORAGE_KEY, "true");
|
|
2307
|
+
} catch {
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
function readPreviewSessionSuppression() {
|
|
2311
|
+
if (typeof window === "undefined") return false;
|
|
2312
|
+
try {
|
|
2313
|
+
return window.sessionStorage.getItem(PREVIEW_SESSION_SUPPRESSION_STORAGE_KEY) === "true";
|
|
2314
|
+
} catch {
|
|
2315
|
+
return false;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2302
2318
|
|
|
2303
2319
|
// src/utils/tourDiscovery.ts
|
|
2304
2320
|
async function fetchTours(serverUrl, toursApiBase, websiteId, userType, userId, experienceType = "tour") {
|
|
@@ -4238,6 +4254,9 @@ function useTourPlayback({
|
|
|
4238
4254
|
|
|
4239
4255
|
// src/hooks/useExperiencePlaybackController.ts
|
|
4240
4256
|
var EXPERIENCE_PRIORITY = ["onboarding", "tour"];
|
|
4257
|
+
function shouldClearDraftPreviewOnPromptDismiss(prompt) {
|
|
4258
|
+
return Boolean(prompt?.options?.reviewMode);
|
|
4259
|
+
}
|
|
4241
4260
|
function shouldDiscoverDraftPreview({
|
|
4242
4261
|
disabled,
|
|
4243
4262
|
hasPendingPrompt,
|
|
@@ -4282,7 +4301,7 @@ function useExperiencePlaybackController({
|
|
|
4282
4301
|
const queuedStartRef = useRef9(null);
|
|
4283
4302
|
const bufferedVoiceInputsRef = useRef9([]);
|
|
4284
4303
|
const previewDiscoveryInFlightRef = useRef9(false);
|
|
4285
|
-
const previewSessionRef = useRef9(
|
|
4304
|
+
const previewSessionRef = useRef9(readPreviewSessionSuppression());
|
|
4286
4305
|
pendingPromptRef.current = pendingPrompt;
|
|
4287
4306
|
const playback = useTourPlayback({
|
|
4288
4307
|
serverUrl,
|
|
@@ -4307,6 +4326,7 @@ function useExperiencePlaybackController({
|
|
|
4307
4326
|
setStartingExperienceType(experienceType);
|
|
4308
4327
|
if (options?.reviewMode) {
|
|
4309
4328
|
previewSessionRef.current = true;
|
|
4329
|
+
persistPreviewSessionSuppression();
|
|
4310
4330
|
}
|
|
4311
4331
|
if (activeExperienceType !== experienceType) {
|
|
4312
4332
|
queuedStartRef.current = { tour, experienceType, options };
|
|
@@ -4331,6 +4351,9 @@ function useExperiencePlaybackController({
|
|
|
4331
4351
|
if (experienceType && prompt.experienceType !== experienceType) return;
|
|
4332
4352
|
setPendingPrompt(null);
|
|
4333
4353
|
pendingPromptRef.current = null;
|
|
4354
|
+
if (shouldClearDraftPreviewOnPromptDismiss(prompt)) {
|
|
4355
|
+
clearActiveDraftPreview(prompt.experienceType);
|
|
4356
|
+
}
|
|
4334
4357
|
if (!userProfile?.userId) return;
|
|
4335
4358
|
void markTourDismissed(
|
|
4336
4359
|
serverUrl,
|
|
@@ -4413,6 +4436,7 @@ function useExperiencePlaybackController({
|
|
|
4413
4436
|
let cancelled = false;
|
|
4414
4437
|
previewDiscoveryInFlightRef.current = true;
|
|
4415
4438
|
previewSessionRef.current = true;
|
|
4439
|
+
persistPreviewSessionSuppression();
|
|
4416
4440
|
(async () => {
|
|
4417
4441
|
try {
|
|
4418
4442
|
persistActiveDraftPreview({ id: request.tourId, experienceType: request.experienceType });
|