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