@usecrow/ui 0.1.76 → 0.1.78

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.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: _fullscreenTopOffset, mode: _mode, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
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: _fullscreenTopOffset, mode: _mode, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
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
@@ -4718,7 +4718,7 @@ function CrowWidget({
4718
4718
  const [onboardingChecked, setOnboardingChecked] = useState(false);
4719
4719
  const [onboardingPhase, setOnboardingPhase] = useState("intro");
4720
4720
  useEffect(() => {
4721
- if (forceOnboarding && !isLoadingStyles && onboardingEnabled && !onboardingChecked) {
4721
+ if (!isLoadingStyles && !onboardingChecked && (forceOnboarding || onboardingEnabled)) {
4722
4722
  setIsOnboarding(true);
4723
4723
  setOnboardingChecked(true);
4724
4724
  }
@@ -4969,6 +4969,7 @@ function CrowWidget({
4969
4969
  }
4970
4970
  if (prevOnboardingRef.current && !isOnboarding) {
4971
4971
  chat.resetMessages();
4972
+ endWorkflow(0);
4972
4973
  }
4973
4974
  prevOnboardingRef.current = isOnboarding;
4974
4975
  }, [isOnboarding]);
@@ -5342,7 +5343,7 @@ function CrowWidget({
5342
5343
  onClose: handleCloseConversationList
5343
5344
  }
5344
5345
  ) }),
5345
- /* @__PURE__ */ jsx(AnimatePresence, { children: activeWorkflow && /* @__PURE__ */ jsx(
5346
+ /* @__PURE__ */ jsx(AnimatePresence, { children: activeWorkflow && !isOnboarding && /* @__PURE__ */ jsx(
5346
5347
  WorkflowPanel,
5347
5348
  {
5348
5349
  workflow: activeWorkflow,
@@ -5817,8 +5818,8 @@ function CrowCopilot({
5817
5818
  language,
5818
5819
  contextLabel: contextLabelProp,
5819
5820
  forceOnboarding = false,
5820
- fullscreenTopOffset: _fullscreenTopOffset = 0,
5821
- mode: _mode
5821
+ fullscreenTopOffset = 0,
5822
+ mode
5822
5823
  }) {
5823
5824
  const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
5824
5825
  const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
@@ -5850,10 +5851,11 @@ function CrowCopilot({
5850
5851
  });
5851
5852
  const agentName = agentNameProp ?? agentNameFromAPI ?? title;
5852
5853
  const [isOnboarding, setIsOnboarding] = useState(false);
5854
+ const [isFullscreenOnboarding, setIsFullscreenOnboarding] = useState(true);
5853
5855
  const [onboardingChecked, setOnboardingChecked] = useState(false);
5854
5856
  const [onboardingPhase, setOnboardingPhase] = useState("intro");
5855
5857
  useEffect(() => {
5856
- if (forceOnboarding && !isLoadingStyles && onboardingEnabled && !onboardingChecked) {
5858
+ if (!isLoadingStyles && !onboardingChecked && (forceOnboarding || onboardingEnabled)) {
5857
5859
  setIsOnboarding(true);
5858
5860
  setOnboardingChecked(true);
5859
5861
  }
@@ -6283,9 +6285,11 @@ function CrowCopilot({
6283
6285
  useEffect(() => {
6284
6286
  if (isOnboarding && !prevOnboardingRef.current) {
6285
6287
  chat.setSuggestedActions([]);
6288
+ chat.resetMessages();
6286
6289
  }
6287
6290
  if (prevOnboardingRef.current && !isOnboarding) {
6288
6291
  chat.resetMessages();
6292
+ endWorkflow(0);
6289
6293
  }
6290
6294
  prevOnboardingRef.current = isOnboarding;
6291
6295
  }, [isOnboarding]);
@@ -6595,7 +6599,7 @@ function CrowCopilot({
6595
6599
  checkTabsOverflow();
6596
6600
  }, [tabs.length, checkTabsOverflow]);
6597
6601
  const widthStyle = typeof width === "number" ? `${width}px` : width;
6598
- const renderCopilotContent = (overrideOnClose, forceShowClose, overrideWidth) => /* @__PURE__ */ jsx(
6602
+ const renderCopilotContent = (overrideOnClose, forceShowClose, overrideWidth, hideBorder) => /* @__PURE__ */ jsx(
6599
6603
  CopilotStyleProvider,
6600
6604
  {
6601
6605
  styles,
@@ -6604,7 +6608,7 @@ function CrowCopilot({
6604
6608
  children: /* @__PURE__ */ jsxs(
6605
6609
  "div",
6606
6610
  {
6607
- className: `crow-flex crow-flex-col crow-h-full ${position === "left" ? "crow-border-r" : "crow-border-l"} ${className || ""}`,
6611
+ className: `crow-flex crow-flex-col crow-h-full ${hideBorder ? "" : position === "left" ? "crow-border-r" : "crow-border-l"} ${className || ""}`,
6608
6612
  style: {
6609
6613
  width: overrideWidth ? typeof overrideWidth === "number" ? `${overrideWidth}px` : overrideWidth : widthStyle,
6610
6614
  fontFamily: styles.typography.fontFamily,
@@ -6637,17 +6641,30 @@ function CrowCopilot({
6637
6641
  style: { borderColor: styles.colors.border },
6638
6642
  children: [
6639
6643
  /* @__PURE__ */ jsx("span", { className: "crow-text-[13px] crow-font-semibold", style: { color: styles.colors.text }, children: onboardingAgentName || agentName }),
6640
- /* @__PURE__ */ jsx(
6641
- "button",
6642
- {
6643
- onClick: () => {
6644
- setIsOnboarding(false);
6645
- },
6646
- className: "crow-text-xs crow-border-none crow-bg-transparent crow-cursor-pointer crow-px-2 crow-py-1",
6647
- style: { color: styles.colors.text + "60" },
6648
- children: "Skip"
6649
- }
6650
- )
6644
+ /* @__PURE__ */ jsxs("div", { className: "crow-flex crow-items-center crow-gap-1", children: [
6645
+ mode === "fullscreen" && isFullscreenOnboarding && /* @__PURE__ */ jsx(
6646
+ "button",
6647
+ {
6648
+ onClick: () => {
6649
+ setIsFullscreenOnboarding(false);
6650
+ },
6651
+ className: "crow-text-xs crow-border-none crow-bg-transparent crow-cursor-pointer crow-px-2 crow-py-1",
6652
+ style: { color: styles.colors.text + "60" },
6653
+ children: "Minimize"
6654
+ }
6655
+ ),
6656
+ /* @__PURE__ */ jsx(
6657
+ "button",
6658
+ {
6659
+ onClick: () => {
6660
+ setIsOnboarding(false);
6661
+ },
6662
+ className: "crow-text-xs crow-border-none crow-bg-transparent crow-cursor-pointer crow-px-2 crow-py-1",
6663
+ style: { color: styles.colors.text + "60" },
6664
+ children: "Skip"
6665
+ }
6666
+ )
6667
+ ] })
6651
6668
  ]
6652
6669
  }
6653
6670
  ),
@@ -6888,7 +6905,7 @@ function CrowCopilot({
6888
6905
  }
6889
6906
  )
6890
6907
  ] }),
6891
- /* @__PURE__ */ jsx(AnimatePresence, { children: activeWorkflow && /* @__PURE__ */ jsx(
6908
+ /* @__PURE__ */ jsx(AnimatePresence, { children: activeWorkflow && !isOnboarding && /* @__PURE__ */ jsx(
6892
6909
  WorkflowPanel,
6893
6910
  {
6894
6911
  workflow: activeWorkflow,
@@ -6976,6 +6993,27 @@ function CrowCopilot({
6976
6993
  }
6977
6994
  );
6978
6995
  const floatingWidth = typeof width === "number" ? width : parseInt(String(width), 10) || 400;
6996
+ if (mode === "fullscreen" && isOnboarding && isFullscreenOnboarding) {
6997
+ return /* @__PURE__ */ jsx(ShadowContainer, { styles: WIDGET_CSS, children: /* @__PURE__ */ jsx("div", { style: {
6998
+ position: "fixed",
6999
+ top: 0,
7000
+ left: 0,
7001
+ width: "100vw",
7002
+ height: "100vh",
7003
+ zIndex: 2147483647,
7004
+ background: styles.colors.background || "#ffffff",
7005
+ display: "flex",
7006
+ flexDirection: "column",
7007
+ alignItems: "center",
7008
+ paddingTop: fullscreenTopOffset || 0
7009
+ }, children: /* @__PURE__ */ jsx("div", { style: {
7010
+ width: "100%",
7011
+ maxWidth: 760,
7012
+ height: "100%",
7013
+ display: "flex",
7014
+ flexDirection: "column"
7015
+ }, children: renderCopilotContent(void 0, false, "100%", true) }) }) });
7016
+ }
6979
7017
  if (variant === "floating") {
6980
7018
  return /* @__PURE__ */ jsx(ShadowContainer, { styles: WIDGET_CSS, children: /* @__PURE__ */ jsx(
6981
7019
  CopilotContainer,