@usecrow/ui 0.1.71 → 0.1.72

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
@@ -941,6 +941,11 @@ interface UseCopilotStylesResult {
941
941
  name: string;
942
942
  provider: "OpenAI" | "Anthropic";
943
943
  }>;
944
+ /** Initial suggestion buttons from product config */
945
+ initialSuggestions: Array<{
946
+ label: string;
947
+ message: string;
948
+ }>;
944
949
  /** Refetch styles from API */
945
950
  refetch: () => Promise<void>;
946
951
  }
package/dist/index.d.ts CHANGED
@@ -941,6 +941,11 @@ interface UseCopilotStylesResult {
941
941
  name: string;
942
942
  provider: "OpenAI" | "Anthropic";
943
943
  }>;
944
+ /** Initial suggestion buttons from product config */
945
+ initialSuggestions: Array<{
946
+ label: string;
947
+ message: string;
948
+ }>;
944
949
  /** Refetch styles from API */
945
950
  refetch: () => Promise<void>;
946
951
  }
package/dist/index.js CHANGED
@@ -1759,6 +1759,9 @@ function useCopilotStyles({
1759
1759
  const [availableModels, setAvailableModels] = useState(
1760
1760
  styleCache.get(key)?.availableModels || []
1761
1761
  );
1762
+ const [initialSuggestions, setInitialSuggestions] = useState(
1763
+ styleCache.get(key)?.initialSuggestions || []
1764
+ );
1762
1765
  const hasFetchedRef = useRef(false);
1763
1766
  const fetchStyles = async () => {
1764
1767
  if (skip) return;
@@ -1778,6 +1781,7 @@ function useCopilotStyles({
1778
1781
  setToolConsentSettings(config.toolConsentSettings || {});
1779
1782
  setModelSelectionEnabled(config.modelSelectionEnabled || false);
1780
1783
  setAvailableModels(config.availableModels || []);
1784
+ setInitialSuggestions(config.initialSuggestions || []);
1781
1785
  } catch (err) {
1782
1786
  console.error("[CrowCopilot] Failed to fetch styles:", err);
1783
1787
  setError(err instanceof Error ? err : new Error(String(err)));
@@ -1799,6 +1803,7 @@ function useCopilotStyles({
1799
1803
  setSelectedModel(cached.model ?? void 0);
1800
1804
  setModelSelectionEnabled(cached.modelSelectionEnabled || false);
1801
1805
  setAvailableModels(cached.availableModels || []);
1806
+ setInitialSuggestions(cached.initialSuggestions || []);
1802
1807
  setIsLoading(false);
1803
1808
  return;
1804
1809
  }
@@ -1820,6 +1825,7 @@ function useCopilotStyles({
1820
1825
  toolConsentSettings,
1821
1826
  modelSelectionEnabled,
1822
1827
  availableModels,
1828
+ initialSuggestions,
1823
1829
  refetch: fetchStyles
1824
1830
  };
1825
1831
  }
@@ -5345,7 +5351,8 @@ function CrowCopilot({
5345
5351
  selectedModel,
5346
5352
  toolConsentSettings,
5347
5353
  modelSelectionEnabled,
5348
- availableModels: availableModelsFromAPI
5354
+ availableModels: availableModelsFromAPI,
5355
+ initialSuggestions
5349
5356
  } = useCopilotStyles({
5350
5357
  productId,
5351
5358
  apiUrl,
@@ -5527,6 +5534,11 @@ function CrowCopilot({
5527
5534
  window.removeEventListener("crow:setSuggestedActions", handleSetSuggestions);
5528
5535
  };
5529
5536
  }, []);
5537
+ useEffect(() => {
5538
+ if (initialSuggestions.length > 0 && chat.suggestedActions.length === 0) {
5539
+ chat.setSuggestedActions(initialSuggestions);
5540
+ }
5541
+ }, [initialSuggestions]);
5530
5542
  const messagesContainerRef = useRef(null);
5531
5543
  const tabsScrollRef = useRef(null);
5532
5544
  const executeClientToolRef = useRef(null);