@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.d.cts
CHANGED
|
@@ -516,6 +516,7 @@ declare global {
|
|
|
516
516
|
__crow_public_metadata?: Record<string, unknown>;
|
|
517
517
|
__crow_journey_callback?: (event: JourneyEvent) => void;
|
|
518
518
|
__crow_client_tools?: Record<string, ClientToolHandler>;
|
|
519
|
+
__crow_page_context?: Record<string, unknown>;
|
|
519
520
|
}
|
|
520
521
|
}
|
|
521
522
|
|
package/dist/index.d.ts
CHANGED
|
@@ -516,6 +516,7 @@ declare global {
|
|
|
516
516
|
__crow_public_metadata?: Record<string, unknown>;
|
|
517
517
|
__crow_journey_callback?: (event: JourneyEvent) => void;
|
|
518
518
|
__crow_client_tools?: Record<string, ClientToolHandler>;
|
|
519
|
+
__crow_page_context?: Record<string, unknown>;
|
|
519
520
|
}
|
|
520
521
|
}
|
|
521
522
|
|
package/dist/index.js
CHANGED
|
@@ -119,7 +119,9 @@ function useChat({
|
|
|
119
119
|
identity_token: identityToken,
|
|
120
120
|
model: selectedModel,
|
|
121
121
|
user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
122
|
-
user_local_time: (/* @__PURE__ */ new Date()).toLocaleString()
|
|
122
|
+
user_local_time: (/* @__PURE__ */ new Date()).toLocaleString(),
|
|
123
|
+
page_path: typeof window !== "undefined" ? window.location.pathname : void 0,
|
|
124
|
+
context: typeof window !== "undefined" ? window.__crow_page_context : void 0
|
|
123
125
|
}),
|
|
124
126
|
signal: abortControllerRef.current.signal
|
|
125
127
|
});
|
|
@@ -750,6 +752,21 @@ function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
|
750
752
|
})
|
|
751
753
|
);
|
|
752
754
|
break;
|
|
755
|
+
case "setContext":
|
|
756
|
+
if (!opts || typeof opts !== "object") {
|
|
757
|
+
console.error("[Crow] setContext() requires an object");
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
window.__crow_page_context = {
|
|
761
|
+
...window.__crow_page_context || {},
|
|
762
|
+
...opts
|
|
763
|
+
};
|
|
764
|
+
console.log("[Crow] Context updated", window.__crow_page_context);
|
|
765
|
+
break;
|
|
766
|
+
case "clearContext":
|
|
767
|
+
window.__crow_page_context = void 0;
|
|
768
|
+
console.log("[Crow] Context cleared");
|
|
769
|
+
break;
|
|
753
770
|
default:
|
|
754
771
|
console.warn(`[Crow] Unknown command: ${command}`);
|
|
755
772
|
}
|