@modelnex/sdk 0.5.34 → 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.d.mts CHANGED
@@ -779,7 +779,6 @@ interface RecordingOverlayProps {
779
779
  pendingNarration: string;
780
780
  polishedNarration: string;
781
781
  isListening: boolean;
782
- onMarkStep: () => void;
783
782
  onToggleVoiceCapture: () => void;
784
783
  onElementSelected: (recorded: RecordedElement) => void;
785
784
  onPageLevelStep: () => void;
@@ -795,7 +794,7 @@ interface RecordingOverlayProps {
795
794
  onCancelRecording: () => void;
796
795
  onStopRecording: () => void;
797
796
  }
798
- declare function RecordingOverlay({ stepIndex, stepCount, captureEventCount, capturedTranscript, isVoiceCaptureActive, phase, pendingNarration, polishedNarration, isListening, onMarkStep, onToggleVoiceCapture, onElementSelected, onPageLevelStep, onStepTypeConfirmed, onStartNarration, onSubmitTextNarration, onNarrationApprove, onNarrationRedo, onNarrationEdit, onAddNextStep, onDoneRecording, onCancel, onCancelRecording, onStopRecording, }: RecordingOverlayProps): react_jsx_runtime.JSX.Element;
797
+ declare function RecordingOverlay({ stepIndex, stepCount, captureEventCount, capturedTranscript, isVoiceCaptureActive, phase, pendingNarration, polishedNarration, isListening, onToggleVoiceCapture, onElementSelected, onPageLevelStep, onStepTypeConfirmed, onStartNarration, onSubmitTextNarration, onNarrationApprove, onNarrationRedo, onNarrationEdit, onAddNextStep, onDoneRecording, onCancel, onCancelRecording, onStopRecording, }: RecordingOverlayProps): react_jsx_runtime.JSX.Element;
799
798
 
800
799
  declare function isAskDrivenInputStepType(stepType?: string | null): boolean;
801
800
  declare function isInteractiveInputStepType(stepType?: string | null): boolean;
package/dist/index.d.ts CHANGED
@@ -779,7 +779,6 @@ interface RecordingOverlayProps {
779
779
  pendingNarration: string;
780
780
  polishedNarration: string;
781
781
  isListening: boolean;
782
- onMarkStep: () => void;
783
782
  onToggleVoiceCapture: () => void;
784
783
  onElementSelected: (recorded: RecordedElement) => void;
785
784
  onPageLevelStep: () => void;
@@ -795,7 +794,7 @@ interface RecordingOverlayProps {
795
794
  onCancelRecording: () => void;
796
795
  onStopRecording: () => void;
797
796
  }
798
- declare function RecordingOverlay({ stepIndex, stepCount, captureEventCount, capturedTranscript, isVoiceCaptureActive, phase, pendingNarration, polishedNarration, isListening, onMarkStep, onToggleVoiceCapture, onElementSelected, onPageLevelStep, onStepTypeConfirmed, onStartNarration, onSubmitTextNarration, onNarrationApprove, onNarrationRedo, onNarrationEdit, onAddNextStep, onDoneRecording, onCancel, onCancelRecording, onStopRecording, }: RecordingOverlayProps): react_jsx_runtime.JSX.Element;
797
+ declare function RecordingOverlay({ stepIndex, stepCount, captureEventCount, capturedTranscript, isVoiceCaptureActive, phase, pendingNarration, polishedNarration, isListening, onToggleVoiceCapture, onElementSelected, onPageLevelStep, onStepTypeConfirmed, onStartNarration, onSubmitTextNarration, onNarrationApprove, onNarrationRedo, onNarrationEdit, onAddNextStep, onDoneRecording, onCancel, onCancelRecording, onStopRecording, }: RecordingOverlayProps): react_jsx_runtime.JSX.Element;
799
798
 
800
799
  declare function isAskDrivenInputStepType(stepType?: string | null): boolean;
801
800
  declare function isInteractiveInputStepType(stepType?: string | null): boolean;
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,
@@ -7588,7 +7596,14 @@ var panelBase = {
7588
7596
  fontSize: "13px",
7589
7597
  color: "#18181b"
7590
7598
  };
7591
- function ActiveHUD({ stepCount, captureEventCount, isVoiceCaptureActive, minimized, onMarkStep, onToggleVoiceCapture, onToggleMinimized, onStop, onCancel }) {
7599
+ function ActiveHUD({ stepCount, captureEventCount, isVoiceCaptureActive, minimized, onToggleVoiceCapture, onToggleMinimized, onStop, onCancel }) {
7600
+ const [hasActivatedVoiceCapture, setHasActivatedVoiceCapture] = (0, import_react17.useState)(isVoiceCaptureActive);
7601
+ (0, import_react17.useEffect)(() => {
7602
+ if (isVoiceCaptureActive) {
7603
+ setHasActivatedVoiceCapture(true);
7604
+ }
7605
+ }, [isVoiceCaptureActive]);
7606
+ const voiceCaptureLabel = isVoiceCaptureActive ? "Pause" : hasActivatedVoiceCapture ? "Continue" : "Start";
7592
7607
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
7593
7608
  "div",
7594
7609
  {
@@ -7648,44 +7663,23 @@ function ActiveHUD({ stepCount, captureEventCount, isVoiceCaptureActive, minimiz
7648
7663
  ),
7649
7664
  !minimized && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
7650
7665
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: "#d4d4d8", fontSize: "12px", whiteSpace: "nowrap", fontWeight: 500 }, children: captureEventCount <= 1 ? "Perform the workflow, then press Start to capture voice" : `${captureEventCount - 1} interactions \u2022 ${stepCount} note${stepCount !== 1 ? "s" : ""}` }),
7651
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
7652
- "button",
7653
- {
7654
- onClick: onMarkStep,
7655
- style: {
7656
- padding: "8px 16px",
7657
- background: "linear-gradient(135deg, #3b82f6, #2563eb)",
7658
- color: "#fff",
7659
- border: "none",
7660
- borderRadius: "10px",
7661
- cursor: "pointer",
7662
- fontSize: "13px",
7663
- fontWeight: 700,
7664
- whiteSpace: "nowrap",
7665
- boxShadow: "0 4px 12px rgba(59, 130, 246, 0.3)",
7666
- transition: "transform 0.1s"
7667
- },
7668
- onMouseDown: (e) => e.currentTarget.style.transform = "scale(0.95)",
7669
- onMouseUp: (e) => e.currentTarget.style.transform = "scale(1)",
7670
- children: "+ Add note"
7671
- }
7672
- ),
7673
7666
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
7674
7667
  "button",
7675
7668
  {
7676
7669
  onClick: onToggleVoiceCapture,
7677
7670
  style: {
7678
7671
  padding: "7px 12px",
7679
- background: isVoiceCaptureActive ? "rgba(59,130,246,0.2)" : "rgba(255,255,255,0.1)",
7680
- color: isVoiceCaptureActive ? "#93c5fd" : "#e4e4e7",
7681
- border: "1px solid rgba(255,255,255,0.12)",
7672
+ background: isVoiceCaptureActive ? "linear-gradient(135deg, rgba(251, 191, 36, 0.28), rgba(245, 158, 11, 0.22))" : "linear-gradient(135deg, #34d399, #059669)",
7673
+ color: isVoiceCaptureActive ? "#fef3c7" : "#f0fdf4",
7674
+ border: isVoiceCaptureActive ? "1px solid rgba(251,191,36,0.35)" : "1px solid rgba(16,185,129,0.45)",
7682
7675
  borderRadius: "8px",
7683
7676
  cursor: "pointer",
7684
7677
  fontSize: "12px",
7685
7678
  fontWeight: 600,
7679
+ boxShadow: isVoiceCaptureActive ? "0 0 0 1px rgba(251,191,36,0.08), 0 6px 16px rgba(245,158,11,0.18)" : "0 6px 16px rgba(5,150,105,0.28)",
7686
7680
  transition: "all 0.2s"
7687
7681
  },
7688
- children: isVoiceCaptureActive ? "Pause" : "Start"
7682
+ children: voiceCaptureLabel
7689
7683
  }
7690
7684
  ),
7691
7685
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -8442,7 +8436,6 @@ function RecordingOverlay({
8442
8436
  pendingNarration,
8443
8437
  polishedNarration,
8444
8438
  isListening,
8445
- onMarkStep,
8446
8439
  onToggleVoiceCapture,
8447
8440
  onElementSelected,
8448
8441
  onPageLevelStep,
@@ -8535,7 +8528,6 @@ function RecordingOverlay({
8535
8528
  captureEventCount,
8536
8529
  isVoiceCaptureActive,
8537
8530
  minimized: hudMinimized,
8538
- onMarkStep,
8539
8531
  onToggleVoiceCapture,
8540
8532
  onToggleMinimized: () => setHudMinimized((value) => !value),
8541
8533
  onStop: onDoneRecording,
@@ -11206,7 +11198,6 @@ function ModelNexChatBubble({
11206
11198
  pendingNarration: recording.pendingNarration,
11207
11199
  polishedNarration: recording.polishedNarration,
11208
11200
  isListening: voice.isListening,
11209
- onMarkStep: () => recording.markStep(),
11210
11201
  onToggleVoiceCapture: () => recording.toggleVoiceCapture(),
11211
11202
  onElementSelected: (recorded) => recording.selectElement(recorded),
11212
11203
  onPageLevelStep: () => recording.selectPageLevel(),
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,
@@ -7378,7 +7386,14 @@ var panelBase = {
7378
7386
  fontSize: "13px",
7379
7387
  color: "#18181b"
7380
7388
  };
7381
- function ActiveHUD({ stepCount, captureEventCount, isVoiceCaptureActive, minimized, onMarkStep, onToggleVoiceCapture, onToggleMinimized, onStop, onCancel }) {
7389
+ function ActiveHUD({ stepCount, captureEventCount, isVoiceCaptureActive, minimized, onToggleVoiceCapture, onToggleMinimized, onStop, onCancel }) {
7390
+ const [hasActivatedVoiceCapture, setHasActivatedVoiceCapture] = useState12(isVoiceCaptureActive);
7391
+ useEffect16(() => {
7392
+ if (isVoiceCaptureActive) {
7393
+ setHasActivatedVoiceCapture(true);
7394
+ }
7395
+ }, [isVoiceCaptureActive]);
7396
+ const voiceCaptureLabel = isVoiceCaptureActive ? "Pause" : hasActivatedVoiceCapture ? "Continue" : "Start";
7382
7397
  return /* @__PURE__ */ jsxs2(
7383
7398
  "div",
7384
7399
  {
@@ -7438,44 +7453,23 @@ function ActiveHUD({ stepCount, captureEventCount, isVoiceCaptureActive, minimiz
7438
7453
  ),
7439
7454
  !minimized && /* @__PURE__ */ jsxs2(Fragment, { children: [
7440
7455
  /* @__PURE__ */ jsx3("span", { style: { color: "#d4d4d8", fontSize: "12px", whiteSpace: "nowrap", fontWeight: 500 }, children: captureEventCount <= 1 ? "Perform the workflow, then press Start to capture voice" : `${captureEventCount - 1} interactions \u2022 ${stepCount} note${stepCount !== 1 ? "s" : ""}` }),
7441
- /* @__PURE__ */ jsx3(
7442
- "button",
7443
- {
7444
- onClick: onMarkStep,
7445
- style: {
7446
- padding: "8px 16px",
7447
- background: "linear-gradient(135deg, #3b82f6, #2563eb)",
7448
- color: "#fff",
7449
- border: "none",
7450
- borderRadius: "10px",
7451
- cursor: "pointer",
7452
- fontSize: "13px",
7453
- fontWeight: 700,
7454
- whiteSpace: "nowrap",
7455
- boxShadow: "0 4px 12px rgba(59, 130, 246, 0.3)",
7456
- transition: "transform 0.1s"
7457
- },
7458
- onMouseDown: (e) => e.currentTarget.style.transform = "scale(0.95)",
7459
- onMouseUp: (e) => e.currentTarget.style.transform = "scale(1)",
7460
- children: "+ Add note"
7461
- }
7462
- ),
7463
7456
  /* @__PURE__ */ jsx3(
7464
7457
  "button",
7465
7458
  {
7466
7459
  onClick: onToggleVoiceCapture,
7467
7460
  style: {
7468
7461
  padding: "7px 12px",
7469
- background: isVoiceCaptureActive ? "rgba(59,130,246,0.2)" : "rgba(255,255,255,0.1)",
7470
- color: isVoiceCaptureActive ? "#93c5fd" : "#e4e4e7",
7471
- border: "1px solid rgba(255,255,255,0.12)",
7462
+ background: isVoiceCaptureActive ? "linear-gradient(135deg, rgba(251, 191, 36, 0.28), rgba(245, 158, 11, 0.22))" : "linear-gradient(135deg, #34d399, #059669)",
7463
+ color: isVoiceCaptureActive ? "#fef3c7" : "#f0fdf4",
7464
+ border: isVoiceCaptureActive ? "1px solid rgba(251,191,36,0.35)" : "1px solid rgba(16,185,129,0.45)",
7472
7465
  borderRadius: "8px",
7473
7466
  cursor: "pointer",
7474
7467
  fontSize: "12px",
7475
7468
  fontWeight: 600,
7469
+ boxShadow: isVoiceCaptureActive ? "0 0 0 1px rgba(251,191,36,0.08), 0 6px 16px rgba(245,158,11,0.18)" : "0 6px 16px rgba(5,150,105,0.28)",
7476
7470
  transition: "all 0.2s"
7477
7471
  },
7478
- children: isVoiceCaptureActive ? "Pause" : "Start"
7472
+ children: voiceCaptureLabel
7479
7473
  }
7480
7474
  ),
7481
7475
  /* @__PURE__ */ jsx3(
@@ -8232,7 +8226,6 @@ function RecordingOverlay({
8232
8226
  pendingNarration,
8233
8227
  polishedNarration,
8234
8228
  isListening,
8235
- onMarkStep,
8236
8229
  onToggleVoiceCapture,
8237
8230
  onElementSelected,
8238
8231
  onPageLevelStep,
@@ -8325,7 +8318,6 @@ function RecordingOverlay({
8325
8318
  captureEventCount,
8326
8319
  isVoiceCaptureActive,
8327
8320
  minimized: hudMinimized,
8328
- onMarkStep,
8329
8321
  onToggleVoiceCapture,
8330
8322
  onToggleMinimized: () => setHudMinimized((value) => !value),
8331
8323
  onStop: onDoneRecording,
@@ -10996,7 +10988,6 @@ function ModelNexChatBubble({
10996
10988
  pendingNarration: recording.pendingNarration,
10997
10989
  polishedNarration: recording.polishedNarration,
10998
10990
  isListening: voice.isListening,
10999
- onMarkStep: () => recording.markStep(),
11000
10991
  onToggleVoiceCapture: () => recording.toggleVoiceCapture(),
11001
10992
  onElementSelected: (recorded) => recording.selectElement(recorded),
11002
10993
  onPageLevelStep: () => recording.selectPageLevel(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelnex/sdk",
3
- "version": "0.5.34",
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",