@retrivora-ai/rag-engine 2.4.3 → 2.4.5
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/{BatchProcessor-zbQMaZHm.d.mts → BatchProcessor-Csy_K1qQ.d.mts} +2 -0
- package/dist/{BatchProcessor-D42E706a.d.ts → BatchProcessor-Dg18zZGk.d.ts} +2 -0
- package/dist/handlers/index.js +27 -4
- package/dist/handlers/index.mjs +27 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -10
- package/dist/index.mjs +12 -10
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +28 -4
- package/dist/server.mjs +28 -4
- package/package.json +1 -3
- package/src/LicensedRetrivora.ts +0 -278
- package/src/app/api/chat/route.ts +0 -4
- package/src/app/api/health/route.ts +0 -5
- package/src/app/api/ingest/route.ts +0 -27
- package/src/app/api/suggestions/route.ts +0 -5
- package/src/app/api/upload/route.ts +0 -5
- package/src/app/constants.tsx +0 -270
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +0 -449
- package/src/app/layout.tsx +0 -22
- package/src/app/page.tsx +0 -64
- package/src/app/types.ts +0 -30
- package/src/browser.tsx +0 -127
- package/src/components/ChatWidget.tsx +0 -393
- package/src/components/ChatWindow.tsx +0 -952
- package/src/components/CodeViewer.tsx +0 -56
- package/src/components/ConfigProvider.tsx +0 -141
- package/src/components/DocumentUpload.tsx +0 -354
- package/src/components/DynamicChart.tsx +0 -297
- package/src/components/HourglassLoader.tsx +0 -87
- package/src/components/MarkdownComponents.tsx +0 -186
- package/src/components/MessageBubble.tsx +0 -498
- package/src/components/ObservabilityPanel.tsx +0 -374
- package/src/components/ProductCard.tsx +0 -107
- package/src/components/ProductCarousel.tsx +0 -97
- package/src/components/SourceCard.tsx +0 -61
- package/src/components/ThemeProvider.tsx +0 -8
- package/src/components/ThemeToggle.tsx +0 -29
- package/src/components/ThinkingBlock.tsx +0 -75
- package/src/components/UIDispatcher.tsx +0 -342
- package/src/components/VisualizationRenderer.tsx +0 -621
- package/src/components/constants.tsx +0 -503
- package/src/config/ConfigBuilder.ts +0 -285
- package/src/config/EmbeddingStrategy.ts +0 -148
- package/src/config/LicenseConfigResolver.ts +0 -298
- package/src/config/RagConfig.ts +0 -328
- package/src/config/UniversalProfiles.ts +0 -82
- package/src/config/constants.ts +0 -64
- package/src/config/serverConfig.ts +0 -378
- package/src/config/uiConstants.ts +0 -47
- package/src/core/BatchProcessor.ts +0 -385
- package/src/core/CircuitBreaker.ts +0 -118
- package/src/core/ConfigFetcher.ts +0 -220
- package/src/core/ConfigResolver.ts +0 -165
- package/src/core/ConfigValidator.ts +0 -197
- package/src/core/DatabaseStorage.ts +0 -526
- package/src/core/FreeTierLimitsGuard.ts +0 -281
- package/src/core/LLMRouter.ts +0 -79
- package/src/core/LangChainAgent.ts +0 -132
- package/src/core/LicenseValidator.ts +0 -284
- package/src/core/LicenseVerifier.ts +0 -261
- package/src/core/MultiAgentCoordinator.ts +0 -239
- package/src/core/Pipeline.ts +0 -1279
- package/src/core/PluginManager.ts +0 -277
- package/src/core/ProjectSettings.ts +0 -247
- package/src/core/ProviderHealthCheck.ts +0 -133
- package/src/core/ProviderInterfaces.ts +0 -37
- package/src/core/ProviderRegistry.ts +0 -156
- package/src/core/QueryProcessor.ts +0 -399
- package/src/core/Retrivora.ts +0 -98
- package/src/core/VectorPlugin.ts +0 -193
- package/src/core/mcp.ts +0 -261
- package/src/exceptions/index.ts +0 -131
- package/src/handlers/index.ts +0 -1625
- package/src/hooks/useHydrated.ts +0 -13
- package/src/hooks/useProjectSettings.ts +0 -105
- package/src/hooks/useRagChat.ts +0 -436
- package/src/hooks/useStoredMessages.ts +0 -64
- package/src/index.css +0 -4269
- package/src/index.ts +0 -137
- package/src/lib/plugin.ts +0 -24
- package/src/llm/ILLMProvider.ts +0 -60
- package/src/llm/LLMFactory.ts +0 -141
- package/src/llm/providers/AnthropicProvider.ts +0 -215
- package/src/llm/providers/GeminiProvider.ts +0 -311
- package/src/llm/providers/GroqProvider.ts +0 -184
- package/src/llm/providers/OllamaProvider.ts +0 -232
- package/src/llm/providers/OpenAIProvider.ts +0 -188
- package/src/llm/providers/QwenProvider.ts +0 -199
- package/src/llm/providers/UniversalLLMAdapter.ts +0 -422
- package/src/llm/utils.ts +0 -46
- package/src/providers/graphdb/BaseGraphProvider.ts +0 -43
- package/src/providers/graphdb/SimpleGraphProvider.ts +0 -66
- package/src/providers/vectordb/BaseVectorProvider.ts +0 -98
- package/src/providers/vectordb/ChromaDBProvider.ts +0 -130
- package/src/providers/vectordb/MilvusProvider.ts +0 -134
- package/src/providers/vectordb/MongoDBProvider.ts +0 -250
- package/src/providers/vectordb/MultiTablePostgresProvider.ts +0 -461
- package/src/providers/vectordb/PineconeProvider.ts +0 -295
- package/src/providers/vectordb/PostgreSQLProvider.ts +0 -227
- package/src/providers/vectordb/QdrantProvider.ts +0 -294
- package/src/providers/vectordb/RedisProvider.ts +0 -105
- package/src/providers/vectordb/UniversalVectorProvider.ts +0 -221
- package/src/providers/vectordb/WeaviateProvider.ts +0 -172
- package/src/rag/DocumentChunker.ts +0 -144
- package/src/rag/EntityExtractor.ts +0 -90
- package/src/rag/LlamaIndexIngestor.ts +0 -60
- package/src/rag/Reranker.ts +0 -106
- package/src/rendering/IntentClassifier.ts +0 -167
- package/src/rendering/RendererRegistry.ts +0 -164
- package/src/rendering/RuleEngine.ts +0 -67
- package/src/rendering/VisualizationDecisionEngine.ts +0 -164
- package/src/rendering/__tests__/VisualizationDecisionEngine.test.ts +0 -237
- package/src/rendering/index.ts +0 -12
- package/src/rendering/rules/Rule1SpecificInfoRule.ts +0 -28
- package/src/rendering/rules/Rule2ComparisonRule.ts +0 -24
- package/src/rendering/rules/Rule3ProductDiscoveryRule.ts +0 -28
- package/src/rendering/rules/Rule4AnalyticalRule.ts +0 -38
- package/src/rendering/rules/Rule5MixedResponseRule.ts +0 -29
- package/src/rendering/rules/Rule6SmallResultSetRule.ts +0 -24
- package/src/rendering/rules/Rule7LargeTableRule.ts +0 -35
- package/src/rendering/types.ts +0 -96
- package/src/server.ts +0 -156
- package/src/tailwind.css +0 -194
- package/src/telemetry/TelemetryService.ts +0 -330
- package/src/types/chat.ts +0 -89
- package/src/types/index.ts +0 -278
- package/src/types/pdf-parse.d.ts +0 -13
- package/src/types/props.ts +0 -169
- package/src/utils/DocumentParser.ts +0 -111
- package/src/utils/ProductExtractor.ts +0 -350
- package/src/utils/SchemaMapper.ts +0 -176
- package/src/utils/UITransformer.ts +0 -1812
- package/src/utils/synonyms.ts +0 -80
- package/src/utils/templateUtils.ts +0 -78
- package/src/version.ts +0 -6
package/src/app/globals.css
DELETED
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
|
|
3
|
-
@custom-variant dark (&:where(.dark, .dark *));
|
|
4
|
-
|
|
5
|
-
@theme {
|
|
6
|
-
--animate-shapeshift: shapeshift 5s ease-in-out infinite forwards;
|
|
7
|
-
--animate-gradientMove: gradientMove 3.5s ease-in-out infinite alternate;
|
|
8
|
-
|
|
9
|
-
@keyframes shapeshift {
|
|
10
|
-
0% {
|
|
11
|
-
clip-path: var(--circle);
|
|
12
|
-
rotate: 0turn;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
25% {
|
|
16
|
-
clip-path: var(--flower);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
50% {
|
|
20
|
-
clip-path: var(--cylinder);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
75% {
|
|
24
|
-
clip-path: var(--hexagon);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
100% {
|
|
28
|
-
clip-path: var(--circle);
|
|
29
|
-
rotate: 1turn;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
120% {
|
|
33
|
-
clip-path: var(--flower);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
140% {
|
|
37
|
-
clip-path: var(--cylinder);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
160% {
|
|
41
|
-
clip-path: var(--hexagon);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
180% {
|
|
45
|
-
clip-path: var(--circle);
|
|
46
|
-
rotate: 1turn;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@keyframes gradientMove {
|
|
51
|
-
0% {
|
|
52
|
-
translate: 0 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
100% {
|
|
56
|
-
translate: -75% -75%;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@layer base {
|
|
62
|
-
:root {
|
|
63
|
-
--star: shape(evenodd from 50% 24.787%,
|
|
64
|
-
curve by 7.143% 18.016% with 0% 0% / 2.9725% 13.814%,
|
|
65
|
-
curve by 17.882% 7.197% with 4.171% 4.2025% / 17.882% 7.197%,
|
|
66
|
-
curve by -17.882% 8.6765% with 0% 0% / -13.711% 4.474%,
|
|
67
|
-
curve by -7.143% 16.5365% with -4.1705% 4.202% / -7.143% 16.5365%,
|
|
68
|
-
curve by -8.6115% -16.5365% with 0% 0% / -4.441% -12.3345%,
|
|
69
|
-
curve by -16.4135% -8.6765% with -4.171% -4.2025% / -16.4135% -8.6765%,
|
|
70
|
-
curve by 16.4135% -7.197% with 0% 0% / 12.2425% -2.9945%,
|
|
71
|
-
curve by 8.6115% -18.016% with 4.1705% -4.202% / 8.6115% -18.016%,
|
|
72
|
-
close);
|
|
73
|
-
--flower: shape(evenodd from 17.9665% 82.0335%,
|
|
74
|
-
curve by -12.349% -32.0335% with -13.239% -5.129% / -18.021% -15.402%,
|
|
75
|
-
curve by -0.0275% -22.203% with -3.1825% -9.331% / -3.074% -16.6605%,
|
|
76
|
-
curve by 12.3765% -9.8305% with 2.3835% -4.3365% / 6.565% -7.579%,
|
|
77
|
-
curve by 32.0335% -12.349% with 5.129% -13.239% / 15.402% -18.021%,
|
|
78
|
-
curve by 20.4535% -0.8665% with 8.3805% -2.858% / 15.1465% -3.062%,
|
|
79
|
-
curve by 11.58% 13.2155% with 5.225% 2.161% / 9.0355% 6.6475%,
|
|
80
|
-
curve by 12.349% 32.0335% with 13.239% 5.129% / 18.021% 15.402%,
|
|
81
|
-
curve by 0.5715% 21.1275% with 2.9805% 8.7395% / 3.0745% 15.723%,
|
|
82
|
-
curve by -12.9205% 10.906% with -2.26% 4.88% / -6.638% 8.472%,
|
|
83
|
-
curve by -32.0335% 12.349% with -5.129% 13.239% / -15.402% 18.021%,
|
|
84
|
-
curve by -21.1215% 0.5745% with -8.736% 2.9795% / -15.718% 3.0745%,
|
|
85
|
-
curve by -10.912% -12.9235% with -4.883% -2.2595% / -8.477% -6.6385%,
|
|
86
|
-
close);
|
|
87
|
-
--hexagon: shape(evenodd from 6.47% 67.001%,
|
|
88
|
-
curve by 0% -34.002% with -1.1735% -7.7% / -1.1735% -26.302%,
|
|
89
|
-
curve by 7.0415% -12.1965% with 0.7075% -4.641% / 3.3765% -9.2635%,
|
|
90
|
-
curve by 29.447% -17.001% with 6.0815% -4.8665% / 22.192% -14.1675%,
|
|
91
|
-
curve by 14.083% 0% with 4.3725% -1.708% / 9.7105% -1.708%,
|
|
92
|
-
curve by 29.447% 17.001% with 7.255% 2.8335% / 23.3655% 12.1345%,
|
|
93
|
-
curve by 7.0415% 12.1965% with 3.665% 2.933% / 6.334% 7.5555%,
|
|
94
|
-
curve by 0% 34.002% with 1.1735% 7.7% / 1.1735% 26.302%,
|
|
95
|
-
curve by -7.0415% 12.1965% with -0.7075% 4.641% / -3.3765% 9.2635%,
|
|
96
|
-
curve by -29.447% 17.001% with -6.0815% 4.8665% / -22.192% 14.1675%,
|
|
97
|
-
curve by -14.083% 0% with -4.3725% 1.708% / -9.7105% 1.708%,
|
|
98
|
-
curve by -29.447% -17.001% with -7.255% -2.8335% / -23.3655% -12.1345%,
|
|
99
|
-
curve by -7.0415% -12.1965% with -3.665% -2.933% / -6.334% -7.5555%,
|
|
100
|
-
close);
|
|
101
|
-
--cylinder: shape(evenodd from 10.5845% 59.7305%,
|
|
102
|
-
curve by 0% -19.461% with -0.113% -1.7525% / -0.11% -18.14%,
|
|
103
|
-
curve by 10.098% -26.213% with 0.837% -10.0375% / 3.821% -19.2625%,
|
|
104
|
-
curve by 29.3175% -13.0215% with 7.2175% -7.992% / 17.682% -13.0215%,
|
|
105
|
-
curve by 19.5845% 5.185% with 7.1265% 0% / 13.8135% 1.887%,
|
|
106
|
-
curve by 9.8595% 7.9775% with 3.7065% 2.1185% / 7.035% 4.8195%,
|
|
107
|
-
curve by 9.9715% 26.072% with 6.2015% 6.933% / 9.4345% 16.082%,
|
|
108
|
-
curve by 0% 19.461% with 0.074% 1.384% / 0.0745% 17.7715%,
|
|
109
|
-
curve by -13.0065% 29.1155% with -0.511% 11.5345% / -5.021% 21.933%,
|
|
110
|
-
curve by -26.409% 10.119% with -6.991% 6.288% / -16.254% 10.119%,
|
|
111
|
-
curve by -20.945% -5.9995% with -7.6935% 0% / -14.8755% -2.199%,
|
|
112
|
-
curve by -8.713% -7.404% with -3.255% -2.0385% / -6.1905% -4.537%,
|
|
113
|
-
curve by -9.7575% -25.831% with -6.074% -6.9035% / -9.1205% -15.963%,
|
|
114
|
-
close);
|
|
115
|
-
--circle: shape(evenodd from 13.482% 79.505%,
|
|
116
|
-
curve by -7.1945% -12.47% with -1.4985% -1.8575% / -6.328% -10.225%,
|
|
117
|
-
curve by 0.0985% -33.8965% with -4.1645% -10.7945% / -4.1685% -23.0235%,
|
|
118
|
-
curve by 6.9955% -12.101% with 1.72% -4.3825% / 4.0845% -8.458%,
|
|
119
|
-
curve by 30.125% -17.119% with 7.339% -9.1825% / 18.4775% -15.5135%,
|
|
120
|
-
curve by 13.4165% 0.095% with 4.432% -0.6105% / 8.9505% -0.5855%,
|
|
121
|
-
curve by 29.364% 16.9% with 11.6215% 1.77% / 22.102% 7.9015%,
|
|
122
|
-
curve by 7.176% 12.4145% with 3.002% 3.7195% / 5.453% 7.968%,
|
|
123
|
-
curve by -0.0475% 33.8925% with 4.168% 10.756% / 4.2305% 22.942%,
|
|
124
|
-
curve by -7.1135% 12.2825% with -1.74% 4.4535% / -4.1455% 8.592%,
|
|
125
|
-
curve by -29.404% 16.9075% with -7.202% 8.954% / -18.019% 15.137%,
|
|
126
|
-
curve by -14.19% -0.018% with -4.6635% 0.7255% / -9.4575% 0.7205%,
|
|
127
|
-
curve by -29.226% -16.8875% with -11.573% -1.8065% / -21.9955% -7.9235%,
|
|
128
|
-
close);
|
|
129
|
-
--circle: shape(evenodd from 13.482% 79.505%,
|
|
130
|
-
curve by -7.1945% -12.47% with -1.4985% -1.8575% / -6.328% -10.225%,
|
|
131
|
-
curve by 0.0985% -33.8965% with -4.1645% -10.7945% / -4.1685% -23.0235%,
|
|
132
|
-
curve by 6.9955% -12.101% with 1.72% -4.3825% / 4.0845% -8.458%,
|
|
133
|
-
curve by 30.125% -17.119% with 7.339% -9.1825% / 18.4775% -15.5135%,
|
|
134
|
-
curve by 13.4165% 0.095% with 4.432% -0.6105% / 8.9505% -0.5855%,
|
|
135
|
-
curve by 29.364% 16.9% with 11.6215% 1.77% / 22.102% 7.9015%,
|
|
136
|
-
curve by 7.176% 12.4145% with 3.002% 3.7195% / 5.453% 7.968%,
|
|
137
|
-
curve by -0.0475% 33.8925% with 4.168% 10.756% / 4.2305% 22.942%,
|
|
138
|
-
curve by -7.1135% 12.2825% with -1.74% 4.4535% / -4.1455% 8.592%,
|
|
139
|
-
curve by -29.404% 16.9075% with -7.202% 8.954% / -18.019% 15.137%,
|
|
140
|
-
curve by -14.19% -0.018% with -4.6635% 0.7255% / -9.4575% 0.7205%,
|
|
141
|
-
curve by -29.226% -16.8875% with -11.573% -1.8065% / -21.9955% -7.9235%,
|
|
142
|
-
close);
|
|
143
|
-
--heart: shape(evenodd from 51.311% 83.603%,
|
|
144
|
-
curve by -8.333% -20.508% with -14.104% -4.287% / -16.406% -16.185%,
|
|
145
|
-
curve by -4.271% -37.41% with -5.419% -9.658% / -6.815% -22.733%,
|
|
146
|
-
curve by 13.589% -33.586% with 3.982% -7.448% / 8.411% -15.994%,
|
|
147
|
-
curve by 28.187% -21.985% with 4.029% -4.29% / 4.029% -4.29%,
|
|
148
|
-
curve by 33.835% 0.721% with 9.618% 4.647% / 22.541% 9.618%,
|
|
149
|
-
curve by 37.596% 21.304% with 3.306% 13.266% / 7.589% 24.251%,
|
|
150
|
-
curve by 21.985% 43.613% with -4.208% 3.982% / -15.994% 8.411%,
|
|
151
|
-
curve by 0.721% 37.596% with -7.448% 4.029% / -15.994% 8.411%,
|
|
152
|
-
curve by -16.185% 28.187% with -9.658% 5.419% / -22.733% 6.815%,
|
|
153
|
-
curve by -37.41% 4.271% with -4.29% 4.029% / -4.29% 4.029%,
|
|
154
|
-
curve by -33.586% -13.589% with -7.448% 3.982% / -15.994% 8.411%,
|
|
155
|
-
curve by -28.187% -32.094% with -4.029% 4.029% / -4.029% 4.029%,
|
|
156
|
-
close);
|
|
157
|
-
--spiral: shape(evenodd from 13.347% 30.885%,
|
|
158
|
-
curve by 5.502% 18.447% with 11.052% 5.562% / 19.995% 9.169%,
|
|
159
|
-
curve by -20.309% 16.907% with -7.146% -1.332% / -9.016% -2.812%,
|
|
160
|
-
curve by -25.848% -13.087% with -7.017% -7.46% / -9.941% -15.041%,
|
|
161
|
-
curve by 10.154% -25.731% with 2.473% -6.063% / 7.163% -10.656%,
|
|
162
|
-
curve by 31.473% -7.963% with 8.814% 2.403% / 13.84% 8.748%,
|
|
163
|
-
curve by 16.526% 20.487% with -4.058% 1.502% / -9.51% 3.304%,
|
|
164
|
-
curve by 5.502% 18.447% with 11.052% 5.562% / 19.995% 9.169%,
|
|
165
|
-
close);
|
|
166
|
-
--star2: shape(open from 28.947% 47.744%,
|
|
167
|
-
curve by 24.042% -2.139% with 0% 0% / -24.042% 2.139%,
|
|
168
|
-
curve by 4.208% -25.165% with 4.208% -25.165% / 4.208% -25.165%,
|
|
169
|
-
curve by 2.341% -18.447% with 0% 0% / 1.888% -1.438%,
|
|
170
|
-
curve by 32.355% 1.085% with 0% 0% / 25.984% 1.085%,
|
|
171
|
-
curve by -4.655% 25.165% with 0% 0% / -4.655% 25.165%,
|
|
172
|
-
curve by -4.208% -25.165% with -4.208% -25.165% / -4.208% -25.165%,
|
|
173
|
-
curve by 2.566% -4.208% with 0% 0% / 2.072% -1.639%,
|
|
174
|
-
curve by 30.069% 1.085% with 0% 0% / 24.156% 1.085%,
|
|
175
|
-
curve by -2.791% 25.165% with 0% 0% / -2.791% 25.165%,
|
|
176
|
-
curve by -4.208% -25.165% with -4.208% -25.165% / -4.208% -25.165%,
|
|
177
|
-
curve by 2.116% -4.208% with 0% 0% / 1.659% -1.557%,
|
|
178
|
-
close);
|
|
179
|
-
--sun: shape(evenodd from 12.758% 22.039%,
|
|
180
|
-
curve by 2.2585% 27.561% with 4.517% 18.961% / 2.2585% 27.561%,
|
|
181
|
-
curve by 3.187% -11.541% with 2.2585% -8.483% / 4.7615% -12.541%,
|
|
182
|
-
curve by 31.034% 31.034% with 31.034% 31.034% / 31.034% 31.034%,
|
|
183
|
-
curve by 33.825% -14.163% with 8.961% -7.455% / 13.585% -11.059%,
|
|
184
|
-
curve by 19.814% -34.731% with 4.7615% -12.541% / 2.2585% -27.561%,
|
|
185
|
-
curve by 33.825% -14.163% with 2.2585% -8.483% / 4.517% -18.961%,
|
|
186
|
-
curve by 19.814% -34.731% with 0% 0% / -3.187% 11.541%,
|
|
187
|
-
curve by 33.825% -14.163% with 8.961% -7.455% / 13.585% -11.059%,
|
|
188
|
-
curve by 31.034% 31.034% with 31.034% 31.034% / 31.034% 31.034%,
|
|
189
|
-
curve by 19.814% -34.731% with 4.7615% -12.541% / 2.2585% -27.561%,
|
|
190
|
-
curve by 33.825% -14.163% with 2.2585% -8.483% / 4.517% -18.961%,
|
|
191
|
-
close);
|
|
192
|
-
--star2: shape(open from 28.947% 47.744%,
|
|
193
|
-
curve by 24.042% -2.139% with 0% 0% / -24.042% 2.139%,
|
|
194
|
-
curve by 4.208% -25.165% with 4.208% -25.165% / 4.208% -25.165%,
|
|
195
|
-
curve by 2.341% -18.447% with 0% 0% / 1.888% -1.438%,
|
|
196
|
-
curve by 32.355% 1.085% with 0% 0% / 25.984% 1.085%,
|
|
197
|
-
curve by -4.655% 25.165% with 0% 0% / -4.655% 25.165%,
|
|
198
|
-
curve by -4.208% -25.165% with -4.208% -25.165% / -4.208% -25.165%,
|
|
199
|
-
curve by 2.566% -4.208% with 0% 0% / 2.072% -1.639%,
|
|
200
|
-
curve by 30.069% 1.085% with 0% 0% / 24.156% 1.085%,
|
|
201
|
-
curve by -2.791% 25.165% with 0% 0% / -2.791% 25.165%,
|
|
202
|
-
curve by -4.208% -25.165% with -4.208% -25.165% / -4.208% -25.165%,
|
|
203
|
-
curve by 2.116% -4.208% with 0% 0% / 1.659% -1.557%,
|
|
204
|
-
close);
|
|
205
|
-
--tri-star: shape(open from 25% 25%,
|
|
206
|
-
curve by 25% 25% with 0% 0% / 25% 25%,
|
|
207
|
-
close);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/* ─── Design Tokens ─────────────────────────────────────────── */
|
|
212
|
-
:root {
|
|
213
|
-
--font-inter: 'Inter', sans-serif;
|
|
214
|
-
|
|
215
|
-
/* Light Mode (Default) */
|
|
216
|
-
--bg-base: #f8fafc;
|
|
217
|
-
/* slate-50 */
|
|
218
|
-
--bg-surface: #ffffff;
|
|
219
|
-
--bg-elevated: #f1f5f9;
|
|
220
|
-
/* slate-100 */
|
|
221
|
-
--border: rgba(0, 0, 0, 0.08);
|
|
222
|
-
--text-primary: #0f172a;
|
|
223
|
-
/* slate-900 */
|
|
224
|
-
--text-secondary: #475569;
|
|
225
|
-
/* slate-600 */
|
|
226
|
-
--text-muted: #94a3b8;
|
|
227
|
-
/* slate-400 */
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.dark {
|
|
231
|
-
/* Dark Mode */
|
|
232
|
-
--bg-base: #080811;
|
|
233
|
-
--bg-surface: #0f0f1a;
|
|
234
|
-
--bg-elevated: #161625;
|
|
235
|
-
--border: rgba(255, 255, 255, 0.08);
|
|
236
|
-
--text-primary: rgba(255, 255, 255, 0.92);
|
|
237
|
-
--text-secondary: rgba(255, 255, 255, 0.55);
|
|
238
|
-
--text-muted: rgba(255, 255, 255, 0.25);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/* ─── Base Reset ────────────────────────────────────────────── */
|
|
242
|
-
*,
|
|
243
|
-
*::before,
|
|
244
|
-
*::after {
|
|
245
|
-
box-sizing: border-box;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
html {
|
|
249
|
-
font-family: var(--font-inter), system-ui, sans-serif;
|
|
250
|
-
-webkit-font-smoothing: antialiased;
|
|
251
|
-
-moz-osx-font-smoothing: grayscale;
|
|
252
|
-
scroll-behavior: smooth;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
body {
|
|
256
|
-
background-color: var(--bg-base);
|
|
257
|
-
color: var(--text-primary);
|
|
258
|
-
margin: 0;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/* ─── Scrollbar ─────────────────────────────────────────────── */
|
|
262
|
-
::-webkit-scrollbar {
|
|
263
|
-
width: 4px;
|
|
264
|
-
height: 4px;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
::-webkit-scrollbar-track {
|
|
268
|
-
background: transparent;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
::-webkit-scrollbar-thumb {
|
|
272
|
-
background: rgba(255, 255, 255, 0.12);
|
|
273
|
-
border-radius: 999px;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
::-webkit-scrollbar-thumb:hover {
|
|
277
|
-
background: rgba(255, 255, 255, 0.2);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.scrollbar-hide::-webkit-scrollbar {
|
|
281
|
-
display: none;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.scrollbar-hide {
|
|
285
|
-
-ms-overflow-style: none;
|
|
286
|
-
scrollbar-width: none;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/* ─── Prose Overrides (markdown in chat) ───────────────────── */
|
|
290
|
-
.prose {
|
|
291
|
-
font-size: 0.875rem;
|
|
292
|
-
line-height: 1.5;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.prose strong {
|
|
296
|
-
font-weight: 700;
|
|
297
|
-
color: inherit;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.prose em {
|
|
301
|
-
font-style: italic;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.prose p {
|
|
305
|
-
margin: 0.5em 0;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.prose ul,
|
|
309
|
-
.prose ol {
|
|
310
|
-
padding-left: 1.5em;
|
|
311
|
-
margin: 0.5em 0;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.prose li {
|
|
315
|
-
margin: 0.25em 0;
|
|
316
|
-
list-style-type: none;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.prose li::before {
|
|
320
|
-
content: "\27A4";
|
|
321
|
-
/* Unicode for a right-pointing arrow */
|
|
322
|
-
padding-right: 8px;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.prose table {
|
|
326
|
-
width: 100%;
|
|
327
|
-
border-collapse: collapse;
|
|
328
|
-
margin: 1em 0;
|
|
329
|
-
font-size: 0.8rem;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.prose th,
|
|
333
|
-
.prose td {
|
|
334
|
-
border: 1px solid var(--border);
|
|
335
|
-
padding: 0.5rem;
|
|
336
|
-
text-align: left;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
.prose th {
|
|
340
|
-
background: rgba(0, 0, 0, 0.05);
|
|
341
|
-
font-weight: 600;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.dark .prose th {
|
|
345
|
-
background: rgba(255, 255, 255, 0.05);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
.prose-invert {
|
|
349
|
-
color: inherit;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.prose-invert p {
|
|
353
|
-
margin: 0.25em 0;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.prose-invert pre {
|
|
357
|
-
background: rgba(0, 0, 0, 0.4);
|
|
358
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
359
|
-
border-radius: 0.5rem;
|
|
360
|
-
padding: 0.75rem 1rem;
|
|
361
|
-
overflow-x: auto;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.prose-invert code:not(pre code) {
|
|
365
|
-
background: rgba(255, 255, 255, 0.08);
|
|
366
|
-
border-radius: 0.25rem;
|
|
367
|
-
padding: 0.1em 0.35em;
|
|
368
|
-
font-size: 0.85em;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
.prose-invert a {
|
|
372
|
-
color: #818cf8;
|
|
373
|
-
text-decoration: underline;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
.prose-invert ul,
|
|
377
|
-
.prose-invert ol {
|
|
378
|
-
padding-left: 1.25em;
|
|
379
|
-
margin: 0.35em 0;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
.prose-invert li {
|
|
383
|
-
margin: 0.15em 0;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
.prose-invert blockquote {
|
|
387
|
-
border-left: 3px solid rgba(99, 102, 241, 0.5);
|
|
388
|
-
padding-left: 0.75em;
|
|
389
|
-
color: rgba(255, 255, 255, 0.6);
|
|
390
|
-
margin: 0.5em 0;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/* ─── Animations ────────────────────────────────────────────── */
|
|
394
|
-
@keyframes fadeInUp {
|
|
395
|
-
from {
|
|
396
|
-
opacity: 0;
|
|
397
|
-
transform: translateY(8px);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
to {
|
|
401
|
-
opacity: 1;
|
|
402
|
-
transform: translateY(0);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
@keyframes slideUp {
|
|
407
|
-
from {
|
|
408
|
-
opacity: 0;
|
|
409
|
-
transform: translateY(16px) scale(0.98);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
to {
|
|
413
|
-
opacity: 1;
|
|
414
|
-
transform: translateY(0) scale(1);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
@keyframes shimmer {
|
|
419
|
-
0% {
|
|
420
|
-
background-position: -200% 0;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
100% {
|
|
424
|
-
background-position: 200% 0;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.animate-fade-in-up {
|
|
429
|
-
animation: fadeInUp 0.3s ease-out both;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.animate-slide-up {
|
|
433
|
-
animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/* ─── Glass Surface ─────────────────────────────────────────── */
|
|
437
|
-
.glass {
|
|
438
|
-
background: rgba(255, 255, 255, 0.04);
|
|
439
|
-
backdrop-filter: blur(16px);
|
|
440
|
-
border: 1px solid var(--border);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/* ─── Gradient Text Utility ─────────────────────────────────── */
|
|
444
|
-
.gradient-text {
|
|
445
|
-
background: linear-gradient(135deg, #6366f1, #8b5cf6);
|
|
446
|
-
-webkit-background-clip: text;
|
|
447
|
-
-webkit-text-fill-color: transparent;
|
|
448
|
-
background-clip: text;
|
|
449
|
-
}
|
package/src/app/layout.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from 'next';
|
|
2
|
-
import { Inter } from 'next/font/google';
|
|
3
|
-
import './globals.css';
|
|
4
|
-
|
|
5
|
-
const inter = Inter({ subsets: ['latin'], variable: '--font-inter' });
|
|
6
|
-
|
|
7
|
-
export const metadata: Metadata = {
|
|
8
|
-
title: 'Retrivora AI — Plug-and-Play RAG Engine',
|
|
9
|
-
description:
|
|
10
|
-
'Retrivora AI is the easiest way to add a production-grade RAG chatbot to any React or Next.js application. Plug in your LLM, your vector database, and ship.',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
14
|
-
return (
|
|
15
|
-
<html lang="en" className={inter.variable} suppressHydrationWarning>
|
|
16
|
-
<body className="bg-slate-50 text-slate-900 antialiased" suppressHydrationWarning>
|
|
17
|
-
{children}
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
package/src/app/page.tsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { ChatWidget } from '@/components/ChatWidget';
|
|
5
|
-
import { ChatWindow } from '@/components/ChatWindow';
|
|
6
|
-
|
|
7
|
-
export default function HomePage() {
|
|
8
|
-
const [showChatWindow, setShowChatWindow] = useState(true);
|
|
9
|
-
const [showChatWidget, setShowChatWidget] = useState(true);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<main className="min-h-screen bg-slate-50 dark:bg-[#080811] text-slate-900 dark:text-slate-100 p-6 md:p-12 transition-colors duration-300">
|
|
13
|
-
<div className="max-w-4xl mx-auto space-y-8">
|
|
14
|
-
{/* Header / Intro */}
|
|
15
|
-
<div className="border-b border-slate-200 dark:border-slate-800 pb-6">
|
|
16
|
-
<h1 className="text-3xl font-bold tracking-tight">Retrivora SDK Preview</h1>
|
|
17
|
-
<p className="text-sm text-slate-500 dark:text-slate-400 mt-2">
|
|
18
|
-
Test and preview the SDK interactive components: Embedded <code className="text-xs bg-slate-200 dark:bg-slate-800 px-1.5 py-0.5 rounded">ChatWindow</code> and Floating <code className="text-xs bg-slate-200 dark:bg-slate-800 px-1.5 py-0.5 rounded">ChatWidget</code>.
|
|
19
|
-
</p>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
{/* Controls */}
|
|
23
|
-
<div className="flex flex-wrap items-center gap-4 bg-white dark:bg-slate-900 p-4 rounded-xl border border-slate-200 dark:border-slate-800 shadow-sm">
|
|
24
|
-
<label className="flex items-center gap-2 cursor-pointer text-sm font-medium">
|
|
25
|
-
<input
|
|
26
|
-
type="checkbox"
|
|
27
|
-
checked={showChatWindow}
|
|
28
|
-
onChange={(e) => setShowChatWindow(e.target.checked)}
|
|
29
|
-
className="w-4 h-4 rounded text-blue-600 focus:ring-blue-500 text-sm"
|
|
30
|
-
/>
|
|
31
|
-
Show Embedded ChatWindow
|
|
32
|
-
</label>
|
|
33
|
-
|
|
34
|
-
<label className="flex items-center gap-2 cursor-pointer text-sm font-medium">
|
|
35
|
-
<input
|
|
36
|
-
type="checkbox"
|
|
37
|
-
checked={showChatWidget}
|
|
38
|
-
onChange={(e) => setShowChatWidget(e.target.checked)}
|
|
39
|
-
className="w-4 h-4 rounded text-blue-600 focus:ring-blue-500 text-sm"
|
|
40
|
-
/>
|
|
41
|
-
Enable Floating ChatWidget
|
|
42
|
-
</label>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
{/* Embedded ChatWindow Section */}
|
|
46
|
-
{showChatWindow ? (
|
|
47
|
-
<div className="bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-2xl p-4 shadow-lg h-[600px]">
|
|
48
|
-
<ChatWindow
|
|
49
|
-
className="h-full"
|
|
50
|
-
showClose={false}
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
) : (
|
|
54
|
-
<div className="border border-dashed border-slate-300 dark:border-slate-700 rounded-2xl p-8 text-center text-slate-400">
|
|
55
|
-
Embedded ChatWindow is disabled. Check the toggle above to enable it.
|
|
56
|
-
</div>
|
|
57
|
-
)}
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
{/* Floating ChatWidget */}
|
|
61
|
-
{showChatWidget && <ChatWidget position="bottom-right" />}
|
|
62
|
-
</main>
|
|
63
|
-
);
|
|
64
|
-
}
|
package/src/app/types.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface ArchitectureCardProps {
|
|
4
|
-
icon: React.ReactNode;
|
|
5
|
-
title: string;
|
|
6
|
-
description: string;
|
|
7
|
-
badge: string;
|
|
8
|
-
badgeColor: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface Snippet {
|
|
12
|
-
id: string;
|
|
13
|
-
title: string;
|
|
14
|
-
description: string;
|
|
15
|
-
code: string;
|
|
16
|
-
language: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface PipelineStep {
|
|
20
|
-
step: string;
|
|
21
|
-
Icon: React.ElementType;
|
|
22
|
-
title: string;
|
|
23
|
-
desc: string;
|
|
24
|
-
colors: { from: string; to: string };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ProviderPill {
|
|
28
|
-
Icon: React.ElementType;
|
|
29
|
-
label: string;
|
|
30
|
-
}
|
package/src/browser.tsx
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
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/v1';
|
|
16
|
-
if (currentScript && currentScript.src) {
|
|
17
|
-
const src = currentScript.src;
|
|
18
|
-
const lastSlashIndex = src.lastIndexOf('/');
|
|
19
|
-
if (lastSlashIndex !== -1) {
|
|
20
|
-
cdnUrl = src.substring(0, lastSlashIndex);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const cssId = 'retrivora-sdk-styles';
|
|
25
|
-
if (!document.getElementById(cssId)) {
|
|
26
|
-
const link = document.createElement('link');
|
|
27
|
-
link.id = cssId;
|
|
28
|
-
link.rel = 'stylesheet';
|
|
29
|
-
const isMin = currentScript && currentScript.src && currentScript.src.includes('retrivora.min.js');
|
|
30
|
-
link.href = `${cdnUrl}/${isMin ? 'retrivora.min.css' : 'retrivora.css'}`;
|
|
31
|
-
document.head.appendChild(link);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// 2. Parse attributes from the HTML element
|
|
35
|
-
const hasAttr = (name: string) => this.hasAttribute(name);
|
|
36
|
-
const getAttr = (name: string) => this.getAttribute(name);
|
|
37
|
-
|
|
38
|
-
const projectId = getAttr('project-id') || '';
|
|
39
|
-
const licenseKey = getAttr('license-key') || '';
|
|
40
|
-
const retrivoraApiBase = getAttr('retrivora-api-base') || undefined;
|
|
41
|
-
|
|
42
|
-
// 3. Construct partial settings based on explicitly defined attributes
|
|
43
|
-
const branding: any = {};
|
|
44
|
-
if (hasAttr('company-name')) branding.companyName = getAttr('company-name');
|
|
45
|
-
if (hasAttr('bot-name')) branding.botName = getAttr('bot-name');
|
|
46
|
-
if (hasAttr('welcome-message')) branding.welcomeMessage = getAttr('welcome-message');
|
|
47
|
-
if (hasAttr('primary-color')) branding.primaryColor = getAttr('primary-color');
|
|
48
|
-
if (hasAttr('secondary-color')) branding.secondaryColor = getAttr('secondary-color');
|
|
49
|
-
|
|
50
|
-
const widget: any = {};
|
|
51
|
-
if (hasAttr('position')) widget.position = getAttr('position');
|
|
52
|
-
if (hasAttr('theme')) widget.theme = getAttr('theme');
|
|
53
|
-
|
|
54
|
-
const auth: any = {};
|
|
55
|
-
if (hasAttr('auth-mode')) auth.mode = getAttr('auth-mode');
|
|
56
|
-
if (hasAttr('allowed-origins')) auth.allowedOrigins = getAttr('allowed-origins')?.split(',').filter(Boolean);
|
|
57
|
-
|
|
58
|
-
const telemetry: any = {};
|
|
59
|
-
if (hasAttr('telemetry')) telemetry.enabled = getAttr('telemetry') !== 'disabled';
|
|
60
|
-
|
|
61
|
-
const hasBrandingOverrides = Object.keys(branding).length > 0;
|
|
62
|
-
const hasWidgetOverrides = Object.keys(widget).length > 0;
|
|
63
|
-
const hasAuthOverrides = Object.keys(auth).length > 0;
|
|
64
|
-
const hasTelemetryOverrides = Object.keys(telemetry).length > 0;
|
|
65
|
-
|
|
66
|
-
const projectSettings: any = {
|
|
67
|
-
projectId,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
if (hasBrandingOverrides) projectSettings.branding = branding;
|
|
71
|
-
if (hasWidgetOverrides) projectSettings.widget = widget;
|
|
72
|
-
if (hasAuthOverrides) projectSettings.auth = auth;
|
|
73
|
-
if (hasTelemetryOverrides) projectSettings.telemetry = telemetry;
|
|
74
|
-
|
|
75
|
-
const config: any = {
|
|
76
|
-
projectId,
|
|
77
|
-
licenseKey,
|
|
78
|
-
retrivoraApiBase,
|
|
79
|
-
autoLoadProjectSettings: true,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// Only pass projectSettings override if there are custom values set on the tag
|
|
83
|
-
if (hasBrandingOverrides || hasWidgetOverrides || hasAuthOverrides || hasTelemetryOverrides) {
|
|
84
|
-
config.projectSettings = projectSettings;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Direct UI color overrides
|
|
88
|
-
if (hasAttr('primary-color')) config.primaryColor = getAttr('primary-color');
|
|
89
|
-
if (hasAttr('secondary-color')) config.secondaryColor = getAttr('secondary-color');
|
|
90
|
-
if (hasAttr('accent-color')) {
|
|
91
|
-
config.accentColor = getAttr('accent-color');
|
|
92
|
-
} else if (hasAttr('secondary-color')) {
|
|
93
|
-
config.accentColor = getAttr('secondary-color');
|
|
94
|
-
}
|
|
95
|
-
if (hasAttr('theme')) config.theme = getAttr('theme');
|
|
96
|
-
|
|
97
|
-
const position = (getAttr('position') || 'bottom-right') as any;
|
|
98
|
-
|
|
99
|
-
// 4. Create mount container inside custom element
|
|
100
|
-
const container = document.createElement('div');
|
|
101
|
-
this.appendChild(container);
|
|
102
|
-
|
|
103
|
-
// 5. Mount React Tree
|
|
104
|
-
this.root = createRoot(container);
|
|
105
|
-
this.root.render(
|
|
106
|
-
<React.StrictMode>
|
|
107
|
-
<ConfigProvider config={config}>
|
|
108
|
-
<ChatWidget position={position} />
|
|
109
|
-
</ConfigProvider>
|
|
110
|
-
</React.StrictMode>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
disconnectedCallback() {
|
|
115
|
-
if (this.root) {
|
|
116
|
-
const root = this.root;
|
|
117
|
-
setTimeout(() => {
|
|
118
|
-
root.unmount();
|
|
119
|
-
}, 0);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Register the custom element if it hasn't been defined yet
|
|
125
|
-
if (typeof window !== 'undefined' && !customElements.get('retrivora-chat')) {
|
|
126
|
-
customElements.define('retrivora-chat', RetrivoraChatElement);
|
|
127
|
-
}
|