Skip to content

Commit c060074

Browse files
committed
rebuild, readme and example cleanup
1 parent 35ceb2c commit c060074

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ For websites that don't use npm packages, you can directly include the ACCESS Q&
111111

112112
Replace `v0.2.0` with the specific version you want to use. This method provides the React version of the bot and automatically initializes it when the page loads.
113113

114-
115114
## Properties
116115

117116
| Property | Type | Description |

build/static/js/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/static/js/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,23 @@ <h1>ACCESS Q&A Bot Standalone Demo</h1>
3838
<div class="explanation">
3939
<p>This page demonstrates how to integrate the ACCESS Q&A Bot in different ways using the pre-built files.
4040
No React framework setup is needed - just include the CSS and JS files from the build directory, or from the CDN.</p>
41+
<p>You can use either the <strong>jsDelivr CDN</strong> OR the <strong>unpkg CDN</strong>:</p>
4142
</div>
4243

44+
<div class="html-code">
45+
<pre>
46+
<!-- jsDelivr CDN (direct from GitHub) -->
47+
&lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/necyberteam/[email protected]/build/static/css/main.css" /&gt;
48+
&lt;script src="https://cdn.jsdelivr.net/gh/necyberteam/[email protected]/build/static/js/main.js" /&gt;
49+
&lt;script src="https://cdn.jsdelivr.net/gh/necyberteam/[email protected]/build/static/js/453.chunk.js" /&gt;
50+
51+
OR
52+
<!-- OR unpkg CDN (from npm package) -->
53+
&lt;script src="https://unpkg.com/@snf/[email protected]/dist/access-qa-bot.standalone.js" /&gt;
54+
</pre>
55+
</div>
56+
57+
4358
<div class="demo-section">
4459
<h2>Method 1: Mount React Component to <code>div#qa-bot</code></h2>
4560
<p>The floating widget that appears in the bottom-right corner.</p>
@@ -71,24 +86,24 @@ <h2>Method 3: Explicitly Call JavaScript Function</h2>
7186
function initializeQABot() {
7287
// Method 1: Auto-detect div#qa-bot
7388
const qaBot = document.getElementById('qa-bot');
74-
if (qaBot && window.qAndATool) {
89+
if (qaBot && window.qAndATool && !qaBot.hasChildNodes()) {
7590
window.qAndATool({
7691
target: qaBot,
7792
isLoggedIn: !window.isAnonymous,
78-
disabled: window.isAnonymous
93+
isAnonymous: window.isAnonymous
7994
});
8095
}
8196

8297
// Method 2: Auto-detect embedded-qa-bot divs
8398
document.querySelectorAll('.embedded-qa-bot').forEach(container => {
84-
if (window.qAndATool) {
99+
if (window.qAndATool && !container.hasChildNodes()) {
85100
window.qAndATool({
86101
target: container,
87102
embedded: true,
88103
welcome: container.dataset.welcome || "Hello!",
89104
prompt: container.dataset.prompt || "Ask me a question...",
90105
isLoggedIn: !window.isAnonymous,
91-
disabled: window.isAnonymous
106+
isAnonymous: window.isAnonymous
92107
});
93108
}
94109
});
@@ -113,17 +128,18 @@ <h2>Method 3: Explicitly Call JavaScript Function</h2>
113128
initializeQABot();
114129

115130
// Method 3 (explicit JS function call)
116-
if (window.qAndATool) {
131+
const customBot = document.getElementById('custom-qa-bot');
132+
if (window.qAndATool && customBot && !customBot.hasChildNodes()) {
117133
window.qAndATool({
118-
target: document.getElementById('custom-qa-bot'),
134+
target: customBot,
119135
embedded: true,
120136
welcome: "This is configured using JavaScript!",
121137
prompt: "Try asking a question about ACCESS...",
122138
isLoggedIn: !window.isAnonymous,
123-
disabled: window.isAnonymous,
139+
isAnonymous: window.isAnonymous,
124140
isOpen: true
125141
});
126-
} else {
142+
} else if (!window.qAndATool) {
127143
console.error("qAndATool function not found. Make sure the JS files are loaded properly.");
128144
}
129145
});

0 commit comments

Comments
 (0)