@usecrow/ui 0.1.61 → 0.1.63
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 +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -309,7 +309,7 @@ type ClientToolHandler = (args: Record<string, unknown>) => Promise<{
|
|
|
309
309
|
};
|
|
310
310
|
declare global {
|
|
311
311
|
interface Window {
|
|
312
|
-
crow: (command: string, options?: unknown) => void;
|
|
312
|
+
crow: (command: string, options?: unknown) => AbortController | void;
|
|
313
313
|
__crow_identity_token?: string;
|
|
314
314
|
__crow_public_metadata?: Record<string, unknown>;
|
|
315
315
|
__crow_journey_callback?: (event: JourneyEvent) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -309,7 +309,7 @@ type ClientToolHandler = (args: Record<string, unknown>) => Promise<{
|
|
|
309
309
|
};
|
|
310
310
|
declare global {
|
|
311
311
|
interface Window {
|
|
312
|
-
crow: (command: string, options?: unknown) => void;
|
|
312
|
+
crow: (command: string, options?: unknown) => AbortController | void;
|
|
313
313
|
__crow_identity_token?: string;
|
|
314
314
|
__crow_public_metadata?: Record<string, unknown>;
|
|
315
315
|
__crow_journey_callback?: (event: JourneyEvent) => void;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React3, { createContext, forwardRef, useEffect, useRef, useCallback, useContext, useState, useMemo, useLayoutEffect } from 'react';
|
|
2
2
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
3
|
-
import { DEFAULT_TOOLS, CrowClient } from '@usecrow/client';
|
|
3
|
+
import { DEFAULT_TOOLS, crowAsk, CrowClient } from '@usecrow/client';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
6
|
import { Mic, Square, ArrowUp, ChevronDown, Check, MessageCircle, Plus, RotateCcw, History, X, Brain, ChevronRight, Loader2 } from 'lucide-react';
|
|
@@ -1230,6 +1230,13 @@ function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
|
1230
1230
|
new CustomEvent("crow:setGreeting", { detail: options })
|
|
1231
1231
|
);
|
|
1232
1232
|
break;
|
|
1233
|
+
case "ask": {
|
|
1234
|
+
if (!opts || typeof opts !== "object") {
|
|
1235
|
+
console.error("[Crow] ask() requires an options object");
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
return crowAsk(opts);
|
|
1239
|
+
}
|
|
1233
1240
|
case "setSuggestedActions":
|
|
1234
1241
|
if (!Array.isArray(options)) {
|
|
1235
1242
|
console.error("[Crow] setSuggestedActions() requires an array of { label, message }");
|
|
@@ -3886,7 +3893,22 @@ function CrowWidget({
|
|
|
3886
3893
|
const messagesContainerRef = useRef(null);
|
|
3887
3894
|
const executeClientToolRef = useRef(null);
|
|
3888
3895
|
const submitToolResultRef = useRef(null);
|
|
3889
|
-
const [isCollapsed, setIsCollapsed] = useState(
|
|
3896
|
+
const [isCollapsed, setIsCollapsed] = useState(() => {
|
|
3897
|
+
if (variant !== "floating") return false;
|
|
3898
|
+
try {
|
|
3899
|
+
const stored = sessionStorage.getItem("crow_widget_collapsed");
|
|
3900
|
+
if (stored !== null) return stored === "true";
|
|
3901
|
+
} catch {
|
|
3902
|
+
}
|
|
3903
|
+
return true;
|
|
3904
|
+
});
|
|
3905
|
+
useEffect(() => {
|
|
3906
|
+
if (variant !== "floating") return;
|
|
3907
|
+
try {
|
|
3908
|
+
sessionStorage.setItem("crow_widget_collapsed", String(isCollapsed));
|
|
3909
|
+
} catch {
|
|
3910
|
+
}
|
|
3911
|
+
}, [isCollapsed, variant]);
|
|
3890
3912
|
const [showConversationList, setShowConversationList] = useState(false);
|
|
3891
3913
|
const [isVerifiedUser, setIsVerifiedUser] = useState(false);
|
|
3892
3914
|
const [isBrowserUseActive, setIsBrowserUseActive] = useState(false);
|