@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.cjs CHANGED
@@ -1786,6 +1786,9 @@ function useCopilotStyles({
1786
1786
  const [availableModels, setAvailableModels] = React3.useState(
1787
1787
  styleCache.get(key)?.availableModels || []
1788
1788
  );
1789
+ const [initialSuggestions, setInitialSuggestions] = React3.useState(
1790
+ styleCache.get(key)?.initialSuggestions || []
1791
+ );
1789
1792
  const hasFetchedRef = React3.useRef(false);
1790
1793
  const fetchStyles = async () => {
1791
1794
  if (skip) return;
@@ -1805,6 +1808,7 @@ function useCopilotStyles({
1805
1808
  setToolConsentSettings(config.toolConsentSettings || {});
1806
1809
  setModelSelectionEnabled(config.modelSelectionEnabled || false);
1807
1810
  setAvailableModels(config.availableModels || []);
1811
+ setInitialSuggestions(config.initialSuggestions || []);
1808
1812
  } catch (err) {
1809
1813
  console.error("[CrowCopilot] Failed to fetch styles:", err);
1810
1814
  setError(err instanceof Error ? err : new Error(String(err)));
@@ -1826,6 +1830,7 @@ function useCopilotStyles({
1826
1830
  setSelectedModel(cached.model ?? void 0);
1827
1831
  setModelSelectionEnabled(cached.modelSelectionEnabled || false);
1828
1832
  setAvailableModels(cached.availableModels || []);
1833
+ setInitialSuggestions(cached.initialSuggestions || []);
1829
1834
  setIsLoading(false);
1830
1835
  return;
1831
1836
  }
@@ -1847,6 +1852,7 @@ function useCopilotStyles({
1847
1852
  toolConsentSettings,
1848
1853
  modelSelectionEnabled,
1849
1854
  availableModels,
1855
+ initialSuggestions,
1850
1856
  refetch: fetchStyles
1851
1857
  };
1852
1858
  }
@@ -5372,7 +5378,8 @@ function CrowCopilot({
5372
5378
  selectedModel,
5373
5379
  toolConsentSettings,
5374
5380
  modelSelectionEnabled,
5375
- availableModels: availableModelsFromAPI
5381
+ availableModels: availableModelsFromAPI,
5382
+ initialSuggestions
5376
5383
  } = useCopilotStyles({
5377
5384
  productId,
5378
5385
  apiUrl,
@@ -5554,6 +5561,11 @@ function CrowCopilot({
5554
5561
  window.removeEventListener("crow:setSuggestedActions", handleSetSuggestions);
5555
5562
  };
5556
5563
  }, []);
5564
+ React3.useEffect(() => {
5565
+ if (initialSuggestions.length > 0 && chat.suggestedActions.length === 0) {
5566
+ chat.setSuggestedActions(initialSuggestions);
5567
+ }
5568
+ }, [initialSuggestions]);
5557
5569
  const messagesContainerRef = React3.useRef(null);
5558
5570
  const tabsScrollRef = React3.useRef(null);
5559
5571
  const executeClientToolRef = React3.useRef(null);