@modelnex/sdk 0.5.20 → 0.5.21

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
@@ -4448,6 +4448,15 @@ function useTourPlayback({
4448
4448
 
4449
4449
  // src/hooks/useExperiencePlaybackController.ts
4450
4450
  var EXPERIENCE_PRIORITY = ["onboarding", "tour"];
4451
+ function shouldDiscoverDraftPreview({
4452
+ disabled,
4453
+ hasPendingPrompt,
4454
+ isPlaybackActive,
4455
+ isPreviewDiscoveryInFlight,
4456
+ isStartingExperience
4457
+ }) {
4458
+ return !disabled && !hasPendingPrompt && !isPlaybackActive && !isPreviewDiscoveryInFlight && !isStartingExperience;
4459
+ }
4451
4460
  function useExperiencePlaybackController({
4452
4461
  serverUrl,
4453
4462
  commandUrl,
@@ -4567,9 +4576,14 @@ function useExperiencePlaybackController({
4567
4576
  readyInputs.forEach((item) => playback.handleVoiceInput(item.transcript));
4568
4577
  }, [activeExperienceType, playback]);
4569
4578
  (0, import_react13.useEffect)(() => {
4570
- if (disabled) return;
4579
+ if (!shouldDiscoverDraftPreview({
4580
+ disabled,
4581
+ hasPendingPrompt: Boolean(pendingPromptRef.current),
4582
+ isPlaybackActive: playback.isActive,
4583
+ isPreviewDiscoveryInFlight: previewDiscoveryInFlightRef.current,
4584
+ isStartingExperience: startingExperienceType !== null
4585
+ })) return;
4571
4586
  if (typeof window === "undefined") return;
4572
- if (previewDiscoveryInFlightRef.current) return;
4573
4587
  const params = new URLSearchParams(window.location.search);
4574
4588
  const activeDraftPreview = readActiveDraftPreview();
4575
4589
  const previewRequests = [];
@@ -4625,7 +4639,7 @@ function useExperiencePlaybackController({
4625
4639
  cancelled = true;
4626
4640
  previewDiscoveryInFlightRef.current = false;
4627
4641
  };
4628
- }, [disabled, queueExperienceStart, serverUrl, toursApiBase, websiteId]);
4642
+ }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, websiteId]);
4629
4643
  (0, import_react13.useEffect)(() => {
4630
4644
  if (disabled) return;
4631
4645
  if (!websiteId || !userProfile) return;
package/dist/index.mjs CHANGED
@@ -4238,6 +4238,15 @@ function useTourPlayback({
4238
4238
 
4239
4239
  // src/hooks/useExperiencePlaybackController.ts
4240
4240
  var EXPERIENCE_PRIORITY = ["onboarding", "tour"];
4241
+ function shouldDiscoverDraftPreview({
4242
+ disabled,
4243
+ hasPendingPrompt,
4244
+ isPlaybackActive,
4245
+ isPreviewDiscoveryInFlight,
4246
+ isStartingExperience
4247
+ }) {
4248
+ return !disabled && !hasPendingPrompt && !isPlaybackActive && !isPreviewDiscoveryInFlight && !isStartingExperience;
4249
+ }
4241
4250
  function useExperiencePlaybackController({
4242
4251
  serverUrl,
4243
4252
  commandUrl,
@@ -4357,9 +4366,14 @@ function useExperiencePlaybackController({
4357
4366
  readyInputs.forEach((item) => playback.handleVoiceInput(item.transcript));
4358
4367
  }, [activeExperienceType, playback]);
4359
4368
  useEffect12(() => {
4360
- if (disabled) return;
4369
+ if (!shouldDiscoverDraftPreview({
4370
+ disabled,
4371
+ hasPendingPrompt: Boolean(pendingPromptRef.current),
4372
+ isPlaybackActive: playback.isActive,
4373
+ isPreviewDiscoveryInFlight: previewDiscoveryInFlightRef.current,
4374
+ isStartingExperience: startingExperienceType !== null
4375
+ })) return;
4361
4376
  if (typeof window === "undefined") return;
4362
- if (previewDiscoveryInFlightRef.current) return;
4363
4377
  const params = new URLSearchParams(window.location.search);
4364
4378
  const activeDraftPreview = readActiveDraftPreview();
4365
4379
  const previewRequests = [];
@@ -4415,7 +4429,7 @@ function useExperiencePlaybackController({
4415
4429
  cancelled = true;
4416
4430
  previewDiscoveryInFlightRef.current = false;
4417
4431
  };
4418
- }, [disabled, queueExperienceStart, serverUrl, toursApiBase, websiteId]);
4432
+ }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, websiteId]);
4419
4433
  useEffect12(() => {
4420
4434
  if (disabled) return;
4421
4435
  if (!websiteId || !userProfile) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelnex/sdk",
3
- "version": "0.5.20",
3
+ "version": "0.5.21",
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",