@paramms/chat-widget 1.0.8 → 1.0.9
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/index.js +21 -18
- package/dist/index.js.map +1 -1
- package/dist/react.js +160 -158
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -123,10 +123,10 @@ function Re(s, e) {
|
|
|
123
123
|
const t = s.getUint32(e), i = s.getUint32(e + 4);
|
|
124
124
|
return t * 4294967296 + i;
|
|
125
125
|
}
|
|
126
|
-
const Fe = -1,
|
|
126
|
+
const Fe = -1, qe = 4294967296 - 1, je = 17179869184 - 1;
|
|
127
127
|
function Oe({ sec: s, nsec: e }) {
|
|
128
|
-
if (s >= 0 && e >= 0 && s <=
|
|
129
|
-
if (e === 0 && s <=
|
|
128
|
+
if (s >= 0 && e >= 0 && s <= je)
|
|
129
|
+
if (e === 0 && s <= qe) {
|
|
130
130
|
const t = new Uint8Array(4);
|
|
131
131
|
return new DataView(t.buffer).setUint32(0, s), t;
|
|
132
132
|
} else {
|
|
@@ -516,7 +516,7 @@ class it {
|
|
|
516
516
|
return this.store(c, o), o;
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
-
const Q = "array",
|
|
519
|
+
const Q = "array", j = "map_key", xe = "map_value", nt = (s) => {
|
|
520
520
|
if (typeof s == "string" || typeof s == "number")
|
|
521
521
|
return s;
|
|
522
522
|
throw new U("The type of key must be string or number but " + typeof s);
|
|
@@ -538,7 +538,7 @@ class st {
|
|
|
538
538
|
}
|
|
539
539
|
pushMapState(e) {
|
|
540
540
|
const t = this.getUninitializedStateFromPool();
|
|
541
|
-
t.type =
|
|
541
|
+
t.type = j, t.readCount = 0, t.size = e, t.map = {};
|
|
542
542
|
}
|
|
543
543
|
getUninitializedStateFromPool() {
|
|
544
544
|
if (this.stackHeadPosition++, this.stackHeadPosition === this.stack.length) {
|
|
@@ -562,7 +562,7 @@ class st {
|
|
|
562
562
|
const i = e;
|
|
563
563
|
i.size = 0, i.array = void 0, i.position = 0, i.type = void 0;
|
|
564
564
|
}
|
|
565
|
-
if (e.type ===
|
|
565
|
+
if (e.type === j || e.type === xe) {
|
|
566
566
|
const i = e;
|
|
567
567
|
i.size = 0, i.map = void 0, i.readCount = 0, i.type = void 0;
|
|
568
568
|
}
|
|
@@ -572,7 +572,7 @@ class st {
|
|
|
572
572
|
this.stack.length = 0, this.stackHeadPosition = -1;
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
const
|
|
575
|
+
const q = -1, ie = new DataView(new ArrayBuffer(0)), ot = new Uint8Array(ie.buffer);
|
|
576
576
|
try {
|
|
577
577
|
ie.getInt8(0);
|
|
578
578
|
} catch (s) {
|
|
@@ -597,7 +597,7 @@ class ne {
|
|
|
597
597
|
r(this, "pos", 0);
|
|
598
598
|
r(this, "view", ie);
|
|
599
599
|
r(this, "bytes", ot);
|
|
600
|
-
r(this, "headByte",
|
|
600
|
+
r(this, "headByte", q);
|
|
601
601
|
r(this, "stack", new st());
|
|
602
602
|
r(this, "entered", !1);
|
|
603
603
|
this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? V.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.rawStrings = (e == null ? void 0 : e.rawStrings) ?? !1, this.maxStrLength = (e == null ? void 0 : e.maxStrLength) ?? F, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? F, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? F, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? F, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? F, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : rt, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? nt;
|
|
@@ -617,14 +617,14 @@ class ne {
|
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
619
|
reinitializeState() {
|
|
620
|
-
this.totalPos = 0, this.headByte =
|
|
620
|
+
this.totalPos = 0, this.headByte = q, this.stack.reset();
|
|
621
621
|
}
|
|
622
622
|
setBuffer(e) {
|
|
623
623
|
const t = Z(e);
|
|
624
624
|
this.bytes = t, this.view = new DataView(t.buffer, t.byteOffset, t.byteLength), this.pos = 0;
|
|
625
625
|
}
|
|
626
626
|
appendBuffer(e) {
|
|
627
|
-
if (this.headByte ===
|
|
627
|
+
if (this.headByte === q && !this.hasRemaining(1))
|
|
628
628
|
this.setBuffer(e);
|
|
629
629
|
else {
|
|
630
630
|
const t = this.bytes.subarray(this.pos), i = Z(e), n = new Uint8Array(t.length + i.length);
|
|
@@ -856,7 +856,7 @@ class ne {
|
|
|
856
856
|
t = n.array, i.release(n);
|
|
857
857
|
else
|
|
858
858
|
continue e;
|
|
859
|
-
else if (n.type ===
|
|
859
|
+
else if (n.type === j) {
|
|
860
860
|
if (t === "__proto__")
|
|
861
861
|
throw new U("The key __proto__ is not allowed");
|
|
862
862
|
n.key = this.mapKeyConverter(t), n.type = xe;
|
|
@@ -864,7 +864,7 @@ class ne {
|
|
|
864
864
|
} else if (n.map[n.key] = t, n.readCount++, n.readCount === n.size)
|
|
865
865
|
t = n.map, i.release(n);
|
|
866
866
|
else {
|
|
867
|
-
n.key = null, n.type =
|
|
867
|
+
n.key = null, n.type = j;
|
|
868
868
|
continue e;
|
|
869
869
|
}
|
|
870
870
|
}
|
|
@@ -872,10 +872,10 @@ class ne {
|
|
|
872
872
|
}
|
|
873
873
|
}
|
|
874
874
|
readHeadByte() {
|
|
875
|
-
return this.headByte ===
|
|
875
|
+
return this.headByte === q && (this.headByte = this.readU8()), this.headByte;
|
|
876
876
|
}
|
|
877
877
|
complete() {
|
|
878
|
-
this.headByte =
|
|
878
|
+
this.headByte = q;
|
|
879
879
|
}
|
|
880
880
|
readArraySize() {
|
|
881
881
|
const e = this.readHeadByte();
|
|
@@ -918,7 +918,7 @@ class ne {
|
|
|
918
918
|
return this.stateIsMapKey() && ((o = this.keyDecoder) != null && o.canBeCached(e)) ? n = this.keyDecoder.decode(this.bytes, i, e) : n = _e(this.bytes, i, e), this.pos += t + e, n;
|
|
919
919
|
}
|
|
920
920
|
stateIsMapKey() {
|
|
921
|
-
return this.stack.length > 0 ? this.stack.top().type ===
|
|
921
|
+
return this.stack.length > 0 ? this.stack.top().type === j : !1;
|
|
922
922
|
}
|
|
923
923
|
/**
|
|
924
924
|
* @throws {@link RangeError}
|
|
@@ -1644,8 +1644,9 @@ const pe = "objectchat-widget-styles", Tt = ["👍", "❤️", "😂", "😮", "
|
|
|
1644
1644
|
.ocw-typing-dot:nth-child(2) { animation-delay:.2s; }
|
|
1645
1645
|
.ocw-typing-dot:nth-child(3) { animation-delay:.4s; }
|
|
1646
1646
|
@keyframes ocw-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }
|
|
1647
|
-
.ocw-quick { display:flex; gap:8px; padding:8px 12px
|
|
1648
|
-
.ocw-quick
|
|
1647
|
+
.ocw-quick { display:flex; gap:8px; padding:8px 12px 6px; overflow-x:auto; scrollbar-width:none; flex-shrink:0; }
|
|
1648
|
+
.ocw-quick::-webkit-scrollbar { display:none; }
|
|
1649
|
+
.ocw-quick button { flex:none; border:1px solid #e3ded7; background:#fff; border-radius:999px; padding:7px 14px; font-size:13px; cursor:pointer; color:#444; white-space:nowrap; transition:border-color .12s,color .12s; }
|
|
1649
1650
|
.ocw-quick button:hover { border-color:var(--ocw-accent); color:var(--ocw-accent); }
|
|
1650
1651
|
.ocw-form-host:empty { display:none; }
|
|
1651
1652
|
.ocw-form { margin:6px 12px 0; padding:12px; background:var(--ocw-card); border:1px solid var(--ocw-line); border-radius:14px; }
|
|
@@ -1776,7 +1777,9 @@ class At {
|
|
|
1776
1777
|
x.append(a("div", "ocw-typing-dot"), a("div", "ocw-typing-dot"), a("div", "ocw-typing-dot")), this.typing.append(a("div", "ocw-dot", "🧑"), x), this.quick = a("div", "ocw-quick");
|
|
1777
1778
|
for (const k of n.quickReplies ?? []) {
|
|
1778
1779
|
const E = a("button", void 0, k);
|
|
1779
|
-
E.addEventListener("click", () =>
|
|
1780
|
+
E.addEventListener("click", () => {
|
|
1781
|
+
this.h.onSend(k), this.quick.style.display = "none";
|
|
1782
|
+
}), this.quick.append(E);
|
|
1780
1783
|
}
|
|
1781
1784
|
this.formHost = a("div", "ocw-form-host"), this.csatPanel = a("div", "ocw-csat"), this.csatPanel.style.display = "none", this.offlinePanel = a("div", "ocw-offline"), this.offlinePanel.style.display = "none", this.input = a("textarea", void 0), this.input.rows = 1, this.input.placeholder = "Message…";
|
|
1782
1785
|
const f = a("button", "ocw-sendbtn", (($ = n.i18n) == null ? void 0 : $.send) ?? "➤");
|