@modelnex/sdk 0.5.35 → 0.5.36

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
@@ -3167,6 +3167,12 @@ function readPreviewSessionSuppression() {
3167
3167
  }
3168
3168
  }
3169
3169
 
3170
+ // src/utils/locationSignature.ts
3171
+ function getLocationSignature(locationLike) {
3172
+ if (!locationLike) return "";
3173
+ return `${locationLike.pathname ?? ""}${locationLike.search ?? ""}${locationLike.hash ?? ""}`;
3174
+ }
3175
+
3170
3176
  // src/hooks/useTourPlayback.ts
3171
3177
  var import_react12 = require("react");
3172
3178
 
@@ -3799,6 +3805,7 @@ function useTourPlayback({
3799
3805
  showCaptions = true,
3800
3806
  enableAutoDiscovery = true
3801
3807
  }) {
3808
+ const locationSignature = typeof window === "undefined" ? "" : getLocationSignature(window.location);
3802
3809
  const [isActive, setIsActive] = (0, import_react12.useState)(false);
3803
3810
  const [currentStepIndex, setCurrentStepIndex] = (0, import_react12.useState)(0);
3804
3811
  const [totalSteps, setTotalSteps] = (0, import_react12.useState)(0);
@@ -4842,7 +4849,7 @@ function useTourPlayback({
4842
4849
  return () => {
4843
4850
  cancelled = true;
4844
4851
  };
4845
- }, [serverUrl, toursApiBase, disabled, websiteId, experienceType, enableAutoDiscovery]);
4852
+ }, [serverUrl, toursApiBase, disabled, websiteId, experienceType, enableAutoDiscovery, locationSignature]);
4846
4853
  (0, import_react12.useEffect)(() => {
4847
4854
  if (!shouldRunTourAutoDiscovery({
4848
4855
  enableAutoDiscovery,
@@ -4889,7 +4896,7 @@ function useTourPlayback({
4889
4896
  cancelled = true;
4890
4897
  clearTimeout(timer);
4891
4898
  };
4892
- }, [websiteId, serverUrl, toursApiBase, disabled, experienceType, userProfile?.userId, userProfile?.type, userProfile?.isNewUser, enableAutoDiscovery]);
4899
+ }, [websiteId, serverUrl, toursApiBase, disabled, experienceType, userProfile?.userId, userProfile?.type, userProfile?.isNewUser, enableAutoDiscovery, locationSignature]);
4893
4900
  (0, import_react12.useEffect)(() => {
4894
4901
  if (!disabled || !isActiveRef.current) return;
4895
4902
  stopTour();
@@ -5107,6 +5114,7 @@ function useExperiencePlaybackController({
5107
5114
  showCaptions = true,
5108
5115
  initialExperienceType = "tour"
5109
5116
  }) {
5117
+ const locationSignature = typeof window === "undefined" ? "" : getLocationSignature(window.location);
5110
5118
  const [activeExperienceType, setActiveExperienceType] = (0, import_react13.useState)(initialExperienceType);
5111
5119
  const [startingExperienceType, setStartingExperienceType] = (0, import_react13.useState)(null);
5112
5120
  const [pendingPrompt, setPendingPrompt] = (0, import_react13.useState)(null);
@@ -5302,7 +5310,7 @@ function useExperiencePlaybackController({
5302
5310
  cancelled = true;
5303
5311
  previewDiscoveryInFlightRef.current = false;
5304
5312
  };
5305
- }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, websiteId]);
5313
+ }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, websiteId, locationSignature]);
5306
5314
  (0, import_react13.useEffect)(() => {
5307
5315
  if (!shouldDiscoverEligibleTours({
5308
5316
  disabled,
@@ -5353,7 +5361,7 @@ function useExperiencePlaybackController({
5353
5361
  cancelled = true;
5354
5362
  clearTimeout(timer);
5355
5363
  };
5356
- }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, userProfile, websiteId]);
5364
+ }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, userProfile, websiteId, locationSignature]);
5357
5365
  return {
5358
5366
  activeExperienceType,
5359
5367
  startingExperienceType,
package/dist/index.mjs CHANGED
@@ -2958,6 +2958,12 @@ function readPreviewSessionSuppression() {
2958
2958
  }
2959
2959
  }
2960
2960
 
2961
+ // src/utils/locationSignature.ts
2962
+ function getLocationSignature(locationLike) {
2963
+ if (!locationLike) return "";
2964
+ return `${locationLike.pathname ?? ""}${locationLike.search ?? ""}${locationLike.hash ?? ""}`;
2965
+ }
2966
+
2961
2967
  // src/hooks/useTourPlayback.ts
2962
2968
  import { useState as useState7, useRef as useRef8, useCallback as useCallback7, useEffect as useEffect11, useContext as useContext4 } from "react";
2963
2969
 
@@ -3590,6 +3596,7 @@ function useTourPlayback({
3590
3596
  showCaptions = true,
3591
3597
  enableAutoDiscovery = true
3592
3598
  }) {
3599
+ const locationSignature = typeof window === "undefined" ? "" : getLocationSignature(window.location);
3593
3600
  const [isActive, setIsActive] = useState7(false);
3594
3601
  const [currentStepIndex, setCurrentStepIndex] = useState7(0);
3595
3602
  const [totalSteps, setTotalSteps] = useState7(0);
@@ -4633,7 +4640,7 @@ function useTourPlayback({
4633
4640
  return () => {
4634
4641
  cancelled = true;
4635
4642
  };
4636
- }, [serverUrl, toursApiBase, disabled, websiteId, experienceType, enableAutoDiscovery]);
4643
+ }, [serverUrl, toursApiBase, disabled, websiteId, experienceType, enableAutoDiscovery, locationSignature]);
4637
4644
  useEffect11(() => {
4638
4645
  if (!shouldRunTourAutoDiscovery({
4639
4646
  enableAutoDiscovery,
@@ -4680,7 +4687,7 @@ function useTourPlayback({
4680
4687
  cancelled = true;
4681
4688
  clearTimeout(timer);
4682
4689
  };
4683
- }, [websiteId, serverUrl, toursApiBase, disabled, experienceType, userProfile?.userId, userProfile?.type, userProfile?.isNewUser, enableAutoDiscovery]);
4690
+ }, [websiteId, serverUrl, toursApiBase, disabled, experienceType, userProfile?.userId, userProfile?.type, userProfile?.isNewUser, enableAutoDiscovery, locationSignature]);
4684
4691
  useEffect11(() => {
4685
4692
  if (!disabled || !isActiveRef.current) return;
4686
4693
  stopTour();
@@ -4898,6 +4905,7 @@ function useExperiencePlaybackController({
4898
4905
  showCaptions = true,
4899
4906
  initialExperienceType = "tour"
4900
4907
  }) {
4908
+ const locationSignature = typeof window === "undefined" ? "" : getLocationSignature(window.location);
4901
4909
  const [activeExperienceType, setActiveExperienceType] = useState8(initialExperienceType);
4902
4910
  const [startingExperienceType, setStartingExperienceType] = useState8(null);
4903
4911
  const [pendingPrompt, setPendingPrompt] = useState8(null);
@@ -5093,7 +5101,7 @@ function useExperiencePlaybackController({
5093
5101
  cancelled = true;
5094
5102
  previewDiscoveryInFlightRef.current = false;
5095
5103
  };
5096
- }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, websiteId]);
5104
+ }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, websiteId, locationSignature]);
5097
5105
  useEffect12(() => {
5098
5106
  if (!shouldDiscoverEligibleTours({
5099
5107
  disabled,
@@ -5144,7 +5152,7 @@ function useExperiencePlaybackController({
5144
5152
  cancelled = true;
5145
5153
  clearTimeout(timer);
5146
5154
  };
5147
- }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, userProfile, websiteId]);
5155
+ }, [disabled, playback.isActive, queueExperienceStart, serverUrl, startingExperienceType, toursApiBase, userProfile, websiteId, locationSignature]);
5148
5156
  return {
5149
5157
  activeExperienceType,
5150
5158
  startingExperienceType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelnex/sdk",
3
- "version": "0.5.35",
3
+ "version": "0.5.36",
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",