@retrivora-ai/rag-engine 2.4.7 → 2.4.9

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.
@@ -1,5 +1,5 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { p as RagConfig, I as ILLMProvider, C as ChatMessage, e as ChatResponse, h as IngestDocument } from './ILLMProvider-BYQd0Nys.js';
2
+ import { p as RagConfig, I as ILLMProvider, C as ChatMessage, e as ChatResponse, h as IngestDocument } from './ILLMProvider-BynaFBpy.js';
3
3
 
4
4
  interface ValidationError {
5
5
  field: string;
@@ -1,5 +1,5 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { p as RagConfig, I as ILLMProvider, C as ChatMessage, e as ChatResponse, h as IngestDocument } from './ILLMProvider-BYQd0Nys.mjs';
2
+ import { p as RagConfig, I as ILLMProvider, C as ChatMessage, e as ChatResponse, h as IngestDocument } from './ILLMProvider-BynaFBpy.mjs';
3
3
 
4
4
  interface ValidationError {
5
5
  field: string;
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './BatchProcessor-BZhwvT6o.mjs';
3
- export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './BatchProcessor-BZhwvT6o.mjs';
4
- import { O as ObservabilityTrace, P as Product, U as UITransformationResponse, a as UseRagChatOptions, b as UseRagChatReturn, c as ProjectChatSettings } from './ILLMProvider-BYQd0Nys.mjs';
5
- export { A as AuthMode, C as ChatMessage, d as ChatOptions, e as ChatResponse, E as EmbedOptions, f as EmbeddingConfig, g as EmbeddingProvider, I as ILLMProvider, h as IngestDocument, L as LLMConfig, i as LLMProvider, j as LatencyBreakdown, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, R as RAGConfig, p as RagConfig, q as RagMessage, r as RetrievalConfig, s as RetrievedChunk, T as ThemeMode, t as TokenUsage, u as UIConfig, v as UniversalRagConfig, w as UpsertDocument, V as VectorDBConfig, x as VectorDBProvider, y as VectorMatch, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-BYQd0Nys.mjs';
2
+ import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './BatchProcessor-OVOIlNfK.mjs';
3
+ export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './BatchProcessor-OVOIlNfK.mjs';
4
+ import { O as ObservabilityTrace, P as Product, U as UITransformationResponse, a as UseRagChatOptions, b as UseRagChatReturn, c as ProjectChatSettings } from './ILLMProvider-BynaFBpy.mjs';
5
+ export { A as AuthMode, C as ChatMessage, d as ChatOptions, e as ChatResponse, E as EmbedOptions, f as EmbeddingConfig, g as EmbeddingProvider, I as ILLMProvider, h as IngestDocument, L as LLMConfig, i as LLMProvider, j as LatencyBreakdown, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, R as RAGConfig, p as RagConfig, q as RagMessage, r as RetrievalConfig, s as RetrievedChunk, T as ThemeMode, t as TokenUsage, u as UIConfig, v as UniversalRagConfig, w as UpsertDocument, V as VectorDBConfig, x as VectorDBProvider, y as VectorMatch, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-BynaFBpy.mjs';
6
6
  import React from 'react';
7
7
 
8
8
  /**
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './BatchProcessor-DlAkfGbv.js';
3
- export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './BatchProcessor-DlAkfGbv.js';
4
- import { O as ObservabilityTrace, P as Product, U as UITransformationResponse, a as UseRagChatOptions, b as UseRagChatReturn, c as ProjectChatSettings } from './ILLMProvider-BYQd0Nys.js';
5
- export { A as AuthMode, C as ChatMessage, d as ChatOptions, e as ChatResponse, E as EmbedOptions, f as EmbeddingConfig, g as EmbeddingProvider, I as ILLMProvider, h as IngestDocument, L as LLMConfig, i as LLMProvider, j as LatencyBreakdown, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, R as RAGConfig, p as RagConfig, q as RagMessage, r as RetrievalConfig, s as RetrievedChunk, T as ThemeMode, t as TokenUsage, u as UIConfig, v as UniversalRagConfig, w as UpsertDocument, V as VectorDBConfig, x as VectorDBProvider, y as VectorMatch, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-BYQd0Nys.js';
2
+ import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './BatchProcessor-B8OLSahY.js';
3
+ export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './BatchProcessor-B8OLSahY.js';
4
+ import { O as ObservabilityTrace, P as Product, U as UITransformationResponse, a as UseRagChatOptions, b as UseRagChatReturn, c as ProjectChatSettings } from './ILLMProvider-BynaFBpy.js';
5
+ export { A as AuthMode, C as ChatMessage, d as ChatOptions, e as ChatResponse, E as EmbedOptions, f as EmbeddingConfig, g as EmbeddingProvider, I as ILLMProvider, h as IngestDocument, L as LLMConfig, i as LLMProvider, j as LatencyBreakdown, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, R as RAGConfig, p as RagConfig, q as RagMessage, r as RetrievalConfig, s as RetrievedChunk, T as ThemeMode, t as TokenUsage, u as UIConfig, v as UniversalRagConfig, w as UpsertDocument, V as VectorDBConfig, x as VectorDBProvider, y as VectorMatch, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-BynaFBpy.js';
6
6
  import React from 'react';
7
7
 
8
8
  /**
package/dist/index.js CHANGED
@@ -356,7 +356,7 @@ function projectSettingsToUiConfig(settings) {
356
356
  // package.json
357
357
  var package_default = {
358
358
  name: "@retrivora-ai/rag-engine",
359
- version: "2.4.7",
359
+ version: "2.4.9",
360
360
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
361
361
  author: "Abhinav Alkuchi",
362
362
  license: "UNLICENSED",
@@ -548,10 +548,10 @@ var ConfigFetcher = class {
548
548
  const url = `${baseUrl}/api/v1/config?projectId=${encodeURIComponent(projectId)}`;
549
549
  const res = await fetch(url, {
550
550
  method: "GET",
551
- headers: __spreadValues({
551
+ headers: __spreadValues(__spreadValues({
552
552
  "Content-Type": "application/json",
553
553
  "x-sdk-version": SDK_VERSION
554
- }, licenseKey ? { "x-license-key": licenseKey } : {})
554
+ }, licenseKey ? { "x-license-key": licenseKey } : {}), projectId ? { "x-project-id": projectId } : {})
555
555
  });
556
556
  if (!res.ok) {
557
557
  console.warn(`[ConfigFetcher] Error text: ${await res.text()}`);
@@ -603,9 +603,9 @@ var ConfigFetcher = class {
603
603
  const credUrl = `${baseUrl}/api/v1/credentials`;
604
604
  const credRes = await fetch(credUrl, {
605
605
  method: "POST",
606
- headers: {
606
+ headers: __spreadValues(__spreadValues({
607
607
  "Content-Type": "application/json"
608
- },
608
+ }, licenseKey ? { "x-license-key": licenseKey } : {}), fetchedProjectId ? { "x-project-id": fetchedProjectId } : {}),
609
609
  body: JSON.stringify({ licenseKey, projectId: fetchedProjectId })
610
610
  });
611
611
  if (credRes.ok) {
@@ -828,7 +828,7 @@ function DocumentUpload({ namespace, uploadUrl, retrivoraApiBase, onUploadComple
828
828
  formData.append("dimension", dimension.toString());
829
829
  const apiBase = retrivoraApiBase || configuredApiBase || "https://www.retrivora.com/api/retrivora";
830
830
  const primaryUrl = uploadUrl || `${apiBase.replace(/\/$/, "")}/upload`;
831
- const uploadHeaders = __spreadValues(__spreadValues({}, configHeaders || {}), licenseKey ? { "x-license-key": licenseKey } : {});
831
+ const uploadHeaders = __spreadValues(__spreadValues(__spreadValues({}, configHeaders || {}), licenseKey ? { "x-license-key": licenseKey } : {}), projectId ? { "x-project-id": projectId } : {});
832
832
  try {
833
833
  let response = await fetch(primaryUrl, {
834
834
  method: "POST",
@@ -2599,8 +2599,8 @@ function UIBlockRenderer({
2599
2599
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2600
2600
  ProductCarousel,
2601
2601
  {
2602
- products: items.map((item) => ({
2603
- id: item.id || `carousel_${Math.random()}`,
2602
+ products: items.map((item, idx) => ({
2603
+ id: item.id || `carousel_${idx}`,
2604
2604
  name: item.name || item.title || "Product",
2605
2605
  brand: item.brand,
2606
2606
  price: item.price,
@@ -3579,12 +3579,45 @@ function useRagChat(projectId, options = {}) {
3579
3579
  const lastInputRef = (0, import_react12.useRef)("");
3580
3580
  const messagesRef = (0, import_react12.useRef)(messages);
3581
3581
  const abortControllerRef = (0, import_react12.useRef)(null);
3582
+ const errorTimeoutRef = (0, import_react12.useRef)(null);
3583
+ const resolvedLicenseKey = (0, import_react12.useMemo)(() => {
3584
+ var _a;
3585
+ const getHeader = (headersObj, name) => {
3586
+ if (!headersObj) return void 0;
3587
+ const target = name.toLowerCase();
3588
+ for (const [k, v] of Object.entries(headersObj)) {
3589
+ if (k.toLowerCase() === target) return v;
3590
+ }
3591
+ return void 0;
3592
+ };
3593
+ return options.licenseKey || getHeader(options.headers, "x-license-key") || ((_a = getHeader(options.headers, "authorization")) == null ? void 0 : _a.replace(/^Bearer\s+/i, "")) || (typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY : "") || "";
3594
+ }, [options.licenseKey, options.headers]);
3595
+ const setTemporaryError = (0, import_react12.useCallback)((msg) => {
3596
+ setError(msg);
3597
+ if (errorTimeoutRef.current) {
3598
+ clearTimeout(errorTimeoutRef.current);
3599
+ errorTimeoutRef.current = null;
3600
+ }
3601
+ if (msg) {
3602
+ errorTimeoutRef.current = setTimeout(() => {
3603
+ setError(null);
3604
+ errorTimeoutRef.current = null;
3605
+ }, 5e3);
3606
+ }
3607
+ }, []);
3608
+ (0, import_react12.useEffect)(() => {
3609
+ return () => {
3610
+ if (errorTimeoutRef.current) {
3611
+ clearTimeout(errorTimeoutRef.current);
3612
+ }
3613
+ };
3614
+ }, []);
3582
3615
  (0, import_react12.useEffect)(() => {
3583
3616
  messagesRef.current = messages;
3584
3617
  }, [messages]);
3585
3618
  const sendMessage = (0, import_react12.useCallback)(
3586
3619
  async (text, opts) => {
3587
- var _a, _b, _c, _d, _e, _f;
3620
+ var _a, _b, _c, _d, _e;
3588
3621
  const trimmed = text.trim();
3589
3622
  if (!trimmed || isLoading) return;
3590
3623
  lastInputRef.current = trimmed;
@@ -3616,18 +3649,9 @@ function useRagChat(projectId, options = {}) {
3616
3649
  messageId: assistantMessageId,
3617
3650
  userMessageId: userMsgId
3618
3651
  });
3619
- const getHeader = (headersObj, name) => {
3620
- if (!headersObj) return void 0;
3621
- const target = name.toLowerCase();
3622
- for (const [k, v] of Object.entries(headersObj)) {
3623
- if (k.toLowerCase() === target) return v;
3624
- }
3625
- return void 0;
3626
- };
3627
- const resolvedLicenseKey = options.licenseKey || getHeader(options.headers, "x-license-key") || ((_b = getHeader(options.headers, "authorization")) == null ? void 0 : _b.replace(/^Bearer\s+/i, "")) || (typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY : "") || "";
3628
- const fetchHeaders = __spreadValues(__spreadValues({
3652
+ const fetchHeaders = __spreadValues(__spreadValues(__spreadValues({
3629
3653
  "Content-Type": "application/json"
3630
- }, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), options.headers || {});
3654
+ }, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), options.headers || {});
3631
3655
  let response = await fetch(primaryUrl, {
3632
3656
  method: "POST",
3633
3657
  headers: fetchHeaders,
@@ -3635,7 +3659,7 @@ function useRagChat(projectId, options = {}) {
3635
3659
  body: payloadBody
3636
3660
  });
3637
3661
  if (response.status === 404 && !apiUrl && primaryUrl !== "/api/chat") {
3638
- console.warn(`[Retrivora SDK] \u26A0\uFE0F Chat endpoint "${primaryUrl}" returned 404. Retrying fallback to "/api/chat"...`);
3662
+ console.warn(`[Retrivora SDK] Chat endpoint "${primaryUrl}" returned 404. Retrying fallback to "/api/chat"...`);
3639
3663
  response = await fetch("/api/chat", {
3640
3664
  method: "POST",
3641
3665
  headers: fetchHeaders,
@@ -3645,10 +3669,10 @@ function useRagChat(projectId, options = {}) {
3645
3669
  }
3646
3670
  if (!response.ok) {
3647
3671
  const errorData = await response.json().catch(() => ({}));
3648
- if (response.status === 403 || response.status === 401 || typeof errorData.error === "string" && errorData.error.toLowerCase().includes("license") || ((_c = errorData.error) == null ? void 0 : _c.type) === "license_revoked") {
3672
+ if (response.status === 403 || response.status === 401 || typeof errorData.error === "string" && errorData.error.toLowerCase().includes("license") || ((_b = errorData.error) == null ? void 0 : _b.type) === "license_revoked") {
3649
3673
  throw new Error("Your Retrivora license is no longer valid. Please contact your administrator or obtain a valid license key.");
3650
3674
  }
3651
- throw new Error(((_d = errorData.error) == null ? void 0 : _d.message) || errorData.error || `Server returned ${response.status}`);
3675
+ throw new Error(((_c = errorData.error) == null ? void 0 : _c.message) || errorData.error || `Server returned ${response.status}`);
3652
3676
  }
3653
3677
  if (!response.body) {
3654
3678
  throw new Error("No response body received from server");
@@ -3712,7 +3736,7 @@ function useRagChat(projectId, options = {}) {
3712
3736
  pendingThinkingRef.current = thinkingContent;
3713
3737
  scheduleFlush(assistantMessageId);
3714
3738
  } else if (frame.type === "metadata") {
3715
- sources = (_e = frame.sources) != null ? _e : [];
3739
+ sources = (_d = frame.sources) != null ? _d : [];
3716
3740
  thinkingMs = frame.thinkingMs;
3717
3741
  } else if (frame.type === "ui_transformation") {
3718
3742
  uiTransformation = frame.data;
@@ -3728,7 +3752,7 @@ function useRagChat(projectId, options = {}) {
3728
3752
  if (frame.type === "text" && frame.text) assistantContent += frame.text;
3729
3753
  else if (frame.type === "thinking" && frame.text) thinkingContent += frame.text;
3730
3754
  else if (frame.type === "metadata") {
3731
- sources = (_f = frame.sources) != null ? _f : [];
3755
+ sources = (_e = frame.sources) != null ? _e : [];
3732
3756
  thinkingMs = frame.thinkingMs;
3733
3757
  } else if (frame.type === "observability") trace = frame.data;
3734
3758
  }
@@ -3756,14 +3780,14 @@ function useRagChat(projectId, options = {}) {
3756
3780
  if (msg.includes("403") || msg.toLowerCase().includes("license") || msg.toLowerCase().includes("revoked") || msg.toLowerCase().includes("terminated")) {
3757
3781
  msg = "Your Retrivora license key has been terminated, suspended, or revoked. Access denied.";
3758
3782
  }
3759
- setError(msg);
3783
+ setTemporaryError(msg);
3760
3784
  onError == null ? void 0 : onError(msg);
3761
3785
  } finally {
3762
3786
  setIsLoading(false);
3763
3787
  abortControllerRef.current = null;
3764
3788
  }
3765
3789
  },
3766
- [apiUrl, isLoading, namespace, onError, onReply, projectId, setMessages, options.headers, options.sessionId]
3790
+ [apiUrl, isLoading, namespace, onError, onReply, projectId, setMessages, options.headers, options.sessionId, setTemporaryError, resolvedLicenseKey]
3767
3791
  );
3768
3792
  const clear = (0, import_react12.useCallback)(() => {
3769
3793
  setMessages([]);
@@ -3789,8 +3813,16 @@ function useRagChat(projectId, options = {}) {
3789
3813
  setIsLoading(true);
3790
3814
  setError(null);
3791
3815
  try {
3792
- const res = await fetch(`${retrivoraApiBase}/history?sessionId=${encodeURIComponent(sessionId)}`);
3793
- if (!res.ok) throw new Error(`Failed to load history: ${res.statusText}`);
3816
+ const res = await fetch(`${retrivoraApiBase}/history?sessionId=${encodeURIComponent(sessionId)}`, {
3817
+ headers: __spreadValues(__spreadValues(__spreadValues({}, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), options.headers || {})
3818
+ });
3819
+ if (!res.ok) {
3820
+ if (res.status === 404) {
3821
+ setMessages([]);
3822
+ return;
3823
+ }
3824
+ throw new Error(`Failed to load history: ${res.statusText}`);
3825
+ }
3794
3826
  const data = await res.json();
3795
3827
  const loadedMessages = (data.history || []).map((msg) => ({
3796
3828
  id: msg.id,
@@ -3804,19 +3836,21 @@ function useRagChat(projectId, options = {}) {
3804
3836
  setMessages(loadedMessages);
3805
3837
  } catch (err) {
3806
3838
  const msg = err instanceof Error ? err.message : "Failed to load history";
3807
- setError(msg);
3839
+ setTemporaryError(msg);
3808
3840
  onError == null ? void 0 : onError(msg);
3809
3841
  } finally {
3810
3842
  setIsLoading(false);
3811
3843
  }
3812
- }, [retrivoraApiBase, onError, setMessages]);
3844
+ }, [retrivoraApiBase, onError, setMessages, setTemporaryError, resolvedLicenseKey, projectId, options.headers]);
3813
3845
  const clearHistory = (0, import_react12.useCallback)(async (sessionId) => {
3814
3846
  setIsLoading(true);
3815
3847
  setError(null);
3816
3848
  try {
3817
3849
  const res = await fetch(`${retrivoraApiBase}/history/clear`, {
3818
3850
  method: "POST",
3819
- headers: { "Content-Type": "application/json" },
3851
+ headers: __spreadValues(__spreadValues(__spreadValues({
3852
+ "Content-Type": "application/json"
3853
+ }, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), options.headers || {}),
3820
3854
  body: JSON.stringify({ sessionId })
3821
3855
  });
3822
3856
  if (!res.ok) throw new Error(`Failed to clear history: ${res.statusText}`);
@@ -3824,17 +3858,19 @@ function useRagChat(projectId, options = {}) {
3824
3858
  if (persist) localStorage.removeItem(storageKey);
3825
3859
  } catch (err) {
3826
3860
  const msg = err instanceof Error ? err.message : "Failed to clear history";
3827
- setError(msg);
3861
+ setTemporaryError(msg);
3828
3862
  onError == null ? void 0 : onError(msg);
3829
3863
  } finally {
3830
3864
  setIsLoading(false);
3831
3865
  }
3832
- }, [retrivoraApiBase, onError, persist, setMessages, storageKey]);
3866
+ }, [retrivoraApiBase, onError, persist, setMessages, storageKey, setTemporaryError, resolvedLicenseKey, projectId, options.headers]);
3833
3867
  const submitFeedback = (0, import_react12.useCallback)(async (messageId, rating, comment) => {
3834
3868
  try {
3835
3869
  const res = await fetch(`${retrivoraApiBase}/feedback`, {
3836
3870
  method: "POST",
3837
- headers: { "Content-Type": "application/json" },
3871
+ headers: __spreadValues(__spreadValues(__spreadValues({
3872
+ "Content-Type": "application/json"
3873
+ }, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), options.headers || {}),
3838
3874
  body: JSON.stringify({
3839
3875
  messageId,
3840
3876
  sessionId: options.sessionId || "default",
@@ -3848,7 +3884,7 @@ function useRagChat(projectId, options = {}) {
3848
3884
  onError == null ? void 0 : onError(msg);
3849
3885
  throw err;
3850
3886
  }
3851
- }, [retrivoraApiBase, onError, options.sessionId]);
3887
+ }, [retrivoraApiBase, onError, options.sessionId, resolvedLicenseKey, projectId, options.headers]);
3852
3888
  return {
3853
3889
  messages,
3854
3890
  isLoading,
@@ -4369,7 +4405,9 @@ function ChatWindow({
4369
4405
  const fetchSessions = (0, import_react13.useCallback)(async () => {
4370
4406
  try {
4371
4407
  const base = effectiveApiBase || "https://www.retrivora.com/api/retrivora";
4372
- const res = await fetch(`${base}/sessions`);
4408
+ const res = await fetch(`${base}/sessions`, {
4409
+ headers: __spreadValues(__spreadValues(__spreadValues({}, effectiveLicenseKey ? { "x-license-key": effectiveLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), effectiveHeaders || {})
4410
+ });
4373
4411
  if (res.ok) {
4374
4412
  const data = await res.json();
4375
4413
  if (data.sessions) {
@@ -4404,7 +4442,7 @@ function ChatWindow({
4404
4442
  } catch (e) {
4405
4443
  console.warn("[ChatWindow] Failed to load sessions list:", e);
4406
4444
  }
4407
- }, [effectiveApiBase]);
4445
+ }, [effectiveApiBase, effectiveLicenseKey, projectId, effectiveHeaders]);
4408
4446
  (0, import_react13.useEffect)(() => {
4409
4447
  if (showHistory && mounted) {
4410
4448
  fetchSessions();
@@ -4582,9 +4620,9 @@ function ChatWindow({
4582
4620
  try {
4583
4621
  const base = effectiveApiBase || "https://www.retrivora.com/api/retrivora";
4584
4622
  const primaryUrl = `${base}/suggestions`;
4585
- const suggestionHeaders = __spreadValues(__spreadValues({
4623
+ const suggestionHeaders = __spreadValues(__spreadValues(__spreadValues({
4586
4624
  "Content-Type": "application/json"
4587
- }, effectiveLicenseKey ? { "x-license-key": effectiveLicenseKey } : {}), effectiveHeaders || {});
4625
+ }, effectiveLicenseKey ? { "x-license-key": effectiveLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), effectiveHeaders || {});
4588
4626
  let response = await fetch(primaryUrl, {
4589
4627
  method: "POST",
4590
4628
  headers: suggestionHeaders,
package/dist/index.mjs CHANGED
@@ -312,7 +312,7 @@ function projectSettingsToUiConfig(settings) {
312
312
  // package.json
313
313
  var package_default = {
314
314
  name: "@retrivora-ai/rag-engine",
315
- version: "2.4.7",
315
+ version: "2.4.9",
316
316
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
317
317
  author: "Abhinav Alkuchi",
318
318
  license: "UNLICENSED",
@@ -504,10 +504,10 @@ var ConfigFetcher = class {
504
504
  const url = `${baseUrl}/api/v1/config?projectId=${encodeURIComponent(projectId)}`;
505
505
  const res = await fetch(url, {
506
506
  method: "GET",
507
- headers: __spreadValues({
507
+ headers: __spreadValues(__spreadValues({
508
508
  "Content-Type": "application/json",
509
509
  "x-sdk-version": SDK_VERSION
510
- }, licenseKey ? { "x-license-key": licenseKey } : {})
510
+ }, licenseKey ? { "x-license-key": licenseKey } : {}), projectId ? { "x-project-id": projectId } : {})
511
511
  });
512
512
  if (!res.ok) {
513
513
  console.warn(`[ConfigFetcher] Error text: ${await res.text()}`);
@@ -559,9 +559,9 @@ var ConfigFetcher = class {
559
559
  const credUrl = `${baseUrl}/api/v1/credentials`;
560
560
  const credRes = await fetch(credUrl, {
561
561
  method: "POST",
562
- headers: {
562
+ headers: __spreadValues(__spreadValues({
563
563
  "Content-Type": "application/json"
564
- },
564
+ }, licenseKey ? { "x-license-key": licenseKey } : {}), fetchedProjectId ? { "x-project-id": fetchedProjectId } : {}),
565
565
  body: JSON.stringify({ licenseKey, projectId: fetchedProjectId })
566
566
  });
567
567
  if (credRes.ok) {
@@ -784,7 +784,7 @@ function DocumentUpload({ namespace, uploadUrl, retrivoraApiBase, onUploadComple
784
784
  formData.append("dimension", dimension.toString());
785
785
  const apiBase = retrivoraApiBase || configuredApiBase || "https://www.retrivora.com/api/retrivora";
786
786
  const primaryUrl = uploadUrl || `${apiBase.replace(/\/$/, "")}/upload`;
787
- const uploadHeaders = __spreadValues(__spreadValues({}, configHeaders || {}), licenseKey ? { "x-license-key": licenseKey } : {});
787
+ const uploadHeaders = __spreadValues(__spreadValues(__spreadValues({}, configHeaders || {}), licenseKey ? { "x-license-key": licenseKey } : {}), projectId ? { "x-project-id": projectId } : {});
788
788
  try {
789
789
  let response = await fetch(primaryUrl, {
790
790
  method: "POST",
@@ -2601,8 +2601,8 @@ function UIBlockRenderer({
2601
2601
  /* @__PURE__ */ jsx9(
2602
2602
  ProductCarousel,
2603
2603
  {
2604
- products: items.map((item) => ({
2605
- id: item.id || `carousel_${Math.random()}`,
2604
+ products: items.map((item, idx) => ({
2605
+ id: item.id || `carousel_${idx}`,
2606
2606
  name: item.name || item.title || "Product",
2607
2607
  brand: item.brand,
2608
2608
  price: item.price,
@@ -3503,7 +3503,7 @@ ${match.trim()}
3503
3503
  }
3504
3504
 
3505
3505
  // src/hooks/useRagChat.ts
3506
- import { useState as useState7, useCallback, useRef as useRef5, useEffect as useEffect5 } from "react";
3506
+ import { useState as useState7, useCallback, useRef as useRef5, useEffect as useEffect5, useMemo as useMemo2 } from "react";
3507
3507
 
3508
3508
  // src/hooks/useStoredMessages.ts
3509
3509
  import * as React12 from "react";
@@ -3581,12 +3581,45 @@ function useRagChat(projectId, options = {}) {
3581
3581
  const lastInputRef = useRef5("");
3582
3582
  const messagesRef = useRef5(messages);
3583
3583
  const abortControllerRef = useRef5(null);
3584
+ const errorTimeoutRef = useRef5(null);
3585
+ const resolvedLicenseKey = useMemo2(() => {
3586
+ var _a;
3587
+ const getHeader = (headersObj, name) => {
3588
+ if (!headersObj) return void 0;
3589
+ const target = name.toLowerCase();
3590
+ for (const [k, v] of Object.entries(headersObj)) {
3591
+ if (k.toLowerCase() === target) return v;
3592
+ }
3593
+ return void 0;
3594
+ };
3595
+ return options.licenseKey || getHeader(options.headers, "x-license-key") || ((_a = getHeader(options.headers, "authorization")) == null ? void 0 : _a.replace(/^Bearer\s+/i, "")) || (typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY : "") || "";
3596
+ }, [options.licenseKey, options.headers]);
3597
+ const setTemporaryError = useCallback((msg) => {
3598
+ setError(msg);
3599
+ if (errorTimeoutRef.current) {
3600
+ clearTimeout(errorTimeoutRef.current);
3601
+ errorTimeoutRef.current = null;
3602
+ }
3603
+ if (msg) {
3604
+ errorTimeoutRef.current = setTimeout(() => {
3605
+ setError(null);
3606
+ errorTimeoutRef.current = null;
3607
+ }, 5e3);
3608
+ }
3609
+ }, []);
3610
+ useEffect5(() => {
3611
+ return () => {
3612
+ if (errorTimeoutRef.current) {
3613
+ clearTimeout(errorTimeoutRef.current);
3614
+ }
3615
+ };
3616
+ }, []);
3584
3617
  useEffect5(() => {
3585
3618
  messagesRef.current = messages;
3586
3619
  }, [messages]);
3587
3620
  const sendMessage = useCallback(
3588
3621
  async (text, opts) => {
3589
- var _a, _b, _c, _d, _e, _f;
3622
+ var _a, _b, _c, _d, _e;
3590
3623
  const trimmed = text.trim();
3591
3624
  if (!trimmed || isLoading) return;
3592
3625
  lastInputRef.current = trimmed;
@@ -3618,18 +3651,9 @@ function useRagChat(projectId, options = {}) {
3618
3651
  messageId: assistantMessageId,
3619
3652
  userMessageId: userMsgId
3620
3653
  });
3621
- const getHeader = (headersObj, name) => {
3622
- if (!headersObj) return void 0;
3623
- const target = name.toLowerCase();
3624
- for (const [k, v] of Object.entries(headersObj)) {
3625
- if (k.toLowerCase() === target) return v;
3626
- }
3627
- return void 0;
3628
- };
3629
- const resolvedLicenseKey = options.licenseKey || getHeader(options.headers, "x-license-key") || ((_b = getHeader(options.headers, "authorization")) == null ? void 0 : _b.replace(/^Bearer\s+/i, "")) || (typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY : "") || "";
3630
- const fetchHeaders = __spreadValues(__spreadValues({
3654
+ const fetchHeaders = __spreadValues(__spreadValues(__spreadValues({
3631
3655
  "Content-Type": "application/json"
3632
- }, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), options.headers || {});
3656
+ }, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), options.headers || {});
3633
3657
  let response = await fetch(primaryUrl, {
3634
3658
  method: "POST",
3635
3659
  headers: fetchHeaders,
@@ -3637,7 +3661,7 @@ function useRagChat(projectId, options = {}) {
3637
3661
  body: payloadBody
3638
3662
  });
3639
3663
  if (response.status === 404 && !apiUrl && primaryUrl !== "/api/chat") {
3640
- console.warn(`[Retrivora SDK] \u26A0\uFE0F Chat endpoint "${primaryUrl}" returned 404. Retrying fallback to "/api/chat"...`);
3664
+ console.warn(`[Retrivora SDK] Chat endpoint "${primaryUrl}" returned 404. Retrying fallback to "/api/chat"...`);
3641
3665
  response = await fetch("/api/chat", {
3642
3666
  method: "POST",
3643
3667
  headers: fetchHeaders,
@@ -3647,10 +3671,10 @@ function useRagChat(projectId, options = {}) {
3647
3671
  }
3648
3672
  if (!response.ok) {
3649
3673
  const errorData = await response.json().catch(() => ({}));
3650
- if (response.status === 403 || response.status === 401 || typeof errorData.error === "string" && errorData.error.toLowerCase().includes("license") || ((_c = errorData.error) == null ? void 0 : _c.type) === "license_revoked") {
3674
+ if (response.status === 403 || response.status === 401 || typeof errorData.error === "string" && errorData.error.toLowerCase().includes("license") || ((_b = errorData.error) == null ? void 0 : _b.type) === "license_revoked") {
3651
3675
  throw new Error("Your Retrivora license is no longer valid. Please contact your administrator or obtain a valid license key.");
3652
3676
  }
3653
- throw new Error(((_d = errorData.error) == null ? void 0 : _d.message) || errorData.error || `Server returned ${response.status}`);
3677
+ throw new Error(((_c = errorData.error) == null ? void 0 : _c.message) || errorData.error || `Server returned ${response.status}`);
3654
3678
  }
3655
3679
  if (!response.body) {
3656
3680
  throw new Error("No response body received from server");
@@ -3714,7 +3738,7 @@ function useRagChat(projectId, options = {}) {
3714
3738
  pendingThinkingRef.current = thinkingContent;
3715
3739
  scheduleFlush(assistantMessageId);
3716
3740
  } else if (frame.type === "metadata") {
3717
- sources = (_e = frame.sources) != null ? _e : [];
3741
+ sources = (_d = frame.sources) != null ? _d : [];
3718
3742
  thinkingMs = frame.thinkingMs;
3719
3743
  } else if (frame.type === "ui_transformation") {
3720
3744
  uiTransformation = frame.data;
@@ -3730,7 +3754,7 @@ function useRagChat(projectId, options = {}) {
3730
3754
  if (frame.type === "text" && frame.text) assistantContent += frame.text;
3731
3755
  else if (frame.type === "thinking" && frame.text) thinkingContent += frame.text;
3732
3756
  else if (frame.type === "metadata") {
3733
- sources = (_f = frame.sources) != null ? _f : [];
3757
+ sources = (_e = frame.sources) != null ? _e : [];
3734
3758
  thinkingMs = frame.thinkingMs;
3735
3759
  } else if (frame.type === "observability") trace = frame.data;
3736
3760
  }
@@ -3758,14 +3782,14 @@ function useRagChat(projectId, options = {}) {
3758
3782
  if (msg.includes("403") || msg.toLowerCase().includes("license") || msg.toLowerCase().includes("revoked") || msg.toLowerCase().includes("terminated")) {
3759
3783
  msg = "Your Retrivora license key has been terminated, suspended, or revoked. Access denied.";
3760
3784
  }
3761
- setError(msg);
3785
+ setTemporaryError(msg);
3762
3786
  onError == null ? void 0 : onError(msg);
3763
3787
  } finally {
3764
3788
  setIsLoading(false);
3765
3789
  abortControllerRef.current = null;
3766
3790
  }
3767
3791
  },
3768
- [apiUrl, isLoading, namespace, onError, onReply, projectId, setMessages, options.headers, options.sessionId]
3792
+ [apiUrl, isLoading, namespace, onError, onReply, projectId, setMessages, options.headers, options.sessionId, setTemporaryError, resolvedLicenseKey]
3769
3793
  );
3770
3794
  const clear = useCallback(() => {
3771
3795
  setMessages([]);
@@ -3791,8 +3815,16 @@ function useRagChat(projectId, options = {}) {
3791
3815
  setIsLoading(true);
3792
3816
  setError(null);
3793
3817
  try {
3794
- const res = await fetch(`${retrivoraApiBase}/history?sessionId=${encodeURIComponent(sessionId)}`);
3795
- if (!res.ok) throw new Error(`Failed to load history: ${res.statusText}`);
3818
+ const res = await fetch(`${retrivoraApiBase}/history?sessionId=${encodeURIComponent(sessionId)}`, {
3819
+ headers: __spreadValues(__spreadValues(__spreadValues({}, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), options.headers || {})
3820
+ });
3821
+ if (!res.ok) {
3822
+ if (res.status === 404) {
3823
+ setMessages([]);
3824
+ return;
3825
+ }
3826
+ throw new Error(`Failed to load history: ${res.statusText}`);
3827
+ }
3796
3828
  const data = await res.json();
3797
3829
  const loadedMessages = (data.history || []).map((msg) => ({
3798
3830
  id: msg.id,
@@ -3806,19 +3838,21 @@ function useRagChat(projectId, options = {}) {
3806
3838
  setMessages(loadedMessages);
3807
3839
  } catch (err) {
3808
3840
  const msg = err instanceof Error ? err.message : "Failed to load history";
3809
- setError(msg);
3841
+ setTemporaryError(msg);
3810
3842
  onError == null ? void 0 : onError(msg);
3811
3843
  } finally {
3812
3844
  setIsLoading(false);
3813
3845
  }
3814
- }, [retrivoraApiBase, onError, setMessages]);
3846
+ }, [retrivoraApiBase, onError, setMessages, setTemporaryError, resolvedLicenseKey, projectId, options.headers]);
3815
3847
  const clearHistory = useCallback(async (sessionId) => {
3816
3848
  setIsLoading(true);
3817
3849
  setError(null);
3818
3850
  try {
3819
3851
  const res = await fetch(`${retrivoraApiBase}/history/clear`, {
3820
3852
  method: "POST",
3821
- headers: { "Content-Type": "application/json" },
3853
+ headers: __spreadValues(__spreadValues(__spreadValues({
3854
+ "Content-Type": "application/json"
3855
+ }, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), options.headers || {}),
3822
3856
  body: JSON.stringify({ sessionId })
3823
3857
  });
3824
3858
  if (!res.ok) throw new Error(`Failed to clear history: ${res.statusText}`);
@@ -3826,17 +3860,19 @@ function useRagChat(projectId, options = {}) {
3826
3860
  if (persist) localStorage.removeItem(storageKey);
3827
3861
  } catch (err) {
3828
3862
  const msg = err instanceof Error ? err.message : "Failed to clear history";
3829
- setError(msg);
3863
+ setTemporaryError(msg);
3830
3864
  onError == null ? void 0 : onError(msg);
3831
3865
  } finally {
3832
3866
  setIsLoading(false);
3833
3867
  }
3834
- }, [retrivoraApiBase, onError, persist, setMessages, storageKey]);
3868
+ }, [retrivoraApiBase, onError, persist, setMessages, storageKey, setTemporaryError, resolvedLicenseKey, projectId, options.headers]);
3835
3869
  const submitFeedback = useCallback(async (messageId, rating, comment) => {
3836
3870
  try {
3837
3871
  const res = await fetch(`${retrivoraApiBase}/feedback`, {
3838
3872
  method: "POST",
3839
- headers: { "Content-Type": "application/json" },
3873
+ headers: __spreadValues(__spreadValues(__spreadValues({
3874
+ "Content-Type": "application/json"
3875
+ }, resolvedLicenseKey ? { "x-license-key": resolvedLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), options.headers || {}),
3840
3876
  body: JSON.stringify({
3841
3877
  messageId,
3842
3878
  sessionId: options.sessionId || "default",
@@ -3850,7 +3886,7 @@ function useRagChat(projectId, options = {}) {
3850
3886
  onError == null ? void 0 : onError(msg);
3851
3887
  throw err;
3852
3888
  }
3853
- }, [retrivoraApiBase, onError, options.sessionId]);
3889
+ }, [retrivoraApiBase, onError, options.sessionId, resolvedLicenseKey, projectId, options.headers]);
3854
3890
  return {
3855
3891
  messages,
3856
3892
  isLoading,
@@ -4371,7 +4407,9 @@ function ChatWindow({
4371
4407
  const fetchSessions = useCallback2(async () => {
4372
4408
  try {
4373
4409
  const base = effectiveApiBase || "https://www.retrivora.com/api/retrivora";
4374
- const res = await fetch(`${base}/sessions`);
4410
+ const res = await fetch(`${base}/sessions`, {
4411
+ headers: __spreadValues(__spreadValues(__spreadValues({}, effectiveLicenseKey ? { "x-license-key": effectiveLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), effectiveHeaders || {})
4412
+ });
4375
4413
  if (res.ok) {
4376
4414
  const data = await res.json();
4377
4415
  if (data.sessions) {
@@ -4406,7 +4444,7 @@ function ChatWindow({
4406
4444
  } catch (e) {
4407
4445
  console.warn("[ChatWindow] Failed to load sessions list:", e);
4408
4446
  }
4409
- }, [effectiveApiBase]);
4447
+ }, [effectiveApiBase, effectiveLicenseKey, projectId, effectiveHeaders]);
4410
4448
  useEffect6(() => {
4411
4449
  if (showHistory && mounted) {
4412
4450
  fetchSessions();
@@ -4584,9 +4622,9 @@ function ChatWindow({
4584
4622
  try {
4585
4623
  const base = effectiveApiBase || "https://www.retrivora.com/api/retrivora";
4586
4624
  const primaryUrl = `${base}/suggestions`;
4587
- const suggestionHeaders = __spreadValues(__spreadValues({
4625
+ const suggestionHeaders = __spreadValues(__spreadValues(__spreadValues({
4588
4626
  "Content-Type": "application/json"
4589
- }, effectiveLicenseKey ? { "x-license-key": effectiveLicenseKey } : {}), effectiveHeaders || {});
4627
+ }, effectiveLicenseKey ? { "x-license-key": effectiveLicenseKey } : {}), projectId ? { "x-project-id": projectId } : {}), effectiveHeaders || {});
4590
4628
  let response = await fetch(primaryUrl, {
4591
4629
  method: "POST",
4592
4630
  headers: suggestionHeaders,
@@ -5344,9 +5382,9 @@ function CodeViewer({ snippet }) {
5344
5382
  }
5345
5383
 
5346
5384
  // src/hooks/useProjectSettings.ts
5347
- import { useEffect as useEffect8, useMemo as useMemo2, useState as useState10 } from "react";
5385
+ import { useEffect as useEffect8, useMemo as useMemo3, useState as useState10 } from "react";
5348
5386
  function useProjectSettings(projectId, options = {}) {
5349
- const initialSettings = useMemo2(
5387
+ const initialSettings = useMemo3(
5350
5388
  () => normalizeProjectSettings(projectId, options.initialSettings || createDefaultProjectSettings(projectId)),
5351
5389
  [options.initialSettings, projectId]
5352
5390
  );