@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.cjs CHANGED
@@ -4745,7 +4745,7 @@ function CrowWidget({
4745
4745
  const [onboardingChecked, setOnboardingChecked] = React3.useState(false);
4746
4746
  const [onboardingPhase, setOnboardingPhase] = React3.useState("intro");
4747
4747
  React3.useEffect(() => {
4748
- if (forceOnboarding && !isLoadingStyles && onboardingEnabled && !onboardingChecked) {
4748
+ if (!isLoadingStyles && !onboardingChecked && (forceOnboarding || onboardingEnabled)) {
4749
4749
  setIsOnboarding(true);
4750
4750
  setOnboardingChecked(true);
4751
4751
  }
@@ -4996,6 +4996,7 @@ function CrowWidget({
4996
4996
  }
4997
4997
  if (prevOnboardingRef.current && !isOnboarding) {
4998
4998
  chat.resetMessages();
4999
+ endWorkflow(0);
4999
5000
  }
5000
5001
  prevOnboardingRef.current = isOnboarding;
5001
5002
  }, [isOnboarding]);
@@ -5369,7 +5370,7 @@ function CrowWidget({
5369
5370
  onClose: handleCloseConversationList
5370
5371
  }
5371
5372
  ) }),
5372
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: activeWorkflow && /* @__PURE__ */ jsxRuntime.jsx(
5373
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: activeWorkflow && !isOnboarding && /* @__PURE__ */ jsxRuntime.jsx(
5373
5374
  WorkflowPanel,
5374
5375
  {
5375
5376
  workflow: activeWorkflow,
@@ -5844,8 +5845,8 @@ function CrowCopilot({
5844
5845
  language,
5845
5846
  contextLabel: contextLabelProp,
5846
5847
  forceOnboarding = false,
5847
- fullscreenTopOffset: _fullscreenTopOffset = 0,
5848
- mode: _mode
5848
+ fullscreenTopOffset = 0,
5849
+ mode
5849
5850
  }) {
5850
5851
  const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
5851
5852
  const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
@@ -5877,10 +5878,11 @@ function CrowCopilot({
5877
5878
  });
5878
5879
  const agentName = agentNameProp ?? agentNameFromAPI ?? title;
5879
5880
  const [isOnboarding, setIsOnboarding] = React3.useState(false);
5881
+ const [isFullscreenOnboarding, setIsFullscreenOnboarding] = React3.useState(true);
5880
5882
  const [onboardingChecked, setOnboardingChecked] = React3.useState(false);
5881
5883
  const [onboardingPhase, setOnboardingPhase] = React3.useState("intro");
5882
5884
  React3.useEffect(() => {
5883
- if (forceOnboarding && !isLoadingStyles && onboardingEnabled && !onboardingChecked) {
5885
+ if (!isLoadingStyles && !onboardingChecked && (forceOnboarding || onboardingEnabled)) {
5884
5886
  setIsOnboarding(true);
5885
5887
  setOnboardingChecked(true);
5886
5888
  }
@@ -6310,9 +6312,11 @@ function CrowCopilot({
6310
6312
  React3.useEffect(() => {
6311
6313
  if (isOnboarding && !prevOnboardingRef.current) {
6312
6314
  chat.setSuggestedActions([]);
6315
+ chat.resetMessages();
6313
6316
  }
6314
6317
  if (prevOnboardingRef.current && !isOnboarding) {
6315
6318
  chat.resetMessages();
6319
+ endWorkflow(0);
6316
6320
  }
6317
6321
  prevOnboardingRef.current = isOnboarding;
6318
6322
  }, [isOnboarding]);
@@ -6622,7 +6626,7 @@ function CrowCopilot({
6622
6626
  checkTabsOverflow();
6623
6627
  }, [tabs.length, checkTabsOverflow]);
6624
6628
  const widthStyle = typeof width === "number" ? `${width}px` : width;
6625
- const renderCopilotContent = (overrideOnClose, forceShowClose, overrideWidth) => /* @__PURE__ */ jsxRuntime.jsx(
6629
+ const renderCopilotContent = (overrideOnClose, forceShowClose, overrideWidth, hideBorder) => /* @__PURE__ */ jsxRuntime.jsx(
6626
6630
  CopilotStyleProvider,
6627
6631
  {
6628
6632
  styles,
@@ -6631,7 +6635,7 @@ function CrowCopilot({
6631
6635
  children: /* @__PURE__ */ jsxRuntime.jsxs(
6632
6636
  "div",
6633
6637
  {
6634
- className: `crow-flex crow-flex-col crow-h-full ${position === "left" ? "crow-border-r" : "crow-border-l"} ${className || ""}`,
6638
+ className: `crow-flex crow-flex-col crow-h-full ${hideBorder ? "" : position === "left" ? "crow-border-r" : "crow-border-l"} ${className || ""}`,
6635
6639
  style: {
6636
6640
  width: overrideWidth ? typeof overrideWidth === "number" ? `${overrideWidth}px` : overrideWidth : widthStyle,
6637
6641
  fontFamily: styles.typography.fontFamily,
@@ -6664,17 +6668,30 @@ function CrowCopilot({
6664
6668
  style: { borderColor: styles.colors.border },
6665
6669
  children: [
6666
6670
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "crow-text-[13px] crow-font-semibold", style: { color: styles.colors.text }, children: onboardingAgentName || agentName }),
6667
- /* @__PURE__ */ jsxRuntime.jsx(
6668
- "button",
6669
- {
6670
- onClick: () => {
6671
- setIsOnboarding(false);
6672
- },
6673
- className: "crow-text-xs crow-border-none crow-bg-transparent crow-cursor-pointer crow-px-2 crow-py-1",
6674
- style: { color: styles.colors.text + "60" },
6675
- children: "Skip"
6676
- }
6677
- )
6671
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "crow-flex crow-items-center crow-gap-1", children: [
6672
+ mode === "fullscreen" && isFullscreenOnboarding && /* @__PURE__ */ jsxRuntime.jsx(
6673
+ "button",
6674
+ {
6675
+ onClick: () => {
6676
+ setIsFullscreenOnboarding(false);
6677
+ },
6678
+ className: "crow-text-xs crow-border-none crow-bg-transparent crow-cursor-pointer crow-px-2 crow-py-1",
6679
+ style: { color: styles.colors.text + "60" },
6680
+ children: "Minimize"
6681
+ }
6682
+ ),
6683
+ /* @__PURE__ */ jsxRuntime.jsx(
6684
+ "button",
6685
+ {
6686
+ onClick: () => {
6687
+ setIsOnboarding(false);
6688
+ },
6689
+ className: "crow-text-xs crow-border-none crow-bg-transparent crow-cursor-pointer crow-px-2 crow-py-1",
6690
+ style: { color: styles.colors.text + "60" },
6691
+ children: "Skip"
6692
+ }
6693
+ )
6694
+ ] })
6678
6695
  ]
6679
6696
  }
6680
6697
  ),
@@ -6915,7 +6932,7 @@ function CrowCopilot({
6915
6932
  }
6916
6933
  )
6917
6934
  ] }),
6918
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: activeWorkflow && /* @__PURE__ */ jsxRuntime.jsx(
6935
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: activeWorkflow && !isOnboarding && /* @__PURE__ */ jsxRuntime.jsx(
6919
6936
  WorkflowPanel,
6920
6937
  {
6921
6938
  workflow: activeWorkflow,
@@ -7003,6 +7020,27 @@ function CrowCopilot({
7003
7020
  }
7004
7021
  );
7005
7022
  const floatingWidth = typeof width === "number" ? width : parseInt(String(width), 10) || 400;
7023
+ if (mode === "fullscreen" && isOnboarding && isFullscreenOnboarding) {
7024
+ return /* @__PURE__ */ jsxRuntime.jsx(ShadowContainer, { styles: WIDGET_CSS, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
7025
+ position: "fixed",
7026
+ top: 0,
7027
+ left: 0,
7028
+ width: "100vw",
7029
+ height: "100vh",
7030
+ zIndex: 2147483647,
7031
+ background: styles.colors.background || "#ffffff",
7032
+ display: "flex",
7033
+ flexDirection: "column",
7034
+ alignItems: "center",
7035
+ paddingTop: fullscreenTopOffset || 0
7036
+ }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
7037
+ width: "100%",
7038
+ maxWidth: 760,
7039
+ height: "100%",
7040
+ display: "flex",
7041
+ flexDirection: "column"
7042
+ }, children: renderCopilotContent(void 0, false, "100%", true) }) }) });
7043
+ }
7006
7044
  if (variant === "floating") {
7007
7045
  return /* @__PURE__ */ jsxRuntime.jsx(ShadowContainer, { styles: WIDGET_CSS, children: /* @__PURE__ */ jsxRuntime.jsx(
7008
7046
  CopilotContainer,