@everymatrix/nuts-inbox-widget 1.98.18 → 1.98.19
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/cjs/nuts-inbox-widget_3.cjs.entry.js +140 -206
- package/dist/esm/nuts-inbox-widget_3.entry.js +140 -206
- package/dist/nuts-inbox-widget/nuts-inbox-widget_3.entry.js +1 -1
- package/hydrate/index.js +140 -206
- package/hydrate/index.mjs +140 -206
- package/package.json +1 -1
|
@@ -1563,39 +1563,29 @@ if (withEventListeners) {
|
|
|
1563
1563
|
}
|
|
1564
1564
|
/**
|
|
1565
1565
|
* This class provides a WebSocket-like interface to connect to an Engine.IO server. The connection will be established
|
|
1566
|
-
* with one of the available low-level transports, like HTTP long-polling, WebSocket or WebTransport.
|
|
1566
|
+
* with one of the available low-level transports, like HTTP long-polling, WebSocket, or WebTransport.
|
|
1567
1567
|
*
|
|
1568
|
-
* This class comes
|
|
1569
|
-
*
|
|
1570
|
-
*
|
|
1571
|
-
* In order to allow tree-shaking, there are no transports included, that's why the `transports` option is mandatory.
|
|
1568
|
+
* This class comes with an upgrade mechanism, which means that once the connection is established with the first
|
|
1569
|
+
* low-level transport, it will try to upgrade to a better transport.
|
|
1572
1570
|
*
|
|
1573
1571
|
* @example
|
|
1574
|
-
* import {
|
|
1572
|
+
* import { Socket } from "engine.io-client";
|
|
1575
1573
|
*
|
|
1576
|
-
* const socket = new
|
|
1577
|
-
* transports: [WebSocket]
|
|
1578
|
-
* });
|
|
1574
|
+
* const socket = new Socket();
|
|
1579
1575
|
*
|
|
1580
1576
|
* socket.on("open", () => {
|
|
1581
1577
|
* socket.send("hello");
|
|
1582
1578
|
* });
|
|
1583
1579
|
*
|
|
1584
|
-
* @see SocketWithUpgrade
|
|
1585
|
-
* @see Socket
|
|
1586
1580
|
*/
|
|
1587
|
-
class
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
*
|
|
1591
|
-
* @param {String|Object} uri - uri or options
|
|
1592
|
-
* @param {Object} opts - options
|
|
1593
|
-
*/
|
|
1594
|
-
constructor(uri, opts) {
|
|
1581
|
+
class Socket$1 extends Emitter {
|
|
1582
|
+
constructor(uri, opts = {}) {
|
|
1583
|
+
var _a, _b;
|
|
1595
1584
|
super();
|
|
1596
1585
|
this.binaryType = defaultBinaryType;
|
|
1597
1586
|
this.writeBuffer = [];
|
|
1598
1587
|
this._prevBufferLen = 0;
|
|
1588
|
+
this._upgrades = [];
|
|
1599
1589
|
this._pingInterval = -1;
|
|
1600
1590
|
this._pingTimeout = -1;
|
|
1601
1591
|
this._maxPayload = -1;
|
|
@@ -1639,13 +1629,26 @@ class SocketWithoutUpgrade extends Emitter {
|
|
|
1639
1629
|
: this.secure
|
|
1640
1630
|
? "443"
|
|
1641
1631
|
: "80");
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1632
|
+
if (opts.transportImplementations && opts.transports) {
|
|
1633
|
+
throw new Error("specifying both 'transportImplementations' and 'transports' options is not supported");
|
|
1634
|
+
}
|
|
1635
|
+
if (opts.transportImplementations ||
|
|
1636
|
+
(((_a = opts.transports) === null || _a === void 0 ? void 0 : _a.length) && typeof opts.transports[0] === "function")) {
|
|
1637
|
+
// 'transports' option as an array of transport implementations is kept for backward compatibility
|
|
1638
|
+
this.transports = [];
|
|
1639
|
+
this._transportsByName = Object.create(null);
|
|
1640
|
+
((_b = opts.transportImplementations) !== null && _b !== void 0 ? _b : opts.transports).forEach((t) => {
|
|
1641
|
+
const transportName = t.prototype.name;
|
|
1642
|
+
this.transports.push(transportName);
|
|
1643
|
+
this._transportsByName[transportName] = t;
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
else {
|
|
1647
|
+
this.transports = opts.transports
|
|
1648
|
+
? [...opts.transports]
|
|
1649
|
+
: ["polling", "websocket", "webtransport"];
|
|
1650
|
+
this._transportsByName = transports;
|
|
1651
|
+
}
|
|
1649
1652
|
this.opts = Object.assign({
|
|
1650
1653
|
path: "/engine.io",
|
|
1651
1654
|
agent: false,
|
|
@@ -1734,7 +1737,7 @@ class SocketWithoutUpgrade extends Emitter {
|
|
|
1734
1737
|
return;
|
|
1735
1738
|
}
|
|
1736
1739
|
const transportName = this.opts.rememberUpgrade &&
|
|
1737
|
-
|
|
1740
|
+
Socket$1.priorWebsocketSuccess &&
|
|
1738
1741
|
this.transports.indexOf("websocket") !== -1
|
|
1739
1742
|
? "websocket"
|
|
1740
1743
|
: this.transports[0];
|
|
@@ -1761,6 +1764,107 @@ class SocketWithoutUpgrade extends Emitter {
|
|
|
1761
1764
|
.on("error", this._onError.bind(this))
|
|
1762
1765
|
.on("close", (reason) => this._onClose("transport close", reason));
|
|
1763
1766
|
}
|
|
1767
|
+
/**
|
|
1768
|
+
* Probes a transport.
|
|
1769
|
+
*
|
|
1770
|
+
* @param {String} name - transport name
|
|
1771
|
+
* @private
|
|
1772
|
+
*/
|
|
1773
|
+
_probe(name) {
|
|
1774
|
+
let transport = this.createTransport(name);
|
|
1775
|
+
let failed = false;
|
|
1776
|
+
Socket$1.priorWebsocketSuccess = false;
|
|
1777
|
+
const onTransportOpen = () => {
|
|
1778
|
+
if (failed)
|
|
1779
|
+
return;
|
|
1780
|
+
transport.send([{ type: "ping", data: "probe" }]);
|
|
1781
|
+
transport.once("packet", (msg) => {
|
|
1782
|
+
if (failed)
|
|
1783
|
+
return;
|
|
1784
|
+
if ("pong" === msg.type && "probe" === msg.data) {
|
|
1785
|
+
this.upgrading = true;
|
|
1786
|
+
this.emitReserved("upgrading", transport);
|
|
1787
|
+
if (!transport)
|
|
1788
|
+
return;
|
|
1789
|
+
Socket$1.priorWebsocketSuccess = "websocket" === transport.name;
|
|
1790
|
+
this.transport.pause(() => {
|
|
1791
|
+
if (failed)
|
|
1792
|
+
return;
|
|
1793
|
+
if ("closed" === this.readyState)
|
|
1794
|
+
return;
|
|
1795
|
+
cleanup();
|
|
1796
|
+
this.setTransport(transport);
|
|
1797
|
+
transport.send([{ type: "upgrade" }]);
|
|
1798
|
+
this.emitReserved("upgrade", transport);
|
|
1799
|
+
transport = null;
|
|
1800
|
+
this.upgrading = false;
|
|
1801
|
+
this.flush();
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
else {
|
|
1805
|
+
const err = new Error("probe error");
|
|
1806
|
+
// @ts-ignore
|
|
1807
|
+
err.transport = transport.name;
|
|
1808
|
+
this.emitReserved("upgradeError", err);
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1811
|
+
};
|
|
1812
|
+
function freezeTransport() {
|
|
1813
|
+
if (failed)
|
|
1814
|
+
return;
|
|
1815
|
+
// Any callback called by transport should be ignored since now
|
|
1816
|
+
failed = true;
|
|
1817
|
+
cleanup();
|
|
1818
|
+
transport.close();
|
|
1819
|
+
transport = null;
|
|
1820
|
+
}
|
|
1821
|
+
// Handle any error that happens while probing
|
|
1822
|
+
const onerror = (err) => {
|
|
1823
|
+
const error = new Error("probe error: " + err);
|
|
1824
|
+
// @ts-ignore
|
|
1825
|
+
error.transport = transport.name;
|
|
1826
|
+
freezeTransport();
|
|
1827
|
+
this.emitReserved("upgradeError", error);
|
|
1828
|
+
};
|
|
1829
|
+
function onTransportClose() {
|
|
1830
|
+
onerror("transport closed");
|
|
1831
|
+
}
|
|
1832
|
+
// When the socket is closed while we're probing
|
|
1833
|
+
function onclose() {
|
|
1834
|
+
onerror("socket closed");
|
|
1835
|
+
}
|
|
1836
|
+
// When the socket is upgraded while we're probing
|
|
1837
|
+
function onupgrade(to) {
|
|
1838
|
+
if (transport && to.name !== transport.name) {
|
|
1839
|
+
freezeTransport();
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
// Remove all listeners on the transport and on self
|
|
1843
|
+
const cleanup = () => {
|
|
1844
|
+
transport.removeListener("open", onTransportOpen);
|
|
1845
|
+
transport.removeListener("error", onerror);
|
|
1846
|
+
transport.removeListener("close", onTransportClose);
|
|
1847
|
+
this.off("close", onclose);
|
|
1848
|
+
this.off("upgrading", onupgrade);
|
|
1849
|
+
};
|
|
1850
|
+
transport.once("open", onTransportOpen);
|
|
1851
|
+
transport.once("error", onerror);
|
|
1852
|
+
transport.once("close", onTransportClose);
|
|
1853
|
+
this.once("close", onclose);
|
|
1854
|
+
this.once("upgrading", onupgrade);
|
|
1855
|
+
if (this._upgrades.indexOf("webtransport") !== -1 &&
|
|
1856
|
+
name !== "webtransport") {
|
|
1857
|
+
// favor WebTransport
|
|
1858
|
+
this.setTimeoutFn(() => {
|
|
1859
|
+
if (!failed) {
|
|
1860
|
+
transport.open();
|
|
1861
|
+
}
|
|
1862
|
+
}, 200);
|
|
1863
|
+
}
|
|
1864
|
+
else {
|
|
1865
|
+
transport.open();
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1764
1868
|
/**
|
|
1765
1869
|
* Called when connection is deemed open.
|
|
1766
1870
|
*
|
|
@@ -1768,10 +1872,14 @@ class SocketWithoutUpgrade extends Emitter {
|
|
|
1768
1872
|
*/
|
|
1769
1873
|
onOpen() {
|
|
1770
1874
|
this.readyState = "open";
|
|
1771
|
-
|
|
1772
|
-
"websocket" === this.transport.name;
|
|
1875
|
+
Socket$1.priorWebsocketSuccess = "websocket" === this.transport.name;
|
|
1773
1876
|
this.emitReserved("open");
|
|
1774
1877
|
this.flush();
|
|
1878
|
+
if ("open" === this.readyState && this.opts.upgrade) {
|
|
1879
|
+
for (let i = 0; i < this._upgrades.length; i++) {
|
|
1880
|
+
this._probe(this._upgrades[i]);
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1775
1883
|
}
|
|
1776
1884
|
/**
|
|
1777
1885
|
* Handles a packet.
|
|
@@ -1818,6 +1926,7 @@ class SocketWithoutUpgrade extends Emitter {
|
|
|
1818
1926
|
this.emitReserved("handshake", data);
|
|
1819
1927
|
this.id = data.sid;
|
|
1820
1928
|
this.transport.query.sid = data.sid;
|
|
1929
|
+
this._upgrades = this._filterUpgrades(data.upgrades);
|
|
1821
1930
|
this._pingInterval = data.pingInterval;
|
|
1822
1931
|
this._pingTimeout = data.pingTimeout;
|
|
1823
1932
|
this._maxPayload = data.maxPayload;
|
|
@@ -2029,7 +2138,7 @@ class SocketWithoutUpgrade extends Emitter {
|
|
|
2029
2138
|
* @private
|
|
2030
2139
|
*/
|
|
2031
2140
|
_onError(err) {
|
|
2032
|
-
|
|
2141
|
+
Socket$1.priorWebsocketSuccess = false;
|
|
2033
2142
|
if (this.opts.tryAllTransports &&
|
|
2034
2143
|
this.transports.length > 1 &&
|
|
2035
2144
|
this.readyState === "opening") {
|
|
@@ -2079,150 +2188,6 @@ class SocketWithoutUpgrade extends Emitter {
|
|
|
2079
2188
|
this._prevBufferLen = 0;
|
|
2080
2189
|
}
|
|
2081
2190
|
}
|
|
2082
|
-
}
|
|
2083
|
-
SocketWithoutUpgrade.protocol = protocol$1;
|
|
2084
|
-
/**
|
|
2085
|
-
* This class provides a WebSocket-like interface to connect to an Engine.IO server. The connection will be established
|
|
2086
|
-
* with one of the available low-level transports, like HTTP long-polling, WebSocket or WebTransport.
|
|
2087
|
-
*
|
|
2088
|
-
* This class comes with an upgrade mechanism, which means that once the connection is established with the first
|
|
2089
|
-
* low-level transport, it will try to upgrade to a better transport.
|
|
2090
|
-
*
|
|
2091
|
-
* In order to allow tree-shaking, there are no transports included, that's why the `transports` option is mandatory.
|
|
2092
|
-
*
|
|
2093
|
-
* @example
|
|
2094
|
-
* import { SocketWithUpgrade, WebSocket } from "engine.io-client";
|
|
2095
|
-
*
|
|
2096
|
-
* const socket = new SocketWithUpgrade({
|
|
2097
|
-
* transports: [WebSocket]
|
|
2098
|
-
* });
|
|
2099
|
-
*
|
|
2100
|
-
* socket.on("open", () => {
|
|
2101
|
-
* socket.send("hello");
|
|
2102
|
-
* });
|
|
2103
|
-
*
|
|
2104
|
-
* @see SocketWithoutUpgrade
|
|
2105
|
-
* @see Socket
|
|
2106
|
-
*/
|
|
2107
|
-
class SocketWithUpgrade extends SocketWithoutUpgrade {
|
|
2108
|
-
constructor() {
|
|
2109
|
-
super(...arguments);
|
|
2110
|
-
this._upgrades = [];
|
|
2111
|
-
}
|
|
2112
|
-
onOpen() {
|
|
2113
|
-
super.onOpen();
|
|
2114
|
-
if ("open" === this.readyState && this.opts.upgrade) {
|
|
2115
|
-
for (let i = 0; i < this._upgrades.length; i++) {
|
|
2116
|
-
this._probe(this._upgrades[i]);
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
/**
|
|
2121
|
-
* Probes a transport.
|
|
2122
|
-
*
|
|
2123
|
-
* @param {String} name - transport name
|
|
2124
|
-
* @private
|
|
2125
|
-
*/
|
|
2126
|
-
_probe(name) {
|
|
2127
|
-
let transport = this.createTransport(name);
|
|
2128
|
-
let failed = false;
|
|
2129
|
-
SocketWithoutUpgrade.priorWebsocketSuccess = false;
|
|
2130
|
-
const onTransportOpen = () => {
|
|
2131
|
-
if (failed)
|
|
2132
|
-
return;
|
|
2133
|
-
transport.send([{ type: "ping", data: "probe" }]);
|
|
2134
|
-
transport.once("packet", (msg) => {
|
|
2135
|
-
if (failed)
|
|
2136
|
-
return;
|
|
2137
|
-
if ("pong" === msg.type && "probe" === msg.data) {
|
|
2138
|
-
this.upgrading = true;
|
|
2139
|
-
this.emitReserved("upgrading", transport);
|
|
2140
|
-
if (!transport)
|
|
2141
|
-
return;
|
|
2142
|
-
SocketWithoutUpgrade.priorWebsocketSuccess =
|
|
2143
|
-
"websocket" === transport.name;
|
|
2144
|
-
this.transport.pause(() => {
|
|
2145
|
-
if (failed)
|
|
2146
|
-
return;
|
|
2147
|
-
if ("closed" === this.readyState)
|
|
2148
|
-
return;
|
|
2149
|
-
cleanup();
|
|
2150
|
-
this.setTransport(transport);
|
|
2151
|
-
transport.send([{ type: "upgrade" }]);
|
|
2152
|
-
this.emitReserved("upgrade", transport);
|
|
2153
|
-
transport = null;
|
|
2154
|
-
this.upgrading = false;
|
|
2155
|
-
this.flush();
|
|
2156
|
-
});
|
|
2157
|
-
}
|
|
2158
|
-
else {
|
|
2159
|
-
const err = new Error("probe error");
|
|
2160
|
-
// @ts-ignore
|
|
2161
|
-
err.transport = transport.name;
|
|
2162
|
-
this.emitReserved("upgradeError", err);
|
|
2163
|
-
}
|
|
2164
|
-
});
|
|
2165
|
-
};
|
|
2166
|
-
function freezeTransport() {
|
|
2167
|
-
if (failed)
|
|
2168
|
-
return;
|
|
2169
|
-
// Any callback called by transport should be ignored since now
|
|
2170
|
-
failed = true;
|
|
2171
|
-
cleanup();
|
|
2172
|
-
transport.close();
|
|
2173
|
-
transport = null;
|
|
2174
|
-
}
|
|
2175
|
-
// Handle any error that happens while probing
|
|
2176
|
-
const onerror = (err) => {
|
|
2177
|
-
const error = new Error("probe error: " + err);
|
|
2178
|
-
// @ts-ignore
|
|
2179
|
-
error.transport = transport.name;
|
|
2180
|
-
freezeTransport();
|
|
2181
|
-
this.emitReserved("upgradeError", error);
|
|
2182
|
-
};
|
|
2183
|
-
function onTransportClose() {
|
|
2184
|
-
onerror("transport closed");
|
|
2185
|
-
}
|
|
2186
|
-
// When the socket is closed while we're probing
|
|
2187
|
-
function onclose() {
|
|
2188
|
-
onerror("socket closed");
|
|
2189
|
-
}
|
|
2190
|
-
// When the socket is upgraded while we're probing
|
|
2191
|
-
function onupgrade(to) {
|
|
2192
|
-
if (transport && to.name !== transport.name) {
|
|
2193
|
-
freezeTransport();
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
// Remove all listeners on the transport and on self
|
|
2197
|
-
const cleanup = () => {
|
|
2198
|
-
transport.removeListener("open", onTransportOpen);
|
|
2199
|
-
transport.removeListener("error", onerror);
|
|
2200
|
-
transport.removeListener("close", onTransportClose);
|
|
2201
|
-
this.off("close", onclose);
|
|
2202
|
-
this.off("upgrading", onupgrade);
|
|
2203
|
-
};
|
|
2204
|
-
transport.once("open", onTransportOpen);
|
|
2205
|
-
transport.once("error", onerror);
|
|
2206
|
-
transport.once("close", onTransportClose);
|
|
2207
|
-
this.once("close", onclose);
|
|
2208
|
-
this.once("upgrading", onupgrade);
|
|
2209
|
-
if (this._upgrades.indexOf("webtransport") !== -1 &&
|
|
2210
|
-
name !== "webtransport") {
|
|
2211
|
-
// favor WebTransport
|
|
2212
|
-
this.setTimeoutFn(() => {
|
|
2213
|
-
if (!failed) {
|
|
2214
|
-
transport.open();
|
|
2215
|
-
}
|
|
2216
|
-
}, 200);
|
|
2217
|
-
}
|
|
2218
|
-
else {
|
|
2219
|
-
transport.open();
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
onHandshake(data) {
|
|
2223
|
-
this._upgrades = this._filterUpgrades(data.upgrades);
|
|
2224
|
-
super.onHandshake(data);
|
|
2225
|
-
}
|
|
2226
2191
|
/**
|
|
2227
2192
|
* Filters upgrades, returning only those matching client transports.
|
|
2228
2193
|
*
|
|
@@ -2238,38 +2203,7 @@ class SocketWithUpgrade extends SocketWithoutUpgrade {
|
|
|
2238
2203
|
return filteredUpgrades;
|
|
2239
2204
|
}
|
|
2240
2205
|
}
|
|
2241
|
-
|
|
2242
|
-
* This class provides a WebSocket-like interface to connect to an Engine.IO server. The connection will be established
|
|
2243
|
-
* with one of the available low-level transports, like HTTP long-polling, WebSocket or WebTransport.
|
|
2244
|
-
*
|
|
2245
|
-
* This class comes with an upgrade mechanism, which means that once the connection is established with the first
|
|
2246
|
-
* low-level transport, it will try to upgrade to a better transport.
|
|
2247
|
-
*
|
|
2248
|
-
* @example
|
|
2249
|
-
* import { Socket } from "engine.io-client";
|
|
2250
|
-
*
|
|
2251
|
-
* const socket = new Socket();
|
|
2252
|
-
*
|
|
2253
|
-
* socket.on("open", () => {
|
|
2254
|
-
* socket.send("hello");
|
|
2255
|
-
* });
|
|
2256
|
-
*
|
|
2257
|
-
* @see SocketWithoutUpgrade
|
|
2258
|
-
* @see SocketWithUpgrade
|
|
2259
|
-
*/
|
|
2260
|
-
class Socket$1 extends SocketWithUpgrade {
|
|
2261
|
-
constructor(uri, opts = {}) {
|
|
2262
|
-
const isOptionsOnly = typeof uri === "object";
|
|
2263
|
-
const o = isOptionsOnly ? { ...uri } : { ...opts };
|
|
2264
|
-
if (!o.transports ||
|
|
2265
|
-
(o.transports && typeof o.transports[0] === "string")) {
|
|
2266
|
-
o.transports = (o.transports || ["polling", "websocket", "webtransport"])
|
|
2267
|
-
.map((transportName) => transports[transportName])
|
|
2268
|
-
.filter((t) => !!t);
|
|
2269
|
-
}
|
|
2270
|
-
super(isOptionsOnly ? o : uri, o);
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2206
|
+
Socket$1.protocol = protocol$1;
|
|
2273
2207
|
|
|
2274
2208
|
/**
|
|
2275
2209
|
* URL parser.
|