@querlo/sdk 1.0.0 → 1.0.1
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/LICENSE +1 -1
- package/QUERLO_SDK_GUIDE.md +39 -5
- package/dist/querlo-client.service.d.ts +1 -0
- package/dist/querlo-sdk.es.js +68 -67
- package/dist/querlo-sdk.umd.js +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
package/QUERLO_SDK_GUIDE.md
CHANGED
|
@@ -16,12 +16,12 @@ This guide describes how to use the Querlo Client-Side SDK to embed, control, an
|
|
|
16
16
|
|
|
17
17
|
## Setup and Initialization
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
### 1. Script Tag (Vanilla JS)
|
|
20
|
+
Include the Querlo embed script in your HTML. Once loaded, it attaches a global `Querlo` object to the `window`.
|
|
20
21
|
|
|
21
|
-
### Loading the SDK
|
|
22
22
|
```html
|
|
23
23
|
<!-- Load the Querlo SDK -->
|
|
24
|
-
<script
|
|
24
|
+
<script src="https://statig.querlo.com/js/embeds/dist/querlo-sdk.umd.js"></script>
|
|
25
25
|
|
|
26
26
|
<!-- Optional: Wait for the SDK to be ready -->
|
|
27
27
|
<script>
|
|
@@ -31,6 +31,22 @@ To use the SDK, include the Querlo embed script in your HTML. Once loaded, it at
|
|
|
31
31
|
</script>
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
### 2. Package Manager (NPM)
|
|
35
|
+
For modern projects using bundlers (Vite, Webpack), install the package:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @querlo/sdk
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then import it in your JavaScript or TypeScript files:
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
import Querlo from '@querlo/sdk';
|
|
45
|
+
|
|
46
|
+
// Initialize embedded chatbots automatically
|
|
47
|
+
// Or use the programmatic API below
|
|
48
|
+
```
|
|
49
|
+
|
|
34
50
|
---
|
|
35
51
|
|
|
36
52
|
## Embedding Chatbots
|
|
@@ -44,7 +60,8 @@ Add a `div` with the class `querlo` and the necessary data attributes. The SDK w
|
|
|
44
60
|
<div class="querlo"
|
|
45
61
|
data-id="YOUR_CHATBOT_ID"
|
|
46
62
|
data-template="esd"
|
|
47
|
-
data-main-color="#ff0000"
|
|
63
|
+
data-main-color="#ff0000"
|
|
64
|
+
data-debug="true">
|
|
48
65
|
</div>
|
|
49
66
|
```
|
|
50
67
|
|
|
@@ -56,10 +73,27 @@ const myChat = Querlo.embed({
|
|
|
56
73
|
id: 'YOUR_CHATBOT_ID',
|
|
57
74
|
template: 'inpage_popup',
|
|
58
75
|
container: '#chat-container', // Optional selector or element
|
|
59
|
-
mainColor: 'rgb(253, 168, 176)'
|
|
76
|
+
mainColor: 'rgb(253, 168, 176)',
|
|
77
|
+
debug: true // Enables debug mode in the chatbot iframe
|
|
60
78
|
});
|
|
61
79
|
```
|
|
62
80
|
|
|
81
|
+
#### Available Options
|
|
82
|
+
|
|
83
|
+
| Option | Type | Description |
|
|
84
|
+
| :--- | :--- | :--- |
|
|
85
|
+
| `id` | `string` | **Required.** The ID of the chatbot to embed. |
|
|
86
|
+
| `template` | `string` | The embed template to use (`esd`, `inpage`, `popup_center`, `inpage_popup`). Defaults to `esd`. |
|
|
87
|
+
| `container` | `string`\|`HTMLElement` | Selector or element where the chatbot should be rendered. |
|
|
88
|
+
| `width` | `string` | Width of the chatbot (e.g., `'100%'`, `'400px'`). |
|
|
89
|
+
| `height` | `string` | Height of the chatbot (e.g., `'500px'`). |
|
|
90
|
+
| `mainColor` | `string` | Primary color for the chatbot UI (CSS color string). |
|
|
91
|
+
| `speakerImg` | `string` | URL for the speaker's avatar image. |
|
|
92
|
+
| `speakerName` | `string` | Name of the speaker displayed in the UI. |
|
|
93
|
+
| `introTxt` | `string` | Introductory text shown before the chat starts. |
|
|
94
|
+
| `delay` | `number` | Delay in milliseconds before automatically opening the chat. |
|
|
95
|
+
| `debug` | `boolean` | If `true`, appends `debug=1` to the chatbot URL. |
|
|
96
|
+
|
|
63
97
|
---
|
|
64
98
|
|
|
65
99
|
## The Global `Querlo` Object
|
package/dist/querlo-sdk.es.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var le = Object.defineProperty;
|
|
3
3
|
var ae = (n, e, t) => e in n ? le(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
4
4
|
var y = (n, e, t) => ae(n, typeof e != "symbol" ? e + "" : e, t);
|
|
5
|
-
var A, m, Z, P, F, N = {}, J = [],
|
|
5
|
+
var A, m, Z, P, F, N = {}, J = [], de = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
6
6
|
function C(n, e) {
|
|
7
7
|
for (var t in e) n[t] = e[t];
|
|
8
8
|
return n;
|
|
@@ -11,7 +11,7 @@ function K(n) {
|
|
|
11
11
|
var e = n.parentNode;
|
|
12
12
|
e && e.removeChild(n);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ce(n, e, t) {
|
|
15
15
|
var i, r, o, a = {};
|
|
16
16
|
for (o in e) o == "key" ? i = e[o] : o == "ref" ? r = e[o] : a[o] = e[o];
|
|
17
17
|
if (arguments.length > 2 && (a.children = arguments.length > 3 ? A.call(arguments, 2) : t), typeof n == "function" && n.defaultProps != null) for (o in n.defaultProps) a[o] === void 0 && (a[o] = n.defaultProps[o]);
|
|
@@ -54,17 +54,17 @@ function z() {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
function te(n, e, t, i, r, o, a, l, u, f) {
|
|
57
|
-
var s, p, _,
|
|
58
|
-
for (t.__k = [], s = 0; s < e.length; s++) if ((
|
|
59
|
-
if (
|
|
57
|
+
var s, p, _, c, h, E, g, v = i && i.__k || J, q = v.length;
|
|
58
|
+
for (t.__k = [], s = 0; s < e.length; s++) if ((c = t.__k[s] = (c = e[s]) == null || typeof c == "boolean" ? null : typeof c == "string" || typeof c == "number" || typeof c == "bigint" ? L(null, c, null, null, c) : Array.isArray(c) ? L(U, { children: c }, null, null, null) : c.__b > 0 ? L(c.type, c.props, c.key, null, c.__v) : c) != null) {
|
|
59
|
+
if (c.__ = t, c.__b = t.__b + 1, (_ = v[s]) === null || _ && c.key == _.key && c.type === _.type) v[s] = void 0;
|
|
60
60
|
else for (p = 0; p < q; p++) {
|
|
61
|
-
if ((_ = v[p]) &&
|
|
61
|
+
if ((_ = v[p]) && c.key == _.key && c.type === _.type) {
|
|
62
62
|
v[p] = void 0;
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
65
|
_ = null;
|
|
66
66
|
}
|
|
67
|
-
O(n,
|
|
67
|
+
O(n, c, _ = _ || N, r, o, a, l, u, f), h = c.__e, (p = c.ref) && _.ref != p && (g || (g = []), _.ref && g.push(_.ref, null, c), g.push(p, c.__c || h, c)), h != null ? (E == null && (E = h), typeof c.type == "function" && c.__k === _.__k ? c.__d = u = ne(c, u, n) : u = ie(n, c, _, v, h, u), typeof t.type == "function" && (t.__d = u)) : u && _.__e == u && u.parentNode != n && (u = x(_));
|
|
68
68
|
}
|
|
69
69
|
for (t.__e = E, s = q; s--; ) v[s] != null && (typeof t.type == "function" && v[s].__e != null && v[s].__e == t.__d && (t.__d = x(i, s + 1)), se(v[s], v[s]));
|
|
70
70
|
if (g) for (s = 0; s < g.length; s++) re(g[s], g[++s], g[++s]);
|
|
@@ -89,7 +89,7 @@ function _e(n, e, t, i, r) {
|
|
|
89
89
|
for (o in e) r && typeof e[o] != "function" || o === "children" || o === "key" || o === "value" || o === "checked" || t[o] === e[o] || W(n, o, e[o], t[o], i);
|
|
90
90
|
}
|
|
91
91
|
function $(n, e, t) {
|
|
92
|
-
e[0] === "-" ? n.setProperty(e, t) : n[e] = t == null ? "" : typeof t != "number" ||
|
|
92
|
+
e[0] === "-" ? n.setProperty(e, t) : n[e] = t == null ? "" : typeof t != "number" || de.test(e) ? t : t + "px";
|
|
93
93
|
}
|
|
94
94
|
function W(n, e, t, i, r) {
|
|
95
95
|
var o;
|
|
@@ -116,12 +116,12 @@ function X(n) {
|
|
|
116
116
|
this.l[n.type + !0](m.event ? m.event(n) : n);
|
|
117
117
|
}
|
|
118
118
|
function O(n, e, t, i, r, o, a, l, u) {
|
|
119
|
-
var f, s, p, _,
|
|
119
|
+
var f, s, p, _, c, h, E, g, v, q, M, R, T, w = e.type;
|
|
120
120
|
if (e.constructor !== void 0) return null;
|
|
121
121
|
t.__h != null && (u = t.__h, l = e.__e = t.__e, e.__h = null, o = [l]), (f = m.__b) && f(e);
|
|
122
122
|
try {
|
|
123
123
|
e: if (typeof w == "function") {
|
|
124
|
-
if (g = e.props, v = (f = w.contextType) && i[f.__c], q = f ? v ? v.props.value : f.__ : i, t.__c ? E = (s = e.__c = t.__c).__ = s.__E : ("prototype" in w && w.prototype.render ? e.__c = s = new w(g, q) : (e.__c = s = new k(g, q), s.constructor = w, s.render = he), v && v.sub(s), s.props = g, s.state || (s.state = {}), s.context = q, s.__n = i, p = s.__d = !0, s.__h = []), s.__s == null && (s.__s = s.state), w.getDerivedStateFromProps != null && (s.__s == s.state && (s.__s = C({}, s.__s)), C(s.__s, w.getDerivedStateFromProps(g, s.__s))), _ = s.props,
|
|
124
|
+
if (g = e.props, v = (f = w.contextType) && i[f.__c], q = f ? v ? v.props.value : f.__ : i, t.__c ? E = (s = e.__c = t.__c).__ = s.__E : ("prototype" in w && w.prototype.render ? e.__c = s = new w(g, q) : (e.__c = s = new k(g, q), s.constructor = w, s.render = he), v && v.sub(s), s.props = g, s.state || (s.state = {}), s.context = q, s.__n = i, p = s.__d = !0, s.__h = []), s.__s == null && (s.__s = s.state), w.getDerivedStateFromProps != null && (s.__s == s.state && (s.__s = C({}, s.__s)), C(s.__s, w.getDerivedStateFromProps(g, s.__s))), _ = s.props, c = s.state, p) w.getDerivedStateFromProps == null && s.componentWillMount != null && s.componentWillMount(), s.componentDidMount != null && s.__h.push(s.componentDidMount);
|
|
125
125
|
else {
|
|
126
126
|
if (w.getDerivedStateFromProps == null && g !== _ && s.componentWillReceiveProps != null && s.componentWillReceiveProps(g, q), !s.__e && s.shouldComponentUpdate != null && s.shouldComponentUpdate(g, s.__s, q) === !1 || e.__v === t.__v) {
|
|
127
127
|
s.props = g, s.state = s.__s, e.__v !== t.__v && (s.__d = !1), s.__v = e, e.__e = t.__e, e.__k = t.__k, e.__k.forEach(function(I) {
|
|
@@ -130,14 +130,14 @@ function O(n, e, t, i, r, o, a, l, u) {
|
|
|
130
130
|
break e;
|
|
131
131
|
}
|
|
132
132
|
s.componentWillUpdate != null && s.componentWillUpdate(g, s.__s, q), s.componentDidUpdate != null && s.__h.push(function() {
|
|
133
|
-
s.componentDidUpdate(_,
|
|
133
|
+
s.componentDidUpdate(_, c, h);
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
if (s.context = q, s.props = g, s.__v = e, s.__P = n, M = m.__r, R = 0, "prototype" in w && w.prototype.render) s.state = s.__s, s.__d = !1, M && M(e), f = s.render(s.props, s.state, s.context);
|
|
137
137
|
else do
|
|
138
138
|
s.__d = !1, M && M(e), f = s.render(s.props, s.state, s.context), s.state = s.__s;
|
|
139
139
|
while (s.__d && ++R < 25);
|
|
140
|
-
s.state = s.__s, s.getChildContext != null && (i = C(C({}, i), s.getChildContext())), p || s.getSnapshotBeforeUpdate == null || (h = s.getSnapshotBeforeUpdate(_,
|
|
140
|
+
s.state = s.__s, s.getChildContext != null && (i = C(C({}, i), s.getChildContext())), p || s.getSnapshotBeforeUpdate == null || (h = s.getSnapshotBeforeUpdate(_, c)), T = f != null && f.type === U && f.key == null ? f.props.children : f, te(n, Array.isArray(T) ? T : [T], e, t, i, r, o, a, l, u), s.base = e.__e, e.__h = null, s.__h.length && a.push(s), E && (s.__E = s.__ = null), s.__e = !1;
|
|
141
141
|
} else o == null && e.__v === t.__v ? (e.__k = t.__k, e.__e = t.__e) : e.__e = ue(t.__e, e, t, i, r, o, a, u);
|
|
142
142
|
(f = m.diffed) && f(e);
|
|
143
143
|
} catch (I) {
|
|
@@ -156,26 +156,26 @@ function oe(n, e) {
|
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
function ue(n, e, t, i, r, o, a, l) {
|
|
159
|
-
var u, f, s, p = t.props, _ = e.props,
|
|
160
|
-
if (
|
|
161
|
-
for (; h < o.length; h++) if ((u = o[h]) && "setAttribute" in u == !!
|
|
159
|
+
var u, f, s, p = t.props, _ = e.props, c = e.type, h = 0;
|
|
160
|
+
if (c === "svg" && (r = !0), o != null) {
|
|
161
|
+
for (; h < o.length; h++) if ((u = o[h]) && "setAttribute" in u == !!c && (c ? u.localName === c : u.nodeType === 3)) {
|
|
162
162
|
n = u, o[h] = null;
|
|
163
163
|
break;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
if (n == null) {
|
|
167
|
-
if (
|
|
168
|
-
n = r ? document.createElementNS("http://www.w3.org/2000/svg",
|
|
167
|
+
if (c === null) return document.createTextNode(_);
|
|
168
|
+
n = r ? document.createElementNS("http://www.w3.org/2000/svg", c) : document.createElement(c, _.is && _), o = null, l = !1;
|
|
169
169
|
}
|
|
170
|
-
if (
|
|
170
|
+
if (c === null) p === _ || l && n.data === _ || (n.data = _);
|
|
171
171
|
else {
|
|
172
172
|
if (o = o && A.call(n.childNodes), f = (p = t.props || N).dangerouslySetInnerHTML, s = _.dangerouslySetInnerHTML, !l) {
|
|
173
173
|
if (o != null) for (p = {}, h = 0; h < n.attributes.length; h++) p[n.attributes[h].name] = n.attributes[h].value;
|
|
174
174
|
(s || f) && (s && (f && s.__html == f.__html || s.__html === n.innerHTML) || (n.innerHTML = s && s.__html || ""));
|
|
175
175
|
}
|
|
176
176
|
if (_e(n, _, p, r, l), s) e.__k = [];
|
|
177
|
-
else if (h = e.props.children, te(n, Array.isArray(h) ? h : [h], e, t, i, r &&
|
|
178
|
-
l || ("value" in _ && (h = _.value) !== void 0 && (h !== n.value ||
|
|
177
|
+
else if (h = e.props.children, te(n, Array.isArray(h) ? h : [h], e, t, i, r && c !== "foreignObject", o, a, o ? o[0] : t.__k && x(t, 0), l), o != null) for (h = o.length; h--; ) o[h] != null && K(o[h]);
|
|
178
|
+
l || ("value" in _ && (h = _.value) !== void 0 && (h !== n.value || c === "progress" && !h || c === "option" && h !== p.value) && W(n, "value", h, p.value, !1), "checked" in _ && (h = _.checked) !== void 0 && h !== n.checked && W(n, "checked", h, p.checked, !1));
|
|
179
179
|
}
|
|
180
180
|
return n;
|
|
181
181
|
}
|
|
@@ -204,7 +204,7 @@ function he(n, e, t) {
|
|
|
204
204
|
}
|
|
205
205
|
function fe(n, e, t) {
|
|
206
206
|
var i, r, o;
|
|
207
|
-
m.__ && m.__(n, e), r = (i = !1) ? null : e.__k, o = [], O(e, n = e.__k =
|
|
207
|
+
m.__ && m.__(n, e), r = (i = !1) ? null : e.__k, o = [], O(e, n = e.__k = ce(U, null, [n]), r || N, N, e.ownerSVGElement !== void 0, r ? null : e.firstChild ? A.call(e.childNodes) : null, o, r ? r.__e : e.firstChild, i), oe(o, n);
|
|
208
208
|
}
|
|
209
209
|
A = J.slice, m = { __e: function(n, e, t, i) {
|
|
210
210
|
for (var r, o, a; e = e.__; ) if ((r = e.__c) && !r.__) try {
|
|
@@ -220,7 +220,7 @@ A = J.slice, m = { __e: function(n, e, t, i) {
|
|
|
220
220
|
this.__v && (this.__e = !0, n && this.__h.push(n), G(this));
|
|
221
221
|
}, k.prototype.render = U, P = [], z.__r = 0;
|
|
222
222
|
var pe = 0;
|
|
223
|
-
function
|
|
223
|
+
function d(n, e, t, i, r) {
|
|
224
224
|
var o, a, l = {};
|
|
225
225
|
for (a in e) a == "ref" ? o = e[a] : l[a] = e[a];
|
|
226
226
|
var u = { type: n, props: l, key: t, ref: o, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: --pe, __source: r, __self: i };
|
|
@@ -237,34 +237,34 @@ function ge(n) {
|
|
|
237
237
|
return t === null ? "" : decodeURIComponent(t[1].replace(/\+/g, " "));
|
|
238
238
|
}
|
|
239
239
|
function ve() {
|
|
240
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ d("svg", { className: "querlo_icon icon-window-minimize", children: /* @__PURE__ */ d("use", { xlinkHref: "#icon-window-minimize" }) });
|
|
241
241
|
}
|
|
242
242
|
function ye() {
|
|
243
|
-
return /* @__PURE__ */
|
|
243
|
+
return /* @__PURE__ */ d("svg", { className: "querlo_icon icon-window-maximize", children: /* @__PURE__ */ d("use", { xlinkHref: "#icon-window-maximize" }) });
|
|
244
244
|
}
|
|
245
245
|
function H() {
|
|
246
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ d("svg", { className: "querlo_icon icon-cancel", children: /* @__PURE__ */ d("use", { xlinkHref: "#icon-cancel" }) });
|
|
247
247
|
}
|
|
248
|
-
const Q = /* @__PURE__ */
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
/* @__PURE__ */
|
|
248
|
+
const Q = /* @__PURE__ */ d("svg", { style: "position: absolute; width: 0; height: 0; overflow: hidden;", children: /* @__PURE__ */ d("defs", { children: [
|
|
249
|
+
/* @__PURE__ */ d("symbol", { id: "icon-cancel", viewBox: "0 0 25 32", children: [
|
|
250
|
+
/* @__PURE__ */ d("title", { children: "cancel" }),
|
|
251
|
+
/* @__PURE__ */ d("path", { d: "M23.168 23.616q0 0.704-0.48 1.216l-2.432 2.432q-0.512 0.48-1.216 0.48t-1.216-0.48l-5.248-5.28-5.248 5.28q-0.512 0.48-1.216 0.48t-1.216-0.48l-2.432-2.432q-0.512-0.512-0.512-1.216t0.512-1.216l5.248-5.248-5.248-5.248q-0.512-0.512-0.512-1.216t0.512-1.216l2.432-2.432q0.512-0.512 1.216-0.512t1.216 0.512l5.248 5.248 5.248-5.248q0.512-0.512 1.216-0.512t1.216 0.512l2.432 2.432q0.48 0.48 0.48 1.216t-0.48 1.216l-5.248 5.248 5.248 5.248q0.48 0.48 0.48 1.216z" })
|
|
252
252
|
] }),
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ d("symbol", { id: "icon-help-circled", viewBox: "0 0 27 32", children: [
|
|
254
|
+
/* @__PURE__ */ d("title", { children: "help-circled" }),
|
|
255
|
+
/* @__PURE__ */ d("path", { d: "M16 24.576v-3.424q0-0.256-0.16-0.416t-0.416-0.16h-3.424q-0.256 0-0.416 0.16t-0.16 0.416v3.424q0 0.256 0.16 0.416t0.416 0.16h3.424q0.256 0 0.416-0.16t0.16-0.416zM20.576 12.576q0-1.568-0.992-2.912t-2.464-2.080-3.040-0.736q-4.352 0-6.624 3.808-0.288 0.416 0.128 0.768l2.368 1.76q0.128 0.128 0.32 0.128 0.288 0 0.448-0.224 0.96-1.216 1.536-1.632 0.608-0.448 1.536-0.448 0.864 0 1.536 0.48t0.672 1.056q0 0.672-0.352 1.088t-1.216 0.8q-1.12 0.48-2.080 1.536t-0.928 2.24v0.64q0 0.256 0.16 0.416t0.416 0.16h3.424q0.256 0 0.416-0.16t0.16-0.416q0-0.32 0.384-0.864t0.96-0.896q0.576-0.32 0.896-0.512t0.8-0.608 0.8-0.864 0.512-1.088 0.224-1.44zM27.424 16q0 3.744-1.824 6.88t-4.992 4.992-6.88 1.856-6.912-1.856-4.96-4.992-1.856-6.88 1.856-6.88 4.96-4.992 6.912-1.856 6.88 1.856 4.992 4.992 1.824 6.88z" })
|
|
256
256
|
] }),
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ d("symbol", { id: "icon-comment", viewBox: "0 0 32 32", children: [
|
|
258
|
+
/* @__PURE__ */ d("title", { children: "comment" }),
|
|
259
|
+
/* @__PURE__ */ d("path", { d: "M32 16q0 3.104-2.144 5.728t-5.824 4.16-8.032 1.536q-1.248 0-2.592-0.128-3.52 3.104-8.224 4.32-0.864 0.256-2.016 0.384-0.32 0.032-0.544-0.16t-0.32-0.512v-0.032q-0.064-0.064 0-0.192t0.032-0.192 0.064-0.16l0.128-0.16t0.128-0.16 0.128-0.16q0.128-0.16 0.544-0.608t0.64-0.704 0.544-0.704 0.576-0.896 0.48-1.056 0.48-1.344q-2.816-1.6-4.416-3.936t-1.632-5.024q0-2.336 1.28-4.448t3.392-3.648 5.12-2.432 6.208-0.896q4.352 0 8.032 1.536t5.824 4.16 2.144 5.728z" })
|
|
260
260
|
] }),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ d("symbol", { id: "icon-window-maximize", viewBox: "0 0 32 32", children: [
|
|
262
|
+
/* @__PURE__ */ d("title", { children: "window-maximize" }),
|
|
263
|
+
/* @__PURE__ */ d("path", { d: "M4.576 25.152h22.848v-13.728h-22.848v13.728zM32 5.152v21.696q0 1.184-0.832 2.016t-2.016 0.864h-26.304q-1.152 0-2.016-0.864t-0.832-2.016v-21.696q0-1.184 0.832-2.016t2.016-0.864h26.304q1.184 0 2.016 0.864t0.832 2.016z" })
|
|
264
264
|
] }),
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ d("symbol", { id: "icon-window-minimize", viewBox: "0 0 32 32", children: [
|
|
266
|
+
/* @__PURE__ */ d("title", { children: "window-minimize" }),
|
|
267
|
+
/* @__PURE__ */ d("path", { d: "M32 23.424v3.424q0 1.184-0.832 2.016t-2.016 0.864h-26.304q-1.152 0-2.016-0.864t-0.832-2.016v-3.424q0-1.184 0.832-2.016t2.016-0.832h26.304q1.184 0 2.016 0.832t0.832 2.016z" })
|
|
268
268
|
] })
|
|
269
269
|
] }) });
|
|
270
270
|
class we extends k {
|
|
@@ -272,56 +272,56 @@ class we extends k {
|
|
|
272
272
|
super();
|
|
273
273
|
}
|
|
274
274
|
render(e) {
|
|
275
|
-
return /* @__PURE__ */
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
/* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ d("div", { class: "querlo_popup querlo_img", children: /* @__PURE__ */ d("div", { class: "querlo_contentWrp", children: [
|
|
276
|
+
/* @__PURE__ */ d("div", { class: "querlo_header", style: { backgroundColor: e.color }, children: /* @__PURE__ */ d("div", { class: "querlo_close", onClick: e.cb, children: /* @__PURE__ */ d(H, {}) }) }),
|
|
277
|
+
/* @__PURE__ */ d("section", { id: "querlo_docWrp", children: /* @__PURE__ */ d("img", { src: e.data.img }) })
|
|
278
278
|
] }) });
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
function qe(n, e, t, i, r) {
|
|
282
|
-
const o = /* @__PURE__ */
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
!e.inited && n.data.introTxt ? /* @__PURE__ */
|
|
286
|
-
e.inited ? "" : /* @__PURE__ */
|
|
282
|
+
const o = /* @__PURE__ */ d("div", { className: e.show ? "querlo_chatWrp querlo_open" : "querlo_chatWrp", children: [
|
|
283
|
+
/* @__PURE__ */ d("div", { className: "querlo_chatBar qrlfadeInUp", onClick: r.toggle, children: [
|
|
284
|
+
/* @__PURE__ */ d("div", { className: e.inited ? "querlo_avatar" : "querlo_avatar qrlpulse", style: { borderColor: n.data.mainColor }, children: /* @__PURE__ */ d("img", { src: n.data.speakerImg ? n.data.speakerImg : "https://static.querlo.com/image_uploads/avatar1/608_5f2bcb679692b_png_small.png" }) }),
|
|
285
|
+
!e.inited && n.data.introTxt ? /* @__PURE__ */ d("div", { class: "querlo_message", children: n.data.introTxt }) : "",
|
|
286
|
+
e.inited ? "" : /* @__PURE__ */ d("div", { className: "querlo_number", children: "1" })
|
|
287
287
|
] }),
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
/* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ d("div", { className: "querlo_openWrp", children: /* @__PURE__ */ d("div", { class: "querlo_bodyWrp querlo_qrlfadeInUp2", children: [
|
|
289
|
+
/* @__PURE__ */ d("div", { class: "querlo_header", style: { backgroundColor: n.data.mainColor }, children: [
|
|
290
290
|
n.data.speakerName,
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ d("div", { class: "querlo_buttonsWrp", children: [
|
|
292
|
+
/* @__PURE__ */ d(
|
|
293
293
|
"a",
|
|
294
294
|
{
|
|
295
295
|
href: "#",
|
|
296
296
|
onMouseEnter: (l) => r.toggleHoverColor(l, n.data.mainColor),
|
|
297
297
|
onMouseLeave: (l) => r.toggleHoverColor(l, ""),
|
|
298
298
|
onClick: r.toggleFullscreen,
|
|
299
|
-
children: e.fullscreen ? /* @__PURE__ */
|
|
299
|
+
children: e.fullscreen ? /* @__PURE__ */ d(ve, {}) : /* @__PURE__ */ d(ye, {})
|
|
300
300
|
}
|
|
301
301
|
),
|
|
302
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ d(
|
|
303
303
|
"a",
|
|
304
304
|
{
|
|
305
305
|
href: "#",
|
|
306
306
|
onMouseEnter: (l) => r.toggleHoverColor(l, n.data.mainColor),
|
|
307
307
|
onMouseLeave: (l) => r.toggleHoverColor(l, ""),
|
|
308
308
|
onClick: r.toggle,
|
|
309
|
-
children: /* @__PURE__ */
|
|
309
|
+
children: /* @__PURE__ */ d(H, {})
|
|
310
310
|
}
|
|
311
311
|
)
|
|
312
312
|
] })
|
|
313
313
|
] }),
|
|
314
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ d("div", { className: "querlo_iframeWrp", children: e.inited ? /* @__PURE__ */ d("iframe", { allow: "microphone;camera;midi;encrypted-media;", src: i, id: "querloIframe", seamless: !0 }) : "" })
|
|
315
315
|
] }) }),
|
|
316
316
|
Q,
|
|
317
|
-
e.showImagePopup ? /* @__PURE__ */
|
|
317
|
+
e.showImagePopup ? /* @__PURE__ */ d(we, { cb: r.closeImagePopup, data: e.showImagePopup, color: n.data.mainColor }) : ""
|
|
318
318
|
] });
|
|
319
319
|
return {
|
|
320
320
|
/*
|
|
321
321
|
* standard iframe inpage content
|
|
322
322
|
*
|
|
323
323
|
*/
|
|
324
|
-
inpage: /* @__PURE__ */
|
|
324
|
+
inpage: /* @__PURE__ */ d("iframe", { allow: "microphone;camera;midi;encrypted-media;", src: i, seamless: !0 }),
|
|
325
325
|
/*
|
|
326
326
|
* digitransforum.com
|
|
327
327
|
* classic window iconfied like bitlanders
|
|
@@ -380,10 +380,10 @@ function qe(n, e, t, i, r) {
|
|
|
380
380
|
* popup_center
|
|
381
381
|
* embedded initially, centered popup on click
|
|
382
382
|
*/
|
|
383
|
-
inpage_popup: /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
e.show && /* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
383
|
+
inpage_popup: /* @__PURE__ */ d("div", { className: `querlo_popup_center ${e.show ? "open" : "closed"}`, children: [
|
|
384
|
+
/* @__PURE__ */ d("div", { className: "querlo_overlay", onClick: r.toggle }),
|
|
385
|
+
e.show && /* @__PURE__ */ d("div", { className: "querlo_close_btn", onClick: r.toggle, style: { backgroundColor: n.data.mainColor }, children: /* @__PURE__ */ d(H, {}) }),
|
|
386
|
+
/* @__PURE__ */ d("iframe", { allow: "microphone;camera;midi;encrypted-media;", src: i, seamless: !0 }),
|
|
387
387
|
Q
|
|
388
388
|
] })
|
|
389
389
|
}[t];
|
|
@@ -485,7 +485,7 @@ class Ee extends k {
|
|
|
485
485
|
}
|
|
486
486
|
render(t, i) {
|
|
487
487
|
let o = "https://chat.querlo.com/" + t.data.id + "?utm_source_js=" + t.data.referrer;
|
|
488
|
-
return t.data.params && (o += "&" + t.data.params), qe(t, i, t.data.template, o, this);
|
|
488
|
+
return t.data.params && (o += "&" + t.data.params), t.data.debug && (o += "&debug=1"), qe(t, i, t.data.template, o, this);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
const b = class b {
|
|
@@ -508,9 +508,10 @@ const b = class b {
|
|
|
508
508
|
speakerName: i.speakerName,
|
|
509
509
|
introTxt: i.introTxt,
|
|
510
510
|
delay: i.delay,
|
|
511
|
-
mainColor: i.mainColor || "rgb(107,185,240)"
|
|
511
|
+
mainColor: i.mainColor || "rgb(107,185,240)",
|
|
512
|
+
debug: i.debug === "true"
|
|
512
513
|
};
|
|
513
|
-
t.classList.add(r.template), t.classList.add(r.posX), t.classList.add(r.posY), (r.template === "inpage" || r.template === "popup_center" || r.template === "inpage_popup") && (t.style.width = r.width + "px", t.style.minHeight = r.height + "px"), fe(/* @__PURE__ */
|
|
514
|
+
t.classList.add(r.template), t.classList.add(r.posX), t.classList.add(r.posY), (r.template === "inpage" || r.template === "popup_center" || r.template === "inpage_popup") && (t.style.width = r.width + "px", t.style.minHeight = r.height + "px"), fe(/* @__PURE__ */ d(Ee, { data: r }), t);
|
|
514
515
|
});
|
|
515
516
|
}
|
|
516
517
|
};
|
|
@@ -531,7 +532,7 @@ class ke {
|
|
|
531
532
|
*/
|
|
532
533
|
embed(e) {
|
|
533
534
|
let t = null;
|
|
534
|
-
e.container && (t = typeof e.container == "string" ? document.querySelector(e.container) : e.container), t || (t = document.createElement("div"), document.body.appendChild(t)), t.classList.add("querlo"), e.id && (t.dataset.id = e.id), e.width && (t.dataset.width = e.width), e.height && (t.dataset.height = e.height), e.template && (t.dataset.template = e.template), e.posX && (t.dataset.posX = e.posX), e.posY && (t.dataset.posY = e.posY), e.mainColor && (t.dataset.mainColor = e.mainColor), e.speakerImg && (t.dataset.speakerImg = e.speakerImg), e.speakerName && (t.dataset.speakerName = e.speakerName), e.introTxt && (t.dataset.introTxt = e.introTxt), e.delay && (t.dataset.delay = e.delay);
|
|
535
|
+
e.container && (t = typeof e.container == "string" ? document.querySelector(e.container) : e.container), t || (t = document.createElement("div"), document.body.appendChild(t)), t.classList.add("querlo"), e.id && (t.dataset.id = e.id), e.width && (t.dataset.width = e.width), e.height && (t.dataset.height = e.height), e.template && (t.dataset.template = e.template), e.posX && (t.dataset.posX = e.posX), e.posY && (t.dataset.posY = e.posY), e.mainColor && (t.dataset.mainColor = e.mainColor), e.speakerImg && (t.dataset.speakerImg = e.speakerImg), e.speakerName && (t.dataset.speakerName = e.speakerName), e.introTxt && (t.dataset.introTxt = e.introTxt), e.delay && (t.dataset.delay = e.delay), e.debug && (t.dataset.debug = "true");
|
|
535
536
|
const i = t, r = {
|
|
536
537
|
element: i,
|
|
537
538
|
open: (o = !1) => this.sendCommandToElement(i, "OPEN", { fullscreen: o }),
|
package/dist/querlo-sdk.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.querlo{transition:all .5s cubic-bezier(.16,1,.3,1)}.querlo *{margin:0;padding:0;border:0;vertical-align:baseline;box-sizing:border-box;font-family:Roboto,Helvetica Neue,sans-serif;color:#444}.querlo .iframeWrp{transition:all .5s cubic-bezier(.16,1,.3,1)}.querlo iframe{display:none;width:100%;border-width:0}.querlo .querlo_open iframe{display:block}.querlo.esd{position:fixed;width:500px;background:none;z-index:9999;transition:all .5s cubic-bezier(.16,1,.3,1)}.querlo.esd.bottom{bottom:10px}.querlo.esd.top{top:10px}.querlo.esd.right{right:10px}.querlo.esd.left{left:10px}.querlo.esd.querlo_fullscreen{width:100%!important;height:100%!important;bottom:0!important;right:0!important;left:0!important;top:0!important}.querlo.esd.querlo_fullscreen .querlo_iframeWrp{height:calc(100% - 50px)!important;max-height:none}.querlo.esd.querlo_fullscreen .querlo_chatWrp,.querlo.esd.querlo_fullscreen .querlo_openWrp,.querlo.esd.querlo_fullscreen .querlo_bodyWrp{height:100%!important}.querlo.esd.querlo_fullscreen .querlo_avatar{margin:0 10px 10px 0;box-shadow:none}.querlo.esd.querlo_fullscreen .querlo_message{margin-bottom:10px}.querlo.esd.querlo_fullscreen .querlo_bodyWrp{box-shadow:none;border-radius:0;margin-bottom:0}.querlo.esd.querlo_fullscreen .querlo_copy{float:none;margin:0}.querlo.esd.querlo_fullscreen .querlo_number{margin:0 10px 10px 0}.querlo.esd.querlo_fullscreen .querlo_resizeButton{margin-right:68px!important}@media screen and (max-width:812px){.querlo.esd.querlo_fullscreen .querlo_resizeButton{display:none}}.querlo.esd .querlo_iframeWrp{background:#fff;height:calc(100vh - 90px);max-height:600px}.querlo.esd .querlo_iframeWrp iframe{height:100%}@media screen and (max-width:812px){.querlo.esd .querlo_iframeWrp{height:calc(100% - 50px);max-height:none}}.querlo.esd .querlo_chatWrp{position:relative}@media screen and (max-width:812px){.querlo.esd .querlo_chatWrp{height:100%}}@media screen and (max-width:812px){.querlo.esd .querlo_chatWrp.querlo_open{width:100%;height:100%;top:0;bottom:0;right:0;left:0;position:fixed}}.querlo.esd .querlo_chatBar{position:fixed}.querlo.esd.bottom .querlo_chatBar{bottom:10px}.querlo.esd.top .querlo_chatBar{top:10px}.querlo.esd.right .querlo_chatBar{right:10px}.querlo.esd.left .querlo_chatBar{left:10px}.querlo.esd .querlo_open .querlo_chatBar{display:none}.querlo.esd .querlo_message{padding:12px 16px 12px 18px;font-size:13px;color:#000;background:#fff;max-width:260px;box-shadow:0 0 10px #00000026,0 0 30px #0000004d;border-radius:5px;position:relative}@media screen and (max-width:812px){.querlo.esd .querlo_message{margin-bottom:10px}}.querlo.esd .querlo_message:after{content:"";position:absolute;width:0;height:0;border:10px solid transparent;margin-top:-5px}.querlo.esd.right .querlo_message{float:right;margin-right:10px}.querlo.esd.right .querlo_message:after{right:-10px;border-left-color:#fff}.querlo.esd.left .querlo_message{float:left;margin-left:10px}.querlo.esd.left .querlo_message:after{left:-10px;border-right-color:#fff}.querlo.esd.bottom .querlo_message:after{bottom:20px}.querlo.esd.top .querlo_message:after{top:20px}.querlo.esd .querlo_avatar{border-radius:50%;border:3px solid #f1592a;cursor:pointer;width:60px;height:60px;overflow:hidden;transition:all .3s;transform-origin:50% 50%;box-shadow:0 0 10px #00000026,0 0 30px #0000004d}@media screen and (max-width:812px){.querlo.esd .querlo_avatar{margin:0 10px 10px 0;box-shadow:none}}.querlo.esd .querlo_avatar img{width:100%}.querlo.esd.right .querlo_avatar{float:right}.querlo.esd.left .querlo_avatar{float:left}.querlo.esd .querlo_avatar:hover{width:60px;height:60px}.querlo.esd .querlo_openWrp{display:none}@media screen and (max-width:812px){.querlo.esd .querlo_openWrp{height:100%}}.querlo.esd .querlo_open .querlo_openWrp{display:block;animation-duration:.4s;animation-timing-function:cubic-bezier(.16,1,.3,1);animation-fill-mode:forwards}.querlo.esd .querlo_bodyWrp{box-shadow:0 0 10px #00000026,0 0 30px #0000004d;border-radius:5px;overflow:hidden}@media screen and (max-width:812px){.querlo.esd .querlo_bodyWrp{box-shadow:none;border-radius:0;height:100%}}.querlo.esd.bottom .querlo_bodyWrp{margin-bottom:10px}.querlo.esd.top .querlo_bodyWrp{margin-top:10px}.querlo.esd.top .querlo_openWrp{display:flex;flex-direction:column-reverse}.querlo.esd .querlo_header{background:#f1592a;color:#fff;height:50px;line-height:48px;font-size:16px;text-align:center}.querlo.esd .querlo_header .querlo_buttonsWrp{float:right;height:50px;display:flex;justify-content:center;align-items:center}.querlo.esd .querlo_header .querlo_buttonsWrp a{display:flex;justify-content:center;align-items:center;padding:10px 13px}.querlo.esd .querlo_header .querlo_buttonsWrp svg{fill:#fff;height:48px}.querlo.esd .querlo_header .querlo_buttonsWrp a:hover{background:#fff}.querlo.esd .querlo_copy{display:block;padding:10px;font-size:12px;background:#fff;text-decoration:none;color:#a8b6c2}@media screen and (max-width:812px){.querlo.esd .querlo_copy{float:none;margin:0}}.querlo.esd .querlo_copy span{font-size:12px;color:#23a7d6}.querlo.esd .querlo_copy:hover{background:#23a7d6;color:#fff}.querlo.esd .querlo_copy:hover span{color:#fff}.querlo.esd .querlo_number{position:absolute;width:20px;height:20px;right:-4px;top:-4px;border-radius:50%;color:#fff;font-size:11px;border:2px solid #fff;background:#f82d6c;line-height:18px;text-align:center}@media screen and (max-width:812px){.querlo.esd .querlo_number{margin:0 10px 10px 0}}.querlo.esd.top,.querlo.esd.top .querlo_openWrp{animation-name:qrlEntranceTop}.querlo.esd.bottom,.querlo.esd.bottom .querlo_openWrp{animation-name:qrlEntranceBottom}.querlo.esd footer{text-align:center}.qrlpulse{animation-iteration-count:infinite;animation-name:qrlpulse;animation-duration:2s;animation-fill-mode:both}@keyframes qrlpulse{0%{transform:scaleZ(1)}50%{transform:scale3d(1.05,1.05,1.05)}to{transform:scaleZ(1)}}.qrlfadeInUp{animation-name:qrlfadeInUp;animation-duration:1s;animation-delay:1s;animation-fill-mode:both}.qrlfadeInUp2{animation-name:qrlfadeInUp;animation-duration:.5s;animation-fill-mode:both}@keyframes qrlEntranceBottom{0%{opacity:0;transform:scale(.9) translateY(20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes qrlEntranceTop{0%{opacity:0;transform:scale(.9) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes qrlfadeInUp{0%{opacity:0;transform:translate3d(0,500px,0)}to{opacity:1;transform:none}}.querlo.inpage{display:flex;flex-direction:column}.querlo.inpage iframe{flex:1;display:block}.querlo .querlo_icon{display:inline-block;width:1em;height:1em;stroke-width:0;stroke:currentColor;fill:currentColor}.querlo .icon-help-circled{width:.857421875em}.querlo.inpage_popup{display:flex;flex-direction:column}.querlo.inpage_popup iframe{display:block}.querlo.inpage_popup .querlo_popup_center{flex:1;display:flex;flex-direction:column;transition:background-color .3s ease-in-out}.querlo.inpage_popup .querlo_popup_center.closed{position:relative;cursor:pointer}.querlo.inpage_popup .querlo_popup_center.closed iframe{flex:1;height:auto;pointer-events:none}.querlo.inpage_popup .querlo_popup_center.closed .querlo_overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background:transparent}.querlo.inpage_popup .querlo_popup_center.open{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:90%;max-width:800px;height:80vh;z-index:99999;box-shadow:0 0 20px #0000004d;background:#fff;border-radius:8px;overflow:hidden;animation:zoomIn .4s cubic-bezier(.16,1,.3,1) forwards}.querlo.inpage_popup .querlo_popup_center.open .querlo_overlay{display:none}.querlo.inpage_popup .querlo_popup_center.open iframe{width:100%;height:100%;border:none}.querlo.inpage_popup .querlo_popup_center.open .querlo_close_btn{position:absolute;top:10px;right:10px;width:30px;height:30px;background:#00000080;color:#fff;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:20;opacity:0;animation:fadeIn .3s ease-in-out .3s forwards}.querlo.inpage_popup .querlo_popup_center.open .querlo_close_btn svg{width:16px;height:16px;fill:#fff}.querlo.inpage_popup .querlo_popup_center.open .querlo_close_btn:hover{background:#000000b3}@media(max-width:768px){.querlo.inpage_popup .querlo_popup_center.open{width:100%;height:100%;max-width:none;max-height:none;border-radius:0}}@keyframes zoomIn{0%{position:fixed;top:var(--origin-top);left:var(--origin-left);width:var(--origin-width);height:var(--origin-height);transform:translate(0);border-radius:0}to{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:90%;max-width:990px;height:80vh;border-radius:8px}}@media(max-width:768px){@keyframes zoomIn{0%{position:fixed;top:var(--origin-top);left:var(--origin-left);width:var(--origin-width);height:var(--origin-height);transform:translate(0);border-radius:0}to{position:fixed;top:0;left:0;transform:translate(0);width:100%;height:100%;border-radius:0}}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.querlo .querlo_popup{position:fixed;top:0;left:0;right:0;bottom:0;background:#0003;display:flex;justify-content:center;align-items:center}.querlo .querlo_popup .querlo_contentWrp{border-radius:5px;width:95%;height:auto;background:#fff;overflow:hidden;box-shadow:0 2px 6px #0000002b}.querlo .querlo_popup .querlo_header{height:50px!important}.querlo .querlo_popup .querlo_close{background:none!important;box-shadow:none!important}.querlo .querlo_popup img{width:100%}.querlo .querlo_popup section{height:calc(100% - 60px);padding:15px!important}.querlo .querlo_popup section iframe{border:0;display:block;width:100%;height:100%}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
-
(function(q,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(q=typeof globalThis<"u"?globalThis:q||self,y(q.Querlo={}))})(this,(function(q){"use strict";var ke=Object.defineProperty;var xe=(q,y,p)=>y in q?ke(q,y,{enumerable:!0,configurable:!0,writable:!0,value:p}):q[y]=p;var w=(q,y,p)=>xe(q,typeof y!="symbol"?y+"":y,p);var y,p,F,T,G,L={},$=[],ae=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function E(n,e){for(var t in e)n[t]=e[t];return n}function Q(n){var e=n.parentNode;e&&e.removeChild(n)}function de(n,e,t){var i,r,o,a={};for(o in e)o=="key"?i=e[o]:o=="ref"?r=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?y.call(arguments,2):t),typeof n=="function"&&n.defaultProps!=null)for(o in n.defaultProps)a[o]===void 0&&(a[o]=n.defaultProps[o]);return N(n,a,i,r,null)}function N(n,e,t,i,r){var o={type:n,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:r??++F};return r==null&&p.vnode!=null&&p.vnode(o),o}function z(n){return n.children}function x(n,e){this.props=n,this.context=e}function M(n,e){if(e==null)return n.__?M(n.__,n.__.__k.indexOf(n)+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type=="function"?M(n):null}function X(n){var e,t;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,e=0;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null){n.__e=n.__c.base=t.__e;break}return X(n)}}function V(n){(!n.__d&&(n.__d=!0)&&T.push(n)&&!W.__r++||G!==p.debounceRendering)&&((G=p.debounceRendering)||setTimeout)(W)}function W(){for(var n;W.__r=T.length;)n=T.sort(function(e,t){return e.__v.__b-t.__v.__b}),T=[],n.some(function(e){var t,i,r,o,a,l;e.__d&&(a=(o=(t=e).__v).__e,(l=t.__P)&&(i=[],(r=E({},o)).__v=o.__v+1,H(l,o,r,t.__n,l.ownerSVGElement!==void 0,o.__h!=null?[a]:null,i,a??M(o),o.__h),ne(i,o),o.__e!=a&&X(o)))})}function Y(n,e,t,i,r,o,a,l,u,f){var s,m,_,c,h,S,g,v=i&&i.__k||$,C=v.length;for(t.__k=[],s=0;s<e.length;s++)if((c=t.__k[s]=(c=e[s])==null||typeof c=="boolean"?null:typeof c=="string"||typeof c=="number"||typeof c=="bigint"?N(null,c,null,null,c):Array.isArray(c)?N(z,{children:c},null,null,null):c.__b>0?N(c.type,c.props,c.key,null,c.__v):c)!=null){if(c.__=t,c.__b=t.__b+1,(_=v[s])===null||_&&c.key==_.key&&c.type===_.type)v[s]=void 0;else for(m=0;m<C;m++){if((_=v[m])&&c.key==_.key&&c.type===_.type){v[m]=void 0;break}_=null}H(n,c,_=_||L,r,o,a,l,u,f),h=c.__e,(m=c.ref)&&_.ref!=m&&(g||(g=[]),_.ref&&g.push(_.ref,null,c),g.push(m,c.__c||h,c)),h!=null?(S==null&&(S=h),typeof c.type=="function"&&c.__k===_.__k?c.__d=u=Z(c,u,n):u=J(n,c,_,v,h,u),typeof t.type=="function"&&(t.__d=u)):u&&_.__e==u&&u.parentNode!=n&&(u=M(_))}for(t.__e=S,s=C;s--;)v[s]!=null&&(typeof t.type=="function"&&v[s].__e!=null&&v[s].__e==t.__d&&(t.__d=M(i,s+1)),oe(v[s],v[s]));if(g)for(s=0;s<g.length;s++)ie(g[s],g[++s],g[++s])}function Z(n,e,t){for(var i,r=n.__k,o=0;r&&o<r.length;o++)(i=r[o])&&(i.__=n,e=typeof i.type=="function"?Z(i,e,t):J(t,i,i,r,i.__e,e));return e}function J(n,e,t,i,r,o){var a,l,u;if(e.__d!==void 0)a=e.__d,e.__d=void 0;else if(t==null||r!=o||r.parentNode==null)e:if(o==null||o.parentNode!==n)n.appendChild(r),a=null;else{for(l=o,u=0;(l=l.nextSibling)&&u<i.length;u+=2)if(l==r)break e;n.insertBefore(r,o),a=o}return a!==void 0?a:r.nextSibling}function ce(n,e,t,i,r){var o;for(o in t)o==="children"||o==="key"||o in e||A(n,o,null,t[o],i);for(o in e)r&&typeof e[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||t[o]===e[o]||A(n,o,e[o],t[o],i)}function K(n,e,t){e[0]==="-"?n.setProperty(e,t):n[e]=t==null?"":typeof t!="number"||ae.test(e)?t:t+"px"}function A(n,e,t,i,r){var o;e:if(e==="style")if(typeof t=="string")n.style.cssText=t;else{if(typeof i=="string"&&(n.style.cssText=i=""),i)for(e in i)t&&e in t||K(n.style,e,"");if(t)for(e in t)i&&t[e]===i[e]||K(n.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in n?e.toLowerCase().slice(2):e.slice(2),n.l||(n.l={}),n.l[e+o]=t,t?i||n.addEventListener(e,o?te:ee,o):n.removeEventListener(e,o?te:ee,o);else if(e!=="dangerouslySetInnerHTML"){if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in n)try{n[e]=t??"";break e}catch{}typeof t=="function"||(t!=null&&(t!==!1||e[0]==="a"&&e[1]==="r")?n.setAttribute(e,t):n.removeAttribute(e))}}function ee(n){this.l[n.type+!1](p.event?p.event(n):n)}function te(n){this.l[n.type+!0](p.event?p.event(n):n)}function H(n,e,t,i,r,o,a,l,u){var f,s,m,_,c,h,S,g,v,C,I,le,U,b=e.type;if(e.constructor!==void 0)return null;t.__h!=null&&(u=t.__h,l=e.__e=t.__e,e.__h=null,o=[l]),(f=p.__b)&&f(e);try{e:if(typeof b=="function"){if(g=e.props,v=(f=b.contextType)&&i[f.__c],C=f?v?v.props.value:f.__:i,t.__c?S=(s=e.__c=t.__c).__=s.__E:("prototype"in b&&b.prototype.render?e.__c=s=new b(g,C):(e.__c=s=new x(g,C),s.constructor=b,s.render=ue),v&&v.sub(s),s.props=g,s.state||(s.state={}),s.context=C,s.__n=i,m=s.__d=!0,s.__h=[]),s.__s==null&&(s.__s=s.state),b.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=E({},s.__s)),E(s.__s,b.getDerivedStateFromProps(g,s.__s))),_=s.props,c=s.state,m)b.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(b.getDerivedStateFromProps==null&&g!==_&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(g,C),!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(g,s.__s,C)===!1||e.__v===t.__v){s.props=g,s.state=s.__s,e.__v!==t.__v&&(s.__d=!1),s.__v=e,e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(B){B&&(B.__=e)}),s.__h.length&&a.push(s);break e}s.componentWillUpdate!=null&&s.componentWillUpdate(g,s.__s,C),s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(_,c,h)})}if(s.context=C,s.props=g,s.__v=e,s.__P=n,I=p.__r,le=0,"prototype"in b&&b.prototype.render)s.state=s.__s,s.__d=!1,I&&I(e),f=s.render(s.props,s.state,s.context);else do s.__d=!1,I&&I(e),f=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++le<25);s.state=s.__s,s.getChildContext!=null&&(i=E(E({},i),s.getChildContext())),m||s.getSnapshotBeforeUpdate==null||(h=s.getSnapshotBeforeUpdate(_,c)),U=f!=null&&f.type===z&&f.key==null?f.props.children:f,Y(n,Array.isArray(U)?U:[U],e,t,i,r,o,a,l,u),s.base=e.__e,e.__h=null,s.__h.length&&a.push(s),S&&(s.__E=s.__=null),s.__e=!1}else o==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=_e(t.__e,e,t,i,r,o,a,u);(f=p.diffed)&&f(e)}catch(B){e.__v=null,(u||o!=null)&&(e.__e=l,e.__h=!!u,o[o.indexOf(l)]=null),p.__e(B,e,t)}}function ne(n,e){p.__c&&p.__c(e,n),n.some(function(t){try{n=t.__h,t.__h=[],n.some(function(i){i.call(t)})}catch(i){p.__e(i,t.__v)}})}function _e(n,e,t,i,r,o,a,l){var u,f,s,m=t.props,_=e.props,c=e.type,h=0;if(c==="svg"&&(r=!0),o!=null){for(;h<o.length;h++)if((u=o[h])&&"setAttribute"in u==!!c&&(c?u.localName===c:u.nodeType===3)){n=u,o[h]=null;break}}if(n==null){if(c===null)return document.createTextNode(_);n=r?document.createElementNS("http://www.w3.org/2000/svg",c):document.createElement(c,_.is&&_),o=null,l=!1}if(c===null)m===_||l&&n.data===_||(n.data=_);else{if(o=o&&y.call(n.childNodes),f=(m=t.props||L).dangerouslySetInnerHTML,s=_.dangerouslySetInnerHTML,!l){if(o!=null)for(m={},h=0;h<n.attributes.length;h++)m[n.attributes[h].name]=n.attributes[h].value;(s||f)&&(s&&(f&&s.__html==f.__html||s.__html===n.innerHTML)||(n.innerHTML=s&&s.__html||""))}if(ce(n,_,m,r,l),s)e.__k=[];else if(h=e.props.children,Y(n,Array.isArray(h)?h:[h],e,t,i,r&&c!=="foreignObject",o,a,o?o[0]:t.__k&&M(t,0),l),o!=null)for(h=o.length;h--;)o[h]!=null&&Q(o[h]);l||("value"in _&&(h=_.value)!==void 0&&(h!==n.value||c==="progress"&&!h||c==="option"&&h!==m.value)&&A(n,"value",h,m.value,!1),"checked"in _&&(h=_.checked)!==void 0&&h!==n.checked&&A(n,"checked",h,m.checked,!1))}return n}function ie(n,e,t){try{typeof n=="function"?n(e):n.current=e}catch(i){p.__e(i,t)}}function oe(n,e,t){var i,r;if(p.unmount&&p.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||ie(i,null,e)),(i=n.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){p.__e(o,e)}i.base=i.__P=null}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&oe(i[r],e,typeof n.type!="function");t||n.__e==null||Q(n.__e),n.__e=n.__d=void 0}function ue(n,e,t){return this.constructor(n,t)}function he(n,e,t){var i,r,o;p.__&&p.__(n,e),r=(i=!1)?null:e.__k,o=[],H(e,n=e.__k=de(z,null,[n]),r||L,L,e.ownerSVGElement!==void 0,r?null:e.firstChild?y.call(e.childNodes):null,o,r?r.__e:e.firstChild,i),ne(o,n)}y=$.slice,p={__e:function(n,e,t,i){for(var r,o,a;e=e.__;)if((r=e.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(n)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(n,i||{}),a=r.__d),a)return r.__E=r}catch(l){n=l}throw n}},F=0,x.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=E({},this.state),typeof n=="function"&&(n=n(E({},t),this.props)),n&&E(t,n),n!=null&&this.__v&&(e&&this.__h.push(e),V(this))},x.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),V(this))},x.prototype.render=z,T=[],W.__r=0;var fe=0;function d(n,e,t,i,r){var o,a,l={};for(a in e)a=="ref"?o=e[a]:l[a]=e[a];var u={type:n,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--fe,__source:r,__self:i};if(typeof n=="function"&&(o=n.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return p.vnode&&p.vnode(u),u}function pe(){let n,e=me("utm_source");return e?n=e:document.referrer?n=document.referrer:n="",encodeURIComponent(n+"")}function me(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");let e=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=e.exec(location.search);return t===null?"":decodeURIComponent(t[1].replace(/\+/g," "))}function ge(){return d("svg",{className:"querlo_icon icon-window-minimize",children:d("use",{xlinkHref:"#icon-window-minimize"})})}function ve(){return d("svg",{className:"querlo_icon icon-window-maximize",children:d("use",{xlinkHref:"#icon-window-maximize"})})}function D(){return d("svg",{className:"querlo_icon icon-cancel",children:d("use",{xlinkHref:"#icon-cancel"})})}const re=d("svg",{style:"position: absolute; width: 0; height: 0; overflow: hidden;",children:d("defs",{children:[d("symbol",{id:"icon-cancel",viewBox:"0 0 25 32",children:[d("title",{children:"cancel"}),d("path",{d:"M23.168 23.616q0 0.704-0.48 1.216l-2.432 2.432q-0.512 0.48-1.216 0.48t-1.216-0.48l-5.248-5.28-5.248 5.28q-0.512 0.48-1.216 0.48t-1.216-0.48l-2.432-2.432q-0.512-0.512-0.512-1.216t0.512-1.216l5.248-5.248-5.248-5.248q-0.512-0.512-0.512-1.216t0.512-1.216l2.432-2.432q0.512-0.512 1.216-0.512t1.216 0.512l5.248 5.248 5.248-5.248q0.512-0.512 1.216-0.512t1.216 0.512l2.432 2.432q0.48 0.48 0.48 1.216t-0.48 1.216l-5.248 5.248 5.248 5.248q0.48 0.48 0.48 1.216z"})]}),d("symbol",{id:"icon-help-circled",viewBox:"0 0 27 32",children:[d("title",{children:"help-circled"}),d("path",{d:"M16 24.576v-3.424q0-0.256-0.16-0.416t-0.416-0.16h-3.424q-0.256 0-0.416 0.16t-0.16 0.416v3.424q0 0.256 0.16 0.416t0.416 0.16h3.424q0.256 0 0.416-0.16t0.16-0.416zM20.576 12.576q0-1.568-0.992-2.912t-2.464-2.080-3.040-0.736q-4.352 0-6.624 3.808-0.288 0.416 0.128 0.768l2.368 1.76q0.128 0.128 0.32 0.128 0.288 0 0.448-0.224 0.96-1.216 1.536-1.632 0.608-0.448 1.536-0.448 0.864 0 1.536 0.48t0.672 1.056q0 0.672-0.352 1.088t-1.216 0.8q-1.12 0.48-2.080 1.536t-0.928 2.24v0.64q0 0.256 0.16 0.416t0.416 0.16h3.424q0.256 0 0.416-0.16t0.16-0.416q0-0.32 0.384-0.864t0.96-0.896q0.576-0.32 0.896-0.512t0.8-0.608 0.8-0.864 0.512-1.088 0.224-1.44zM27.424 16q0 3.744-1.824 6.88t-4.992 4.992-6.88 1.856-6.912-1.856-4.96-4.992-1.856-6.88 1.856-6.88 4.96-4.992 6.912-1.856 6.88 1.856 4.992 4.992 1.824 6.88z"})]}),d("symbol",{id:"icon-comment",viewBox:"0 0 32 32",children:[d("title",{children:"comment"}),d("path",{d:"M32 16q0 3.104-2.144 5.728t-5.824 4.16-8.032 1.536q-1.248 0-2.592-0.128-3.52 3.104-8.224 4.32-0.864 0.256-2.016 0.384-0.32 0.032-0.544-0.16t-0.32-0.512v-0.032q-0.064-0.064 0-0.192t0.032-0.192 0.064-0.16l0.128-0.16t0.128-0.16 0.128-0.16q0.128-0.16 0.544-0.608t0.64-0.704 0.544-0.704 0.576-0.896 0.48-1.056 0.48-1.344q-2.816-1.6-4.416-3.936t-1.632-5.024q0-2.336 1.28-4.448t3.392-3.648 5.12-2.432 6.208-0.896q4.352 0 8.032 1.536t5.824 4.16 2.144 5.728z"})]}),d("symbol",{id:"icon-window-maximize",viewBox:"0 0 32 32",children:[d("title",{children:"window-maximize"}),d("path",{d:"M4.576 25.152h22.848v-13.728h-22.848v13.728zM32 5.152v21.696q0 1.184-0.832 2.016t-2.016 0.864h-26.304q-1.152 0-2.016-0.864t-0.832-2.016v-21.696q0-1.184 0.832-2.016t2.016-0.864h26.304q1.184 0 2.016 0.864t0.832 2.016z"})]}),d("symbol",{id:"icon-window-minimize",viewBox:"0 0 32 32",children:[d("title",{children:"window-minimize"}),d("path",{d:"M32 23.424v3.424q0 1.184-0.832 2.016t-2.016 0.864h-26.304q-1.152 0-2.016-0.864t-0.832-2.016v-3.424q0-1.184 0.832-2.016t2.016-0.832h26.304q1.184 0 2.016 0.832t0.832 2.016z"})]})]})});class ye extends x{constructor(){super()}render(e){return d("div",{class:"querlo_popup querlo_img",children:d("div",{class:"querlo_contentWrp",children:[d("div",{class:"querlo_header",style:{backgroundColor:e.color},children:d("div",{class:"querlo_close",onClick:e.cb,children:d(D,{})})}),d("section",{id:"querlo_docWrp",children:d("img",{src:e.data.img})})]})})}}function we(n,e,t,i,r){const o=d("div",{className:e.show?"querlo_chatWrp querlo_open":"querlo_chatWrp",children:[d("div",{className:"querlo_chatBar qrlfadeInUp",onClick:r.toggle,children:[d("div",{className:e.inited?"querlo_avatar":"querlo_avatar qrlpulse",style:{borderColor:n.data.mainColor},children:d("img",{src:n.data.speakerImg?n.data.speakerImg:"https://static.querlo.com/image_uploads/avatar1/608_5f2bcb679692b_png_small.png"})}),!e.inited&&n.data.introTxt?d("div",{class:"querlo_message",children:n.data.introTxt}):"",e.inited?"":d("div",{className:"querlo_number",children:"1"})]}),d("div",{className:"querlo_openWrp",children:d("div",{class:"querlo_bodyWrp querlo_qrlfadeInUp2",children:[d("div",{class:"querlo_header",style:{backgroundColor:n.data.mainColor},children:[n.data.speakerName,d("div",{class:"querlo_buttonsWrp",children:[d("a",{href:"#",onMouseEnter:l=>r.toggleHoverColor(l,n.data.mainColor),onMouseLeave:l=>r.toggleHoverColor(l,""),onClick:r.toggleFullscreen,children:e.fullscreen?d(ge,{}):d(ve,{})}),d("a",{href:"#",onMouseEnter:l=>r.toggleHoverColor(l,n.data.mainColor),onMouseLeave:l=>r.toggleHoverColor(l,""),onClick:r.toggle,children:d(D,{})})]})]}),d("div",{className:"querlo_iframeWrp",children:e.inited?d("iframe",{allow:"microphone;camera;midi;encrypted-media;",src:i,id:"querloIframe",seamless:!0}):""})]})}),re,e.showImagePopup?d(ye,{cb:r.closeImagePopup,data:e.showImagePopup,color:n.data.mainColor}):""]});return{inpage:d("iframe",{allow:"microphone;camera;midi;encrypted-media;",src:i,seamless:!0}),esd:o,inpage_popup:d("div",{className:`querlo_popup_center ${e.show?"open":"closed"}`,children:[d("div",{className:"querlo_overlay",onClick:r.toggle}),e.show&&d("div",{className:"querlo_close_btn",onClick:r.toggle,style:{backgroundColor:n.data.mainColor},children:d(D,{})}),d("iframe",{allow:"microphone;camera;midi;encrypted-media;",src:i,seamless:!0}),re]})}[t]}const qe=window.location.href,O="querlo_fullscreen",se=qe.split("/");se[0]+""+se[2];function P(n,e){n&&(e.width&&typeof e.width!="number"&&e.width.indexOf("%")!==-1?n.classList.add(O):(e.width&&(n.style.width=e.width+"px"),n.classList.remove(O)))}function be(n){let e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState===4)return e.status>=200&&e.status<300?(n.cb&&n.cb(e.responseText),e.responseText):(console.log("error",e),n.cb&&n.cb(!1),e)},e.open("GET",n.url),e.send()}class Ce extends x{constructor(){super();w(this,"toggle",(t,i)=>{var l;t&&t.preventDefault&&t.preventDefault();const r=(l=this.base)==null?void 0:l.parentElement;if(!r)return;if(!this.state.show){const u=this.base.classList.contains("querlo_popup_center")?this.base:this.base.querySelector(".querlo_popup_center");if(u){const f=u.getBoundingClientRect();r.style.setProperty("--origin-top",f.top+"px"),r.style.setProperty("--origin-left",f.left+"px"),r.style.setProperty("--origin-width",f.width+"px"),r.style.setProperty("--origin-height",f.height+"px")}}const o=!this.state.show,a=i!==void 0?i:o?this.state.fullscreen:!1;this.setState({inited:!0,show:o,fullscreen:a}),P(r,a?{width:"100%"}:{width:this.props.data.width,height:this.props.data.height})});w(this,"toggleHoverColor",(t,i)=>{const r=t.target.querySelector("svg");r.style.fill=i});w(this,"toggleFullscreen",t=>{var o;t&&t.preventDefault();const i=!this.state.fullscreen,r=(o=this.base)==null?void 0:o.parentElement;r&&(P(r,i?{width:"100%"}:{width:this.props.data.width,height:this.props.data.height}),this.setState({fullscreen:i}))});w(this,"handleScopedCommand",t=>{const{name:i,params:r}=t.detail;i==="OPEN"&&!this.state.show&&this.toggle(!1,r==null?void 0:r.fullscreen),i==="CLOSE"&&this.state.show&&this.toggle(!1),i==="RESIZE_CLIENT"&&!this.state.fullscreen&&P(this.base,r)});w(this,"closeImagePopup",()=>{this.setState({showImagePopup:!1})});w(this,"receiveMessage",t=>{var u,f,s,m;const i=(u=this.base)==null?void 0:u.querySelector("iframe"),r=i==null?void 0:i.contentWindow,o=t.source===r,a=t.source===window;if(!o&&!a)return;const l=t.data.command;if(t.data.querloMessageType==="clientEvent"){if(l.name==="OPEN"&&!this.state.show&&this.toggle(!1,((f=l.params)==null?void 0:f.fullscreen)||((s=l.params)==null?void 0:s.fullScreen)),l.name==="CLOSE"&&this.state.show&&this.toggle(!1),l.name==="RESIZE_CLIENT"&&!this.state.fullscreen&&o){const _=(m=this.base)==null?void 0:m.parentElement;_&&P(_,l.params)}l.name==="XHR_CALL"&&o&&be(t.data.command.params),l.name==="OPEN_IMAGE_POPUP"&&o&&this.setState({showImagePopup:l.params})}});w(this,"stopPropagation",t=>t.stopPropagation());this.state={inited:!1,show:!1}}componentDidMount(){var i,r;if(this.props.data.delay&&setTimeout(()=>{!this.state.inited&&!this.state.show&&this.toggle(!1)},this.props.data.delay),this.props.template==="inpage"||this.props.template==="popup_center"||this.props.template==="inpage_popup"){const o=(i=this.base)==null?void 0:i.parentElement;o&&P(o,{width:this.props.data.width,height:this.props.data.height})}window.addEventListener("message",this.receiveMessage,!1);const t=(r=this.base)==null?void 0:r.parentElement;t&&t.addEventListener("querlo-command",this.handleScopedCommand)}componentWillUnmount(){var i;window.removeEventListener("message",this.receiveMessage);const t=(i=this.base)==null?void 0:i.parentElement;t&&t.removeEventListener("querlo-command",this.handleScopedCommand)}render(t,i){let o="https://chat.querlo.com/"+t.data.id+"?utm_source_js="+t.data.referrer;return t.data.params&&(o+="&"+t.data.params),we(t,i,t.data.template,o,this)}}const k=class k{constructor(){this.initChat(),typeof window<"u"&&!k.listenerAdded&&(k.listenerAdded=!0,window.addEventListener("querlo-new-embed",()=>this.initChat()))}initChat(){document.querySelectorAll(".querlo, #querloEmbd").forEach(t=>{if(k.initializedElements.has(t)||!t.dataset.id)return;k.initializedElements.add(t);const i=t.dataset,r={id:i.id,width:i.querloW||i.width,height:i.querloH||i.height,template:i.template||"esd",referrer:pe(),posX:i.posX||"right",posY:i.posY||"bottom",speakerImg:i.speakerImg,speakerName:i.speakerName,introTxt:i.introTxt,delay:i.delay,mainColor:i.mainColor||"rgb(107,185,240)"};t.classList.add(r.template),t.classList.add(r.posX),t.classList.add(r.posY),(r.template==="inpage"||r.template==="popup_center"||r.template==="inpage_popup")&&(t.style.width=r.width+"px",t.style.minHeight=r.height+"px"),he(d(Ce,{data:r}),t)})}};w(k,"initializedElements",new Set),w(k,"listenerAdded",!1);let R=k;class Ee{constructor(){w(this,"listeners",new Map);w(this,"initialized",!1);w(this,"_loading",!1);w(this,"_chatbotWaiting",!1);w(this,"controllers",new Set);typeof window<"u"&&this.initMessageListener()}embed(e){let t=null;e.container&&(t=typeof e.container=="string"?document.querySelector(e.container):e.container),t||(t=document.createElement("div"),document.body.appendChild(t)),t.classList.add("querlo"),e.id&&(t.dataset.id=e.id),e.width&&(t.dataset.width=e.width),e.height&&(t.dataset.height=e.height),e.template&&(t.dataset.template=e.template),e.posX&&(t.dataset.posX=e.posX),e.posY&&(t.dataset.posY=e.posY),e.mainColor&&(t.dataset.mainColor=e.mainColor),e.speakerImg&&(t.dataset.speakerImg=e.speakerImg),e.speakerName&&(t.dataset.speakerName=e.speakerName),e.introTxt&&(t.dataset.introTxt=e.introTxt),e.delay&&(t.dataset.delay=e.delay);const i=t,r={element:i,open:(o=!1)=>this.sendCommandToElement(i,"OPEN",{fullscreen:o}),close:()=>this.sendCommandToElement(i,"CLOSE"),sendMessage:o=>{const a=i.querySelector("iframe");a!=null&&a.contentWindow&&a.contentWindow.postMessage({querloMessageType:"sendMessage",querloMessageBody:{text:o}},"*")},setVariable:(o,a)=>{const l=i.querySelector("iframe");l!=null&&l.contentWindow&&l.contentWindow.postMessage({querloMessageType:"SET-CHAT-VARIABLE",varName:o,varContent:a},"*")},destroy:()=>{this.controllers.delete(r),i.remove()}};return this.controllers.add(r),typeof window<"u"&&window.dispatchEvent(new CustomEvent("querlo-new-embed")),r}open(e=!1){this.sendCommand("OPEN",{fullscreen:e})}openFullscreen(){this.open(!0)}close(){this.sendCommand("CLOSE")}sendMessage(e){this.controllers.forEach(t=>t.sendMessage(e))}setVariable(e,t){this.controllers.forEach(i=>i.setVariable(e,t))}isLoading(){return this._loading}isWaiting(){return this._chatbotWaiting}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}off(e,t){var i;(i=this.listeners.get(e))==null||i.delete(t)}sendCommand(e,t={}){window.postMessage({querloMessageType:"clientEvent",command:{name:e,params:t}},"*")}sendCommandToElement(e,t,i={}){e.dispatchEvent(new CustomEvent("querlo-command",{detail:{name:t,params:i}}))}initMessageListener(){this.initialized||(this.initialized=!0,window.addEventListener("message",e=>{let t=e.data;if(typeof t=="string")try{t=JSON.parse(t)}catch{return}if(!t||typeof t!="object")return;const i=this.normalizeMessage(t);if(!i)return;const{querloMessageType:r,querloMessageBody:o}=i;if(r==="clientEvent"){const a=o.name||"";if(a==="WAITING_REQUEST")this._chatbotWaiting=!0,this.emit("WAITING_REQUEST",i);else if(a==="BUILD_PAGE"){this._chatbotWaiting=!1,this._loading=!1,this.emit("loading",!1);const l=this.parseBuildPageEvent(o);l&&this.emit("BUILD_PAGE",l)}}this.emit("message",i),this.emit(r,o),r==="clientEvent"&&o.name&&this.emit(o.name,o.params||o)}),console.log("[QuerloAPI] API Layer initialized — Supporting multiple instances"))}parseBuildPageEvent(e){if(!e||typeof e!="object")return null;const t=e.params||e.data||e.payload||e;if(typeof t!="object")return null;let i;if(t.page){if(i=t,i.page&&i.page.page){const r=i.page,o=r.page;i={page:o,missing_info:r.missing_info||o.missing_info||[],version:r.version||i.version}}}else i={page:t,missing_info:t.missing_info||[]};return i}normalizeMessage(e){if(e.querloMessageType&&typeof e.querloMessageType=="string")return{querloMessageType:e.querloMessageType,querloMessageBody:e.querloMessageBody||e.command||{}};if(Array.isArray(e.b)&&e.b.length>0){const t=e.b[0];if(t&&typeof t=="object"&&t.t)return{querloMessageType:t.t,querloMessageBody:t.b||{}}}return null}emit(e,t){var i;(i=this.listeners.get(e))==null||i.forEach(r=>{try{r(t)}catch(o){console.error(o)}})}}const j=new Ee;typeof window<"u"&&(window.Querlo=j,window.dispatchEvent(new CustomEvent("querlo-ready",{detail:j}))),new R,q.QuerloAPI=j,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})}));
|
|
2
|
+
(function(q,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(q=typeof globalThis<"u"?globalThis:q||self,y(q.Querlo={}))})(this,(function(q){"use strict";var ke=Object.defineProperty;var xe=(q,y,p)=>y in q?ke(q,y,{enumerable:!0,configurable:!0,writable:!0,value:p}):q[y]=p;var w=(q,y,p)=>xe(q,typeof y!="symbol"?y+"":y,p);var y,p,F,T,G,L={},$=[],ae=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function E(n,e){for(var t in e)n[t]=e[t];return n}function Q(n){var e=n.parentNode;e&&e.removeChild(n)}function de(n,e,t){var i,r,o,a={};for(o in e)o=="key"?i=e[o]:o=="ref"?r=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?y.call(arguments,2):t),typeof n=="function"&&n.defaultProps!=null)for(o in n.defaultProps)a[o]===void 0&&(a[o]=n.defaultProps[o]);return N(n,a,i,r,null)}function N(n,e,t,i,r){var o={type:n,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:r??++F};return r==null&&p.vnode!=null&&p.vnode(o),o}function z(n){return n.children}function x(n,e){this.props=n,this.context=e}function M(n,e){if(e==null)return n.__?M(n.__,n.__.__k.indexOf(n)+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type=="function"?M(n):null}function X(n){var e,t;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,e=0;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null){n.__e=n.__c.base=t.__e;break}return X(n)}}function V(n){(!n.__d&&(n.__d=!0)&&T.push(n)&&!W.__r++||G!==p.debounceRendering)&&((G=p.debounceRendering)||setTimeout)(W)}function W(){for(var n;W.__r=T.length;)n=T.sort(function(e,t){return e.__v.__b-t.__v.__b}),T=[],n.some(function(e){var t,i,r,o,a,l;e.__d&&(a=(o=(t=e).__v).__e,(l=t.__P)&&(i=[],(r=E({},o)).__v=o.__v+1,H(l,o,r,t.__n,l.ownerSVGElement!==void 0,o.__h!=null?[a]:null,i,a??M(o),o.__h),ne(i,o),o.__e!=a&&X(o)))})}function Y(n,e,t,i,r,o,a,l,u,f){var s,m,_,c,h,S,g,v=i&&i.__k||$,C=v.length;for(t.__k=[],s=0;s<e.length;s++)if((c=t.__k[s]=(c=e[s])==null||typeof c=="boolean"?null:typeof c=="string"||typeof c=="number"||typeof c=="bigint"?N(null,c,null,null,c):Array.isArray(c)?N(z,{children:c},null,null,null):c.__b>0?N(c.type,c.props,c.key,null,c.__v):c)!=null){if(c.__=t,c.__b=t.__b+1,(_=v[s])===null||_&&c.key==_.key&&c.type===_.type)v[s]=void 0;else for(m=0;m<C;m++){if((_=v[m])&&c.key==_.key&&c.type===_.type){v[m]=void 0;break}_=null}H(n,c,_=_||L,r,o,a,l,u,f),h=c.__e,(m=c.ref)&&_.ref!=m&&(g||(g=[]),_.ref&&g.push(_.ref,null,c),g.push(m,c.__c||h,c)),h!=null?(S==null&&(S=h),typeof c.type=="function"&&c.__k===_.__k?c.__d=u=Z(c,u,n):u=J(n,c,_,v,h,u),typeof t.type=="function"&&(t.__d=u)):u&&_.__e==u&&u.parentNode!=n&&(u=M(_))}for(t.__e=S,s=C;s--;)v[s]!=null&&(typeof t.type=="function"&&v[s].__e!=null&&v[s].__e==t.__d&&(t.__d=M(i,s+1)),oe(v[s],v[s]));if(g)for(s=0;s<g.length;s++)ie(g[s],g[++s],g[++s])}function Z(n,e,t){for(var i,r=n.__k,o=0;r&&o<r.length;o++)(i=r[o])&&(i.__=n,e=typeof i.type=="function"?Z(i,e,t):J(t,i,i,r,i.__e,e));return e}function J(n,e,t,i,r,o){var a,l,u;if(e.__d!==void 0)a=e.__d,e.__d=void 0;else if(t==null||r!=o||r.parentNode==null)e:if(o==null||o.parentNode!==n)n.appendChild(r),a=null;else{for(l=o,u=0;(l=l.nextSibling)&&u<i.length;u+=2)if(l==r)break e;n.insertBefore(r,o),a=o}return a!==void 0?a:r.nextSibling}function ce(n,e,t,i,r){var o;for(o in t)o==="children"||o==="key"||o in e||A(n,o,null,t[o],i);for(o in e)r&&typeof e[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||t[o]===e[o]||A(n,o,e[o],t[o],i)}function K(n,e,t){e[0]==="-"?n.setProperty(e,t):n[e]=t==null?"":typeof t!="number"||ae.test(e)?t:t+"px"}function A(n,e,t,i,r){var o;e:if(e==="style")if(typeof t=="string")n.style.cssText=t;else{if(typeof i=="string"&&(n.style.cssText=i=""),i)for(e in i)t&&e in t||K(n.style,e,"");if(t)for(e in t)i&&t[e]===i[e]||K(n.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in n?e.toLowerCase().slice(2):e.slice(2),n.l||(n.l={}),n.l[e+o]=t,t?i||n.addEventListener(e,o?te:ee,o):n.removeEventListener(e,o?te:ee,o);else if(e!=="dangerouslySetInnerHTML"){if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in n)try{n[e]=t??"";break e}catch{}typeof t=="function"||(t!=null&&(t!==!1||e[0]==="a"&&e[1]==="r")?n.setAttribute(e,t):n.removeAttribute(e))}}function ee(n){this.l[n.type+!1](p.event?p.event(n):n)}function te(n){this.l[n.type+!0](p.event?p.event(n):n)}function H(n,e,t,i,r,o,a,l,u){var f,s,m,_,c,h,S,g,v,C,I,le,U,b=e.type;if(e.constructor!==void 0)return null;t.__h!=null&&(u=t.__h,l=e.__e=t.__e,e.__h=null,o=[l]),(f=p.__b)&&f(e);try{e:if(typeof b=="function"){if(g=e.props,v=(f=b.contextType)&&i[f.__c],C=f?v?v.props.value:f.__:i,t.__c?S=(s=e.__c=t.__c).__=s.__E:("prototype"in b&&b.prototype.render?e.__c=s=new b(g,C):(e.__c=s=new x(g,C),s.constructor=b,s.render=ue),v&&v.sub(s),s.props=g,s.state||(s.state={}),s.context=C,s.__n=i,m=s.__d=!0,s.__h=[]),s.__s==null&&(s.__s=s.state),b.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=E({},s.__s)),E(s.__s,b.getDerivedStateFromProps(g,s.__s))),_=s.props,c=s.state,m)b.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(b.getDerivedStateFromProps==null&&g!==_&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(g,C),!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(g,s.__s,C)===!1||e.__v===t.__v){s.props=g,s.state=s.__s,e.__v!==t.__v&&(s.__d=!1),s.__v=e,e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(B){B&&(B.__=e)}),s.__h.length&&a.push(s);break e}s.componentWillUpdate!=null&&s.componentWillUpdate(g,s.__s,C),s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(_,c,h)})}if(s.context=C,s.props=g,s.__v=e,s.__P=n,I=p.__r,le=0,"prototype"in b&&b.prototype.render)s.state=s.__s,s.__d=!1,I&&I(e),f=s.render(s.props,s.state,s.context);else do s.__d=!1,I&&I(e),f=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++le<25);s.state=s.__s,s.getChildContext!=null&&(i=E(E({},i),s.getChildContext())),m||s.getSnapshotBeforeUpdate==null||(h=s.getSnapshotBeforeUpdate(_,c)),U=f!=null&&f.type===z&&f.key==null?f.props.children:f,Y(n,Array.isArray(U)?U:[U],e,t,i,r,o,a,l,u),s.base=e.__e,e.__h=null,s.__h.length&&a.push(s),S&&(s.__E=s.__=null),s.__e=!1}else o==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=_e(t.__e,e,t,i,r,o,a,u);(f=p.diffed)&&f(e)}catch(B){e.__v=null,(u||o!=null)&&(e.__e=l,e.__h=!!u,o[o.indexOf(l)]=null),p.__e(B,e,t)}}function ne(n,e){p.__c&&p.__c(e,n),n.some(function(t){try{n=t.__h,t.__h=[],n.some(function(i){i.call(t)})}catch(i){p.__e(i,t.__v)}})}function _e(n,e,t,i,r,o,a,l){var u,f,s,m=t.props,_=e.props,c=e.type,h=0;if(c==="svg"&&(r=!0),o!=null){for(;h<o.length;h++)if((u=o[h])&&"setAttribute"in u==!!c&&(c?u.localName===c:u.nodeType===3)){n=u,o[h]=null;break}}if(n==null){if(c===null)return document.createTextNode(_);n=r?document.createElementNS("http://www.w3.org/2000/svg",c):document.createElement(c,_.is&&_),o=null,l=!1}if(c===null)m===_||l&&n.data===_||(n.data=_);else{if(o=o&&y.call(n.childNodes),f=(m=t.props||L).dangerouslySetInnerHTML,s=_.dangerouslySetInnerHTML,!l){if(o!=null)for(m={},h=0;h<n.attributes.length;h++)m[n.attributes[h].name]=n.attributes[h].value;(s||f)&&(s&&(f&&s.__html==f.__html||s.__html===n.innerHTML)||(n.innerHTML=s&&s.__html||""))}if(ce(n,_,m,r,l),s)e.__k=[];else if(h=e.props.children,Y(n,Array.isArray(h)?h:[h],e,t,i,r&&c!=="foreignObject",o,a,o?o[0]:t.__k&&M(t,0),l),o!=null)for(h=o.length;h--;)o[h]!=null&&Q(o[h]);l||("value"in _&&(h=_.value)!==void 0&&(h!==n.value||c==="progress"&&!h||c==="option"&&h!==m.value)&&A(n,"value",h,m.value,!1),"checked"in _&&(h=_.checked)!==void 0&&h!==n.checked&&A(n,"checked",h,m.checked,!1))}return n}function ie(n,e,t){try{typeof n=="function"?n(e):n.current=e}catch(i){p.__e(i,t)}}function oe(n,e,t){var i,r;if(p.unmount&&p.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||ie(i,null,e)),(i=n.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){p.__e(o,e)}i.base=i.__P=null}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&oe(i[r],e,typeof n.type!="function");t||n.__e==null||Q(n.__e),n.__e=n.__d=void 0}function ue(n,e,t){return this.constructor(n,t)}function he(n,e,t){var i,r,o;p.__&&p.__(n,e),r=(i=!1)?null:e.__k,o=[],H(e,n=e.__k=de(z,null,[n]),r||L,L,e.ownerSVGElement!==void 0,r?null:e.firstChild?y.call(e.childNodes):null,o,r?r.__e:e.firstChild,i),ne(o,n)}y=$.slice,p={__e:function(n,e,t,i){for(var r,o,a;e=e.__;)if((r=e.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(n)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(n,i||{}),a=r.__d),a)return r.__E=r}catch(l){n=l}throw n}},F=0,x.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=E({},this.state),typeof n=="function"&&(n=n(E({},t),this.props)),n&&E(t,n),n!=null&&this.__v&&(e&&this.__h.push(e),V(this))},x.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),V(this))},x.prototype.render=z,T=[],W.__r=0;var fe=0;function d(n,e,t,i,r){var o,a,l={};for(a in e)a=="ref"?o=e[a]:l[a]=e[a];var u={type:n,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--fe,__source:r,__self:i};if(typeof n=="function"&&(o=n.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return p.vnode&&p.vnode(u),u}function pe(){let n,e=me("utm_source");return e?n=e:document.referrer?n=document.referrer:n="",encodeURIComponent(n+"")}function me(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");let e=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=e.exec(location.search);return t===null?"":decodeURIComponent(t[1].replace(/\+/g," "))}function ge(){return d("svg",{className:"querlo_icon icon-window-minimize",children:d("use",{xlinkHref:"#icon-window-minimize"})})}function ve(){return d("svg",{className:"querlo_icon icon-window-maximize",children:d("use",{xlinkHref:"#icon-window-maximize"})})}function D(){return d("svg",{className:"querlo_icon icon-cancel",children:d("use",{xlinkHref:"#icon-cancel"})})}const re=d("svg",{style:"position: absolute; width: 0; height: 0; overflow: hidden;",children:d("defs",{children:[d("symbol",{id:"icon-cancel",viewBox:"0 0 25 32",children:[d("title",{children:"cancel"}),d("path",{d:"M23.168 23.616q0 0.704-0.48 1.216l-2.432 2.432q-0.512 0.48-1.216 0.48t-1.216-0.48l-5.248-5.28-5.248 5.28q-0.512 0.48-1.216 0.48t-1.216-0.48l-2.432-2.432q-0.512-0.512-0.512-1.216t0.512-1.216l5.248-5.248-5.248-5.248q-0.512-0.512-0.512-1.216t0.512-1.216l2.432-2.432q0.512-0.512 1.216-0.512t1.216 0.512l5.248 5.248 5.248-5.248q0.512-0.512 1.216-0.512t1.216 0.512l2.432 2.432q0.48 0.48 0.48 1.216t-0.48 1.216l-5.248 5.248 5.248 5.248q0.48 0.48 0.48 1.216z"})]}),d("symbol",{id:"icon-help-circled",viewBox:"0 0 27 32",children:[d("title",{children:"help-circled"}),d("path",{d:"M16 24.576v-3.424q0-0.256-0.16-0.416t-0.416-0.16h-3.424q-0.256 0-0.416 0.16t-0.16 0.416v3.424q0 0.256 0.16 0.416t0.416 0.16h3.424q0.256 0 0.416-0.16t0.16-0.416zM20.576 12.576q0-1.568-0.992-2.912t-2.464-2.080-3.040-0.736q-4.352 0-6.624 3.808-0.288 0.416 0.128 0.768l2.368 1.76q0.128 0.128 0.32 0.128 0.288 0 0.448-0.224 0.96-1.216 1.536-1.632 0.608-0.448 1.536-0.448 0.864 0 1.536 0.48t0.672 1.056q0 0.672-0.352 1.088t-1.216 0.8q-1.12 0.48-2.080 1.536t-0.928 2.24v0.64q0 0.256 0.16 0.416t0.416 0.16h3.424q0.256 0 0.416-0.16t0.16-0.416q0-0.32 0.384-0.864t0.96-0.896q0.576-0.32 0.896-0.512t0.8-0.608 0.8-0.864 0.512-1.088 0.224-1.44zM27.424 16q0 3.744-1.824 6.88t-4.992 4.992-6.88 1.856-6.912-1.856-4.96-4.992-1.856-6.88 1.856-6.88 4.96-4.992 6.912-1.856 6.88 1.856 4.992 4.992 1.824 6.88z"})]}),d("symbol",{id:"icon-comment",viewBox:"0 0 32 32",children:[d("title",{children:"comment"}),d("path",{d:"M32 16q0 3.104-2.144 5.728t-5.824 4.16-8.032 1.536q-1.248 0-2.592-0.128-3.52 3.104-8.224 4.32-0.864 0.256-2.016 0.384-0.32 0.032-0.544-0.16t-0.32-0.512v-0.032q-0.064-0.064 0-0.192t0.032-0.192 0.064-0.16l0.128-0.16t0.128-0.16 0.128-0.16q0.128-0.16 0.544-0.608t0.64-0.704 0.544-0.704 0.576-0.896 0.48-1.056 0.48-1.344q-2.816-1.6-4.416-3.936t-1.632-5.024q0-2.336 1.28-4.448t3.392-3.648 5.12-2.432 6.208-0.896q4.352 0 8.032 1.536t5.824 4.16 2.144 5.728z"})]}),d("symbol",{id:"icon-window-maximize",viewBox:"0 0 32 32",children:[d("title",{children:"window-maximize"}),d("path",{d:"M4.576 25.152h22.848v-13.728h-22.848v13.728zM32 5.152v21.696q0 1.184-0.832 2.016t-2.016 0.864h-26.304q-1.152 0-2.016-0.864t-0.832-2.016v-21.696q0-1.184 0.832-2.016t2.016-0.864h26.304q1.184 0 2.016 0.864t0.832 2.016z"})]}),d("symbol",{id:"icon-window-minimize",viewBox:"0 0 32 32",children:[d("title",{children:"window-minimize"}),d("path",{d:"M32 23.424v3.424q0 1.184-0.832 2.016t-2.016 0.864h-26.304q-1.152 0-2.016-0.864t-0.832-2.016v-3.424q0-1.184 0.832-2.016t2.016-0.832h26.304q1.184 0 2.016 0.832t0.832 2.016z"})]})]})});class ye extends x{constructor(){super()}render(e){return d("div",{class:"querlo_popup querlo_img",children:d("div",{class:"querlo_contentWrp",children:[d("div",{class:"querlo_header",style:{backgroundColor:e.color},children:d("div",{class:"querlo_close",onClick:e.cb,children:d(D,{})})}),d("section",{id:"querlo_docWrp",children:d("img",{src:e.data.img})})]})})}}function we(n,e,t,i,r){const o=d("div",{className:e.show?"querlo_chatWrp querlo_open":"querlo_chatWrp",children:[d("div",{className:"querlo_chatBar qrlfadeInUp",onClick:r.toggle,children:[d("div",{className:e.inited?"querlo_avatar":"querlo_avatar qrlpulse",style:{borderColor:n.data.mainColor},children:d("img",{src:n.data.speakerImg?n.data.speakerImg:"https://static.querlo.com/image_uploads/avatar1/608_5f2bcb679692b_png_small.png"})}),!e.inited&&n.data.introTxt?d("div",{class:"querlo_message",children:n.data.introTxt}):"",e.inited?"":d("div",{className:"querlo_number",children:"1"})]}),d("div",{className:"querlo_openWrp",children:d("div",{class:"querlo_bodyWrp querlo_qrlfadeInUp2",children:[d("div",{class:"querlo_header",style:{backgroundColor:n.data.mainColor},children:[n.data.speakerName,d("div",{class:"querlo_buttonsWrp",children:[d("a",{href:"#",onMouseEnter:l=>r.toggleHoverColor(l,n.data.mainColor),onMouseLeave:l=>r.toggleHoverColor(l,""),onClick:r.toggleFullscreen,children:e.fullscreen?d(ge,{}):d(ve,{})}),d("a",{href:"#",onMouseEnter:l=>r.toggleHoverColor(l,n.data.mainColor),onMouseLeave:l=>r.toggleHoverColor(l,""),onClick:r.toggle,children:d(D,{})})]})]}),d("div",{className:"querlo_iframeWrp",children:e.inited?d("iframe",{allow:"microphone;camera;midi;encrypted-media;",src:i,id:"querloIframe",seamless:!0}):""})]})}),re,e.showImagePopup?d(ye,{cb:r.closeImagePopup,data:e.showImagePopup,color:n.data.mainColor}):""]});return{inpage:d("iframe",{allow:"microphone;camera;midi;encrypted-media;",src:i,seamless:!0}),esd:o,inpage_popup:d("div",{className:`querlo_popup_center ${e.show?"open":"closed"}`,children:[d("div",{className:"querlo_overlay",onClick:r.toggle}),e.show&&d("div",{className:"querlo_close_btn",onClick:r.toggle,style:{backgroundColor:n.data.mainColor},children:d(D,{})}),d("iframe",{allow:"microphone;camera;midi;encrypted-media;",src:i,seamless:!0}),re]})}[t]}const qe=window.location.href,O="querlo_fullscreen",se=qe.split("/");se[0]+""+se[2];function P(n,e){n&&(e.width&&typeof e.width!="number"&&e.width.indexOf("%")!==-1?n.classList.add(O):(e.width&&(n.style.width=e.width+"px"),n.classList.remove(O)))}function be(n){let e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState===4)return e.status>=200&&e.status<300?(n.cb&&n.cb(e.responseText),e.responseText):(console.log("error",e),n.cb&&n.cb(!1),e)},e.open("GET",n.url),e.send()}class Ce extends x{constructor(){super();w(this,"toggle",(t,i)=>{var l;t&&t.preventDefault&&t.preventDefault();const r=(l=this.base)==null?void 0:l.parentElement;if(!r)return;if(!this.state.show){const u=this.base.classList.contains("querlo_popup_center")?this.base:this.base.querySelector(".querlo_popup_center");if(u){const f=u.getBoundingClientRect();r.style.setProperty("--origin-top",f.top+"px"),r.style.setProperty("--origin-left",f.left+"px"),r.style.setProperty("--origin-width",f.width+"px"),r.style.setProperty("--origin-height",f.height+"px")}}const o=!this.state.show,a=i!==void 0?i:o?this.state.fullscreen:!1;this.setState({inited:!0,show:o,fullscreen:a}),P(r,a?{width:"100%"}:{width:this.props.data.width,height:this.props.data.height})});w(this,"toggleHoverColor",(t,i)=>{const r=t.target.querySelector("svg");r.style.fill=i});w(this,"toggleFullscreen",t=>{var o;t&&t.preventDefault();const i=!this.state.fullscreen,r=(o=this.base)==null?void 0:o.parentElement;r&&(P(r,i?{width:"100%"}:{width:this.props.data.width,height:this.props.data.height}),this.setState({fullscreen:i}))});w(this,"handleScopedCommand",t=>{const{name:i,params:r}=t.detail;i==="OPEN"&&!this.state.show&&this.toggle(!1,r==null?void 0:r.fullscreen),i==="CLOSE"&&this.state.show&&this.toggle(!1),i==="RESIZE_CLIENT"&&!this.state.fullscreen&&P(this.base,r)});w(this,"closeImagePopup",()=>{this.setState({showImagePopup:!1})});w(this,"receiveMessage",t=>{var u,f,s,m;const i=(u=this.base)==null?void 0:u.querySelector("iframe"),r=i==null?void 0:i.contentWindow,o=t.source===r,a=t.source===window;if(!o&&!a)return;const l=t.data.command;if(t.data.querloMessageType==="clientEvent"){if(l.name==="OPEN"&&!this.state.show&&this.toggle(!1,((f=l.params)==null?void 0:f.fullscreen)||((s=l.params)==null?void 0:s.fullScreen)),l.name==="CLOSE"&&this.state.show&&this.toggle(!1),l.name==="RESIZE_CLIENT"&&!this.state.fullscreen&&o){const _=(m=this.base)==null?void 0:m.parentElement;_&&P(_,l.params)}l.name==="XHR_CALL"&&o&&be(t.data.command.params),l.name==="OPEN_IMAGE_POPUP"&&o&&this.setState({showImagePopup:l.params})}});w(this,"stopPropagation",t=>t.stopPropagation());this.state={inited:!1,show:!1}}componentDidMount(){var i,r;if(this.props.data.delay&&setTimeout(()=>{!this.state.inited&&!this.state.show&&this.toggle(!1)},this.props.data.delay),this.props.template==="inpage"||this.props.template==="popup_center"||this.props.template==="inpage_popup"){const o=(i=this.base)==null?void 0:i.parentElement;o&&P(o,{width:this.props.data.width,height:this.props.data.height})}window.addEventListener("message",this.receiveMessage,!1);const t=(r=this.base)==null?void 0:r.parentElement;t&&t.addEventListener("querlo-command",this.handleScopedCommand)}componentWillUnmount(){var i;window.removeEventListener("message",this.receiveMessage);const t=(i=this.base)==null?void 0:i.parentElement;t&&t.removeEventListener("querlo-command",this.handleScopedCommand)}render(t,i){let o="https://chat.querlo.com/"+t.data.id+"?utm_source_js="+t.data.referrer;return t.data.params&&(o+="&"+t.data.params),t.data.debug&&(o+="&debug=1"),we(t,i,t.data.template,o,this)}}const k=class k{constructor(){this.initChat(),typeof window<"u"&&!k.listenerAdded&&(k.listenerAdded=!0,window.addEventListener("querlo-new-embed",()=>this.initChat()))}initChat(){document.querySelectorAll(".querlo, #querloEmbd").forEach(t=>{if(k.initializedElements.has(t)||!t.dataset.id)return;k.initializedElements.add(t);const i=t.dataset,r={id:i.id,width:i.querloW||i.width,height:i.querloH||i.height,template:i.template||"esd",referrer:pe(),posX:i.posX||"right",posY:i.posY||"bottom",speakerImg:i.speakerImg,speakerName:i.speakerName,introTxt:i.introTxt,delay:i.delay,mainColor:i.mainColor||"rgb(107,185,240)",debug:i.debug==="true"};t.classList.add(r.template),t.classList.add(r.posX),t.classList.add(r.posY),(r.template==="inpage"||r.template==="popup_center"||r.template==="inpage_popup")&&(t.style.width=r.width+"px",t.style.minHeight=r.height+"px"),he(d(Ce,{data:r}),t)})}};w(k,"initializedElements",new Set),w(k,"listenerAdded",!1);let R=k;class Ee{constructor(){w(this,"listeners",new Map);w(this,"initialized",!1);w(this,"_loading",!1);w(this,"_chatbotWaiting",!1);w(this,"controllers",new Set);typeof window<"u"&&this.initMessageListener()}embed(e){let t=null;e.container&&(t=typeof e.container=="string"?document.querySelector(e.container):e.container),t||(t=document.createElement("div"),document.body.appendChild(t)),t.classList.add("querlo"),e.id&&(t.dataset.id=e.id),e.width&&(t.dataset.width=e.width),e.height&&(t.dataset.height=e.height),e.template&&(t.dataset.template=e.template),e.posX&&(t.dataset.posX=e.posX),e.posY&&(t.dataset.posY=e.posY),e.mainColor&&(t.dataset.mainColor=e.mainColor),e.speakerImg&&(t.dataset.speakerImg=e.speakerImg),e.speakerName&&(t.dataset.speakerName=e.speakerName),e.introTxt&&(t.dataset.introTxt=e.introTxt),e.delay&&(t.dataset.delay=e.delay),e.debug&&(t.dataset.debug="true");const i=t,r={element:i,open:(o=!1)=>this.sendCommandToElement(i,"OPEN",{fullscreen:o}),close:()=>this.sendCommandToElement(i,"CLOSE"),sendMessage:o=>{const a=i.querySelector("iframe");a!=null&&a.contentWindow&&a.contentWindow.postMessage({querloMessageType:"sendMessage",querloMessageBody:{text:o}},"*")},setVariable:(o,a)=>{const l=i.querySelector("iframe");l!=null&&l.contentWindow&&l.contentWindow.postMessage({querloMessageType:"SET-CHAT-VARIABLE",varName:o,varContent:a},"*")},destroy:()=>{this.controllers.delete(r),i.remove()}};return this.controllers.add(r),typeof window<"u"&&window.dispatchEvent(new CustomEvent("querlo-new-embed")),r}open(e=!1){this.sendCommand("OPEN",{fullscreen:e})}openFullscreen(){this.open(!0)}close(){this.sendCommand("CLOSE")}sendMessage(e){this.controllers.forEach(t=>t.sendMessage(e))}setVariable(e,t){this.controllers.forEach(i=>i.setVariable(e,t))}isLoading(){return this._loading}isWaiting(){return this._chatbotWaiting}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}off(e,t){var i;(i=this.listeners.get(e))==null||i.delete(t)}sendCommand(e,t={}){window.postMessage({querloMessageType:"clientEvent",command:{name:e,params:t}},"*")}sendCommandToElement(e,t,i={}){e.dispatchEvent(new CustomEvent("querlo-command",{detail:{name:t,params:i}}))}initMessageListener(){this.initialized||(this.initialized=!0,window.addEventListener("message",e=>{let t=e.data;if(typeof t=="string")try{t=JSON.parse(t)}catch{return}if(!t||typeof t!="object")return;const i=this.normalizeMessage(t);if(!i)return;const{querloMessageType:r,querloMessageBody:o}=i;if(r==="clientEvent"){const a=o.name||"";if(a==="WAITING_REQUEST")this._chatbotWaiting=!0,this.emit("WAITING_REQUEST",i);else if(a==="BUILD_PAGE"){this._chatbotWaiting=!1,this._loading=!1,this.emit("loading",!1);const l=this.parseBuildPageEvent(o);l&&this.emit("BUILD_PAGE",l)}}this.emit("message",i),this.emit(r,o),r==="clientEvent"&&o.name&&this.emit(o.name,o.params||o)}),console.log("[QuerloAPI] API Layer initialized — Supporting multiple instances"))}parseBuildPageEvent(e){if(!e||typeof e!="object")return null;const t=e.params||e.data||e.payload||e;if(typeof t!="object")return null;let i;if(t.page){if(i=t,i.page&&i.page.page){const r=i.page,o=r.page;i={page:o,missing_info:r.missing_info||o.missing_info||[],version:r.version||i.version}}}else i={page:t,missing_info:t.missing_info||[]};return i}normalizeMessage(e){if(e.querloMessageType&&typeof e.querloMessageType=="string")return{querloMessageType:e.querloMessageType,querloMessageBody:e.querloMessageBody||e.command||{}};if(Array.isArray(e.b)&&e.b.length>0){const t=e.b[0];if(t&&typeof t=="object"&&t.t)return{querloMessageType:t.t,querloMessageBody:t.b||{}}}return null}emit(e,t){var i;(i=this.listeners.get(e))==null||i.forEach(r=>{try{r(t)}catch(o){console.error(o)}})}}const j=new Ee;typeof window<"u"&&(window.Querlo=j,window.dispatchEvent(new CustomEvent("querlo-ready",{detail:j}))),new R,q.QuerloAPI=j,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@querlo/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Querlo Chatbot Embed SDK - Programmatic control and multi-instance support",
|
|
6
6
|
"author": "Querlo",
|
|
@@ -50,4 +50,4 @@
|
|
|
50
50
|
"vite": "^6.4.1",
|
|
51
51
|
"vite-plugin-css-injected-by-js": "^3.5.2"
|
|
52
52
|
}
|
|
53
|
-
}
|
|
53
|
+
}
|