aptolix_chatbot 1.0.6 → 1.0.7

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.
@@ -408,19 +408,18 @@
408
408
 
409
409
  .aptolix-hint-bubble {
410
410
  position: fixed;
411
- bottom: 110px; /* Adjust so it's above the bubble */
412
- right: 40px; /* Adjust to align with bubble */
411
+ right: 40px;
412
+ bottom: 110px;
413
+ z-index: 9999;
413
414
  background: #fff;
415
+ border-radius: 8px;
416
+ box-shadow: 0 2px 8px rgba(0,0,0,0.15);
417
+ padding: 16px 40px 16px 16px;
418
+ min-width: 180px;
419
+ max-width: 320px;
420
+ font-size: 1em;
414
421
  color: #333;
415
- padding: 10px 18px;
416
- border-radius: 18px;
417
- box-shadow: 0 2px 12px rgba(0,0,0,0.12);
418
- font-size: 15px;
419
- z-index: 9999;
420
- transition: opacity 0.3s;
421
- opacity: 1;
422
- pointer-events: none;
423
- max-width: 220px;
422
+ pointer-events: auto; /* Ensure it's clickable */
424
423
  }
425
424
 
426
425
  .aptolix-hint-bubble::after {
package/src/index.js CHANGED
@@ -7,7 +7,7 @@ const AptolixChatbot = {
7
7
 
8
8
  const modeClass = mode === "section" ? "section-mode" : "bubble-mode";
9
9
  const chatWindow = document.createElement('div');
10
-
10
+
11
11
  let bubble, hintBubbleTimeout, hintBubble;
12
12
  if (mode === "bubble") {
13
13
  bubble = document.createElement('div');
@@ -15,17 +15,61 @@ const AptolixChatbot = {
15
15
  bubble.innerText = "💬";
16
16
  document.body.appendChild(bubble);
17
17
 
18
+ // Remove any existing hint bubble before creating a new one
19
+ const existingHintBubble = document.getElementById("aptolix-chat-hint-bubble");
20
+ if (existingHintBubble) {
21
+ existingHintBubble.remove();
22
+ }
23
+
18
24
  // Create hint bubble but keep it hidden initially
19
25
  hintBubble = document.createElement('div');
20
26
  hintBubble.id = "aptolix-chat-hint-bubble";
21
27
  hintBubble.className = "aptolix-hint-bubble";
22
- hintBubble.innerText = hintText;
23
28
  hintBubble.style.display = "none";
29
+ hintBubble.style.position = "fixed";
30
+ hintBubble.style.right = "40px";
31
+ hintBubble.style.bottom = "110px";
32
+ hintBubble.style.zIndex = "9999"; // <-- Ensure it's on top
33
+
34
+ // Create the hint text span
35
+ const hintTextSpan = document.createElement('span');
36
+ hintTextSpan.textContent = hintText;
37
+
38
+ // Create the close button
39
+ const hintCloseBtn = document.createElement('button');
40
+ hintCloseBtn.id = "aptolix-hint-close";
41
+ hintCloseBtn.title = "Close";
42
+ hintCloseBtn.setAttribute("aria-label", "Close");
43
+ hintCloseBtn.innerHTML = "&#10005;";
44
+ hintCloseBtn.style.background = "none";
45
+ hintCloseBtn.style.border = "none";
46
+ hintCloseBtn.style.color = "#9333ea";
47
+ hintCloseBtn.style.fontSize = "1.3em";
48
+ hintCloseBtn.style.position = "absolute";
49
+ hintCloseBtn.style.top = "8px";
50
+ hintCloseBtn.style.right = "12px";
51
+ hintCloseBtn.style.cursor = "pointer";
52
+ hintCloseBtn.style.padding = "0";
53
+
54
+ // Add event listener directly
55
+ hintCloseBtn.addEventListener("click", () => {
56
+ hintBubble.style.display = "none";
57
+ sessionStorage.setItem("aptolixHintClosed", "true");
58
+ clearTimeout(hintBubbleTimeout);
59
+ });
60
+
61
+ // Append children
62
+ hintBubble.appendChild(hintTextSpan);
63
+ hintBubble.appendChild(hintCloseBtn);
64
+
24
65
  document.body.appendChild(hintBubble);
25
66
 
26
- // Show hint bubble after delay
67
+ // Show hint bubble after delay, unless closed in session
27
68
  hintBubbleTimeout = setTimeout(() => {
28
- if (chatWindow.style.display === "none") {
69
+ if (
70
+ chatWindow.style.display === "none" &&
71
+ !sessionStorage.getItem("aptolixHintClosed")
72
+ ) {
29
73
  hintBubble.style.display = "block";
30
74
  }
31
75
  }, hintDelay);
@@ -287,6 +331,8 @@ const AptolixChatbot = {
287
331
  URL.revokeObjectURL(url);
288
332
  }, 100);
289
333
  });
334
+
335
+
290
336
  },
291
337
  initFull: function(options) {
292
338
  let el = document.querySelector('aptolix-chatbot');