@modelnex/sdk 0.5.22 → 0.5.23

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 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") {
@@ -4492,7 +4508,7 @@ function useExperiencePlaybackController({
4492
4508
  const queuedStartRef = (0, import_react13.useRef)(null);
4493
4509
  const bufferedVoiceInputsRef = (0, import_react13.useRef)([]);
4494
4510
  const previewDiscoveryInFlightRef = (0, import_react13.useRef)(false);
4495
- const previewSessionRef = (0, import_react13.useRef)(false);
4511
+ const previewSessionRef = (0, import_react13.useRef)(readPreviewSessionSuppression());
4496
4512
  pendingPromptRef.current = pendingPrompt;
4497
4513
  const playback = useTourPlayback({
4498
4514
  serverUrl,
@@ -4517,6 +4533,7 @@ function useExperiencePlaybackController({
4517
4533
  setStartingExperienceType(experienceType);
4518
4534
  if (options?.reviewMode) {
4519
4535
  previewSessionRef.current = true;
4536
+ persistPreviewSessionSuppression();
4520
4537
  }
4521
4538
  if (activeExperienceType !== experienceType) {
4522
4539
  queuedStartRef.current = { tour, experienceType, options };
@@ -4623,6 +4640,7 @@ function useExperiencePlaybackController({
4623
4640
  let cancelled = false;
4624
4641
  previewDiscoveryInFlightRef.current = true;
4625
4642
  previewSessionRef.current = true;
4643
+ persistPreviewSessionSuppression();
4626
4644
  (async () => {
4627
4645
  try {
4628
4646
  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") {
@@ -4282,7 +4298,7 @@ function useExperiencePlaybackController({
4282
4298
  const queuedStartRef = useRef9(null);
4283
4299
  const bufferedVoiceInputsRef = useRef9([]);
4284
4300
  const previewDiscoveryInFlightRef = useRef9(false);
4285
- const previewSessionRef = useRef9(false);
4301
+ const previewSessionRef = useRef9(readPreviewSessionSuppression());
4286
4302
  pendingPromptRef.current = pendingPrompt;
4287
4303
  const playback = useTourPlayback({
4288
4304
  serverUrl,
@@ -4307,6 +4323,7 @@ function useExperiencePlaybackController({
4307
4323
  setStartingExperienceType(experienceType);
4308
4324
  if (options?.reviewMode) {
4309
4325
  previewSessionRef.current = true;
4326
+ persistPreviewSessionSuppression();
4310
4327
  }
4311
4328
  if (activeExperienceType !== experienceType) {
4312
4329
  queuedStartRef.current = { tour, experienceType, options };
@@ -4413,6 +4430,7 @@ function useExperiencePlaybackController({
4413
4430
  let cancelled = false;
4414
4431
  previewDiscoveryInFlightRef.current = true;
4415
4432
  previewSessionRef.current = true;
4433
+ persistPreviewSessionSuppression();
4416
4434
  (async () => {
4417
4435
  try {
4418
4436
  persistActiveDraftPreview({ id: request.tourId, experienceType: request.experienceType });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelnex/sdk",
3
- "version": "0.5.22",
3
+ "version": "0.5.23",
4
4
  "description": "React SDK for natural language control of web apps via AI agents",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -20,6 +20,15 @@
20
20
  "dist",
21
21
  "README.md"
22
22
  ],
23
+ "scripts": {
24
+ "prepublishOnly": "npm run build",
25
+ "build": "npm exec -- tsup src/index.ts --format cjs,esm --dts",
26
+ "dev": "npm exec -- tsup src/index.ts --format cjs,esm --watch --dts",
27
+ "lint": "eslint src/",
28
+ "test": "npm run build && node --test tests/*.test.js",
29
+ "test:ci": "npm run test && npm run test:unit",
30
+ "test:unit": "node --import tsx --test tests/*.test.ts"
31
+ },
23
32
  "peerDependencies": {
24
33
  "react": ">=17.0.0",
25
34
  "react-dom": ">=17.0.0",
@@ -58,13 +67,5 @@
58
67
  "bugs": {
59
68
  "url": "https://github.com/sharunaraksha/modelnex-sdk/issues"
60
69
  },
61
- "homepage": "https://github.com/sharunaraksha/modelnex-sdk#readme",
62
- "scripts": {
63
- "build": "npm exec -- tsup src/index.ts --format cjs,esm --dts",
64
- "dev": "npm exec -- tsup src/index.ts --format cjs,esm --watch --dts",
65
- "lint": "eslint src/",
66
- "test": "npm run build && node --test tests/*.test.js",
67
- "test:ci": "npm run test && npm run test:unit",
68
- "test:unit": "node --import tsx --test tests/*.test.ts"
69
- }
70
- }
70
+ "homepage": "https://github.com/sharunaraksha/modelnex-sdk#readme"
71
+ }