@modelnex/sdk 0.5.19 → 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;
@@ -9248,7 +9262,7 @@ function ModelNexChatBubble({
9248
9262
  children: [
9249
9263
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: "12px", fontWeight: 800, letterSpacing: "0.1em", textTransform: "uppercase", color: "var(--modelnex-accent, #4f46e5)", marginBottom: "12px" }, children: mc.title || (onboardingPlayback.pendingTour ? "Workflow" : "Available Tour") }),
9250
9264
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: "26px", lineHeight: 1.2, fontWeight: 700, color: mc.textColor || "var(--modelnex-fg, #09090b)", marginBottom: "12px" }, children: pt?.name }),
9251
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: "15px", color: mc.textColor ? mc.textColor : "var(--modelnex-fg-muted, #52525b)", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.6, marginBottom: "24px" }, children: mc.description || (pt?.trigger === "first_visit" ? onboardingPlayback.pendingTour ? "Start a short workflow to help you get started with the platform." : "Start a short guided tour to help you get started with the platform." : pt?.featureKey ? `We noticed you're exploring ${pt.featureKey}. Would you like a quick walkthrough?` : "A helpful walkthrough is available to guide you through this section.") }),
9265
+ mc.description ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: "15px", color: mc.textColor ? mc.textColor : "var(--modelnex-fg-muted, #52525b)", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.6, marginBottom: "24px" }, children: mc.description }) : null,
9252
9266
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "12px", justifyContent: "flex-end" }, children: [
9253
9267
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
9254
9268
  "button",
@@ -10568,7 +10582,7 @@ function ModelNexOnboardingPanel({
10568
10582
  children: [
10569
10583
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "12px", fontWeight: 700, letterSpacing: "0.04em", textTransform: "uppercase", color: PANEL_THEME2.accent, marginBottom: "10px" }, children: mc.title || "Suggested workflow" }),
10570
10584
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "24px", lineHeight: 1.15, fontWeight: 650, marginBottom: "10px" }, children: playback.pendingTour.name }),
10571
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "14px", color: mc.textColor ? mc.textColor : "#52525b", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.5, marginBottom: "18px" }, children: mc.description || (playback.pendingTour.trigger === "first_visit" ? "Start this workflow for the user now?" : playback.pendingTour.featureKey ? `A workflow is available for ${playback.pendingTour.featureKey}.` : "A workflow is available for this user.") }),
10585
+ mc.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "14px", color: mc.textColor ? mc.textColor : "#52525b", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.5, marginBottom: "18px" }, children: mc.description }) : null,
10572
10586
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", gap: "10px", justifyContent: "flex-end" }, children: [
10573
10587
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
10574
10588
  "button",
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;
@@ -9037,7 +9051,7 @@ function ModelNexChatBubble({
9037
9051
  children: [
9038
9052
  /* @__PURE__ */ jsx4("div", { style: { fontSize: "12px", fontWeight: 800, letterSpacing: "0.1em", textTransform: "uppercase", color: "var(--modelnex-accent, #4f46e5)", marginBottom: "12px" }, children: mc.title || (onboardingPlayback.pendingTour ? "Workflow" : "Available Tour") }),
9039
9053
  /* @__PURE__ */ jsx4("div", { style: { fontSize: "26px", lineHeight: 1.2, fontWeight: 700, color: mc.textColor || "var(--modelnex-fg, #09090b)", marginBottom: "12px" }, children: pt?.name }),
9040
- /* @__PURE__ */ jsx4("div", { style: { fontSize: "15px", color: mc.textColor ? mc.textColor : "var(--modelnex-fg-muted, #52525b)", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.6, marginBottom: "24px" }, children: mc.description || (pt?.trigger === "first_visit" ? onboardingPlayback.pendingTour ? "Start a short workflow to help you get started with the platform." : "Start a short guided tour to help you get started with the platform." : pt?.featureKey ? `We noticed you're exploring ${pt.featureKey}. Would you like a quick walkthrough?` : "A helpful walkthrough is available to guide you through this section.") }),
9054
+ mc.description ? /* @__PURE__ */ jsx4("div", { style: { fontSize: "15px", color: mc.textColor ? mc.textColor : "var(--modelnex-fg-muted, #52525b)", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.6, marginBottom: "24px" }, children: mc.description }) : null,
9041
9055
  /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "12px", justifyContent: "flex-end" }, children: [
9042
9056
  /* @__PURE__ */ jsx4(
9043
9057
  "button",
@@ -10357,7 +10371,7 @@ function ModelNexOnboardingPanel({
10357
10371
  children: [
10358
10372
  /* @__PURE__ */ jsx5("div", { style: { fontSize: "12px", fontWeight: 700, letterSpacing: "0.04em", textTransform: "uppercase", color: PANEL_THEME2.accent, marginBottom: "10px" }, children: mc.title || "Suggested workflow" }),
10359
10373
  /* @__PURE__ */ jsx5("div", { style: { fontSize: "24px", lineHeight: 1.15, fontWeight: 650, marginBottom: "10px" }, children: playback.pendingTour.name }),
10360
- /* @__PURE__ */ jsx5("div", { style: { fontSize: "14px", color: mc.textColor ? mc.textColor : "#52525b", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.5, marginBottom: "18px" }, children: mc.description || (playback.pendingTour.trigger === "first_visit" ? "Start this workflow for the user now?" : playback.pendingTour.featureKey ? `A workflow is available for ${playback.pendingTour.featureKey}.` : "A workflow is available for this user.") }),
10374
+ mc.description ? /* @__PURE__ */ jsx5("div", { style: { fontSize: "14px", color: mc.textColor ? mc.textColor : "#52525b", opacity: mc.textColor ? 0.8 : 1, lineHeight: 1.5, marginBottom: "18px" }, children: mc.description }) : null,
10361
10375
  /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "10px", justifyContent: "flex-end" }, children: [
10362
10376
  /* @__PURE__ */ jsx5(
10363
10377
  "button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelnex/sdk",
3
- "version": "0.5.19",
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",