@sendity/client 0.1.6 → 0.1.8
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/components/sendity.d.ts +9 -1
- package/dist/i18n/sendity.en.d.ts +1 -0
- package/dist/sendity-client.js +303 -258
- package/package.json +1 -1
package/dist/sendity-client.js
CHANGED
|
@@ -15,6 +15,10 @@ const pt = `<template id="sendity-tpl">
|
|
|
15
15
|
<div class="verifiers" role="group" aria-label="Send the code">
|
|
16
16
|
<!-- Channel options inserted by component -->
|
|
17
17
|
</div>
|
|
18
|
+
|
|
19
|
+
<div class="sendity-secondary-slot" hidden>
|
|
20
|
+
<slot name="secondary"></slot>
|
|
21
|
+
</div>
|
|
18
22
|
</div>
|
|
19
23
|
|
|
20
24
|
<footer class="sendity-footer" aria-live="polite" aria-atomic="true">
|
|
@@ -81,6 +85,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
81
85
|
--sendity-code-border-color:var(--sendity-border-strong);
|
|
82
86
|
--sendity-code-border-radius: 0.75rem; /* 12 — radius-lg */
|
|
83
87
|
--sendity-code-padding: 0.95rem 0.75rem;
|
|
88
|
+
--sendity-code-min-height: 3.75rem;
|
|
84
89
|
|
|
85
90
|
/* Channel buttons: muted Sky for Email, brand Emerald for WhatsApp. */
|
|
86
91
|
--sendity-email-bg: #e0f2fe; /* sky-100 */
|
|
@@ -233,6 +238,8 @@ const pt = `<template id="sendity-tpl">
|
|
|
233
238
|
border: var(--sendity-code-border-size) var(--sendity-code-border-style) var(--sendity-code-border-color);
|
|
234
239
|
display: inline-grid;
|
|
235
240
|
place-items: center;
|
|
241
|
+
min-height: var(--sendity-code-min-height);
|
|
242
|
+
flex: 0 0 auto;
|
|
236
243
|
text-align: center;
|
|
237
244
|
gap: 0.5rem;
|
|
238
245
|
overflow: hidden;
|
|
@@ -288,6 +295,27 @@ const pt = `<template id="sendity-tpl">
|
|
|
288
295
|
pointer-events: none;
|
|
289
296
|
}
|
|
290
297
|
|
|
298
|
+
.sendity .sendity-secondary-slot {
|
|
299
|
+
display: block;
|
|
300
|
+
min-width: 0;
|
|
301
|
+
font-size: var(--sendity-font-size-sm);
|
|
302
|
+
line-height: 1.45;
|
|
303
|
+
color: var(--sendity-fg-2);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.sendity .sendity-secondary-slot[hidden] {
|
|
307
|
+
display: none !important;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.sendity .sendity-secondary-slot--filled {
|
|
311
|
+
margin-top: 0.125rem;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.sendity .sendity-secondary-slot ::slotted(*) {
|
|
315
|
+
box-sizing: border-box;
|
|
316
|
+
max-width: 100%;
|
|
317
|
+
}
|
|
318
|
+
|
|
291
319
|
.sendity .verifiers.is-two {
|
|
292
320
|
grid-template-columns: 1fr 1px 1fr;
|
|
293
321
|
}
|
|
@@ -820,7 +848,7 @@ class Di extends Ue {
|
|
|
820
848
|
), this;
|
|
821
849
|
}
|
|
822
850
|
}
|
|
823
|
-
class
|
|
851
|
+
class Wi extends St {
|
|
824
852
|
/**
|
|
825
853
|
* Register a callback to be called anytime the member list changes.
|
|
826
854
|
*/
|
|
@@ -855,7 +883,7 @@ class Fi extends St {
|
|
|
855
883
|
}), this;
|
|
856
884
|
}
|
|
857
885
|
}
|
|
858
|
-
class
|
|
886
|
+
class Tt extends qe {
|
|
859
887
|
/**
|
|
860
888
|
* Create a new class instance.
|
|
861
889
|
*/
|
|
@@ -931,7 +959,7 @@ class xt extends qe {
|
|
|
931
959
|
)), (!s || this.listeners[i].length === 0) && (this.events[i] && (this.socket.removeListener(i, this.events[i]), delete this.events[i]), delete this.listeners[i]);
|
|
932
960
|
}
|
|
933
961
|
}
|
|
934
|
-
class
|
|
962
|
+
class Et extends Tt {
|
|
935
963
|
/**
|
|
936
964
|
* Send a whisper event to other clients in the channel.
|
|
937
965
|
*/
|
|
@@ -943,7 +971,7 @@ class Tt extends xt {
|
|
|
943
971
|
}), this;
|
|
944
972
|
}
|
|
945
973
|
}
|
|
946
|
-
class
|
|
974
|
+
class Fi extends Et {
|
|
947
975
|
/**
|
|
948
976
|
* Register a callback to be called anytime the member list changes.
|
|
949
977
|
*/
|
|
@@ -1029,7 +1057,7 @@ class ge extends qe {
|
|
|
1029
1057
|
return this;
|
|
1030
1058
|
}
|
|
1031
1059
|
}
|
|
1032
|
-
class
|
|
1060
|
+
class xt extends ge {
|
|
1033
1061
|
/**
|
|
1034
1062
|
* Send a whisper event to other clients in the channel.
|
|
1035
1063
|
*/
|
|
@@ -1045,7 +1073,7 @@ class Bi extends ge {
|
|
|
1045
1073
|
return this;
|
|
1046
1074
|
}
|
|
1047
1075
|
}
|
|
1048
|
-
class $i extends
|
|
1076
|
+
class $i extends xt {
|
|
1049
1077
|
/**
|
|
1050
1078
|
* Register a callback to be called anytime the member list changes.
|
|
1051
1079
|
*/
|
|
@@ -1182,7 +1210,7 @@ class fe extends Ne {
|
|
|
1182
1210
|
* Get a presence channel instance by name.
|
|
1183
1211
|
*/
|
|
1184
1212
|
presenceChannel(i) {
|
|
1185
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1213
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Wi(
|
|
1186
1214
|
this.pusher,
|
|
1187
1215
|
"presence-" + i,
|
|
1188
1216
|
this.options
|
|
@@ -1291,7 +1319,7 @@ class Vi extends Ne {
|
|
|
1291
1319
|
* Get a channel instance by name.
|
|
1292
1320
|
*/
|
|
1293
1321
|
channel(i) {
|
|
1294
|
-
return this.channels[i] || (this.channels[i] = new
|
|
1322
|
+
return this.channels[i] || (this.channels[i] = new Tt(
|
|
1295
1323
|
this.socket,
|
|
1296
1324
|
i,
|
|
1297
1325
|
this.options
|
|
@@ -1301,7 +1329,7 @@ class Vi extends Ne {
|
|
|
1301
1329
|
* Get a private channel instance by name.
|
|
1302
1330
|
*/
|
|
1303
1331
|
privateChannel(i) {
|
|
1304
|
-
return this.channels["private-" + i] || (this.channels["private-" + i] = new
|
|
1332
|
+
return this.channels["private-" + i] || (this.channels["private-" + i] = new Et(
|
|
1305
1333
|
this.socket,
|
|
1306
1334
|
"private-" + i,
|
|
1307
1335
|
this.options
|
|
@@ -1311,7 +1339,7 @@ class Vi extends Ne {
|
|
|
1311
1339
|
* Get a presence channel instance by name.
|
|
1312
1340
|
*/
|
|
1313
1341
|
presenceChannel(i) {
|
|
1314
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1342
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Fi(
|
|
1315
1343
|
this.socket,
|
|
1316
1344
|
"presence-" + i,
|
|
1317
1345
|
this.options
|
|
@@ -1398,7 +1426,7 @@ class mt extends Ne {
|
|
|
1398
1426
|
* Get a private channel instance by name.
|
|
1399
1427
|
*/
|
|
1400
1428
|
privateChannel(i) {
|
|
1401
|
-
return new
|
|
1429
|
+
return new xt();
|
|
1402
1430
|
}
|
|
1403
1431
|
/**
|
|
1404
1432
|
* Get a private encrypted channel instance by name.
|
|
@@ -1608,7 +1636,7 @@ class Xi {
|
|
|
1608
1636
|
function Ji(v) {
|
|
1609
1637
|
return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
|
|
1610
1638
|
}
|
|
1611
|
-
var
|
|
1639
|
+
var Re = { exports: {} };
|
|
1612
1640
|
var gt;
|
|
1613
1641
|
function Gi() {
|
|
1614
1642
|
return gt || (gt = 1, (function(v, i) {
|
|
@@ -1621,15 +1649,15 @@ function Gi() {
|
|
|
1621
1649
|
/***/
|
|
1622
1650
|
594(m, g) {
|
|
1623
1651
|
var y = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1624
|
-
var
|
|
1625
|
-
return
|
|
1652
|
+
var E = function(u, f) {
|
|
1653
|
+
return E = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(C, L) {
|
|
1626
1654
|
C.__proto__ = L;
|
|
1627
1655
|
} || function(C, L) {
|
|
1628
1656
|
for (var q in L) L.hasOwnProperty(q) && (C[q] = L[q]);
|
|
1629
|
-
},
|
|
1657
|
+
}, E(u, f);
|
|
1630
1658
|
};
|
|
1631
1659
|
return function(u, f) {
|
|
1632
|
-
|
|
1660
|
+
E(u, f);
|
|
1633
1661
|
function C() {
|
|
1634
1662
|
this.constructor = u;
|
|
1635
1663
|
}
|
|
@@ -1637,15 +1665,15 @@ function Gi() {
|
|
|
1637
1665
|
};
|
|
1638
1666
|
})();
|
|
1639
1667
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
1640
|
-
var
|
|
1668
|
+
var x = 256, S = (
|
|
1641
1669
|
/** @class */
|
|
1642
1670
|
(function() {
|
|
1643
|
-
function
|
|
1671
|
+
function E(u) {
|
|
1644
1672
|
u === void 0 && (u = "="), this._paddingCharacter = u;
|
|
1645
1673
|
}
|
|
1646
|
-
return
|
|
1674
|
+
return E.prototype.encodedLength = function(u) {
|
|
1647
1675
|
return this._paddingCharacter ? (u + 2) / 3 * 4 | 0 : (u * 8 + 5) / 6 | 0;
|
|
1648
|
-
},
|
|
1676
|
+
}, E.prototype.encode = function(u) {
|
|
1649
1677
|
for (var f = "", C = 0; C < u.length - 2; C += 3) {
|
|
1650
1678
|
var L = u[C] << 16 | u[C + 1] << 8 | u[C + 2];
|
|
1651
1679
|
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), f += this._encodeByte(L >>> 6 & 63), f += this._encodeByte(L >>> 0 & 63);
|
|
@@ -1656,25 +1684,25 @@ function Gi() {
|
|
|
1656
1684
|
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), q === 2 ? f += this._encodeByte(L >>> 6 & 63) : f += this._paddingCharacter || "", f += this._paddingCharacter || "";
|
|
1657
1685
|
}
|
|
1658
1686
|
return f;
|
|
1659
|
-
},
|
|
1687
|
+
}, E.prototype.maxDecodedLength = function(u) {
|
|
1660
1688
|
return this._paddingCharacter ? u / 4 * 3 | 0 : (u * 6 + 7) / 8 | 0;
|
|
1661
|
-
},
|
|
1689
|
+
}, E.prototype.decodedLength = function(u) {
|
|
1662
1690
|
return this.maxDecodedLength(u.length - this._getPaddingLength(u));
|
|
1663
|
-
},
|
|
1691
|
+
}, E.prototype.decode = function(u) {
|
|
1664
1692
|
if (u.length === 0)
|
|
1665
1693
|
return new Uint8Array(0);
|
|
1666
1694
|
for (var f = this._getPaddingLength(u), C = u.length - f, L = new Uint8Array(this.maxDecodedLength(C)), q = 0, M = 0, z = 0, J = 0, D = 0, H = 0, G = 0; M < C - 4; M += 4)
|
|
1667
|
-
J = this._decodeChar(u.charCodeAt(M + 0)), D = this._decodeChar(u.charCodeAt(M + 1)), H = this._decodeChar(u.charCodeAt(M + 2)), G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = J << 2 | D >>> 4, L[q++] = D << 4 | H >>> 2, L[q++] = H << 6 | G, z |= J &
|
|
1668
|
-
if (M < C - 1 && (J = this._decodeChar(u.charCodeAt(M)), D = this._decodeChar(u.charCodeAt(M + 1)), L[q++] = J << 2 | D >>> 4, z |= J &
|
|
1695
|
+
J = this._decodeChar(u.charCodeAt(M + 0)), D = this._decodeChar(u.charCodeAt(M + 1)), H = this._decodeChar(u.charCodeAt(M + 2)), G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = J << 2 | D >>> 4, L[q++] = D << 4 | H >>> 2, L[q++] = H << 6 | G, z |= J & x, z |= D & x, z |= H & x, z |= G & x;
|
|
1696
|
+
if (M < C - 1 && (J = this._decodeChar(u.charCodeAt(M)), D = this._decodeChar(u.charCodeAt(M + 1)), L[q++] = J << 2 | D >>> 4, z |= J & x, z |= D & x), M < C - 2 && (H = this._decodeChar(u.charCodeAt(M + 2)), L[q++] = D << 4 | H >>> 2, z |= H & x), M < C - 3 && (G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = H << 6 | G, z |= G & x), z !== 0)
|
|
1669
1697
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1670
1698
|
return L;
|
|
1671
|
-
},
|
|
1699
|
+
}, E.prototype._encodeByte = function(u) {
|
|
1672
1700
|
var f = u;
|
|
1673
1701
|
return f += 65, f += 25 - u >>> 8 & 6, f += 51 - u >>> 8 & -75, f += 61 - u >>> 8 & -15, f += 62 - u >>> 8 & 3, String.fromCharCode(f);
|
|
1674
|
-
},
|
|
1675
|
-
var f =
|
|
1676
|
-
return f += (42 - u & u - 44) >>> 8 & -
|
|
1677
|
-
},
|
|
1702
|
+
}, E.prototype._decodeChar = function(u) {
|
|
1703
|
+
var f = x;
|
|
1704
|
+
return f += (42 - u & u - 44) >>> 8 & -x + u - 43 + 62, f += (46 - u & u - 48) >>> 8 & -x + u - 47 + 63, f += (47 - u & u - 58) >>> 8 & -x + u - 48 + 52, f += (64 - u & u - 91) >>> 8 & -x + u - 65 + 0, f += (96 - u & u - 123) >>> 8 & -x + u - 97 + 26, f;
|
|
1705
|
+
}, E.prototype._getPaddingLength = function(u) {
|
|
1678
1706
|
var f = 0;
|
|
1679
1707
|
if (this._paddingCharacter) {
|
|
1680
1708
|
for (var C = u.length - 1; C >= 0 && u[C] === this._paddingCharacter; C--)
|
|
@@ -1683,84 +1711,84 @@ function Gi() {
|
|
|
1683
1711
|
throw new Error("Base64Coder: incorrect padding");
|
|
1684
1712
|
}
|
|
1685
1713
|
return f;
|
|
1686
|
-
},
|
|
1714
|
+
}, E;
|
|
1687
1715
|
})()
|
|
1688
1716
|
);
|
|
1689
1717
|
g.Coder = S;
|
|
1690
1718
|
var O = new S();
|
|
1691
|
-
function
|
|
1692
|
-
return O.encode(
|
|
1719
|
+
function T(E) {
|
|
1720
|
+
return O.encode(E);
|
|
1693
1721
|
}
|
|
1694
|
-
g.encode =
|
|
1695
|
-
function A(
|
|
1696
|
-
return O.decode(
|
|
1722
|
+
g.encode = T;
|
|
1723
|
+
function A(E) {
|
|
1724
|
+
return O.decode(E);
|
|
1697
1725
|
}
|
|
1698
1726
|
g.decode = A;
|
|
1699
|
-
var
|
|
1727
|
+
var W = (
|
|
1700
1728
|
/** @class */
|
|
1701
|
-
(function(
|
|
1702
|
-
y(u,
|
|
1729
|
+
(function(E) {
|
|
1730
|
+
y(u, E);
|
|
1703
1731
|
function u() {
|
|
1704
|
-
return
|
|
1732
|
+
return E !== null && E.apply(this, arguments) || this;
|
|
1705
1733
|
}
|
|
1706
1734
|
return u.prototype._encodeByte = function(f) {
|
|
1707
1735
|
var C = f;
|
|
1708
1736
|
return C += 65, C += 25 - f >>> 8 & 6, C += 51 - f >>> 8 & -75, C += 61 - f >>> 8 & -13, C += 62 - f >>> 8 & 49, String.fromCharCode(C);
|
|
1709
1737
|
}, u.prototype._decodeChar = function(f) {
|
|
1710
|
-
var C =
|
|
1711
|
-
return C += (44 - f & f - 46) >>> 8 & -
|
|
1738
|
+
var C = x;
|
|
1739
|
+
return C += (44 - f & f - 46) >>> 8 & -x + f - 45 + 62, C += (94 - f & f - 96) >>> 8 & -x + f - 95 + 63, C += (47 - f & f - 58) >>> 8 & -x + f - 48 + 52, C += (64 - f & f - 91) >>> 8 & -x + f - 65 + 0, C += (96 - f & f - 123) >>> 8 & -x + f - 97 + 26, C;
|
|
1712
1740
|
}, u;
|
|
1713
1741
|
})(S)
|
|
1714
1742
|
);
|
|
1715
|
-
g.URLSafeCoder =
|
|
1716
|
-
var N = new
|
|
1717
|
-
function
|
|
1718
|
-
return N.encode(
|
|
1743
|
+
g.URLSafeCoder = W;
|
|
1744
|
+
var N = new W();
|
|
1745
|
+
function F(E) {
|
|
1746
|
+
return N.encode(E);
|
|
1719
1747
|
}
|
|
1720
|
-
g.encodeURLSafe =
|
|
1721
|
-
function te(
|
|
1722
|
-
return N.decode(
|
|
1748
|
+
g.encodeURLSafe = F;
|
|
1749
|
+
function te(E) {
|
|
1750
|
+
return N.decode(E);
|
|
1723
1751
|
}
|
|
1724
|
-
g.decodeURLSafe = te, g.encodedLength = function(
|
|
1725
|
-
return O.encodedLength(
|
|
1726
|
-
}, g.maxDecodedLength = function(
|
|
1727
|
-
return O.maxDecodedLength(
|
|
1728
|
-
}, g.decodedLength = function(
|
|
1729
|
-
return O.decodedLength(
|
|
1752
|
+
g.decodeURLSafe = te, g.encodedLength = function(E) {
|
|
1753
|
+
return O.encodedLength(E);
|
|
1754
|
+
}, g.maxDecodedLength = function(E) {
|
|
1755
|
+
return O.maxDecodedLength(E);
|
|
1756
|
+
}, g.decodedLength = function(E) {
|
|
1757
|
+
return O.decodedLength(E);
|
|
1730
1758
|
};
|
|
1731
1759
|
},
|
|
1732
1760
|
/***/
|
|
1733
1761
|
978(m, g) {
|
|
1734
1762
|
var y = "utf8: invalid source encoding";
|
|
1735
|
-
function
|
|
1736
|
-
for (var O = [],
|
|
1737
|
-
var A = S[
|
|
1763
|
+
function x(S) {
|
|
1764
|
+
for (var O = [], T = 0; T < S.length; T++) {
|
|
1765
|
+
var A = S[T];
|
|
1738
1766
|
if (A & 128) {
|
|
1739
|
-
var
|
|
1767
|
+
var W = void 0;
|
|
1740
1768
|
if (A < 224) {
|
|
1741
|
-
if (
|
|
1769
|
+
if (T >= S.length)
|
|
1742
1770
|
throw new Error(y);
|
|
1743
|
-
var N = S[++
|
|
1771
|
+
var N = S[++T];
|
|
1744
1772
|
if ((N & 192) !== 128)
|
|
1745
1773
|
throw new Error(y);
|
|
1746
|
-
A = (A & 31) << 6 | N & 63,
|
|
1774
|
+
A = (A & 31) << 6 | N & 63, W = 128;
|
|
1747
1775
|
} else if (A < 240) {
|
|
1748
|
-
if (
|
|
1776
|
+
if (T >= S.length - 1)
|
|
1749
1777
|
throw new Error(y);
|
|
1750
|
-
var N = S[++
|
|
1751
|
-
if ((N & 192) !== 128 || (
|
|
1778
|
+
var N = S[++T], F = S[++T];
|
|
1779
|
+
if ((N & 192) !== 128 || (F & 192) !== 128)
|
|
1752
1780
|
throw new Error(y);
|
|
1753
|
-
A = (A & 15) << 12 | (N & 63) << 6 |
|
|
1781
|
+
A = (A & 15) << 12 | (N & 63) << 6 | F & 63, W = 2048;
|
|
1754
1782
|
} else if (A < 248) {
|
|
1755
|
-
if (
|
|
1783
|
+
if (T >= S.length - 2)
|
|
1756
1784
|
throw new Error(y);
|
|
1757
|
-
var N = S[++
|
|
1758
|
-
if ((N & 192) !== 128 || (
|
|
1785
|
+
var N = S[++T], F = S[++T], te = S[++T];
|
|
1786
|
+
if ((N & 192) !== 128 || (F & 192) !== 128 || (te & 192) !== 128)
|
|
1759
1787
|
throw new Error(y);
|
|
1760
|
-
A = (A & 15) << 18 | (N & 63) << 12 | (
|
|
1788
|
+
A = (A & 15) << 18 | (N & 63) << 12 | (F & 63) << 6 | te & 63, W = 65536;
|
|
1761
1789
|
} else
|
|
1762
1790
|
throw new Error(y);
|
|
1763
|
-
if (A <
|
|
1791
|
+
if (A < W || A >= 55296 && A <= 57343)
|
|
1764
1792
|
throw new Error(y);
|
|
1765
1793
|
if (A >= 65536) {
|
|
1766
1794
|
if (A > 1114111)
|
|
@@ -1772,7 +1800,7 @@ function Gi() {
|
|
|
1772
1800
|
}
|
|
1773
1801
|
return O.join("");
|
|
1774
1802
|
}
|
|
1775
|
-
g.D4 =
|
|
1803
|
+
g.D4 = x;
|
|
1776
1804
|
},
|
|
1777
1805
|
/***/
|
|
1778
1806
|
721(m, g, y) {
|
|
@@ -1786,7 +1814,7 @@ function Gi() {
|
|
|
1786
1814
|
de
|
|
1787
1815
|
)
|
|
1788
1816
|
});
|
|
1789
|
-
class
|
|
1817
|
+
class x {
|
|
1790
1818
|
constructor(e, t) {
|
|
1791
1819
|
this.lastId = 0, this.prefix = e, this.name = t;
|
|
1792
1820
|
}
|
|
@@ -1801,7 +1829,7 @@ function Gi() {
|
|
|
1801
1829
|
delete this[e.number];
|
|
1802
1830
|
}
|
|
1803
1831
|
}
|
|
1804
|
-
var S = new
|
|
1832
|
+
var S = new x("_pusher_script_", "Pusher.ScriptReceivers"), O = {
|
|
1805
1833
|
VERSION: "8.5.0",
|
|
1806
1834
|
PROTOCOL: 7,
|
|
1807
1835
|
wsPort: 80,
|
|
@@ -1829,7 +1857,7 @@ function Gi() {
|
|
|
1829
1857
|
cdn_https: "https://js.pusher.com",
|
|
1830
1858
|
dependency_suffix: ""
|
|
1831
1859
|
};
|
|
1832
|
-
const
|
|
1860
|
+
const T = O;
|
|
1833
1861
|
class A {
|
|
1834
1862
|
constructor(e) {
|
|
1835
1863
|
this.options = e, this.receivers = e.receivers || S, this.loading = {};
|
|
@@ -1844,8 +1872,8 @@ function Gi() {
|
|
|
1844
1872
|
if (o.receivers.remove(l), o.loading[e]) {
|
|
1845
1873
|
var b = o.loading[e];
|
|
1846
1874
|
delete o.loading[e];
|
|
1847
|
-
for (var _ = function(
|
|
1848
|
-
|
|
1875
|
+
for (var _ = function(P) {
|
|
1876
|
+
P || c.cleanup();
|
|
1849
1877
|
}, k = 0; k < b.length; k++)
|
|
1850
1878
|
b[k](p, _);
|
|
1851
1879
|
}
|
|
@@ -1861,14 +1889,14 @@ function Gi() {
|
|
|
1861
1889
|
return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
|
|
1862
1890
|
}
|
|
1863
1891
|
}
|
|
1864
|
-
var
|
|
1865
|
-
cdn_http:
|
|
1866
|
-
cdn_https:
|
|
1867
|
-
version:
|
|
1868
|
-
suffix:
|
|
1869
|
-
receivers:
|
|
1892
|
+
var W = new x("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1893
|
+
cdn_http: T.cdn_http,
|
|
1894
|
+
cdn_https: T.cdn_https,
|
|
1895
|
+
version: T.VERSION,
|
|
1896
|
+
suffix: T.dependency_suffix,
|
|
1897
|
+
receivers: W
|
|
1870
1898
|
});
|
|
1871
|
-
const
|
|
1899
|
+
const F = {
|
|
1872
1900
|
baseUrl: "https://pusher.com",
|
|
1873
1901
|
urls: {
|
|
1874
1902
|
authenticationEndpoint: {
|
|
@@ -1887,12 +1915,12 @@ function Gi() {
|
|
|
1887
1915
|
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
1888
1916
|
}
|
|
1889
1917
|
}
|
|
1890
|
-
},
|
|
1891
|
-
const e = "See:", t =
|
|
1918
|
+
}, E = { buildLogSuffix: function(n) {
|
|
1919
|
+
const e = "See:", t = F.urls[n];
|
|
1892
1920
|
if (!t)
|
|
1893
1921
|
return "";
|
|
1894
1922
|
let r;
|
|
1895
|
-
return t.fullUrl ? r = t.fullUrl : t.path && (r =
|
|
1923
|
+
return t.fullUrl ? r = t.fullUrl : t.path && (r = F.baseUrl + t.path), r ? `${e} ${r}` : "";
|
|
1896
1924
|
} };
|
|
1897
1925
|
var u;
|
|
1898
1926
|
(function(n) {
|
|
@@ -1967,24 +1995,24 @@ function Gi() {
|
|
|
1967
1995
|
let p = "";
|
|
1968
1996
|
switch (r) {
|
|
1969
1997
|
case u.UserAuthentication:
|
|
1970
|
-
p =
|
|
1998
|
+
p = E.buildLogSuffix("authenticationEndpoint");
|
|
1971
1999
|
break;
|
|
1972
2000
|
case u.ChannelAuthorization:
|
|
1973
|
-
p = `Clients must be authorized to join private or presence channels. ${
|
|
2001
|
+
p = `Clients must be authorized to join private or presence channels. ${E.buildLogSuffix("authorizationEndpoint")}`;
|
|
1974
2002
|
break;
|
|
1975
2003
|
}
|
|
1976
2004
|
o(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
1977
2005
|
}
|
|
1978
2006
|
}, c.send(e), c;
|
|
1979
2007
|
};
|
|
1980
|
-
function
|
|
2008
|
+
function Rt(n) {
|
|
1981
2009
|
return qt(It(n));
|
|
1982
2010
|
}
|
|
1983
|
-
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
2011
|
+
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Pt = function(n) {
|
|
1984
2012
|
var e = n.charCodeAt(0);
|
|
1985
2013
|
return e < 128 ? n : e < 2048 ? ne(192 | e >>> 6) + ne(128 | e & 63) : ne(224 | e >>> 12 & 15) + ne(128 | e >>> 6 & 63) + ne(128 | e & 63);
|
|
1986
2014
|
}, It = function(n) {
|
|
1987
|
-
return n.replace(/[^\x00-\x7F]/g,
|
|
2015
|
+
return n.replace(/[^\x00-\x7F]/g, Pt);
|
|
1988
2016
|
}, Ot = function(n) {
|
|
1989
2017
|
var e = [0, 2, 1][n.length % 3], t = n.charCodeAt(0) << 16 | (n.length > 1 ? n.charCodeAt(1) : 0) << 8 | (n.length > 2 ? n.charCodeAt(2) : 0), r = [
|
|
1990
2018
|
oe.charAt(t >>> 18),
|
|
@@ -2069,19 +2097,19 @@ function Gi() {
|
|
|
2069
2097
|
return r;
|
|
2070
2098
|
return -1;
|
|
2071
2099
|
}
|
|
2072
|
-
function
|
|
2100
|
+
function $(n, e) {
|
|
2073
2101
|
for (var t in n)
|
|
2074
2102
|
Object.prototype.hasOwnProperty.call(n, t) && e(n[t], t, n);
|
|
2075
2103
|
}
|
|
2076
2104
|
function De(n) {
|
|
2077
2105
|
var e = [];
|
|
2078
|
-
return
|
|
2106
|
+
return $(n, function(t, r) {
|
|
2079
2107
|
e.push(r);
|
|
2080
2108
|
}), e;
|
|
2081
2109
|
}
|
|
2082
2110
|
function Dt(n) {
|
|
2083
2111
|
var e = [];
|
|
2084
|
-
return
|
|
2112
|
+
return $(n, function(t) {
|
|
2085
2113
|
e.push(t);
|
|
2086
2114
|
}), e;
|
|
2087
2115
|
}
|
|
@@ -2089,18 +2117,18 @@ function Gi() {
|
|
|
2089
2117
|
for (var r = 0; r < n.length; r++)
|
|
2090
2118
|
e.call(t || window, n[r], r, n);
|
|
2091
2119
|
}
|
|
2092
|
-
function
|
|
2120
|
+
function We(n, e) {
|
|
2093
2121
|
for (var t = [], r = 0; r < n.length; r++)
|
|
2094
2122
|
t.push(e(n[r], r, n, t));
|
|
2095
2123
|
return t;
|
|
2096
2124
|
}
|
|
2097
|
-
function
|
|
2125
|
+
function Wt(n, e) {
|
|
2098
2126
|
var t = {};
|
|
2099
|
-
return
|
|
2127
|
+
return $(n, function(r, o) {
|
|
2100
2128
|
t[o] = e(r);
|
|
2101
2129
|
}), t;
|
|
2102
2130
|
}
|
|
2103
|
-
function
|
|
2131
|
+
function Fe(n, e) {
|
|
2104
2132
|
e = e || function(o) {
|
|
2105
2133
|
return !!o;
|
|
2106
2134
|
};
|
|
@@ -2110,13 +2138,13 @@ function Gi() {
|
|
|
2110
2138
|
}
|
|
2111
2139
|
function Be(n, e) {
|
|
2112
2140
|
var t = {};
|
|
2113
|
-
return
|
|
2141
|
+
return $(n, function(r, o) {
|
|
2114
2142
|
(e && e(r, o, n, t) || r) && (t[o] = r);
|
|
2115
2143
|
}), t;
|
|
2116
2144
|
}
|
|
2117
|
-
function
|
|
2145
|
+
function Ft(n) {
|
|
2118
2146
|
var e = [];
|
|
2119
|
-
return
|
|
2147
|
+
return $(n, function(t, r) {
|
|
2120
2148
|
e.push([r, t]);
|
|
2121
2149
|
}), e;
|
|
2122
2150
|
}
|
|
@@ -2133,14 +2161,14 @@ function Gi() {
|
|
|
2133
2161
|
return !0;
|
|
2134
2162
|
}
|
|
2135
2163
|
function $t(n) {
|
|
2136
|
-
return
|
|
2137
|
-
return typeof e == "object" && (e = ae(e)), encodeURIComponent(
|
|
2164
|
+
return Wt(n, function(e) {
|
|
2165
|
+
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Rt(e.toString()));
|
|
2138
2166
|
});
|
|
2139
2167
|
}
|
|
2140
2168
|
function Vt(n) {
|
|
2141
2169
|
var e = Be(n, function(r) {
|
|
2142
2170
|
return r !== void 0;
|
|
2143
|
-
}), t =
|
|
2171
|
+
}), t = We(Ft($t(e)), U.method("join", "=")).join("&");
|
|
2144
2172
|
return t;
|
|
2145
2173
|
}
|
|
2146
2174
|
function Xt(n) {
|
|
@@ -2203,9 +2231,9 @@ function Gi() {
|
|
|
2203
2231
|
de.log ? de.log(r) : de.logToConsole && e.bind(this)(r);
|
|
2204
2232
|
}
|
|
2205
2233
|
}
|
|
2206
|
-
const
|
|
2234
|
+
const R = new Jt();
|
|
2207
2235
|
var Gt = function(n, e, t, r, o) {
|
|
2208
|
-
(t.headers !== void 0 || t.headersProvider != null) &&
|
|
2236
|
+
(t.headers !== void 0 || t.headersProvider != null) && R.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
2209
2237
|
var c = n.nextAuthCallbackID.toString();
|
|
2210
2238
|
n.nextAuthCallbackID++;
|
|
2211
2239
|
var l = n.getDocument(), p = l.createElement("script");
|
|
@@ -2269,7 +2297,7 @@ function Gi() {
|
|
|
2269
2297
|
return r + "://" + o + t;
|
|
2270
2298
|
}
|
|
2271
2299
|
function be(n, e) {
|
|
2272
|
-
var t = "/app/" + n, r = "?protocol=" +
|
|
2300
|
+
var t = "/app/" + n, r = "?protocol=" + T.PROTOCOL + "&client=js&version=" + T.VERSION + (e ? "&" + e : "");
|
|
2273
2301
|
return t + r;
|
|
2274
2302
|
}
|
|
2275
2303
|
var nn = {
|
|
@@ -2314,7 +2342,7 @@ function Gi() {
|
|
|
2314
2342
|
}
|
|
2315
2343
|
removeCallback(e, t, r) {
|
|
2316
2344
|
ie(e, function(o) {
|
|
2317
|
-
this._callbacks[o] =
|
|
2345
|
+
this._callbacks[o] = Fe(this._callbacks[o] || [], function(c) {
|
|
2318
2346
|
return t && t !== c.fn || r && r !== c.context;
|
|
2319
2347
|
}), this._callbacks[o].length === 0 && delete this._callbacks[o];
|
|
2320
2348
|
}, this);
|
|
@@ -2328,7 +2356,7 @@ function Gi() {
|
|
|
2328
2356
|
function we(n) {
|
|
2329
2357
|
return "_" + n;
|
|
2330
2358
|
}
|
|
2331
|
-
class
|
|
2359
|
+
class V {
|
|
2332
2360
|
constructor(e) {
|
|
2333
2361
|
this.callbacks = new on(), this.global_callbacks = [], this.failThrough = e;
|
|
2334
2362
|
}
|
|
@@ -2342,7 +2370,7 @@ function Gi() {
|
|
|
2342
2370
|
return this.callbacks.remove(e, t, r), this;
|
|
2343
2371
|
}
|
|
2344
2372
|
unbind_global(e) {
|
|
2345
|
-
return e ? (this.global_callbacks =
|
|
2373
|
+
return e ? (this.global_callbacks = Fe(this.global_callbacks || [], (t) => t !== e), this) : (this.global_callbacks = [], this);
|
|
2346
2374
|
}
|
|
2347
2375
|
unbind_all() {
|
|
2348
2376
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -2358,7 +2386,7 @@ function Gi() {
|
|
|
2358
2386
|
return this;
|
|
2359
2387
|
}
|
|
2360
2388
|
}
|
|
2361
|
-
class an extends
|
|
2389
|
+
class an extends V {
|
|
2362
2390
|
constructor(e, t, r, o, c) {
|
|
2363
2391
|
super(), this.initialize = w.transportConnectionInitializer, this.hooks = e, this.name = t, this.priority = r, this.key = o, this.options = c, this.state = "new", this.timeline = c.timeline, this.activityTimeout = c.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
2364
2392
|
}
|
|
@@ -2379,7 +2407,7 @@ function Gi() {
|
|
|
2379
2407
|
this.onError(t), this.changeState("closed");
|
|
2380
2408
|
}), !1;
|
|
2381
2409
|
}
|
|
2382
|
-
return this.bindListeners(),
|
|
2410
|
+
return this.bindListeners(), R.debug("Connecting", { transport: this.name, url: e }), this.changeState("connecting"), !0;
|
|
2383
2411
|
}
|
|
2384
2412
|
close() {
|
|
2385
2413
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
@@ -2518,7 +2546,7 @@ function Gi() {
|
|
|
2518
2546
|
}, fn = new ee(j({}, Xe, Ye)), pn = new ee(j({}, Je, Ye));
|
|
2519
2547
|
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs = un;
|
|
2520
2548
|
const mn = ce;
|
|
2521
|
-
class gn extends
|
|
2549
|
+
class gn extends V {
|
|
2522
2550
|
constructor() {
|
|
2523
2551
|
super();
|
|
2524
2552
|
var e = this;
|
|
@@ -2611,7 +2639,7 @@ function Gi() {
|
|
|
2611
2639
|
} : null;
|
|
2612
2640
|
}
|
|
2613
2641
|
}, K = Ke;
|
|
2614
|
-
class bn extends
|
|
2642
|
+
class bn extends V {
|
|
2615
2643
|
constructor(e, t) {
|
|
2616
2644
|
super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
|
|
2617
2645
|
}
|
|
@@ -2623,7 +2651,7 @@ function Gi() {
|
|
|
2623
2651
|
}
|
|
2624
2652
|
send_event(e, t, r) {
|
|
2625
2653
|
var o = { event: e, data: t };
|
|
2626
|
-
return r && (o.channel = r),
|
|
2654
|
+
return r && (o.channel = r), R.debug("Event sent", o), this.send(K.encodeMessage(o));
|
|
2627
2655
|
}
|
|
2628
2656
|
ping() {
|
|
2629
2657
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -2645,7 +2673,7 @@ function Gi() {
|
|
|
2645
2673
|
});
|
|
2646
2674
|
}
|
|
2647
2675
|
if (o !== void 0) {
|
|
2648
|
-
switch (
|
|
2676
|
+
switch (R.debug("Event recd", o), o.event) {
|
|
2649
2677
|
case "pusher:error":
|
|
2650
2678
|
this.emit("error", {
|
|
2651
2679
|
type: "PusherError",
|
|
@@ -2672,11 +2700,11 @@ function Gi() {
|
|
|
2672
2700
|
t(), r && r.code && this.handleCloseEvent(r), this.transport = null, this.emit("closed");
|
|
2673
2701
|
}
|
|
2674
2702
|
}, t = () => {
|
|
2675
|
-
|
|
2703
|
+
$(e, (r, o) => {
|
|
2676
2704
|
this.transport.unbind(o, r);
|
|
2677
2705
|
});
|
|
2678
2706
|
};
|
|
2679
|
-
|
|
2707
|
+
$(e, (r, o) => {
|
|
2680
2708
|
this.transport.bind(o, r);
|
|
2681
2709
|
});
|
|
2682
2710
|
}
|
|
@@ -2727,10 +2755,10 @@ function Gi() {
|
|
|
2727
2755
|
this.timeline.isEmpty() || this.timeline.send(w.TimelineTransport.getAgent(this, e), t);
|
|
2728
2756
|
}
|
|
2729
2757
|
}
|
|
2730
|
-
class Ce extends
|
|
2758
|
+
class Ce extends V {
|
|
2731
2759
|
constructor(e, t) {
|
|
2732
2760
|
super(function(r, o) {
|
|
2733
|
-
|
|
2761
|
+
R.debug("No callbacks on " + e + " for " + r);
|
|
2734
2762
|
}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
2735
2763
|
}
|
|
2736
2764
|
authorize(e, t) {
|
|
@@ -2740,8 +2768,8 @@ function Gi() {
|
|
|
2740
2768
|
if (e.indexOf("client-") !== 0)
|
|
2741
2769
|
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2742
2770
|
if (!this.subscribed) {
|
|
2743
|
-
var r =
|
|
2744
|
-
|
|
2771
|
+
var r = E.buildLogSuffix("triggeringClientEvents");
|
|
2772
|
+
R.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2745
2773
|
}
|
|
2746
2774
|
return this.pusher.send_event(e, t, this.name);
|
|
2747
2775
|
}
|
|
@@ -2767,7 +2795,7 @@ function Gi() {
|
|
|
2767
2795
|
}
|
|
2768
2796
|
subscribe() {
|
|
2769
2797
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (e, t) => {
|
|
2770
|
-
e ? (this.subscriptionPending = !1,
|
|
2798
|
+
e ? (this.subscriptionPending = !1, R.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
2771
2799
|
type: "AuthError",
|
|
2772
2800
|
error: e.message
|
|
2773
2801
|
}, e instanceof H ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
@@ -2808,7 +2836,7 @@ function Gi() {
|
|
|
2808
2836
|
} : null;
|
|
2809
2837
|
}
|
|
2810
2838
|
each(e) {
|
|
2811
|
-
|
|
2839
|
+
$(this.members, (t, r) => {
|
|
2812
2840
|
e(this.get(r));
|
|
2813
2841
|
});
|
|
2814
2842
|
}
|
|
@@ -2829,7 +2857,7 @@ function Gi() {
|
|
|
2829
2857
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
2830
2858
|
}
|
|
2831
2859
|
}
|
|
2832
|
-
var
|
|
2860
|
+
var Tn = function(n, e, t, r) {
|
|
2833
2861
|
function o(c) {
|
|
2834
2862
|
return c instanceof t ? c : new t(function(l) {
|
|
2835
2863
|
l(c);
|
|
@@ -2839,15 +2867,15 @@ function Gi() {
|
|
|
2839
2867
|
function p(k) {
|
|
2840
2868
|
try {
|
|
2841
2869
|
_(r.next(k));
|
|
2842
|
-
} catch (
|
|
2843
|
-
l(
|
|
2870
|
+
} catch (P) {
|
|
2871
|
+
l(P);
|
|
2844
2872
|
}
|
|
2845
2873
|
}
|
|
2846
2874
|
function b(k) {
|
|
2847
2875
|
try {
|
|
2848
2876
|
_(r.throw(k));
|
|
2849
|
-
} catch (
|
|
2850
|
-
l(
|
|
2877
|
+
} catch (P) {
|
|
2878
|
+
l(P);
|
|
2851
2879
|
}
|
|
2852
2880
|
}
|
|
2853
2881
|
function _(k) {
|
|
@@ -2856,12 +2884,12 @@ function Gi() {
|
|
|
2856
2884
|
_((r = r.apply(n, e || [])).next());
|
|
2857
2885
|
});
|
|
2858
2886
|
};
|
|
2859
|
-
class
|
|
2887
|
+
class En extends Se {
|
|
2860
2888
|
constructor(e, t) {
|
|
2861
2889
|
super(e, t), this.members = new Sn();
|
|
2862
2890
|
}
|
|
2863
2891
|
authorize(e, t) {
|
|
2864
|
-
super.authorize(e, (r, o) =>
|
|
2892
|
+
super.authorize(e, (r, o) => Tn(this, void 0, void 0, function* () {
|
|
2865
2893
|
if (!r)
|
|
2866
2894
|
if (o = o, o.channel_data != null) {
|
|
2867
2895
|
var c = JSON.parse(o.channel_data);
|
|
@@ -2869,8 +2897,8 @@ function Gi() {
|
|
|
2869
2897
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
2870
2898
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2871
2899
|
else {
|
|
2872
|
-
let l =
|
|
2873
|
-
|
|
2900
|
+
let l = E.buildLogSuffix("authorizationEndpoint");
|
|
2901
|
+
R.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${l}, or the user should be signed in.`), t("Invalid auth response");
|
|
2874
2902
|
return;
|
|
2875
2903
|
}
|
|
2876
2904
|
t(r, o);
|
|
@@ -2911,7 +2939,7 @@ function Gi() {
|
|
|
2911
2939
|
this.members.reset(), super.disconnect();
|
|
2912
2940
|
}
|
|
2913
2941
|
}
|
|
2914
|
-
var
|
|
2942
|
+
var xn = y(978), Te = y(594);
|
|
2915
2943
|
class _n extends Se {
|
|
2916
2944
|
constructor(e, t, r) {
|
|
2917
2945
|
super(e, t), this.key = null, this.nacl = r;
|
|
@@ -2927,7 +2955,7 @@ function Gi() {
|
|
|
2927
2955
|
t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2928
2956
|
return;
|
|
2929
2957
|
}
|
|
2930
|
-
this.key = (0,
|
|
2958
|
+
this.key = (0, Te.decode)(c), delete o.shared_secret, t(null, o);
|
|
2931
2959
|
});
|
|
2932
2960
|
}
|
|
2933
2961
|
trigger(e, t) {
|
|
@@ -2943,32 +2971,32 @@ function Gi() {
|
|
|
2943
2971
|
}
|
|
2944
2972
|
handleEncryptedEvent(e, t) {
|
|
2945
2973
|
if (!this.key) {
|
|
2946
|
-
|
|
2974
|
+
R.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
2947
2975
|
return;
|
|
2948
2976
|
}
|
|
2949
2977
|
if (!t.ciphertext || !t.nonce) {
|
|
2950
|
-
|
|
2978
|
+
R.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
|
|
2951
2979
|
return;
|
|
2952
2980
|
}
|
|
2953
|
-
let r = (0,
|
|
2981
|
+
let r = (0, Te.decode)(t.ciphertext);
|
|
2954
2982
|
if (r.length < this.nacl.secretbox.overheadLength) {
|
|
2955
|
-
|
|
2983
|
+
R.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2956
2984
|
return;
|
|
2957
2985
|
}
|
|
2958
|
-
let o = (0,
|
|
2986
|
+
let o = (0, Te.decode)(t.nonce);
|
|
2959
2987
|
if (o.length < this.nacl.secretbox.nonceLength) {
|
|
2960
|
-
|
|
2988
|
+
R.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${o.length}`);
|
|
2961
2989
|
return;
|
|
2962
2990
|
}
|
|
2963
2991
|
let c = this.nacl.secretbox.open(r, o, this.key);
|
|
2964
2992
|
if (c === null) {
|
|
2965
|
-
|
|
2993
|
+
R.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (l, p) => {
|
|
2966
2994
|
if (l) {
|
|
2967
|
-
|
|
2995
|
+
R.error(`Failed to make a request to the authEndpoint: ${p}. Unable to fetch new key, so dropping encrypted event`);
|
|
2968
2996
|
return;
|
|
2969
2997
|
}
|
|
2970
2998
|
if (c = this.nacl.secretbox.open(r, o, this.key), c === null) {
|
|
2971
|
-
|
|
2999
|
+
R.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
2972
3000
|
return;
|
|
2973
3001
|
}
|
|
2974
3002
|
this.emit(e, this.getDataToEmit(c));
|
|
@@ -2978,7 +3006,7 @@ function Gi() {
|
|
|
2978
3006
|
this.emit(e, this.getDataToEmit(c));
|
|
2979
3007
|
}
|
|
2980
3008
|
getDataToEmit(e) {
|
|
2981
|
-
let t = (0,
|
|
3009
|
+
let t = (0, xn.D4)(e);
|
|
2982
3010
|
try {
|
|
2983
3011
|
return JSON.parse(t);
|
|
2984
3012
|
} catch {
|
|
@@ -2986,7 +3014,7 @@ function Gi() {
|
|
|
2986
3014
|
}
|
|
2987
3015
|
}
|
|
2988
3016
|
}
|
|
2989
|
-
class kn extends
|
|
3017
|
+
class kn extends V {
|
|
2990
3018
|
constructor(e, t) {
|
|
2991
3019
|
super(), this.state = "initialized", this.connection = null, this.key = e, this.options = t, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
2992
3020
|
var r = w.getNetwork();
|
|
@@ -3138,7 +3166,7 @@ function Gi() {
|
|
|
3138
3166
|
var r = this.state;
|
|
3139
3167
|
if (this.state = e, r !== e) {
|
|
3140
3168
|
var o = e;
|
|
3141
|
-
o === "connected" && (o += " with new socket ID " + t.socket_id),
|
|
3169
|
+
o === "connected" && (o += " with new socket ID " + t.socket_id), R.debug("State changed", r + " -> " + o), this.timeline.info({ state: e, params: t }), this.emit("state_change", { previous: r, current: e }), this.emit(e, t);
|
|
3142
3170
|
}
|
|
3143
3171
|
}
|
|
3144
3172
|
shouldRetry() {
|
|
@@ -3163,7 +3191,7 @@ function Gi() {
|
|
|
3163
3191
|
return delete this.channels[e], t;
|
|
3164
3192
|
}
|
|
3165
3193
|
disconnect() {
|
|
3166
|
-
|
|
3194
|
+
$(this.channels, function(e) {
|
|
3167
3195
|
e.disconnect();
|
|
3168
3196
|
});
|
|
3169
3197
|
}
|
|
@@ -3171,20 +3199,20 @@ function Gi() {
|
|
|
3171
3199
|
function Ln(n, e) {
|
|
3172
3200
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3173
3201
|
if (e.config.nacl)
|
|
3174
|
-
return
|
|
3175
|
-
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r =
|
|
3202
|
+
return X.createEncryptedChannel(n, e, e.config.nacl);
|
|
3203
|
+
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = E.buildLogSuffix("encryptedChannelSupport");
|
|
3176
3204
|
throw new z(`${t}. ${r}`);
|
|
3177
3205
|
} else {
|
|
3178
3206
|
if (n.indexOf("private-") === 0)
|
|
3179
|
-
return
|
|
3207
|
+
return X.createPrivateChannel(n, e);
|
|
3180
3208
|
if (n.indexOf("presence-") === 0)
|
|
3181
|
-
return
|
|
3209
|
+
return X.createPresenceChannel(n, e);
|
|
3182
3210
|
if (n.indexOf("#") === 0)
|
|
3183
3211
|
throw new C('Cannot create a channel with name "' + n + '".');
|
|
3184
|
-
return
|
|
3212
|
+
return X.createChannel(n, e);
|
|
3185
3213
|
}
|
|
3186
3214
|
}
|
|
3187
|
-
var
|
|
3215
|
+
var Rn = {
|
|
3188
3216
|
createChannels() {
|
|
3189
3217
|
return new An();
|
|
3190
3218
|
},
|
|
@@ -3198,7 +3226,7 @@ function Gi() {
|
|
|
3198
3226
|
return new Se(n, e);
|
|
3199
3227
|
},
|
|
3200
3228
|
createPresenceChannel(n, e) {
|
|
3201
|
-
return new
|
|
3229
|
+
return new En(n, e);
|
|
3202
3230
|
},
|
|
3203
3231
|
createEncryptedChannel(n, e, t) {
|
|
3204
3232
|
return new _n(n, e, t);
|
|
@@ -3213,13 +3241,13 @@ function Gi() {
|
|
|
3213
3241
|
return new yn(n, e, t);
|
|
3214
3242
|
}
|
|
3215
3243
|
};
|
|
3216
|
-
const
|
|
3244
|
+
const X = Rn;
|
|
3217
3245
|
class Qe {
|
|
3218
3246
|
constructor(e) {
|
|
3219
3247
|
this.options = e || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
3220
3248
|
}
|
|
3221
3249
|
getAssistant(e) {
|
|
3222
|
-
return
|
|
3250
|
+
return X.createAssistantToTheTransportManager(this, e, {
|
|
3223
3251
|
minPingDelay: this.options.minPingDelay,
|
|
3224
3252
|
maxPingDelay: this.options.maxPingDelay
|
|
3225
3253
|
});
|
|
@@ -3267,7 +3295,7 @@ function Gi() {
|
|
|
3267
3295
|
};
|
|
3268
3296
|
}
|
|
3269
3297
|
}
|
|
3270
|
-
class
|
|
3298
|
+
class Ee {
|
|
3271
3299
|
constructor(e) {
|
|
3272
3300
|
this.strategies = e;
|
|
3273
3301
|
}
|
|
@@ -3275,7 +3303,7 @@ function Gi() {
|
|
|
3275
3303
|
return $e(this.strategies, U.method("isSupported"));
|
|
3276
3304
|
}
|
|
3277
3305
|
connect(e, t) {
|
|
3278
|
-
return
|
|
3306
|
+
return Pn(this.strategies, e, function(r, o) {
|
|
3279
3307
|
return function(c, l) {
|
|
3280
3308
|
if (o[r].error = c, c) {
|
|
3281
3309
|
In(o) && t(!0);
|
|
@@ -3288,8 +3316,8 @@ function Gi() {
|
|
|
3288
3316
|
});
|
|
3289
3317
|
}
|
|
3290
3318
|
}
|
|
3291
|
-
function
|
|
3292
|
-
var r =
|
|
3319
|
+
function Pn(n, e, t) {
|
|
3320
|
+
var r = We(n, function(o, c, l, p) {
|
|
3293
3321
|
return o.connect(e, t(c, p));
|
|
3294
3322
|
});
|
|
3295
3323
|
return {
|
|
@@ -3331,8 +3359,8 @@ function Gi() {
|
|
|
3331
3359
|
failFast: !0
|
|
3332
3360
|
}))) : c++);
|
|
3333
3361
|
}
|
|
3334
|
-
var b = U.now(), _ = l.pop().connect(e, function k(
|
|
3335
|
-
|
|
3362
|
+
var b = U.now(), _ = l.pop().connect(e, function k(P, ue) {
|
|
3363
|
+
P ? (Ze(r), l.length > 0 ? (b = U.now(), _ = l.pop().connect(e, k)) : t(P)) : (Nn(r, ue.transport.name, U.now() - b, c), t(null, ue));
|
|
3336
3364
|
});
|
|
3337
3365
|
return {
|
|
3338
3366
|
abort: function() {
|
|
@@ -3344,14 +3372,14 @@ function Gi() {
|
|
|
3344
3372
|
};
|
|
3345
3373
|
}
|
|
3346
3374
|
}
|
|
3347
|
-
function
|
|
3375
|
+
function xe(n) {
|
|
3348
3376
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3349
3377
|
}
|
|
3350
3378
|
function Un(n) {
|
|
3351
3379
|
var e = w.getLocalStorage();
|
|
3352
3380
|
if (e)
|
|
3353
3381
|
try {
|
|
3354
|
-
var t = e[
|
|
3382
|
+
var t = e[xe(n)];
|
|
3355
3383
|
if (t)
|
|
3356
3384
|
return JSON.parse(t);
|
|
3357
3385
|
} catch {
|
|
@@ -3363,7 +3391,7 @@ function Gi() {
|
|
|
3363
3391
|
var o = w.getLocalStorage();
|
|
3364
3392
|
if (o)
|
|
3365
3393
|
try {
|
|
3366
|
-
o[
|
|
3394
|
+
o[xe(n)] = ae({
|
|
3367
3395
|
timestamp: U.now(),
|
|
3368
3396
|
transport: e,
|
|
3369
3397
|
latency: t,
|
|
@@ -3376,7 +3404,7 @@ function Gi() {
|
|
|
3376
3404
|
var e = w.getLocalStorage();
|
|
3377
3405
|
if (e)
|
|
3378
3406
|
try {
|
|
3379
|
-
delete e[
|
|
3407
|
+
delete e[xe(n)];
|
|
3380
3408
|
} catch {
|
|
3381
3409
|
}
|
|
3382
3410
|
}
|
|
@@ -3460,24 +3488,24 @@ function Gi() {
|
|
|
3460
3488
|
lives: 2,
|
|
3461
3489
|
minPingDelay: 1e4,
|
|
3462
3490
|
maxPingDelay: n.activityTimeout
|
|
3463
|
-
}),
|
|
3464
|
-
new re(se(ot), ot,
|
|
3491
|
+
}), P = o("ws", "ws", 3, c, _), ue = o("wss", "ws", 3, l, _), Ri = o("sockjs", "sockjs", 1, p), ot = o("xhr_streaming", "xhr_streaming", 1, p, k), Pi = o("xdr_streaming", "xdr_streaming", 1, p, k), at = o("xhr_polling", "xhr_polling", 1, p), Ii = o("xdr_polling", "xdr_polling", 1, p), ct = new Q([P], b), Oi = new Q([ue], b), qi = new Q([Ri], b), ht = new Q([
|
|
3492
|
+
new re(se(ot), ot, Pi)
|
|
3465
3493
|
], b), lt = new Q([
|
|
3466
3494
|
new re(se(at), at, Ii)
|
|
3467
3495
|
], b), dt = new Q([
|
|
3468
|
-
new re(se(ht), new
|
|
3496
|
+
new re(se(ht), new Ee([
|
|
3469
3497
|
ht,
|
|
3470
3498
|
new he(lt, { delay: 4e3 })
|
|
3471
3499
|
]), lt)
|
|
3472
3500
|
], b), Ae = new re(se(dt), dt, qi), Le;
|
|
3473
|
-
return e.useTLS ? Le = new
|
|
3501
|
+
return e.useTLS ? Le = new Ee([
|
|
3474
3502
|
ct,
|
|
3475
3503
|
new he(Ae, { delay: 2e3 })
|
|
3476
|
-
]) : Le = new
|
|
3504
|
+
]) : Le = new Ee([
|
|
3477
3505
|
ct,
|
|
3478
3506
|
new he(Oi, { delay: 2e3 }),
|
|
3479
3507
|
new he(Ae, { delay: 5e3 })
|
|
3480
|
-
]), new qn(new Mn(new re(se(
|
|
3508
|
+
]), new qn(new Mn(new re(se(P), Le, Ae)), r, {
|
|
3481
3509
|
ttl: 18e5,
|
|
3482
3510
|
timeline: e.timeline,
|
|
3483
3511
|
useTLS: e.useTLS
|
|
@@ -3509,8 +3537,8 @@ function Gi() {
|
|
|
3509
3537
|
n.ontimeout = n.onerror = n.onprogress = n.onload = null, n.abort();
|
|
3510
3538
|
}
|
|
3511
3539
|
};
|
|
3512
|
-
const
|
|
3513
|
-
class Bn extends
|
|
3540
|
+
const Wn = Dn, Fn = 256 * 1024;
|
|
3541
|
+
class Bn extends V {
|
|
3514
3542
|
constructor(e, t, r) {
|
|
3515
3543
|
super(), this.hooks = e, this.method = t, this.url = r;
|
|
3516
3544
|
}
|
|
@@ -3538,7 +3566,7 @@ function Gi() {
|
|
|
3538
3566
|
return r !== -1 ? (this.position += r + 1, t.slice(0, r)) : null;
|
|
3539
3567
|
}
|
|
3540
3568
|
isBufferTooLong(e) {
|
|
3541
|
-
return this.position === e.length && e.length >
|
|
3569
|
+
return this.position === e.length && e.length > Fn;
|
|
3542
3570
|
}
|
|
3543
3571
|
}
|
|
3544
3572
|
var _e;
|
|
@@ -3731,13 +3759,13 @@ function Gi() {
|
|
|
3731
3759
|
};
|
|
3732
3760
|
const nt = ri;
|
|
3733
3761
|
nt.createXDR = function(n, e) {
|
|
3734
|
-
return this.createRequest(
|
|
3762
|
+
return this.createRequest(Wn, n, e);
|
|
3735
3763
|
};
|
|
3736
3764
|
var si = {
|
|
3737
3765
|
nextAuthCallbackID: 1,
|
|
3738
3766
|
auth_callbacks: {},
|
|
3739
3767
|
ScriptReceivers: S,
|
|
3740
|
-
DependenciesReceivers:
|
|
3768
|
+
DependenciesReceivers: W,
|
|
3741
3769
|
getDefaultStrategy: zn,
|
|
3742
3770
|
Transports: mn,
|
|
3743
3771
|
transportConnectionInitializer: Hn,
|
|
@@ -3888,15 +3916,15 @@ function Gi() {
|
|
|
3888
3916
|
var r = !1, o = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3889
3917
|
o.unbind("initialized", l), o.connect();
|
|
3890
3918
|
}, p = function() {
|
|
3891
|
-
c =
|
|
3892
|
-
r = !0, k(), t(null,
|
|
3919
|
+
c = X.createHandshake(o, function(P) {
|
|
3920
|
+
r = !0, k(), t(null, P);
|
|
3893
3921
|
});
|
|
3894
|
-
}, b = function(
|
|
3895
|
-
k(), t(
|
|
3922
|
+
}, b = function(P) {
|
|
3923
|
+
k(), t(P);
|
|
3896
3924
|
}, _ = function() {
|
|
3897
3925
|
k();
|
|
3898
|
-
var
|
|
3899
|
-
|
|
3926
|
+
var P;
|
|
3927
|
+
P = ae(o), t(new M(P));
|
|
3900
3928
|
}, k = function() {
|
|
3901
3929
|
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error", b), o.unbind("closed", _);
|
|
3902
3930
|
};
|
|
@@ -3904,8 +3932,8 @@ function Gi() {
|
|
|
3904
3932
|
abort: () => {
|
|
3905
3933
|
r || (k(), c ? c.close() : o.close());
|
|
3906
3934
|
},
|
|
3907
|
-
forceMinPriority: (
|
|
3908
|
-
r || this.priority <
|
|
3935
|
+
forceMinPriority: (P) => {
|
|
3936
|
+
r || this.priority < P && (c ? c.close() : o.close());
|
|
3909
3937
|
}
|
|
3910
3938
|
};
|
|
3911
3939
|
}
|
|
@@ -3949,7 +3977,7 @@ function Gi() {
|
|
|
3949
3977
|
throw "You must pass an options object";
|
|
3950
3978
|
if (n.cluster == null)
|
|
3951
3979
|
throw "Options object must provide a cluster";
|
|
3952
|
-
"disableStats" in n &&
|
|
3980
|
+
"disableStats" in n && R.warn("The disableStats option is deprecated in favor of enableStats");
|
|
3953
3981
|
}
|
|
3954
3982
|
const ui = (n, e) => {
|
|
3955
3983
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
@@ -4002,28 +4030,28 @@ function Gi() {
|
|
|
4002
4030
|
};
|
|
4003
4031
|
function rt(n, e) {
|
|
4004
4032
|
let t = {
|
|
4005
|
-
activityTimeout: n.activityTimeout ||
|
|
4033
|
+
activityTimeout: n.activityTimeout || T.activityTimeout,
|
|
4006
4034
|
cluster: n.cluster,
|
|
4007
|
-
httpPath: n.httpPath ||
|
|
4008
|
-
httpPort: n.httpPort ||
|
|
4009
|
-
httpsPort: n.httpsPort ||
|
|
4010
|
-
pongTimeout: n.pongTimeout ||
|
|
4011
|
-
statsHost: n.statsHost ||
|
|
4012
|
-
unavailableTimeout: n.unavailableTimeout ||
|
|
4013
|
-
wsPath: n.wsPath ||
|
|
4014
|
-
wsPort: n.wsPort ||
|
|
4015
|
-
wssPort: n.wssPort ||
|
|
4035
|
+
httpPath: n.httpPath || T.httpPath,
|
|
4036
|
+
httpPort: n.httpPort || T.httpPort,
|
|
4037
|
+
httpsPort: n.httpsPort || T.httpsPort,
|
|
4038
|
+
pongTimeout: n.pongTimeout || T.pongTimeout,
|
|
4039
|
+
statsHost: n.statsHost || T.stats_host,
|
|
4040
|
+
unavailableTimeout: n.unavailableTimeout || T.unavailableTimeout,
|
|
4041
|
+
wsPath: n.wsPath || T.wsPath,
|
|
4042
|
+
wsPort: n.wsPort || T.wsPort,
|
|
4043
|
+
wssPort: n.wssPort || T.wssPort,
|
|
4016
4044
|
enableStats: Ci(n),
|
|
4017
4045
|
httpHost: vi(n),
|
|
4018
4046
|
useTLS: wi(n),
|
|
4019
4047
|
wsHost: yi(n),
|
|
4020
4048
|
userAuthenticator: Si(n),
|
|
4021
|
-
channelAuthorizer:
|
|
4049
|
+
channelAuthorizer: Ei(n, e)
|
|
4022
4050
|
};
|
|
4023
4051
|
return "disabledTransports" in n && (t.disabledTransports = n.disabledTransports), "enabledTransports" in n && (t.enabledTransports = n.enabledTransports), "ignoreNullOrigin" in n && (t.ignoreNullOrigin = n.ignoreNullOrigin), "timelineParams" in n && (t.timelineParams = n.timelineParams), "nacl" in n && (t.nacl = n.nacl), t;
|
|
4024
4052
|
}
|
|
4025
4053
|
function vi(n) {
|
|
4026
|
-
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` :
|
|
4054
|
+
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` : T.httpHost;
|
|
4027
4055
|
}
|
|
4028
4056
|
function yi(n) {
|
|
4029
4057
|
return n.wsHost ? n.wsHost : bi(n.cluster);
|
|
@@ -4039,30 +4067,30 @@ function Gi() {
|
|
|
4039
4067
|
}
|
|
4040
4068
|
const st = (n) => "customHandler" in n && n.customHandler != null;
|
|
4041
4069
|
function Si(n) {
|
|
4042
|
-
const e = Object.assign(Object.assign({},
|
|
4070
|
+
const e = Object.assign(Object.assign({}, T.userAuthentication), n.userAuthentication);
|
|
4043
4071
|
return st(e) ? e.customHandler : fi(e);
|
|
4044
4072
|
}
|
|
4045
|
-
function
|
|
4073
|
+
function Ti(n, e) {
|
|
4046
4074
|
let t;
|
|
4047
4075
|
if ("channelAuthorization" in n)
|
|
4048
|
-
t = Object.assign(Object.assign({},
|
|
4076
|
+
t = Object.assign(Object.assign({}, T.channelAuthorization), n.channelAuthorization);
|
|
4049
4077
|
else if (t = {
|
|
4050
|
-
transport: n.authTransport ||
|
|
4051
|
-
endpoint: n.authEndpoint ||
|
|
4078
|
+
transport: n.authTransport || T.authTransport,
|
|
4079
|
+
endpoint: n.authEndpoint || T.authEndpoint
|
|
4052
4080
|
}, "auth" in n && ("params" in n.auth && (t.params = n.auth.params), "headers" in n.auth && (t.headers = n.auth.headers)), "authorizer" in n)
|
|
4053
4081
|
return {
|
|
4054
4082
|
customHandler: gi(e, t, n.authorizer)
|
|
4055
4083
|
};
|
|
4056
4084
|
return t;
|
|
4057
4085
|
}
|
|
4058
|
-
function
|
|
4059
|
-
const t =
|
|
4086
|
+
function Ei(n, e) {
|
|
4087
|
+
const t = Ti(n, e);
|
|
4060
4088
|
return st(t) ? t.customHandler : mi(t);
|
|
4061
4089
|
}
|
|
4062
|
-
class
|
|
4090
|
+
class xi extends V {
|
|
4063
4091
|
constructor(e) {
|
|
4064
4092
|
super(function(t, r) {
|
|
4065
|
-
|
|
4093
|
+
R.debug(`No callbacks on watchlist events for ${t}`);
|
|
4066
4094
|
}), this.pusher = e, this.bindWatchlistInternalEvent();
|
|
4067
4095
|
}
|
|
4068
4096
|
handleEvent(e) {
|
|
@@ -4084,13 +4112,13 @@ function Gi() {
|
|
|
4084
4112
|
}), resolve: n, reject: e };
|
|
4085
4113
|
}
|
|
4086
4114
|
const ki = _i;
|
|
4087
|
-
class Ai extends
|
|
4115
|
+
class Ai extends V {
|
|
4088
4116
|
constructor(e) {
|
|
4089
4117
|
super(function(t, r) {
|
|
4090
|
-
|
|
4118
|
+
R.debug("No callbacks on user for " + t);
|
|
4091
4119
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (t, r) => {
|
|
4092
4120
|
if (t) {
|
|
4093
|
-
|
|
4121
|
+
R.warn(`Error during signin: ${t}`), this._cleanup();
|
|
4094
4122
|
return;
|
|
4095
4123
|
}
|
|
4096
4124
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -4099,7 +4127,7 @@ function Gi() {
|
|
|
4099
4127
|
});
|
|
4100
4128
|
}, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: t, current: r }) => {
|
|
4101
4129
|
t !== "connected" && r === "connected" && this._signin(), t === "connected" && r !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
4102
|
-
}), this.watchlist = new
|
|
4130
|
+
}), this.watchlist = new xi(e), this.pusher.connection.bind("message", (t) => {
|
|
4103
4131
|
var r = t.event;
|
|
4104
4132
|
r === "pusher:signin_success" && this._onSigninSuccess(t.data), this.serverToUserChannel && this.serverToUserChannel.name === t.channel && this.serverToUserChannel.handleEvent(t);
|
|
4105
4133
|
});
|
|
@@ -4116,11 +4144,11 @@ function Gi() {
|
|
|
4116
4144
|
try {
|
|
4117
4145
|
this.user_data = JSON.parse(e.user_data);
|
|
4118
4146
|
} catch {
|
|
4119
|
-
|
|
4147
|
+
R.error(`Failed parsing user data after signin: ${e.user_data}`), this._cleanup();
|
|
4120
4148
|
return;
|
|
4121
4149
|
}
|
|
4122
4150
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
4123
|
-
|
|
4151
|
+
R.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
4124
4152
|
return;
|
|
4125
4153
|
}
|
|
4126
4154
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -4159,19 +4187,19 @@ function Gi() {
|
|
|
4159
4187
|
}));
|
|
4160
4188
|
}
|
|
4161
4189
|
constructor(e, t) {
|
|
4162
|
-
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels =
|
|
4190
|
+
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels = X.createChannels(), this.global_emitter = new V(), this.sessionID = w.randomInt(1e9), this.timeline = new oi(this.key, this.sessionID, {
|
|
4163
4191
|
cluster: this.config.cluster,
|
|
4164
4192
|
features: I.getClientFeatures(),
|
|
4165
4193
|
params: this.config.timelineParams || {},
|
|
4166
4194
|
limit: 50,
|
|
4167
4195
|
level: le.INFO,
|
|
4168
|
-
version:
|
|
4169
|
-
}), this.config.enableStats && (this.timelineSender =
|
|
4196
|
+
version: T.VERSION
|
|
4197
|
+
}), this.config.enableStats && (this.timelineSender = X.createTimelineSender(this.timeline, {
|
|
4170
4198
|
host: this.config.statsHost,
|
|
4171
4199
|
path: "/timeline/v2/" + w.TimelineTransport.name
|
|
4172
4200
|
}));
|
|
4173
4201
|
var r = (o) => w.getDefaultStrategy(this.config, o, hi);
|
|
4174
|
-
this.connection =
|
|
4202
|
+
this.connection = X.createConnectionManager(this.key, {
|
|
4175
4203
|
getStrategy: r,
|
|
4176
4204
|
timeline: this.timeline,
|
|
4177
4205
|
activityTimeout: this.config.activityTimeout,
|
|
@@ -4192,7 +4220,7 @@ function Gi() {
|
|
|
4192
4220
|
}), this.connection.bind("disconnected", () => {
|
|
4193
4221
|
this.channels.disconnect();
|
|
4194
4222
|
}), this.connection.bind("error", (o) => {
|
|
4195
|
-
|
|
4223
|
+
R.warn(o);
|
|
4196
4224
|
}), I.instances.push(this), this.timeline.info({ instances: I.instances.length }), this.user = new Ai(this), I.isReady && this.connect();
|
|
4197
4225
|
}
|
|
4198
4226
|
switchCluster(e) {
|
|
@@ -4287,10 +4315,10 @@ function Gi() {
|
|
|
4287
4315
|
return d;
|
|
4288
4316
|
})()
|
|
4289
4317
|
));
|
|
4290
|
-
})(
|
|
4318
|
+
})(Re)), Re.exports;
|
|
4291
4319
|
}
|
|
4292
4320
|
var Yi = Gi();
|
|
4293
|
-
const Ki = /* @__PURE__ */ Ji(Yi),
|
|
4321
|
+
const Ki = /* @__PURE__ */ Ji(Yi), Pe = "/vendor/sendity-client/tailwind.css", Qi = {
|
|
4294
4322
|
labels: {
|
|
4295
4323
|
email: "Email",
|
|
4296
4324
|
whatsapp: "WhatsApp"
|
|
@@ -4302,6 +4330,7 @@ const Ki = /* @__PURE__ */ Ji(Yi), Re = "/vendor/sendity-client/tailwind.css", Q
|
|
|
4302
4330
|
toPrefix: "to",
|
|
4303
4331
|
footerWaiting: "Ready to receive your code…",
|
|
4304
4332
|
footerWaitingUntil: "Ready to receive your code…",
|
|
4333
|
+
footerReturnedWaiting: "Waiting for your message to arrive…",
|
|
4305
4334
|
codeExpired: "Code expired, request a new one.",
|
|
4306
4335
|
getNewCode: "Get new code"
|
|
4307
4336
|
},
|
|
@@ -4324,6 +4353,7 @@ Code: (Code)`,
|
|
|
4324
4353
|
toPrefix: "an",
|
|
4325
4354
|
footerWaiting: "Bereit zum Empfangen Deines Codes …",
|
|
4326
4355
|
footerWaitingUntil: "Bereit zum Empfangen Deines Codes …",
|
|
4356
|
+
footerReturnedWaiting: "Warte darauf, dass Deine Nachricht ankommt …",
|
|
4327
4357
|
codeExpired: "Code abgelaufen, fordere einen neuen an.",
|
|
4328
4358
|
getNewCode: "Neuen Code anfordern"
|
|
4329
4359
|
},
|
|
@@ -4346,6 +4376,7 @@ Code: (Code)`,
|
|
|
4346
4376
|
toPrefix: "à",
|
|
4347
4377
|
footerWaiting: "Prêt à recevoir votre code…",
|
|
4348
4378
|
footerWaitingUntil: "Prêt à recevoir votre code…",
|
|
4379
|
+
footerReturnedWaiting: "En attente de l’arrivée de votre message…",
|
|
4349
4380
|
codeExpired: "Code expiré, demandez-en un nouveau.",
|
|
4350
4381
|
getNewCode: "Nouveau code"
|
|
4351
4382
|
},
|
|
@@ -4357,7 +4388,7 @@ Code : (Code)`,
|
|
|
4357
4388
|
whatsappText: "Connectez-moi à (Host) avec ce code : (Code)"
|
|
4358
4389
|
}
|
|
4359
4390
|
};
|
|
4360
|
-
function
|
|
4391
|
+
function B(v) {
|
|
4361
4392
|
switch (v) {
|
|
4362
4393
|
case "de":
|
|
4363
4394
|
return Zi;
|
|
@@ -4368,7 +4399,7 @@ function X(v) {
|
|
|
4368
4399
|
}
|
|
4369
4400
|
}
|
|
4370
4401
|
const vt = `<svg role="img" viewBox="0 0 512 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>Email</title><path d="M64 112c-8.8 0-16 7.2-16 16l0 22.1L220.5 291.7c20.7 17 50.4 17 71.1 0L464 150.1l0-22.1c0-8.8-7.2-16-16-16L64 112zM48 212.2L48 384c0 8.8 7.2 16 16 16l384 0c8.8 0 16-7.2 16-16l0-171.8L322 328.8c-38.4 31.5-93.7 31.5-132 0L48 212.2zM0 128C0 92.7 28.7 64 64 64l384 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128z"/></svg>
|
|
4371
|
-
`, yt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>', tr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.998 9.332A5.002 5.002 0 0 1 13.2 5.5H11a1 1 0 1 0 0 2h4.5a1 1 0 0 0 1-1V2a1 1 0 1 0-2 0v1.74A7.002 7.002 0 0 0 3 9.332a1 1 0 1 0 1.998 0ZM15.002 10.668A5.002 5.002 0 0 1 6.8 14.5H9a1 1 0 1 0 0-2H4.5a1 1 0 0 0-1 1V18a1 1 0 1 0 2 0v-1.74a7.002 7.002 0 0 0 11.5-5.592 1 1 0 1 0-1.998 0Z" clip-rule="evenodd" /></svg>', nr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM7.22 6.22a.75.75 0 0 0-1.06 1.06L8.88 10l-2.72 2.72a.75.75 0 1 0 1.06 1.06L9.94 11.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L11 10l2.72-2.72a.75.75 0 0 0-1.06-1.06L9.94 8.94 7.22 6.22Z" clip-rule="evenodd" /></svg>', Me = "sendityAuthRequest", ir = "https://sendity.io/api", rr = 600 * 1e3, sr = 5e3, or = 15e3, Ie = 2e3, pe = 220, At = 0;
|
|
4402
|
+
`, yt = '<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><title>WhatsApp</title><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></svg>', tr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.998 9.332A5.002 5.002 0 0 1 13.2 5.5H11a1 1 0 1 0 0 2h4.5a1 1 0 0 0 1-1V2a1 1 0 1 0-2 0v1.74A7.002 7.002 0 0 0 3 9.332a1 1 0 1 0 1.998 0ZM15.002 10.668A5.002 5.002 0 0 1 6.8 14.5H9a1 1 0 1 0 0-2H4.5a1 1 0 0 0-1 1V18a1 1 0 1 0 2 0v-1.74a7.002 7.002 0 0 0 11.5-5.592 1 1 0 1 0-1.998 0Z" clip-rule="evenodd" /></svg>', nr = '<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM7.22 6.22a.75.75 0 0 0-1.06 1.06L8.88 10l-2.72 2.72a.75.75 0 1 0 1.06 1.06L9.94 11.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L11 10l2.72-2.72a.75.75 0 0 0-1.06-1.06L9.94 8.94 7.22 6.22Z" clip-rule="evenodd" /></svg>', Me = "sendityAuthRequest", ir = "https://sendity.io/api/sendity", rr = 600 * 1e3, sr = 5e3, or = 15e3, ar = 1e3, Ie = 2e3, pe = 220, At = 0;
|
|
4372
4403
|
function je(v, i) {
|
|
4373
4404
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4374
4405
|
}
|
|
@@ -4385,7 +4416,7 @@ function bt(v, i, s, a = Date.now()) {
|
|
|
4385
4416
|
return v.removeItem(h), null;
|
|
4386
4417
|
}
|
|
4387
4418
|
}
|
|
4388
|
-
function
|
|
4419
|
+
function cr(v, i, s, a, h = Date.now()) {
|
|
4389
4420
|
v.setItem(je(i, s), JSON.stringify({ ...a, createdAt: h }));
|
|
4390
4421
|
}
|
|
4391
4422
|
function wt(v, i, s) {
|
|
@@ -4394,10 +4425,10 @@ function wt(v, i, s) {
|
|
|
4394
4425
|
function me() {
|
|
4395
4426
|
return window.localStorage.removeItem(Me), window.sessionStorage;
|
|
4396
4427
|
}
|
|
4397
|
-
function
|
|
4398
|
-
return v.filter((s) =>
|
|
4428
|
+
function hr(v, i = window.location.origin) {
|
|
4429
|
+
return v.filter((s) => lr(s, i));
|
|
4399
4430
|
}
|
|
4400
|
-
function
|
|
4431
|
+
function lr(v, i) {
|
|
4401
4432
|
try {
|
|
4402
4433
|
const s = new URL(v, i);
|
|
4403
4434
|
return ["http:", "https:", "mailto:", "whatsapp:"].includes(s.protocol);
|
|
@@ -4405,12 +4436,14 @@ function hr(v, i) {
|
|
|
4405
4436
|
return !1;
|
|
4406
4437
|
}
|
|
4407
4438
|
}
|
|
4408
|
-
function
|
|
4439
|
+
function dr(v, i, s) {
|
|
4409
4440
|
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !s ? { start: !0, delayMs: 0 } : { start: !0, delayMs: At };
|
|
4410
4441
|
}
|
|
4411
4442
|
const ve = class ve extends HTMLElement {
|
|
4412
4443
|
constructor() {
|
|
4413
|
-
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.rootEl = null, this.codeContainerEl = null, this.codeEl = null, this.promptEl = null, this.successEl = null, this.spinnerEl = null, this.verifiersEl = null, this.footerEl = null, this.footerBrandEl = null, this.footerStatusEl = null, this.footerMessageEl = null, this.footerTimerEl = null, this.footerIndicatorEl = null, this.footerObserver = null, this.authStartObserver = null, this.authFlowStarted = !1, this.footerWaitTimer = null, this.footerTransitionTimer = null, this.successTransitionTimer = null, this.timerInterval = null, this.currentConfig = null, this.destroyed = !1, this.lastCode = void 0, this.echo = null, this.activeVerifyUrls = [], this.authenticated = !1
|
|
4444
|
+
super(), this.pollTimer = null, this.fallbackPollTimer = null, this.authenticatedEventTimer = null, this.rootEl = null, this.codeContainerEl = null, this.codeEl = null, this.promptEl = null, this.successEl = null, this.spinnerEl = null, this.verifiersEl = null, this.footerEl = null, this.footerBrandEl = null, this.footerStatusEl = null, this.footerMessageEl = null, this.footerTimerEl = null, this.footerIndicatorEl = null, this.secondarySlotContainerEl = null, this.secondarySlotEl = null, this.footerObserver = null, this.authStartObserver = null, this.authFlowStarted = !1, this.footerWaitTimer = null, this.returnWaitTimer = null, this.footerTransitionTimer = null, this.successTransitionTimer = null, this.timerInterval = null, this.currentConfig = null, this.destroyed = !1, this.lastCode = void 0, this.echo = null, this.activeVerifyUrls = [], this.authenticated = !1, this.handleBrowserReturn = () => {
|
|
4445
|
+
this.scheduleBrowserReturnCheck();
|
|
4446
|
+
}, this.handleSecondarySlotChange = () => this.syncSecondarySlotState();
|
|
4414
4447
|
const i = this.attachShadow({ mode: "open" });
|
|
4415
4448
|
this.injectTailwind(i);
|
|
4416
4449
|
const s = document.createElement("div");
|
|
@@ -4422,14 +4455,14 @@ const ve = class ve extends HTMLElement {
|
|
|
4422
4455
|
return ["server-url", "public-key", "lang", "transport", "hide-footer", "footer", "authenticated-event-delay-ms", "variant", "no-card"];
|
|
4423
4456
|
}
|
|
4424
4457
|
connectedCallback() {
|
|
4425
|
-
this.rootEl = this.shadowRoot?.querySelector(".sendity"), this.codeContainerEl = this.shadowRoot?.querySelector(".code"), this.codeEl = this.shadowRoot?.querySelector(".formatted-code"), this.promptEl = this.shadowRoot?.querySelector(".prompt"), this.successEl = this.shadowRoot?.querySelector(".success"), this.spinnerEl = this.shadowRoot?.querySelector(".spinner"), this.verifiersEl = this.shadowRoot?.querySelector(".verifiers"), this.footerEl = this.shadowRoot?.querySelector(".sendity-footer"), this.footerBrandEl = this.shadowRoot?.querySelector(".footer-brand"), this.footerStatusEl = this.shadowRoot?.querySelector(".footer-status"), this.footerMessageEl = this.shadowRoot?.querySelector(".footer-message"), this.footerTimerEl = this.shadowRoot?.querySelector(".footer-timer"), this.footerIndicatorEl = this.shadowRoot?.querySelector(".footer-spinner"), this.syncLayoutVariant();
|
|
4458
|
+
this.rootEl = this.shadowRoot?.querySelector(".sendity"), this.codeContainerEl = this.shadowRoot?.querySelector(".code"), this.codeEl = this.shadowRoot?.querySelector(".formatted-code"), this.promptEl = this.shadowRoot?.querySelector(".prompt"), this.successEl = this.shadowRoot?.querySelector(".success"), this.spinnerEl = this.shadowRoot?.querySelector(".spinner"), this.verifiersEl = this.shadowRoot?.querySelector(".verifiers"), this.footerEl = this.shadowRoot?.querySelector(".sendity-footer"), this.footerBrandEl = this.shadowRoot?.querySelector(".footer-brand"), this.footerStatusEl = this.shadowRoot?.querySelector(".footer-status"), this.footerMessageEl = this.shadowRoot?.querySelector(".footer-message"), this.footerTimerEl = this.shadowRoot?.querySelector(".footer-timer"), this.footerIndicatorEl = this.shadowRoot?.querySelector(".footer-spinner"), this.secondarySlotContainerEl = this.shadowRoot?.querySelector(".sendity-secondary-slot"), this.secondarySlotEl = this.shadowRoot?.querySelector('slot[name="secondary"]'), this.secondarySlotEl?.addEventListener("slotchange", this.handleSecondarySlotChange), this.syncSecondarySlotState(), this.syncLayoutVariant();
|
|
4426
4459
|
try {
|
|
4427
4460
|
this.currentConfig = this.resolveConfig();
|
|
4428
4461
|
} catch (i) {
|
|
4429
4462
|
this.handleInitialError(i);
|
|
4430
4463
|
return;
|
|
4431
4464
|
}
|
|
4432
|
-
this.configureFooter(), this.dispatchPublicEvent("sendity:ready", {
|
|
4465
|
+
this.configureFooter(), this.bindBrowserReturnListeners(), this.dispatchPublicEvent("sendity:ready", {
|
|
4433
4466
|
transport: this.currentConfig.transport,
|
|
4434
4467
|
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
4435
4468
|
}), this.showPlaceholderCode(), this.startWhenVisible();
|
|
@@ -4465,7 +4498,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4465
4498
|
}));
|
|
4466
4499
|
}
|
|
4467
4500
|
stop() {
|
|
4468
|
-
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null), this.fallbackPollTimer !== null && (clearTimeout(this.fallbackPollTimer), this.fallbackPollTimer = null), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.authenticatedEventTimer !== null && (clearTimeout(this.authenticatedEventTimer), this.authenticatedEventTimer = null), this.footerTransitionTimer !== null && (clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = null), this.successTransitionTimer !== null && (clearTimeout(this.successTransitionTimer), this.successTransitionTimer = null), this.stopCountdown(), this.footerObserver?.disconnect(), this.footerObserver = null, this.authStartObserver?.disconnect(), this.authStartObserver = null, this.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null;
|
|
4501
|
+
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null), this.fallbackPollTimer !== null && (clearTimeout(this.fallbackPollTimer), this.fallbackPollTimer = null), this.footerWaitTimer !== null && (clearTimeout(this.footerWaitTimer), this.footerWaitTimer = null), this.returnWaitTimer !== null && (clearTimeout(this.returnWaitTimer), this.returnWaitTimer = null), this.authenticatedEventTimer !== null && (clearTimeout(this.authenticatedEventTimer), this.authenticatedEventTimer = null), this.footerTransitionTimer !== null && (clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = null), this.successTransitionTimer !== null && (clearTimeout(this.successTransitionTimer), this.successTransitionTimer = null), this.stopCountdown(), this.footerObserver?.disconnect(), this.footerObserver = null, this.authStartObserver?.disconnect(), this.authStartObserver = null, this.echo && this.activeAuthRequestId && this.echo.leave(`sendity.auth-requests.${this.activeAuthRequestId}`), this.echo?.disconnect(), this.echo = null, window.removeEventListener("focus", this.handleBrowserReturn), window.removeEventListener("pageshow", this.handleBrowserReturn), document.removeEventListener("visibilitychange", this.handleBrowserReturn), this.secondarySlotEl?.removeEventListener("slotchange", this.handleSecondarySlotChange), this.secondarySlotEl = null, this.secondarySlotContainerEl = null;
|
|
4502
|
+
}
|
|
4503
|
+
syncSecondarySlotState() {
|
|
4504
|
+
const i = (this.secondarySlotEl?.assignedNodes({ flatten: !0 }) ?? []).some((s) => s.nodeType === Node.TEXT_NODE ? (s.textContent ?? "").trim() !== "" : s.nodeType === Node.ELEMENT_NODE);
|
|
4505
|
+
this.secondarySlotContainerEl?.classList.toggle("sendity-secondary-slot--filled", i), this.secondarySlotContainerEl && (this.secondarySlotContainerEl.hidden = !i);
|
|
4469
4506
|
}
|
|
4470
4507
|
// Inject Tailwind CSS into the Shadow DOM so Tailwind utility classes
|
|
4471
4508
|
// used in sendity.html work within the component. We cache the processed
|
|
@@ -4480,11 +4517,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4480
4517
|
s.textContent = a.tailwindCssText;
|
|
4481
4518
|
else {
|
|
4482
4519
|
const h = document.createElement("link");
|
|
4483
|
-
h.rel = "stylesheet", h.href =
|
|
4520
|
+
h.rel = "stylesheet", h.href = Pe, i.insertBefore(h, s);
|
|
4484
4521
|
}
|
|
4485
4522
|
return;
|
|
4486
4523
|
}
|
|
4487
|
-
a.tailwindLoading || (a.tailwindLoading = fetch(
|
|
4524
|
+
a.tailwindLoading || (a.tailwindLoading = fetch(Pe).then((h) => h.ok ? h.text() : Promise.reject(new Error(`HTTP ${h.status}`))).then((h) => {
|
|
4488
4525
|
a.tailwindCssText = h;
|
|
4489
4526
|
}).catch((h) => {
|
|
4490
4527
|
console.warn("[sendity-auth] Failed to load Tailwind CSS for Shadow DOM", h), a.tailwindCssText = "";
|
|
@@ -4494,7 +4531,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4494
4531
|
s.textContent = a.tailwindCssText;
|
|
4495
4532
|
else {
|
|
4496
4533
|
const h = document.createElement("link");
|
|
4497
|
-
h.rel = "stylesheet", h.href =
|
|
4534
|
+
h.rel = "stylesheet", h.href = Pe, i.insertBefore(h, s);
|
|
4498
4535
|
}
|
|
4499
4536
|
});
|
|
4500
4537
|
}
|
|
@@ -4507,6 +4544,14 @@ const ve = class ve extends HTMLElement {
|
|
|
4507
4544
|
this.footerEl.hidden = !1, this.footerEl.classList.remove("footer--waiting", "footer--transitioning", "footer--leaving", "footer--verified"), this.setFooterIndicatorWaiting(), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.setAttribute("hidden", ""), this.observeFooterVisibility();
|
|
4508
4545
|
}
|
|
4509
4546
|
}
|
|
4547
|
+
bindBrowserReturnListeners() {
|
|
4548
|
+
window.removeEventListener("focus", this.handleBrowserReturn), window.removeEventListener("pageshow", this.handleBrowserReturn), document.removeEventListener("visibilitychange", this.handleBrowserReturn), window.addEventListener("focus", this.handleBrowserReturn), window.addEventListener("pageshow", this.handleBrowserReturn), document.addEventListener("visibilitychange", this.handleBrowserReturn);
|
|
4549
|
+
}
|
|
4550
|
+
scheduleBrowserReturnCheck() {
|
|
4551
|
+
this.destroyed || this.authenticated || !this.activeAuthRequestId || !this.activeAuthRequestSecret || document.visibilityState && document.visibilityState !== "visible" || (this.returnWaitTimer !== null && clearTimeout(this.returnWaitTimer), this.returnWaitTimer = window.setTimeout(() => {
|
|
4552
|
+
this.returnWaitTimer = null, !(this.destroyed || this.authenticated) && (this.showFooterWaitingState({ returnedFromClient: !0 }), this.step().catch((i) => console.warn("[sendity-auth] return check failed", i)));
|
|
4553
|
+
}, ar));
|
|
4554
|
+
}
|
|
4510
4555
|
isFooterHidden() {
|
|
4511
4556
|
const i = (this.getAttribute("footer") ?? "").trim().toLowerCase();
|
|
4512
4557
|
return this.hasAttribute("hide-footer") || ["false", "hidden", "none", "off", "0"].includes(i);
|
|
@@ -4527,8 +4572,8 @@ const ve = class ve extends HTMLElement {
|
|
|
4527
4572
|
setFooterIndicatorError() {
|
|
4528
4573
|
this.footerIndicatorEl && (this.footerIndicatorEl.classList.add("footer-indicator--error"), this.footerIndicatorEl.innerHTML = nr, this.footerIndicatorEl.removeAttribute("hidden"));
|
|
4529
4574
|
}
|
|
4530
|
-
showFooterWaitingState() {
|
|
4531
|
-
this.isFooterHidden() || (this.currentConfig && this.footerMessageEl && (this.footerMessageEl.textContent = this.waitingFooterMessage()), this.setFooterIndicatorWaiting(), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4575
|
+
showFooterWaitingState(i = {}) {
|
|
4576
|
+
this.isFooterHidden() || (this.currentConfig && this.footerMessageEl && (this.footerMessageEl.textContent = i.returnedFromClient ? B(this.currentConfig.lang).ui.footerReturnedWaiting : this.waitingFooterMessage()), this.setFooterIndicatorWaiting(), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4532
4577
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4533
4578
|
}, pe), this.startCountdown());
|
|
4534
4579
|
}
|
|
@@ -4556,7 +4601,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4556
4601
|
showExpiredState() {
|
|
4557
4602
|
if (!(this.authenticated || this.destroyed || !this.currentConfig)) {
|
|
4558
4603
|
if (this.stopAuthTransports(), this.rootEl?.classList.remove("sendity--verified"), this.rootEl?.classList.add("sendity--expired"), this.codeContainerEl?.classList.remove("code--active", "code--placeholder"), this.codeContainerEl?.classList.add("code--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.codeEl?.removeAttribute("hidden"), !this.isFooterHidden()) {
|
|
4559
|
-
const i =
|
|
4604
|
+
const i = B(this.currentConfig.lang);
|
|
4560
4605
|
this.footerMessageEl && (this.footerMessageEl.textContent = i.ui.codeExpired), this.setFooterIndicatorError(), this.footerEl?.classList.add("footer--waiting", "footer--transitioning"), this.footerBrandEl?.removeAttribute("hidden"), this.footerStatusEl?.removeAttribute("hidden"), this.footerTimerEl?.setAttribute("hidden", ""), this.footerTransitionTimer !== null && clearTimeout(this.footerTransitionTimer), this.footerTransitionTimer = window.setTimeout(() => {
|
|
4561
4606
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4562
4607
|
}, pe);
|
|
@@ -4566,7 +4611,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4566
4611
|
}
|
|
4567
4612
|
renderExpiredAction() {
|
|
4568
4613
|
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4569
|
-
const i =
|
|
4614
|
+
const i = B(this.currentConfig.lang);
|
|
4570
4615
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4571
4616
|
const s = document.createElement("button");
|
|
4572
4617
|
s.type = "button", s.className = "chan error", s.addEventListener("click", () => {
|
|
@@ -4599,7 +4644,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4599
4644
|
const i = {
|
|
4600
4645
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4601
4646
|
transport: "auto"
|
|
4602
|
-
}, s = (
|
|
4647
|
+
}, s = (x) => this.getAttribute(x) ?? void 0, a = s("server-url")?.trim() || ir, h = s("public-key")?.trim();
|
|
4603
4648
|
if (!h)
|
|
4604
4649
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4605
4650
|
let d = s("lang") || i.lang;
|
|
@@ -4627,7 +4672,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4627
4672
|
if (!d.id) throw new Error("Missing id from server response");
|
|
4628
4673
|
const m = this.extractClientSecret(d);
|
|
4629
4674
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4630
|
-
return
|
|
4675
|
+
return cr(a, i, s, { id: String(d.id), clientSecret: m }), this.activeAuthRequestId = String(d.id), this.activeAuthRequestSecret = m, this.updateActiveAuthRequestExpiry(d), this.applyVerifyUrlsFromResponse(d), this.updateCode(d.formattedCode ?? d.code), this.dispatchPublicEvent("sendity:challenge-created", {
|
|
4631
4676
|
verificationId: String(d.id),
|
|
4632
4677
|
code: d.formattedCode ?? d.code ?? "",
|
|
4633
4678
|
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
@@ -4659,7 +4704,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4659
4704
|
const { transport: s } = this.currentConfig, a = i?.broadcasting, h = !!(a?.key && a.channel && a.authEndpoint);
|
|
4660
4705
|
let d = !1;
|
|
4661
4706
|
s !== "polling" && h && a ? d = this.subscribeToBroadcasting(a) : s === "push" && console.warn("[sendity-auth] Push transport requested, but server response does not contain broadcasting metadata");
|
|
4662
|
-
const m =
|
|
4707
|
+
const m = dr(s, h, d);
|
|
4663
4708
|
m.start && this.startPolling(m.delayMs);
|
|
4664
4709
|
}
|
|
4665
4710
|
subscribeToBroadcasting(i) {
|
|
@@ -4740,7 +4785,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4740
4785
|
return s.startsWith("mailto:") ? "email" : s.startsWith("whatsapp:") || s.startsWith("whatsapp://") ? "whatsapp" : "unknown";
|
|
4741
4786
|
}
|
|
4742
4787
|
applyVerifyUrlsFromResponse(i) {
|
|
4743
|
-
const s = Array.isArray(i.verify_urls) ? i.verify_urls : Array.isArray(i.verifyUrls) ? i.verifyUrls : [], a = Array.isArray(i.verification_endpoints) ? i.verification_endpoints.map((d) => typeof d.url == "string" ? d.url : typeof d.scheme == "string" && typeof d.recipient == "string" ? `${d.scheme}:${d.recipient}` : "") : [], h =
|
|
4788
|
+
const s = Array.isArray(i.verify_urls) ? i.verify_urls : Array.isArray(i.verifyUrls) ? i.verifyUrls : [], a = Array.isArray(i.verification_endpoints) ? i.verification_endpoints.map((d) => typeof d.url == "string" ? d.url : typeof d.scheme == "string" && typeof d.recipient == "string" ? `${d.scheme}:${d.recipient}` : "") : [], h = hr([...s, ...a].map(String));
|
|
4744
4789
|
h.length !== 0 && (this.activeVerifyUrls = [...new Set(h)], this.renderVerifiers(this.activeVerifyUrls));
|
|
4745
4790
|
}
|
|
4746
4791
|
authRequestStatusUrl(i, s) {
|
|
@@ -4765,7 +4810,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4765
4810
|
}
|
|
4766
4811
|
waitingFooterMessage() {
|
|
4767
4812
|
if (!this.currentConfig) return "";
|
|
4768
|
-
const i =
|
|
4813
|
+
const i = B(this.currentConfig.lang), s = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4769
4814
|
return s ? i.ui.footerWaitingUntil.replace("(Time)", s) : i.ui.footerWaiting;
|
|
4770
4815
|
}
|
|
4771
4816
|
formatExpiryTime(i, s) {
|
|
@@ -4825,7 +4870,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4825
4870
|
}
|
|
4826
4871
|
showCodeState() {
|
|
4827
4872
|
if (this.spinnerEl?.setAttribute("hidden", ""), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--verified", "code--placeholder"), this.codeContainerEl?.classList.remove("code--exiting"), this.codeContainerEl?.classList.add("code--active"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.verifiersEl?.classList.remove("verifiers--exiting"), this.verifiersEl?.removeAttribute("aria-hidden"), this.codeEl?.removeAttribute("hidden"), this.currentConfig && this.promptEl) {
|
|
4828
|
-
const i =
|
|
4873
|
+
const i = B(this.currentConfig.lang);
|
|
4829
4874
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4830
4875
|
}
|
|
4831
4876
|
this.successEl?.setAttribute("hidden", "");
|
|
@@ -4840,7 +4885,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4840
4885
|
this.footerMessageEl.textContent = this.verifiedSigningInMessage(a);
|
|
4841
4886
|
}
|
|
4842
4887
|
if (this.footerTimerEl && (this.footerTimerEl.hidden = !0, this.footerTimerEl.classList.remove("low"), this.footerTimerEl.textContent = ""), this.verifiersEl?.classList.add("verifiers--exiting"), this.currentConfig && this.successEl) {
|
|
4843
|
-
const a =
|
|
4888
|
+
const a = B(this.currentConfig.lang), h = i.name && i.name.trim().length > 0 ? a.ui.successGreeting.replace("(Name)", i.name) : "You're in!";
|
|
4844
4889
|
this.successEl.innerHTML = `
|
|
4845
4890
|
<span class="success-check" aria-hidden="true">
|
|
4846
4891
|
<svg viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>
|
|
@@ -4899,10 +4944,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4899
4944
|
}
|
|
4900
4945
|
const y = document.createElement("span");
|
|
4901
4946
|
y.className = "label", y.textContent = this.channelLabel(a, s.lang), m.appendChild(y), d.appendChild(m);
|
|
4902
|
-
const
|
|
4903
|
-
if (
|
|
4947
|
+
const x = this.destinationText(a, s.lang);
|
|
4948
|
+
if (x) {
|
|
4904
4949
|
const S = document.createElement("a");
|
|
4905
|
-
S.className = "dest", S.href = m.href, S.target = "_blank", S.rel = "noopener noreferrer", S.textContent =
|
|
4950
|
+
S.className = "dest", S.href = m.href, S.target = "_blank", S.rel = "noopener noreferrer", S.textContent = x, d.appendChild(S);
|
|
4906
4951
|
}
|
|
4907
4952
|
this.verifiersEl.appendChild(d);
|
|
4908
4953
|
});
|
|
@@ -4919,7 +4964,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4919
4964
|
return "generic";
|
|
4920
4965
|
}
|
|
4921
4966
|
channelLabel(i, s) {
|
|
4922
|
-
const a =
|
|
4967
|
+
const a = B(s), h = this.channelClass(i);
|
|
4923
4968
|
if (h === "email") return a.labels.email;
|
|
4924
4969
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4925
4970
|
try {
|
|
@@ -4930,7 +4975,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4930
4975
|
}
|
|
4931
4976
|
}
|
|
4932
4977
|
destinationText(i, s) {
|
|
4933
|
-
const h =
|
|
4978
|
+
const h = B(s).ui.toPrefix ?? "to";
|
|
4934
4979
|
try {
|
|
4935
4980
|
const d = new URL(i, window.location.origin);
|
|
4936
4981
|
if (d.protocol === "mailto:") {
|
|
@@ -4961,7 +5006,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4961
5006
|
return null;
|
|
4962
5007
|
}
|
|
4963
5008
|
labelForUrl(i, s) {
|
|
4964
|
-
const a =
|
|
5009
|
+
const a = B(s);
|
|
4965
5010
|
try {
|
|
4966
5011
|
const h = new URL(i, window.location.origin);
|
|
4967
5012
|
return h.protocol === "mailto:" ? `${a.ui.by} ${a.labels.email}` : h.protocol.startsWith("http") ? h.hostname : h.protocol === "whatsapp:" ? `${a.ui.by} ${a.labels.whatsapp}` : h.protocol.replace(":", "");
|
|
@@ -4970,17 +5015,17 @@ const ve = class ve extends HTMLElement {
|
|
|
4970
5015
|
}
|
|
4971
5016
|
}
|
|
4972
5017
|
buildLink(i, s) {
|
|
4973
|
-
const a = this.lastCode, h =
|
|
5018
|
+
const a = this.lastCode, h = B(s), d = window.location.host;
|
|
4974
5019
|
if (!a) return i;
|
|
4975
5020
|
if (i.startsWith("mailto:")) {
|
|
4976
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g),
|
|
4977
|
-
y.set("subject",
|
|
5021
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), x = this.applyTemplate(h.templates.emailSubject, d, a), S = this.applyTemplate(h.templates.emailBody, d, a);
|
|
5022
|
+
y.set("subject", x), y.set("body", S);
|
|
4978
5023
|
const O = this.toQuery(y);
|
|
4979
5024
|
return `${m}?${O}`;
|
|
4980
5025
|
}
|
|
4981
5026
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) {
|
|
4982
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g),
|
|
4983
|
-
y.set("text",
|
|
5027
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), x = this.applyTemplate(h.templates.whatsappText, d, a);
|
|
5028
|
+
y.set("text", x);
|
|
4984
5029
|
const S = this.toQuery(y);
|
|
4985
5030
|
return `${m}?${S}`;
|
|
4986
5031
|
}
|