@usecrow/ui 0.1.20 → 0.1.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.cjs +18 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -145,7 +145,9 @@ function useChat({
|
|
|
145
145
|
identity_token: identityToken,
|
|
146
146
|
model: selectedModel,
|
|
147
147
|
user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
148
|
-
user_local_time: (/* @__PURE__ */ new Date()).toLocaleString()
|
|
148
|
+
user_local_time: (/* @__PURE__ */ new Date()).toLocaleString(),
|
|
149
|
+
page_path: typeof window !== "undefined" ? window.location.pathname : void 0,
|
|
150
|
+
context: typeof window !== "undefined" ? window.__crow_page_context : void 0
|
|
149
151
|
}),
|
|
150
152
|
signal: abortControllerRef.current.signal
|
|
151
153
|
});
|
|
@@ -776,6 +778,21 @@ function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
|
776
778
|
})
|
|
777
779
|
);
|
|
778
780
|
break;
|
|
781
|
+
case "setContext":
|
|
782
|
+
if (!opts || typeof opts !== "object") {
|
|
783
|
+
console.error("[Crow] setContext() requires an object");
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
window.__crow_page_context = {
|
|
787
|
+
...window.__crow_page_context || {},
|
|
788
|
+
...opts
|
|
789
|
+
};
|
|
790
|
+
console.log("[Crow] Context updated", window.__crow_page_context);
|
|
791
|
+
break;
|
|
792
|
+
case "clearContext":
|
|
793
|
+
window.__crow_page_context = void 0;
|
|
794
|
+
console.log("[Crow] Context cleared");
|
|
795
|
+
break;
|
|
779
796
|
default:
|
|
780
797
|
console.warn(`[Crow] Unknown command: ${command}`);
|
|
781
798
|
}
|