@sampleapp.ai/sdk 1.0.25 → 1.0.27
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/components/chat-bar/typing-textarea.js +17 -11
- package/dist/components/chat-bar/voice-button.js +4 -22
- package/dist/components/chat-bar.js +100 -61
- package/dist/components/icons.js +155 -0
- package/dist/components/minimal-chat-bar.js +51 -0
- package/dist/components/ui/button.js +78 -30
- package/dist/index.d.ts +5 -8
- package/dist/index.es.js +1050 -6085
- package/dist/index.js +1 -0
- package/dist/index.standalone.js +85 -0
- package/dist/index.standalone.umd.js +147 -0
- package/dist/index.umd.js +300 -96
- package/dist/sdk.css +1 -0
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as ReactDOM from "react-dom/client"; // Change this line
|
|
|
3
3
|
import { ChatButton } from "./components/ChatButton";
|
|
4
4
|
import { ModalSearchAndChat } from "./components/ModalSearchAndChat";
|
|
5
5
|
import { ChatBar } from "./components/chat-bar";
|
|
6
|
+
import "./styles.css";
|
|
6
7
|
// Export React components for direct JSX usage
|
|
7
8
|
export { ChatButton, ModalSearchAndChat, ChatBar };
|
|
8
9
|
// Export themes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom/client";
|
|
3
|
+
import { ChatBar as MinimalChatBar, } from "./components/chat-bar";
|
|
4
|
+
function initChatBarStandalone(props, containerSelector) {
|
|
5
|
+
try {
|
|
6
|
+
console.log("SampleApp Standalone: Initializing ChatBar...", props);
|
|
7
|
+
// Add missing height property if not provided
|
|
8
|
+
const propsWithDefaults = Object.assign({}, props);
|
|
9
|
+
let hostContainer;
|
|
10
|
+
if (!containerSelector) {
|
|
11
|
+
hostContainer = document.body;
|
|
12
|
+
}
|
|
13
|
+
else if (typeof containerSelector === "string") {
|
|
14
|
+
const found = document.querySelector(containerSelector);
|
|
15
|
+
if (!found) {
|
|
16
|
+
throw new Error(`Container not found: ${containerSelector}`);
|
|
17
|
+
}
|
|
18
|
+
hostContainer = found;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
hostContainer = containerSelector;
|
|
22
|
+
}
|
|
23
|
+
// Create shadow host element
|
|
24
|
+
const shadowHost = document.createElement("div");
|
|
25
|
+
shadowHost.style.display = "contents"; // Make shadow host transparent to layout
|
|
26
|
+
// Attach shadow DOM for isolation
|
|
27
|
+
const shadow = shadowHost.attachShadow({ mode: "open" });
|
|
28
|
+
// Create app container inside shadow DOM
|
|
29
|
+
const appContainer = document.createElement("div");
|
|
30
|
+
appContainer.style.all = "initial"; // Reset all styles
|
|
31
|
+
appContainer.style.position = "relative";
|
|
32
|
+
appContainer.style.zIndex = "999999";
|
|
33
|
+
// Add basic styles to shadow DOM to prevent host CSS interference
|
|
34
|
+
const styleSheet = document.createElement("style");
|
|
35
|
+
styleSheet.textContent = `
|
|
36
|
+
* {
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Reset any inherited styles that might interfere */
|
|
41
|
+
div, span, p, button, input, textarea {
|
|
42
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
43
|
+
color: inherit;
|
|
44
|
+
background: transparent;
|
|
45
|
+
border: none;
|
|
46
|
+
margin: 0;
|
|
47
|
+
padding: 0;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
shadow.appendChild(styleSheet);
|
|
51
|
+
shadow.appendChild(appContainer);
|
|
52
|
+
hostContainer.appendChild(shadowHost);
|
|
53
|
+
console.log("SampleApp Standalone: Shadow DOM created, rendering React...");
|
|
54
|
+
const root = ReactDOM.createRoot(appContainer);
|
|
55
|
+
const component = React.createElement(MinimalChatBar, propsWithDefaults);
|
|
56
|
+
root.render(component);
|
|
57
|
+
console.log("SampleApp Standalone: ChatBar rendered successfully!");
|
|
58
|
+
return {
|
|
59
|
+
unmount: () => {
|
|
60
|
+
root.unmount();
|
|
61
|
+
shadowHost.remove();
|
|
62
|
+
},
|
|
63
|
+
container: shadowHost,
|
|
64
|
+
shadowRoot: shadow,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error("SampleApp Standalone Error:", error);
|
|
69
|
+
console.error("Error details:", {
|
|
70
|
+
message: error.message,
|
|
71
|
+
stack: error.stack,
|
|
72
|
+
});
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const SampleAppStandalone = {
|
|
77
|
+
ChatBar: initChatBarStandalone,
|
|
78
|
+
version: "1.0.25",
|
|
79
|
+
};
|
|
80
|
+
if (typeof window !== "undefined") {
|
|
81
|
+
window.SampleAppStandalone = SampleAppStandalone;
|
|
82
|
+
console.log("SampleApp Standalone SDK loaded successfully! Version:", SampleAppStandalone.version);
|
|
83
|
+
}
|
|
84
|
+
export default SampleAppStandalone;
|
|
85
|
+
export { initChatBarStandalone as ChatBar };
|