@retrivora-ai/rag-engine 2.4.1 → 2.4.2

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.
@@ -317,7 +317,7 @@ var init_package = __esm({
317
317
  "package.json"() {
318
318
  package_default = {
319
319
  name: "@retrivora-ai/rag-engine",
320
- version: "2.4.1",
320
+ version: "2.4.2",
321
321
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
322
322
  author: "Abhinav Alkuchi",
323
323
  license: "UNLICENSED",
@@ -302,7 +302,7 @@ var init_package = __esm({
302
302
  "package.json"() {
303
303
  package_default = {
304
304
  name: "@retrivora-ai/rag-engine",
305
- version: "2.4.1",
305
+ version: "2.4.2",
306
306
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
307
307
  author: "Abhinav Alkuchi",
308
308
  license: "UNLICENSED",
package/dist/index.js CHANGED
@@ -352,7 +352,7 @@ function projectSettingsToUiConfig(settings) {
352
352
  // package.json
353
353
  var package_default = {
354
354
  name: "@retrivora-ai/rag-engine",
355
- version: "2.4.1",
355
+ version: "2.4.2",
356
356
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
357
357
  author: "Abhinav Alkuchi",
358
358
  license: "UNLICENSED",
package/dist/index.mjs CHANGED
@@ -311,7 +311,7 @@ function projectSettingsToUiConfig(settings) {
311
311
  // package.json
312
312
  var package_default = {
313
313
  name: "@retrivora-ai/rag-engine",
314
- version: "2.4.1",
314
+ version: "2.4.2",
315
315
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
316
316
  author: "Abhinav Alkuchi",
317
317
  license: "UNLICENSED",
package/dist/server.js CHANGED
@@ -330,7 +330,7 @@ var init_package = __esm({
330
330
  "package.json"() {
331
331
  package_default = {
332
332
  name: "@retrivora-ai/rag-engine",
333
- version: "2.4.1",
333
+ version: "2.4.2",
334
334
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
335
335
  author: "Abhinav Alkuchi",
336
336
  license: "UNLICENSED",
package/dist/server.mjs CHANGED
@@ -315,7 +315,7 @@ var init_package = __esm({
315
315
  "package.json"() {
316
316
  package_default = {
317
317
  name: "@retrivora-ai/rag-engine",
318
- version: "2.4.1",
318
+ version: "2.4.2",
319
319
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
320
320
  author: "Abhinav Alkuchi",
321
321
  license: "UNLICENSED",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
5
5
  "author": "Abhinav Alkuchi",
6
6
  "license": "UNLICENSED",
@@ -0,0 +1,139 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { createRoot } from 'react-dom/client';
5
+ import { ChatWidget } from './components/ChatWidget';
6
+ import { ConfigProvider } from './components/ConfigProvider';
7
+
8
+ class RetrivoraChatElement extends HTMLElement {
9
+ private root: any = null;
10
+
11
+ connectedCallback() {
12
+ // 1. Inject Stylesheet if not already present
13
+ // We dynamically determine the CDN host from the script tag's src attribute
14
+ const currentScript = document.currentScript as HTMLScriptElement;
15
+ let cdnUrl = 'https://cdn.retrivora.com';
16
+ if (currentScript && currentScript.src) {
17
+ try {
18
+ const url = new URL(currentScript.src);
19
+ cdnUrl = url.origin;
20
+ } catch (e) {
21
+ console.error('[Retrivora] Failed to parse script source URL:', e);
22
+ }
23
+ }
24
+
25
+ const cssId = 'retrivora-sdk-styles';
26
+ if (!document.getElementById(cssId)) {
27
+ const link = document.createElement('link');
28
+ link.id = cssId;
29
+ link.rel = 'stylesheet';
30
+ link.href = `${cdnUrl}/retrivora.css`;
31
+ document.head.appendChild(link);
32
+ }
33
+
34
+ // 2. Parse attributes from the HTML element
35
+ const projectId = this.getAttribute('project-id') || '';
36
+ const licenseKey = this.getAttribute('license-key') || '';
37
+ const primaryColor = this.getAttribute('primary-color') || '#6366f1';
38
+ const secondaryColor = this.getAttribute('secondary-color') || '#8b5cf6';
39
+ const accentColor = this.getAttribute('accent-color') || secondaryColor;
40
+ const theme = (this.getAttribute('theme') || 'system') as any;
41
+ const position = (this.getAttribute('position') || 'bottom-right') as any;
42
+ const botName = this.getAttribute('bot-name') || 'Retrivora Assistant';
43
+ const companyName = this.getAttribute('company-name') || 'Retrivora AI';
44
+ const welcomeMessage = this.getAttribute('welcome-message') || 'Hi, I can help you search your knowledge base.';
45
+ const telemetryEnabled = this.getAttribute('telemetry') !== 'disabled';
46
+ const authMode = (this.getAttribute('auth-mode') || 'public') as any;
47
+ const allowedOrigins = (this.getAttribute('allowed-origins') || '').split(',').filter(Boolean);
48
+ const retrivoraApiBase = this.getAttribute('retrivora-api-base') || undefined;
49
+
50
+ // 3. Construct config and project settings
51
+ const projectSettings = {
52
+ projectId,
53
+ branding: {
54
+ companyName,
55
+ botName,
56
+ welcomeMessage,
57
+ primaryColor,
58
+ secondaryColor,
59
+ fontFamily: 'Inter, sans-serif',
60
+ borderRadius: 12,
61
+ logoUrl: '',
62
+ avatarUrl: '',
63
+ customCss: '',
64
+ },
65
+ ai: {
66
+ defaultModel: '',
67
+ embeddingModel: '',
68
+ systemPrompt: '',
69
+ memoryEnabled: true,
70
+ multiModelEnabled: false,
71
+ citationsEnabled: true,
72
+ fileUploadEnabled: false,
73
+ },
74
+ auth: {
75
+ mode: authMode,
76
+ allowedOrigins,
77
+ requireVerifiedEmail: false,
78
+ sessionTtlMinutes: 60,
79
+ },
80
+ widget: {
81
+ position,
82
+ theme,
83
+ lazyLoad: false,
84
+ autoReconnect: true,
85
+ persistConversations: true,
86
+ showRetrivoraBranding: true,
87
+ },
88
+ telemetry: {
89
+ enabled: telemetryEnabled,
90
+ collectBrowser: true,
91
+ collectCountry: true,
92
+ redactPii: true,
93
+ retentionDays: 30,
94
+ },
95
+ lifecycleHooks: [],
96
+ conversationFeatures: [],
97
+ };
98
+
99
+ const config = {
100
+ projectId,
101
+ licenseKey,
102
+ retrivoraApiBase,
103
+ projectSettings,
104
+ autoLoadProjectSettings: true,
105
+ primaryColor,
106
+ secondaryColor,
107
+ accentColor,
108
+ theme,
109
+ };
110
+
111
+ // 4. Create mount container inside custom element
112
+ const container = document.createElement('div');
113
+ this.appendChild(container);
114
+
115
+ // 5. Mount React Tree
116
+ this.root = createRoot(container);
117
+ this.root.render(
118
+ <React.StrictMode>
119
+ <ConfigProvider config={config}>
120
+ <ChatWidget position={position} />
121
+ </ConfigProvider>
122
+ </React.StrictMode>
123
+ );
124
+ }
125
+
126
+ disconnectedCallback() {
127
+ if (this.root) {
128
+ const root = this.root;
129
+ setTimeout(() => {
130
+ root.unmount();
131
+ }, 0);
132
+ }
133
+ }
134
+ }
135
+
136
+ // Register the custom element if it hasn't been defined yet
137
+ if (typeof window !== 'undefined' && !customElements.get('retrivora-chat')) {
138
+ customElements.define('retrivora-chat', RetrivoraChatElement);
139
+ }