@wallavi/widget 1.13.0 → 1.13.2
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +11 -5
- package/dist/index.mjs +11 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -174,8 +174,10 @@ interface ChatWidgetConfig {
|
|
|
174
174
|
showThinking?: boolean;
|
|
175
175
|
regenerateMessage?: boolean;
|
|
176
176
|
/**
|
|
177
|
-
* Persist
|
|
178
|
-
*
|
|
177
|
+
* Persist the conversation so it survives page reloads and navigations.
|
|
178
|
+
* The storage key is `wallavi_<agentId>_<userId>` when `userContext.userId`
|
|
179
|
+
* is set, otherwise `wallavi_<agentId>`. Messages go in sessionStorage under
|
|
180
|
+
* `<key>_msgs` and the threadId in localStorage under `<key>_tid`.
|
|
179
181
|
*/
|
|
180
182
|
persist?: boolean;
|
|
181
183
|
onNavigate?: (path: string) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -174,8 +174,10 @@ interface ChatWidgetConfig {
|
|
|
174
174
|
showThinking?: boolean;
|
|
175
175
|
regenerateMessage?: boolean;
|
|
176
176
|
/**
|
|
177
|
-
* Persist
|
|
178
|
-
*
|
|
177
|
+
* Persist the conversation so it survives page reloads and navigations.
|
|
178
|
+
* The storage key is `wallavi_<agentId>_<userId>` when `userContext.userId`
|
|
179
|
+
* is set, otherwise `wallavi_<agentId>`. Messages go in sessionStorage under
|
|
180
|
+
* `<key>_msgs` and the threadId in localStorage under `<key>_tid`.
|
|
179
181
|
*/
|
|
180
182
|
persist?: boolean;
|
|
181
183
|
onNavigate?: (path: string) => void;
|
package/dist/index.js
CHANGED
|
@@ -871,7 +871,13 @@ function useChat({
|
|
|
871
871
|
);
|
|
872
872
|
const fetchAndStream = react.useCallback(
|
|
873
873
|
async (opts) => {
|
|
874
|
-
const {
|
|
874
|
+
const {
|
|
875
|
+
input: userInput,
|
|
876
|
+
msgId,
|
|
877
|
+
extraMetadata,
|
|
878
|
+
attachments,
|
|
879
|
+
pickerSelection
|
|
880
|
+
} = opts;
|
|
875
881
|
const isPrivate = Boolean(workspaceId);
|
|
876
882
|
const token = isPrivate ? await getFreshClerkToken() : null;
|
|
877
883
|
const hostHeaders = await resolveUserHeaders(userContext);
|
|
@@ -893,6 +899,9 @@ function useChat({
|
|
|
893
899
|
} : { threadId },
|
|
894
900
|
source,
|
|
895
901
|
...attachments?.length ? { attachments } : {},
|
|
902
|
+
// Its own field: userMetadata keys starting with __ belong to the
|
|
903
|
+
// engine and the API rejects them.
|
|
904
|
+
...pickerSelection ? { pickerSelection } : {},
|
|
896
905
|
...userContext?.userName ? { userName: userContext.userName } : {},
|
|
897
906
|
...userContext?.userEmail ? { userEmail: userContext.userEmail } : {},
|
|
898
907
|
userMetadata: {
|
|
@@ -1093,7 +1102,6 @@ function useChat({
|
|
|
1093
1102
|
if (persistKey) {
|
|
1094
1103
|
try {
|
|
1095
1104
|
sessionStorage.removeItem(`${persistKey}_msgs`);
|
|
1096
|
-
sessionStorage.removeItem(`${persistKey}_tid`);
|
|
1097
1105
|
localStorage.removeItem(`${persistKey}_tid`);
|
|
1098
1106
|
} catch {
|
|
1099
1107
|
}
|
|
@@ -1205,9 +1213,7 @@ function useChat({
|
|
|
1205
1213
|
await fetchAndStream({
|
|
1206
1214
|
input: label,
|
|
1207
1215
|
msgId: assistantMsgId,
|
|
1208
|
-
|
|
1209
|
-
__pickerSelection: { pickerId, paramName, value, label }
|
|
1210
|
-
}
|
|
1216
|
+
pickerSelection: { pickerId, paramName, value, label }
|
|
1211
1217
|
});
|
|
1212
1218
|
} catch {
|
|
1213
1219
|
setMessages((prev) => {
|
package/dist/index.mjs
CHANGED
|
@@ -845,7 +845,13 @@ function useChat({
|
|
|
845
845
|
);
|
|
846
846
|
const fetchAndStream = useCallback(
|
|
847
847
|
async (opts) => {
|
|
848
|
-
const {
|
|
848
|
+
const {
|
|
849
|
+
input: userInput,
|
|
850
|
+
msgId,
|
|
851
|
+
extraMetadata,
|
|
852
|
+
attachments,
|
|
853
|
+
pickerSelection
|
|
854
|
+
} = opts;
|
|
849
855
|
const isPrivate = Boolean(workspaceId);
|
|
850
856
|
const token = isPrivate ? await getFreshClerkToken() : null;
|
|
851
857
|
const hostHeaders = await resolveUserHeaders(userContext);
|
|
@@ -867,6 +873,9 @@ function useChat({
|
|
|
867
873
|
} : { threadId },
|
|
868
874
|
source,
|
|
869
875
|
...attachments?.length ? { attachments } : {},
|
|
876
|
+
// Its own field: userMetadata keys starting with __ belong to the
|
|
877
|
+
// engine and the API rejects them.
|
|
878
|
+
...pickerSelection ? { pickerSelection } : {},
|
|
870
879
|
...userContext?.userName ? { userName: userContext.userName } : {},
|
|
871
880
|
...userContext?.userEmail ? { userEmail: userContext.userEmail } : {},
|
|
872
881
|
userMetadata: {
|
|
@@ -1067,7 +1076,6 @@ function useChat({
|
|
|
1067
1076
|
if (persistKey) {
|
|
1068
1077
|
try {
|
|
1069
1078
|
sessionStorage.removeItem(`${persistKey}_msgs`);
|
|
1070
|
-
sessionStorage.removeItem(`${persistKey}_tid`);
|
|
1071
1079
|
localStorage.removeItem(`${persistKey}_tid`);
|
|
1072
1080
|
} catch {
|
|
1073
1081
|
}
|
|
@@ -1179,9 +1187,7 @@ function useChat({
|
|
|
1179
1187
|
await fetchAndStream({
|
|
1180
1188
|
input: label,
|
|
1181
1189
|
msgId: assistantMsgId,
|
|
1182
|
-
|
|
1183
|
-
__pickerSelection: { pickerId, paramName, value, label }
|
|
1184
|
-
}
|
|
1190
|
+
pickerSelection: { pickerId, paramName, value, label }
|
|
1185
1191
|
});
|
|
1186
1192
|
} catch {
|
|
1187
1193
|
setMessages((prev) => {
|
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"private": false,
|
|
46
46
|
"types": "./dist/index.d.ts",
|
|
47
|
-
"version": "1.13.
|
|
47
|
+
"version": "1.13.2",
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsup && pnpm build:css",
|
|
50
50
|
"build:css": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --config tailwind.config.cjs --minify",
|