@modelnex/sdk 0.5.5 → 0.5.6
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/README.md +2 -19
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,9 +33,6 @@ export default function AppShell() {
|
|
|
33
33
|
isNewUser: currentUser.isNewUser,
|
|
34
34
|
userId: currentUser.id,
|
|
35
35
|
}}
|
|
36
|
-
tourFacts={{
|
|
37
|
-
features: currentUser.enabledFeatures,
|
|
38
|
-
}}
|
|
39
36
|
>
|
|
40
37
|
<App />
|
|
41
38
|
<ModelNexChatBubble appName="My Product" />
|
|
@@ -44,7 +41,7 @@ export default function AppShell() {
|
|
|
44
41
|
}
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
`websiteId` identifies the integration. `userProfile` is used for tour/workflow targeting and completion tracking.
|
|
44
|
+
`websiteId` identifies the integration. `userProfile` is used for tour/workflow targeting and completion tracking.
|
|
48
45
|
|
|
49
46
|
## Tour Start Model
|
|
50
47
|
|
|
@@ -85,12 +82,8 @@ Current behavior:
|
|
|
85
82
|
|
|
86
83
|
| Prop | Purpose |
|
|
87
84
|
|------|---------|
|
|
88
|
-
| `serverUrl` | ModelNex server base URL. Defaults to `https://api.modelnex.io` |
|
|
89
|
-
| `commandUrl` | Optional same-origin command proxy base |
|
|
90
85
|
| `websiteId` | Tenant/integration identifier |
|
|
91
86
|
| `userProfile` | End-user targeting data for tours/workflows |
|
|
92
|
-
| `tourFacts` | Additional facts, currently used for feature-based eligibility |
|
|
93
|
-
| `toursApiBase` | Same-origin API base for tour/workflow fetches and test URLs |
|
|
94
87
|
| `devMode` | Enables recording/studio tooling for your internal users |
|
|
95
88
|
|
|
96
89
|
## Chat Bubble Props
|
|
@@ -119,14 +112,10 @@ import { ModelNexProvider } from '@modelnex/sdk';
|
|
|
119
112
|
export function AppShell({ children, currentUser }) {
|
|
120
113
|
return (
|
|
121
114
|
<ModelNexProvider
|
|
122
|
-
// Basic Setup
|
|
123
|
-
serverUrl="https://api.yourdomain.com/modelnex"
|
|
124
115
|
websiteId="prod_site_123"
|
|
125
116
|
|
|
126
|
-
// Development
|
|
117
|
+
// Development setup
|
|
127
118
|
devMode={process.env.NODE_ENV === 'development'}
|
|
128
|
-
commandUrl="/api/modelnex/command" // Proxies commands through your own API
|
|
129
|
-
toursApiBase="/api/tours" // Proxies tour fetches to avoid CORS
|
|
130
119
|
|
|
131
120
|
// User Targeting for Tours & Workflows
|
|
132
121
|
userProfile={{
|
|
@@ -134,11 +123,6 @@ export function AppShell({ children, currentUser }) {
|
|
|
134
123
|
isNewUser: currentUser.createdAt > Date.now() - 86400000 * 7, // 7 days
|
|
135
124
|
type: currentUser.role, // e.g. "admin", "viewer"
|
|
136
125
|
}}
|
|
137
|
-
|
|
138
|
-
// Additional facts for Feature-Gated Tours
|
|
139
|
-
tourFacts={{
|
|
140
|
-
features: currentUser.enabledFeatures, // e.g. ["billing", "advanced_reporting"]
|
|
141
|
-
}}
|
|
142
126
|
>
|
|
143
127
|
{children}
|
|
144
128
|
</ModelNexProvider>
|
|
@@ -183,7 +167,6 @@ export function ChatIntegration() {
|
|
|
183
167
|
|
|
184
168
|
- Force a tour with `?modelnex_test_tour=TOUR_ID`
|
|
185
169
|
- Force a workflow with `?modelnex_test_workflow=FLOW_ID`
|
|
186
|
-
- If you use a same-origin proxy, set `toursApiBase` so test fetches avoid CORS issues
|
|
187
170
|
|
|
188
171
|
## Custom UI
|
|
189
172
|
|
package/dist/index.js
CHANGED
|
@@ -2249,7 +2249,7 @@ function useBuiltinActions(registerAction, unregisterAction, tagStore, serverUrl
|
|
|
2249
2249
|
|
|
2250
2250
|
// src/hooks/useRunCommand.ts
|
|
2251
2251
|
var import_react9 = require("react");
|
|
2252
|
-
var DEFAULT_SERVER_URL = "
|
|
2252
|
+
var DEFAULT_SERVER_URL = "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
2253
2253
|
function searchTaggedElementsForQuery(store, query, limit = 8) {
|
|
2254
2254
|
const allTags = store.getAllTags();
|
|
2255
2255
|
if (allTags.length === 0) return [];
|
|
@@ -8339,7 +8339,7 @@ function ModelNexChatBubble({
|
|
|
8339
8339
|
const messagesEndRef = (0, import_react18.useRef)(null);
|
|
8340
8340
|
const abortControllerRef = (0, import_react18.useRef)(null);
|
|
8341
8341
|
const panelRef = (0, import_react18.useRef)(null);
|
|
8342
|
-
const serverUrl = ctx?.serverUrl ?? "
|
|
8342
|
+
const serverUrl = ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8343
8343
|
const voice = useVoice(serverUrl);
|
|
8344
8344
|
const audioLevels = useAudioLevel(voice.isListening);
|
|
8345
8345
|
const recordingMode = ctx?.recordingMode ?? false;
|
|
@@ -8426,7 +8426,7 @@ function ModelNexChatBubble({
|
|
|
8426
8426
|
if (lastAutoTaggedUrlRef.current === currentUrl || localStorage.getItem(storageKey)) {
|
|
8427
8427
|
return;
|
|
8428
8428
|
}
|
|
8429
|
-
const baseUrl = commandUrl ?? serverUrl2 ?? "
|
|
8429
|
+
const baseUrl = commandUrl ?? serverUrl2 ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8430
8430
|
const url = baseUrl.startsWith("/") ? `${window.location.origin}${baseUrl}/agent/auto-tag` : `${baseUrl}/agent/auto-tag`;
|
|
8431
8431
|
const elements = extractedElements.map((el) => ({
|
|
8432
8432
|
fingerprint: el.fingerprint,
|
|
@@ -8830,7 +8830,7 @@ function ModelNexChatBubble({
|
|
|
8830
8830
|
}
|
|
8831
8831
|
};
|
|
8832
8832
|
const stopAgent = async () => {
|
|
8833
|
-
const baseUrl = ctx?.commandUrl ?? ctx?.serverUrl ?? "
|
|
8833
|
+
const baseUrl = ctx?.commandUrl ?? ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8834
8834
|
const abortUrl = baseUrl.startsWith("/") ? `${window.location.origin}${baseUrl}/agent/abort` : `${baseUrl}/agent/abort`;
|
|
8835
8835
|
try {
|
|
8836
8836
|
await fetch(abortUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ socketId: ctx?.socketId }) });
|
|
@@ -10088,7 +10088,7 @@ function ModelNexOnboardingPanel({
|
|
|
10088
10088
|
title = "Getting Started"
|
|
10089
10089
|
}) {
|
|
10090
10090
|
const ctx = (0, import_react19.useContext)(ModelNexContext);
|
|
10091
|
-
const serverUrl = ctx?.serverUrl ?? "
|
|
10091
|
+
const serverUrl = ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
10092
10092
|
const voice = useVoice(serverUrl);
|
|
10093
10093
|
const audioLevels = useAudioLevel(voice.isListening);
|
|
10094
10094
|
const [input, setInput] = (0, import_react19.useState)("");
|
|
@@ -10828,7 +10828,7 @@ function TourProgressPanel({ tour, currentStepIndex, onSkip, voiceOnly }) {
|
|
|
10828
10828
|
}
|
|
10829
10829
|
|
|
10830
10830
|
// src/index.ts
|
|
10831
|
-
var DEFAULT_SERVER_URL2 = "https://
|
|
10831
|
+
var DEFAULT_SERVER_URL2 = "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
10832
10832
|
var ModelNexProvider = ({
|
|
10833
10833
|
children,
|
|
10834
10834
|
websiteId,
|
package/dist/index.mjs
CHANGED
|
@@ -2040,7 +2040,7 @@ function useBuiltinActions(registerAction, unregisterAction, tagStore, serverUrl
|
|
|
2040
2040
|
|
|
2041
2041
|
// src/hooks/useRunCommand.ts
|
|
2042
2042
|
import { useCallback as useCallback5, useContext as useContext2 } from "react";
|
|
2043
|
-
var DEFAULT_SERVER_URL = "
|
|
2043
|
+
var DEFAULT_SERVER_URL = "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
2044
2044
|
function searchTaggedElementsForQuery(store, query, limit = 8) {
|
|
2045
2045
|
const allTags = store.getAllTags();
|
|
2046
2046
|
if (allTags.length === 0) return [];
|
|
@@ -8129,7 +8129,7 @@ function ModelNexChatBubble({
|
|
|
8129
8129
|
const messagesEndRef = useRef13(null);
|
|
8130
8130
|
const abortControllerRef = useRef13(null);
|
|
8131
8131
|
const panelRef = useRef13(null);
|
|
8132
|
-
const serverUrl = ctx?.serverUrl ?? "
|
|
8132
|
+
const serverUrl = ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8133
8133
|
const voice = useVoice(serverUrl);
|
|
8134
8134
|
const audioLevels = useAudioLevel(voice.isListening);
|
|
8135
8135
|
const recordingMode = ctx?.recordingMode ?? false;
|
|
@@ -8216,7 +8216,7 @@ function ModelNexChatBubble({
|
|
|
8216
8216
|
if (lastAutoTaggedUrlRef.current === currentUrl || localStorage.getItem(storageKey)) {
|
|
8217
8217
|
return;
|
|
8218
8218
|
}
|
|
8219
|
-
const baseUrl = commandUrl ?? serverUrl2 ?? "
|
|
8219
|
+
const baseUrl = commandUrl ?? serverUrl2 ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8220
8220
|
const url = baseUrl.startsWith("/") ? `${window.location.origin}${baseUrl}/agent/auto-tag` : `${baseUrl}/agent/auto-tag`;
|
|
8221
8221
|
const elements = extractedElements.map((el) => ({
|
|
8222
8222
|
fingerprint: el.fingerprint,
|
|
@@ -8620,7 +8620,7 @@ function ModelNexChatBubble({
|
|
|
8620
8620
|
}
|
|
8621
8621
|
};
|
|
8622
8622
|
const stopAgent = async () => {
|
|
8623
|
-
const baseUrl = ctx?.commandUrl ?? ctx?.serverUrl ?? "
|
|
8623
|
+
const baseUrl = ctx?.commandUrl ?? ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
8624
8624
|
const abortUrl = baseUrl.startsWith("/") ? `${window.location.origin}${baseUrl}/agent/abort` : `${baseUrl}/agent/abort`;
|
|
8625
8625
|
try {
|
|
8626
8626
|
await fetch(abortUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ socketId: ctx?.socketId }) });
|
|
@@ -9878,7 +9878,7 @@ function ModelNexOnboardingPanel({
|
|
|
9878
9878
|
title = "Getting Started"
|
|
9879
9879
|
}) {
|
|
9880
9880
|
const ctx = useContext6(ModelNexContext);
|
|
9881
|
-
const serverUrl = ctx?.serverUrl ?? "
|
|
9881
|
+
const serverUrl = ctx?.serverUrl ?? "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
9882
9882
|
const voice = useVoice(serverUrl);
|
|
9883
9883
|
const audioLevels = useAudioLevel(voice.isListening);
|
|
9884
9884
|
const [input, setInput] = useState14("");
|
|
@@ -10618,7 +10618,7 @@ function TourProgressPanel({ tour, currentStepIndex, onSkip, voiceOnly }) {
|
|
|
10618
10618
|
}
|
|
10619
10619
|
|
|
10620
10620
|
// src/index.ts
|
|
10621
|
-
var DEFAULT_SERVER_URL2 = "https://
|
|
10621
|
+
var DEFAULT_SERVER_URL2 = "https://69tgf4aic6.us-east-1.awsapprunner.com";
|
|
10622
10622
|
var ModelNexProvider = ({
|
|
10623
10623
|
children,
|
|
10624
10624
|
websiteId,
|