@usecrow/ui 0.1.77 → 0.1.79
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 +56 -17
- 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 +56 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -535,7 +535,7 @@ interface CrowCopilotProps {
|
|
|
535
535
|
*/
|
|
536
536
|
mode?: "sidebar" | "fullscreen";
|
|
537
537
|
}
|
|
538
|
-
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, contextLabel: contextLabelProp, forceOnboarding, fullscreenTopOffset
|
|
538
|
+
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, contextLabel: contextLabelProp, forceOnboarding, fullscreenTopOffset, mode, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
539
539
|
|
|
540
540
|
interface CrowOnboardingProps {
|
|
541
541
|
/** Product ID */
|
package/dist/index.d.ts
CHANGED
|
@@ -535,7 +535,7 @@ interface CrowCopilotProps {
|
|
|
535
535
|
*/
|
|
536
536
|
mode?: "sidebar" | "fullscreen";
|
|
537
537
|
}
|
|
538
|
-
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, contextLabel: contextLabelProp, forceOnboarding, fullscreenTopOffset
|
|
538
|
+
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, contextLabel: contextLabelProp, forceOnboarding, fullscreenTopOffset, mode, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
539
539
|
|
|
540
540
|
interface CrowOnboardingProps {
|
|
541
541
|
/** Product ID */
|
package/dist/index.js
CHANGED
|
@@ -4880,8 +4880,11 @@ function CrowWidget({
|
|
|
4880
4880
|
wasLoadingRef.current = chat.isLoading;
|
|
4881
4881
|
}, [chat.isLoading, chat.messages]);
|
|
4882
4882
|
useEffect(() => {
|
|
4883
|
-
if (!isOnboarding && initialSuggestions.length > 0
|
|
4884
|
-
|
|
4883
|
+
if (!isOnboarding && initialSuggestions.length > 0) {
|
|
4884
|
+
defaultSuggestedActionsRef.current = initialSuggestions;
|
|
4885
|
+
if (chat.suggestedActions.length === 0) {
|
|
4886
|
+
chat.setSuggestedActions(initialSuggestions);
|
|
4887
|
+
}
|
|
4885
4888
|
}
|
|
4886
4889
|
}, [initialSuggestions, isOnboarding]);
|
|
4887
4890
|
useEffect(() => {
|
|
@@ -5818,8 +5821,8 @@ function CrowCopilot({
|
|
|
5818
5821
|
language,
|
|
5819
5822
|
contextLabel: contextLabelProp,
|
|
5820
5823
|
forceOnboarding = false,
|
|
5821
|
-
fullscreenTopOffset
|
|
5822
|
-
mode
|
|
5824
|
+
fullscreenTopOffset = 0,
|
|
5825
|
+
mode
|
|
5823
5826
|
}) {
|
|
5824
5827
|
const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
|
|
5825
5828
|
const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
|
|
@@ -5851,6 +5854,7 @@ function CrowCopilot({
|
|
|
5851
5854
|
});
|
|
5852
5855
|
const agentName = agentNameProp ?? agentNameFromAPI ?? title;
|
|
5853
5856
|
const [isOnboarding, setIsOnboarding] = useState(false);
|
|
5857
|
+
const [isFullscreenOnboarding, setIsFullscreenOnboarding] = useState(true);
|
|
5854
5858
|
const [onboardingChecked, setOnboardingChecked] = useState(false);
|
|
5855
5859
|
const [onboardingPhase, setOnboardingPhase] = useState("intro");
|
|
5856
5860
|
useEffect(() => {
|
|
@@ -6284,6 +6288,7 @@ function CrowCopilot({
|
|
|
6284
6288
|
useEffect(() => {
|
|
6285
6289
|
if (isOnboarding && !prevOnboardingRef.current) {
|
|
6286
6290
|
chat.setSuggestedActions([]);
|
|
6291
|
+
chat.resetMessages();
|
|
6287
6292
|
}
|
|
6288
6293
|
if (prevOnboardingRef.current && !isOnboarding) {
|
|
6289
6294
|
chat.resetMessages();
|
|
@@ -6597,7 +6602,7 @@ function CrowCopilot({
|
|
|
6597
6602
|
checkTabsOverflow();
|
|
6598
6603
|
}, [tabs.length, checkTabsOverflow]);
|
|
6599
6604
|
const widthStyle = typeof width === "number" ? `${width}px` : width;
|
|
6600
|
-
const renderCopilotContent = (overrideOnClose, forceShowClose, overrideWidth) => /* @__PURE__ */ jsx(
|
|
6605
|
+
const renderCopilotContent = (overrideOnClose, forceShowClose, overrideWidth, hideBorder) => /* @__PURE__ */ jsx(
|
|
6601
6606
|
CopilotStyleProvider,
|
|
6602
6607
|
{
|
|
6603
6608
|
styles,
|
|
@@ -6606,7 +6611,7 @@ function CrowCopilot({
|
|
|
6606
6611
|
children: /* @__PURE__ */ jsxs(
|
|
6607
6612
|
"div",
|
|
6608
6613
|
{
|
|
6609
|
-
className: `crow-flex crow-flex-col crow-h-full ${position === "left" ? "crow-border-r" : "crow-border-l"} ${className || ""}`,
|
|
6614
|
+
className: `crow-flex crow-flex-col crow-h-full ${hideBorder ? "" : position === "left" ? "crow-border-r" : "crow-border-l"} ${className || ""}`,
|
|
6610
6615
|
style: {
|
|
6611
6616
|
width: overrideWidth ? typeof overrideWidth === "number" ? `${overrideWidth}px` : overrideWidth : widthStyle,
|
|
6612
6617
|
fontFamily: styles.typography.fontFamily,
|
|
@@ -6639,17 +6644,30 @@ function CrowCopilot({
|
|
|
6639
6644
|
style: { borderColor: styles.colors.border },
|
|
6640
6645
|
children: [
|
|
6641
6646
|
/* @__PURE__ */ jsx("span", { className: "crow-text-[13px] crow-font-semibold", style: { color: styles.colors.text }, children: onboardingAgentName || agentName }),
|
|
6642
|
-
/* @__PURE__ */
|
|
6643
|
-
"
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6647
|
+
/* @__PURE__ */ jsxs("div", { className: "crow-flex crow-items-center crow-gap-1", children: [
|
|
6648
|
+
mode === "fullscreen" && isFullscreenOnboarding && /* @__PURE__ */ jsx(
|
|
6649
|
+
"button",
|
|
6650
|
+
{
|
|
6651
|
+
onClick: () => {
|
|
6652
|
+
setIsFullscreenOnboarding(false);
|
|
6653
|
+
},
|
|
6654
|
+
className: "crow-text-xs crow-border-none crow-bg-transparent crow-cursor-pointer crow-px-2 crow-py-1",
|
|
6655
|
+
style: { color: styles.colors.text + "60" },
|
|
6656
|
+
children: "Minimize"
|
|
6657
|
+
}
|
|
6658
|
+
),
|
|
6659
|
+
/* @__PURE__ */ jsx(
|
|
6660
|
+
"button",
|
|
6661
|
+
{
|
|
6662
|
+
onClick: () => {
|
|
6663
|
+
setIsOnboarding(false);
|
|
6664
|
+
},
|
|
6665
|
+
className: "crow-text-xs crow-border-none crow-bg-transparent crow-cursor-pointer crow-px-2 crow-py-1",
|
|
6666
|
+
style: { color: styles.colors.text + "60" },
|
|
6667
|
+
children: "Skip"
|
|
6668
|
+
}
|
|
6669
|
+
)
|
|
6670
|
+
] })
|
|
6653
6671
|
]
|
|
6654
6672
|
}
|
|
6655
6673
|
),
|
|
@@ -6978,6 +6996,27 @@ function CrowCopilot({
|
|
|
6978
6996
|
}
|
|
6979
6997
|
);
|
|
6980
6998
|
const floatingWidth = typeof width === "number" ? width : parseInt(String(width), 10) || 400;
|
|
6999
|
+
if (mode === "fullscreen" && isOnboarding && isFullscreenOnboarding) {
|
|
7000
|
+
return /* @__PURE__ */ jsx(ShadowContainer, { styles: WIDGET_CSS, children: /* @__PURE__ */ jsx("div", { style: {
|
|
7001
|
+
position: "fixed",
|
|
7002
|
+
top: 0,
|
|
7003
|
+
left: 0,
|
|
7004
|
+
width: "100vw",
|
|
7005
|
+
height: "100vh",
|
|
7006
|
+
zIndex: 2147483647,
|
|
7007
|
+
background: styles.colors.background || "#ffffff",
|
|
7008
|
+
display: "flex",
|
|
7009
|
+
flexDirection: "column",
|
|
7010
|
+
alignItems: "center",
|
|
7011
|
+
paddingTop: fullscreenTopOffset || 0
|
|
7012
|
+
}, children: /* @__PURE__ */ jsx("div", { style: {
|
|
7013
|
+
width: "100%",
|
|
7014
|
+
maxWidth: 760,
|
|
7015
|
+
height: "100%",
|
|
7016
|
+
display: "flex",
|
|
7017
|
+
flexDirection: "column"
|
|
7018
|
+
}, children: renderCopilotContent(void 0, false, "100%", true) }) }) });
|
|
7019
|
+
}
|
|
6981
7020
|
if (variant === "floating") {
|
|
6982
7021
|
return /* @__PURE__ */ jsx(ShadowContainer, { styles: WIDGET_CSS, children: /* @__PURE__ */ jsx(
|
|
6983
7022
|
CopilotContainer,
|