shopify-chatbot-widget 0.4.4 → 0.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/jawebDirect.js +4 -11
- package/package.json +1 -1
- package/xx.html +45 -50
package/dist/jawebDirect.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
const apiBase = currentScript.getAttribute('data-src') || 'https://jawebcrm.onrender.com/api/proxy/iframe';
|
|
9
9
|
const corner = currentScript.getAttribute('data-corner') || 'right'; // 'right' | 'left'
|
|
10
10
|
const openWidth = currentScript.getAttribute('data-open-width') || '400px';
|
|
11
|
-
const openHeight = currentScript.getAttribute('data-open-height') || '
|
|
12
|
-
const mobileSheetVh = currentScript.getAttribute('data-mobile-vh') || '
|
|
11
|
+
const openHeight = currentScript.getAttribute('data-open-height') || '95%';
|
|
12
|
+
const mobileSheetVh = currentScript.getAttribute('data-mobile-vh') || '100%'; // leave some page visible
|
|
13
13
|
|
|
14
14
|
// ----- Make styles -----
|
|
15
15
|
const style = document.createElement('style');
|
|
@@ -24,11 +24,7 @@
|
|
|
24
24
|
overflow: hidden;
|
|
25
25
|
background: transparent;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
width: 64px; height: 64px;
|
|
29
|
-
border-radius: 9999px;
|
|
30
|
-
box-shadow: 0 8px 20px rgba(0,0,0,.2);
|
|
31
|
-
}
|
|
27
|
+
|
|
32
28
|
#jaweb-chatbot-iframe.is-open {
|
|
33
29
|
width: ${openWidth}; height: ${openHeight};
|
|
34
30
|
border-radius: 16px;
|
|
@@ -41,10 +37,7 @@
|
|
|
41
37
|
border-radius: 16px 16px 0 0;
|
|
42
38
|
box-shadow: 0 -10px 30px rgba(0,0,0,.15);
|
|
43
39
|
}
|
|
44
|
-
|
|
45
|
-
${corner === 'left' ? 'left' : 'right'}: 16px;
|
|
46
|
-
bottom: 16px;
|
|
47
|
-
}
|
|
40
|
+
|
|
48
41
|
}
|
|
49
42
|
`;
|
|
50
43
|
document.head.appendChild(style);
|
package/package.json
CHANGED
package/xx.html
CHANGED
|
@@ -2,60 +2,55 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<
|
|
6
|
-
<
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Jaweb Chatbot Test</title>
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0;
|
|
12
|
+
height: 200vh; /* make page scrollable */
|
|
13
|
+
background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
|
|
14
|
+
}
|
|
15
|
+
header {
|
|
16
|
+
padding: 20px;
|
|
17
|
+
background: #7f28f8;
|
|
18
|
+
color: white;
|
|
19
|
+
text-align: center;
|
|
20
|
+
}
|
|
21
|
+
main {
|
|
22
|
+
padding: 20px;
|
|
23
|
+
max-width: 700px;
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
7
27
|
</head>
|
|
8
28
|
<body>
|
|
9
|
-
<
|
|
10
|
-
|
|
29
|
+
<header>
|
|
30
|
+
<h1>Jaweb Chatbot Integration Test</h1>
|
|
31
|
+
</header>
|
|
11
32
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
<main>
|
|
34
|
+
<p>
|
|
35
|
+
Scroll this page up and down to make sure background scrolling still works
|
|
36
|
+
while the chatbot bubble is showing.
|
|
37
|
+
</p>
|
|
38
|
+
<p>
|
|
39
|
+
The bubble should appear at the bottom-right corner. Click it, and the
|
|
40
|
+
chatbot iframe should expand.
|
|
41
|
+
</p>
|
|
42
|
+
<p>
|
|
43
|
+
Replace <code>YOUR_COMPANY_USERNAME</code> below with a real one to test a
|
|
44
|
+
live bot session.
|
|
45
|
+
</p>
|
|
46
|
+
</main>
|
|
24
47
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
iframe.style.right = "20px";
|
|
32
|
-
iframe.style.width = "400px";
|
|
33
|
-
iframe.style.height = "600px";
|
|
34
|
-
iframe.style.zIndex = "999999";
|
|
35
|
-
iframe.style.borderRadius = "16px";
|
|
36
|
-
iframe.style.border="none"
|
|
37
|
-
iframe.id = "jaweb-chatbot-iframe";
|
|
48
|
+
<!-- ✅ Jaweb chatbot embed (script one-liner) -->
|
|
49
|
+
<script
|
|
50
|
+
src="https://cdn.jsdelivr.net/npm/shopify-chatbot-widget@0.4.5/dist/jawebDirect.js"
|
|
51
|
+
data-company="jaweb"
|
|
52
|
+
async
|
|
53
|
+
></script>
|
|
38
54
|
|
|
39
|
-
document.body.appendChild(iframe);
|
|
40
|
-
|
|
41
|
-
// Pass config into iframe (postMessage)
|
|
42
|
-
iframe.onload = function () {
|
|
43
|
-
iframe.contentWindow.postMessage(
|
|
44
|
-
{ type: "jaweb:init", payload: config },
|
|
45
|
-
"*"
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// (Optional) handle messages back from chatbot
|
|
50
|
-
window.addEventListener("message", (e) => {
|
|
51
|
-
if (e.data.type === "jaweb:ready") {
|
|
52
|
-
console.log("Jaweb chatbot is ready!");
|
|
53
|
-
}
|
|
54
|
-
if (e.data.type === "jaweb:event") {
|
|
55
|
-
console.log("Chatbot event:", e.data.payload);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
})();
|
|
59
|
-
</script>
|
|
60
55
|
</body>
|
|
61
56
|
</html>
|