@sendity/client 0.1.6 → 0.1.7
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 +300 -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">
|
|
@@ -288,6 +292,27 @@ const pt = `<template id="sendity-tpl">
|
|
|
288
292
|
pointer-events: none;
|
|
289
293
|
}
|
|
290
294
|
|
|
295
|
+
.sendity .sendity-secondary-slot {
|
|
296
|
+
display: block;
|
|
297
|
+
min-width: 0;
|
|
298
|
+
font-size: var(--sendity-font-size-sm);
|
|
299
|
+
line-height: 1.45;
|
|
300
|
+
color: var(--sendity-fg-2);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.sendity .sendity-secondary-slot[hidden] {
|
|
304
|
+
display: none !important;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.sendity .sendity-secondary-slot--filled {
|
|
308
|
+
margin-top: 0.125rem;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.sendity .sendity-secondary-slot ::slotted(*) {
|
|
312
|
+
box-sizing: border-box;
|
|
313
|
+
max-width: 100%;
|
|
314
|
+
}
|
|
315
|
+
|
|
291
316
|
.sendity .verifiers.is-two {
|
|
292
317
|
grid-template-columns: 1fr 1px 1fr;
|
|
293
318
|
}
|
|
@@ -820,7 +845,7 @@ class Di extends Ue {
|
|
|
820
845
|
), this;
|
|
821
846
|
}
|
|
822
847
|
}
|
|
823
|
-
class
|
|
848
|
+
class Wi extends St {
|
|
824
849
|
/**
|
|
825
850
|
* Register a callback to be called anytime the member list changes.
|
|
826
851
|
*/
|
|
@@ -855,7 +880,7 @@ class Fi extends St {
|
|
|
855
880
|
}), this;
|
|
856
881
|
}
|
|
857
882
|
}
|
|
858
|
-
class
|
|
883
|
+
class Tt extends qe {
|
|
859
884
|
/**
|
|
860
885
|
* Create a new class instance.
|
|
861
886
|
*/
|
|
@@ -931,7 +956,7 @@ class xt extends qe {
|
|
|
931
956
|
)), (!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
957
|
}
|
|
933
958
|
}
|
|
934
|
-
class
|
|
959
|
+
class Et extends Tt {
|
|
935
960
|
/**
|
|
936
961
|
* Send a whisper event to other clients in the channel.
|
|
937
962
|
*/
|
|
@@ -943,7 +968,7 @@ class Tt extends xt {
|
|
|
943
968
|
}), this;
|
|
944
969
|
}
|
|
945
970
|
}
|
|
946
|
-
class
|
|
971
|
+
class Fi extends Et {
|
|
947
972
|
/**
|
|
948
973
|
* Register a callback to be called anytime the member list changes.
|
|
949
974
|
*/
|
|
@@ -1029,7 +1054,7 @@ class ge extends qe {
|
|
|
1029
1054
|
return this;
|
|
1030
1055
|
}
|
|
1031
1056
|
}
|
|
1032
|
-
class
|
|
1057
|
+
class xt extends ge {
|
|
1033
1058
|
/**
|
|
1034
1059
|
* Send a whisper event to other clients in the channel.
|
|
1035
1060
|
*/
|
|
@@ -1045,7 +1070,7 @@ class Bi extends ge {
|
|
|
1045
1070
|
return this;
|
|
1046
1071
|
}
|
|
1047
1072
|
}
|
|
1048
|
-
class $i extends
|
|
1073
|
+
class $i extends xt {
|
|
1049
1074
|
/**
|
|
1050
1075
|
* Register a callback to be called anytime the member list changes.
|
|
1051
1076
|
*/
|
|
@@ -1182,7 +1207,7 @@ class fe extends Ne {
|
|
|
1182
1207
|
* Get a presence channel instance by name.
|
|
1183
1208
|
*/
|
|
1184
1209
|
presenceChannel(i) {
|
|
1185
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1210
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Wi(
|
|
1186
1211
|
this.pusher,
|
|
1187
1212
|
"presence-" + i,
|
|
1188
1213
|
this.options
|
|
@@ -1291,7 +1316,7 @@ class Vi extends Ne {
|
|
|
1291
1316
|
* Get a channel instance by name.
|
|
1292
1317
|
*/
|
|
1293
1318
|
channel(i) {
|
|
1294
|
-
return this.channels[i] || (this.channels[i] = new
|
|
1319
|
+
return this.channels[i] || (this.channels[i] = new Tt(
|
|
1295
1320
|
this.socket,
|
|
1296
1321
|
i,
|
|
1297
1322
|
this.options
|
|
@@ -1301,7 +1326,7 @@ class Vi extends Ne {
|
|
|
1301
1326
|
* Get a private channel instance by name.
|
|
1302
1327
|
*/
|
|
1303
1328
|
privateChannel(i) {
|
|
1304
|
-
return this.channels["private-" + i] || (this.channels["private-" + i] = new
|
|
1329
|
+
return this.channels["private-" + i] || (this.channels["private-" + i] = new Et(
|
|
1305
1330
|
this.socket,
|
|
1306
1331
|
"private-" + i,
|
|
1307
1332
|
this.options
|
|
@@ -1311,7 +1336,7 @@ class Vi extends Ne {
|
|
|
1311
1336
|
* Get a presence channel instance by name.
|
|
1312
1337
|
*/
|
|
1313
1338
|
presenceChannel(i) {
|
|
1314
|
-
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new
|
|
1339
|
+
return this.channels["presence-" + i] || (this.channels["presence-" + i] = new Fi(
|
|
1315
1340
|
this.socket,
|
|
1316
1341
|
"presence-" + i,
|
|
1317
1342
|
this.options
|
|
@@ -1398,7 +1423,7 @@ class mt extends Ne {
|
|
|
1398
1423
|
* Get a private channel instance by name.
|
|
1399
1424
|
*/
|
|
1400
1425
|
privateChannel(i) {
|
|
1401
|
-
return new
|
|
1426
|
+
return new xt();
|
|
1402
1427
|
}
|
|
1403
1428
|
/**
|
|
1404
1429
|
* Get a private encrypted channel instance by name.
|
|
@@ -1608,7 +1633,7 @@ class Xi {
|
|
|
1608
1633
|
function Ji(v) {
|
|
1609
1634
|
return v && v.__esModule && Object.prototype.hasOwnProperty.call(v, "default") ? v.default : v;
|
|
1610
1635
|
}
|
|
1611
|
-
var
|
|
1636
|
+
var Re = { exports: {} };
|
|
1612
1637
|
var gt;
|
|
1613
1638
|
function Gi() {
|
|
1614
1639
|
return gt || (gt = 1, (function(v, i) {
|
|
@@ -1621,15 +1646,15 @@ function Gi() {
|
|
|
1621
1646
|
/***/
|
|
1622
1647
|
594(m, g) {
|
|
1623
1648
|
var y = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1624
|
-
var
|
|
1625
|
-
return
|
|
1649
|
+
var E = function(u, f) {
|
|
1650
|
+
return E = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(C, L) {
|
|
1626
1651
|
C.__proto__ = L;
|
|
1627
1652
|
} || function(C, L) {
|
|
1628
1653
|
for (var q in L) L.hasOwnProperty(q) && (C[q] = L[q]);
|
|
1629
|
-
},
|
|
1654
|
+
}, E(u, f);
|
|
1630
1655
|
};
|
|
1631
1656
|
return function(u, f) {
|
|
1632
|
-
|
|
1657
|
+
E(u, f);
|
|
1633
1658
|
function C() {
|
|
1634
1659
|
this.constructor = u;
|
|
1635
1660
|
}
|
|
@@ -1637,15 +1662,15 @@ function Gi() {
|
|
|
1637
1662
|
};
|
|
1638
1663
|
})();
|
|
1639
1664
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
1640
|
-
var
|
|
1665
|
+
var x = 256, S = (
|
|
1641
1666
|
/** @class */
|
|
1642
1667
|
(function() {
|
|
1643
|
-
function
|
|
1668
|
+
function E(u) {
|
|
1644
1669
|
u === void 0 && (u = "="), this._paddingCharacter = u;
|
|
1645
1670
|
}
|
|
1646
|
-
return
|
|
1671
|
+
return E.prototype.encodedLength = function(u) {
|
|
1647
1672
|
return this._paddingCharacter ? (u + 2) / 3 * 4 | 0 : (u * 8 + 5) / 6 | 0;
|
|
1648
|
-
},
|
|
1673
|
+
}, E.prototype.encode = function(u) {
|
|
1649
1674
|
for (var f = "", C = 0; C < u.length - 2; C += 3) {
|
|
1650
1675
|
var L = u[C] << 16 | u[C + 1] << 8 | u[C + 2];
|
|
1651
1676
|
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 +1681,25 @@ function Gi() {
|
|
|
1656
1681
|
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
1682
|
}
|
|
1658
1683
|
return f;
|
|
1659
|
-
},
|
|
1684
|
+
}, E.prototype.maxDecodedLength = function(u) {
|
|
1660
1685
|
return this._paddingCharacter ? u / 4 * 3 | 0 : (u * 6 + 7) / 8 | 0;
|
|
1661
|
-
},
|
|
1686
|
+
}, E.prototype.decodedLength = function(u) {
|
|
1662
1687
|
return this.maxDecodedLength(u.length - this._getPaddingLength(u));
|
|
1663
|
-
},
|
|
1688
|
+
}, E.prototype.decode = function(u) {
|
|
1664
1689
|
if (u.length === 0)
|
|
1665
1690
|
return new Uint8Array(0);
|
|
1666
1691
|
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 &
|
|
1692
|
+
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;
|
|
1693
|
+
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
1694
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1670
1695
|
return L;
|
|
1671
|
-
},
|
|
1696
|
+
}, E.prototype._encodeByte = function(u) {
|
|
1672
1697
|
var f = u;
|
|
1673
1698
|
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
|
-
},
|
|
1699
|
+
}, E.prototype._decodeChar = function(u) {
|
|
1700
|
+
var f = x;
|
|
1701
|
+
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;
|
|
1702
|
+
}, E.prototype._getPaddingLength = function(u) {
|
|
1678
1703
|
var f = 0;
|
|
1679
1704
|
if (this._paddingCharacter) {
|
|
1680
1705
|
for (var C = u.length - 1; C >= 0 && u[C] === this._paddingCharacter; C--)
|
|
@@ -1683,84 +1708,84 @@ function Gi() {
|
|
|
1683
1708
|
throw new Error("Base64Coder: incorrect padding");
|
|
1684
1709
|
}
|
|
1685
1710
|
return f;
|
|
1686
|
-
},
|
|
1711
|
+
}, E;
|
|
1687
1712
|
})()
|
|
1688
1713
|
);
|
|
1689
1714
|
g.Coder = S;
|
|
1690
1715
|
var O = new S();
|
|
1691
|
-
function
|
|
1692
|
-
return O.encode(
|
|
1716
|
+
function T(E) {
|
|
1717
|
+
return O.encode(E);
|
|
1693
1718
|
}
|
|
1694
|
-
g.encode =
|
|
1695
|
-
function A(
|
|
1696
|
-
return O.decode(
|
|
1719
|
+
g.encode = T;
|
|
1720
|
+
function A(E) {
|
|
1721
|
+
return O.decode(E);
|
|
1697
1722
|
}
|
|
1698
1723
|
g.decode = A;
|
|
1699
|
-
var
|
|
1724
|
+
var W = (
|
|
1700
1725
|
/** @class */
|
|
1701
|
-
(function(
|
|
1702
|
-
y(u,
|
|
1726
|
+
(function(E) {
|
|
1727
|
+
y(u, E);
|
|
1703
1728
|
function u() {
|
|
1704
|
-
return
|
|
1729
|
+
return E !== null && E.apply(this, arguments) || this;
|
|
1705
1730
|
}
|
|
1706
1731
|
return u.prototype._encodeByte = function(f) {
|
|
1707
1732
|
var C = f;
|
|
1708
1733
|
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
1734
|
}, u.prototype._decodeChar = function(f) {
|
|
1710
|
-
var C =
|
|
1711
|
-
return C += (44 - f & f - 46) >>> 8 & -
|
|
1735
|
+
var C = x;
|
|
1736
|
+
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
1737
|
}, u;
|
|
1713
1738
|
})(S)
|
|
1714
1739
|
);
|
|
1715
|
-
g.URLSafeCoder =
|
|
1716
|
-
var N = new
|
|
1717
|
-
function
|
|
1718
|
-
return N.encode(
|
|
1740
|
+
g.URLSafeCoder = W;
|
|
1741
|
+
var N = new W();
|
|
1742
|
+
function F(E) {
|
|
1743
|
+
return N.encode(E);
|
|
1719
1744
|
}
|
|
1720
|
-
g.encodeURLSafe =
|
|
1721
|
-
function te(
|
|
1722
|
-
return N.decode(
|
|
1745
|
+
g.encodeURLSafe = F;
|
|
1746
|
+
function te(E) {
|
|
1747
|
+
return N.decode(E);
|
|
1723
1748
|
}
|
|
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(
|
|
1749
|
+
g.decodeURLSafe = te, g.encodedLength = function(E) {
|
|
1750
|
+
return O.encodedLength(E);
|
|
1751
|
+
}, g.maxDecodedLength = function(E) {
|
|
1752
|
+
return O.maxDecodedLength(E);
|
|
1753
|
+
}, g.decodedLength = function(E) {
|
|
1754
|
+
return O.decodedLength(E);
|
|
1730
1755
|
};
|
|
1731
1756
|
},
|
|
1732
1757
|
/***/
|
|
1733
1758
|
978(m, g) {
|
|
1734
1759
|
var y = "utf8: invalid source encoding";
|
|
1735
|
-
function
|
|
1736
|
-
for (var O = [],
|
|
1737
|
-
var A = S[
|
|
1760
|
+
function x(S) {
|
|
1761
|
+
for (var O = [], T = 0; T < S.length; T++) {
|
|
1762
|
+
var A = S[T];
|
|
1738
1763
|
if (A & 128) {
|
|
1739
|
-
var
|
|
1764
|
+
var W = void 0;
|
|
1740
1765
|
if (A < 224) {
|
|
1741
|
-
if (
|
|
1766
|
+
if (T >= S.length)
|
|
1742
1767
|
throw new Error(y);
|
|
1743
|
-
var N = S[++
|
|
1768
|
+
var N = S[++T];
|
|
1744
1769
|
if ((N & 192) !== 128)
|
|
1745
1770
|
throw new Error(y);
|
|
1746
|
-
A = (A & 31) << 6 | N & 63,
|
|
1771
|
+
A = (A & 31) << 6 | N & 63, W = 128;
|
|
1747
1772
|
} else if (A < 240) {
|
|
1748
|
-
if (
|
|
1773
|
+
if (T >= S.length - 1)
|
|
1749
1774
|
throw new Error(y);
|
|
1750
|
-
var N = S[++
|
|
1751
|
-
if ((N & 192) !== 128 || (
|
|
1775
|
+
var N = S[++T], F = S[++T];
|
|
1776
|
+
if ((N & 192) !== 128 || (F & 192) !== 128)
|
|
1752
1777
|
throw new Error(y);
|
|
1753
|
-
A = (A & 15) << 12 | (N & 63) << 6 |
|
|
1778
|
+
A = (A & 15) << 12 | (N & 63) << 6 | F & 63, W = 2048;
|
|
1754
1779
|
} else if (A < 248) {
|
|
1755
|
-
if (
|
|
1780
|
+
if (T >= S.length - 2)
|
|
1756
1781
|
throw new Error(y);
|
|
1757
|
-
var N = S[++
|
|
1758
|
-
if ((N & 192) !== 128 || (
|
|
1782
|
+
var N = S[++T], F = S[++T], te = S[++T];
|
|
1783
|
+
if ((N & 192) !== 128 || (F & 192) !== 128 || (te & 192) !== 128)
|
|
1759
1784
|
throw new Error(y);
|
|
1760
|
-
A = (A & 15) << 18 | (N & 63) << 12 | (
|
|
1785
|
+
A = (A & 15) << 18 | (N & 63) << 12 | (F & 63) << 6 | te & 63, W = 65536;
|
|
1761
1786
|
} else
|
|
1762
1787
|
throw new Error(y);
|
|
1763
|
-
if (A <
|
|
1788
|
+
if (A < W || A >= 55296 && A <= 57343)
|
|
1764
1789
|
throw new Error(y);
|
|
1765
1790
|
if (A >= 65536) {
|
|
1766
1791
|
if (A > 1114111)
|
|
@@ -1772,7 +1797,7 @@ function Gi() {
|
|
|
1772
1797
|
}
|
|
1773
1798
|
return O.join("");
|
|
1774
1799
|
}
|
|
1775
|
-
g.D4 =
|
|
1800
|
+
g.D4 = x;
|
|
1776
1801
|
},
|
|
1777
1802
|
/***/
|
|
1778
1803
|
721(m, g, y) {
|
|
@@ -1786,7 +1811,7 @@ function Gi() {
|
|
|
1786
1811
|
de
|
|
1787
1812
|
)
|
|
1788
1813
|
});
|
|
1789
|
-
class
|
|
1814
|
+
class x {
|
|
1790
1815
|
constructor(e, t) {
|
|
1791
1816
|
this.lastId = 0, this.prefix = e, this.name = t;
|
|
1792
1817
|
}
|
|
@@ -1801,7 +1826,7 @@ function Gi() {
|
|
|
1801
1826
|
delete this[e.number];
|
|
1802
1827
|
}
|
|
1803
1828
|
}
|
|
1804
|
-
var S = new
|
|
1829
|
+
var S = new x("_pusher_script_", "Pusher.ScriptReceivers"), O = {
|
|
1805
1830
|
VERSION: "8.5.0",
|
|
1806
1831
|
PROTOCOL: 7,
|
|
1807
1832
|
wsPort: 80,
|
|
@@ -1829,7 +1854,7 @@ function Gi() {
|
|
|
1829
1854
|
cdn_https: "https://js.pusher.com",
|
|
1830
1855
|
dependency_suffix: ""
|
|
1831
1856
|
};
|
|
1832
|
-
const
|
|
1857
|
+
const T = O;
|
|
1833
1858
|
class A {
|
|
1834
1859
|
constructor(e) {
|
|
1835
1860
|
this.options = e, this.receivers = e.receivers || S, this.loading = {};
|
|
@@ -1844,8 +1869,8 @@ function Gi() {
|
|
|
1844
1869
|
if (o.receivers.remove(l), o.loading[e]) {
|
|
1845
1870
|
var b = o.loading[e];
|
|
1846
1871
|
delete o.loading[e];
|
|
1847
|
-
for (var _ = function(
|
|
1848
|
-
|
|
1872
|
+
for (var _ = function(P) {
|
|
1873
|
+
P || c.cleanup();
|
|
1849
1874
|
}, k = 0; k < b.length; k++)
|
|
1850
1875
|
b[k](p, _);
|
|
1851
1876
|
}
|
|
@@ -1861,14 +1886,14 @@ function Gi() {
|
|
|
1861
1886
|
return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
|
|
1862
1887
|
}
|
|
1863
1888
|
}
|
|
1864
|
-
var
|
|
1865
|
-
cdn_http:
|
|
1866
|
-
cdn_https:
|
|
1867
|
-
version:
|
|
1868
|
-
suffix:
|
|
1869
|
-
receivers:
|
|
1889
|
+
var W = new x("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1890
|
+
cdn_http: T.cdn_http,
|
|
1891
|
+
cdn_https: T.cdn_https,
|
|
1892
|
+
version: T.VERSION,
|
|
1893
|
+
suffix: T.dependency_suffix,
|
|
1894
|
+
receivers: W
|
|
1870
1895
|
});
|
|
1871
|
-
const
|
|
1896
|
+
const F = {
|
|
1872
1897
|
baseUrl: "https://pusher.com",
|
|
1873
1898
|
urls: {
|
|
1874
1899
|
authenticationEndpoint: {
|
|
@@ -1887,12 +1912,12 @@ function Gi() {
|
|
|
1887
1912
|
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
1888
1913
|
}
|
|
1889
1914
|
}
|
|
1890
|
-
},
|
|
1891
|
-
const e = "See:", t =
|
|
1915
|
+
}, E = { buildLogSuffix: function(n) {
|
|
1916
|
+
const e = "See:", t = F.urls[n];
|
|
1892
1917
|
if (!t)
|
|
1893
1918
|
return "";
|
|
1894
1919
|
let r;
|
|
1895
|
-
return t.fullUrl ? r = t.fullUrl : t.path && (r =
|
|
1920
|
+
return t.fullUrl ? r = t.fullUrl : t.path && (r = F.baseUrl + t.path), r ? `${e} ${r}` : "";
|
|
1896
1921
|
} };
|
|
1897
1922
|
var u;
|
|
1898
1923
|
(function(n) {
|
|
@@ -1967,24 +1992,24 @@ function Gi() {
|
|
|
1967
1992
|
let p = "";
|
|
1968
1993
|
switch (r) {
|
|
1969
1994
|
case u.UserAuthentication:
|
|
1970
|
-
p =
|
|
1995
|
+
p = E.buildLogSuffix("authenticationEndpoint");
|
|
1971
1996
|
break;
|
|
1972
1997
|
case u.ChannelAuthorization:
|
|
1973
|
-
p = `Clients must be authorized to join private or presence channels. ${
|
|
1998
|
+
p = `Clients must be authorized to join private or presence channels. ${E.buildLogSuffix("authorizationEndpoint")}`;
|
|
1974
1999
|
break;
|
|
1975
2000
|
}
|
|
1976
2001
|
o(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
1977
2002
|
}
|
|
1978
2003
|
}, c.send(e), c;
|
|
1979
2004
|
};
|
|
1980
|
-
function
|
|
2005
|
+
function Rt(n) {
|
|
1981
2006
|
return qt(It(n));
|
|
1982
2007
|
}
|
|
1983
|
-
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
2008
|
+
var ne = String.fromCharCode, oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Pt = function(n) {
|
|
1984
2009
|
var e = n.charCodeAt(0);
|
|
1985
2010
|
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
2011
|
}, It = function(n) {
|
|
1987
|
-
return n.replace(/[^\x00-\x7F]/g,
|
|
2012
|
+
return n.replace(/[^\x00-\x7F]/g, Pt);
|
|
1988
2013
|
}, Ot = function(n) {
|
|
1989
2014
|
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
2015
|
oe.charAt(t >>> 18),
|
|
@@ -2069,19 +2094,19 @@ function Gi() {
|
|
|
2069
2094
|
return r;
|
|
2070
2095
|
return -1;
|
|
2071
2096
|
}
|
|
2072
|
-
function
|
|
2097
|
+
function $(n, e) {
|
|
2073
2098
|
for (var t in n)
|
|
2074
2099
|
Object.prototype.hasOwnProperty.call(n, t) && e(n[t], t, n);
|
|
2075
2100
|
}
|
|
2076
2101
|
function De(n) {
|
|
2077
2102
|
var e = [];
|
|
2078
|
-
return
|
|
2103
|
+
return $(n, function(t, r) {
|
|
2079
2104
|
e.push(r);
|
|
2080
2105
|
}), e;
|
|
2081
2106
|
}
|
|
2082
2107
|
function Dt(n) {
|
|
2083
2108
|
var e = [];
|
|
2084
|
-
return
|
|
2109
|
+
return $(n, function(t) {
|
|
2085
2110
|
e.push(t);
|
|
2086
2111
|
}), e;
|
|
2087
2112
|
}
|
|
@@ -2089,18 +2114,18 @@ function Gi() {
|
|
|
2089
2114
|
for (var r = 0; r < n.length; r++)
|
|
2090
2115
|
e.call(t || window, n[r], r, n);
|
|
2091
2116
|
}
|
|
2092
|
-
function
|
|
2117
|
+
function We(n, e) {
|
|
2093
2118
|
for (var t = [], r = 0; r < n.length; r++)
|
|
2094
2119
|
t.push(e(n[r], r, n, t));
|
|
2095
2120
|
return t;
|
|
2096
2121
|
}
|
|
2097
|
-
function
|
|
2122
|
+
function Wt(n, e) {
|
|
2098
2123
|
var t = {};
|
|
2099
|
-
return
|
|
2124
|
+
return $(n, function(r, o) {
|
|
2100
2125
|
t[o] = e(r);
|
|
2101
2126
|
}), t;
|
|
2102
2127
|
}
|
|
2103
|
-
function
|
|
2128
|
+
function Fe(n, e) {
|
|
2104
2129
|
e = e || function(o) {
|
|
2105
2130
|
return !!o;
|
|
2106
2131
|
};
|
|
@@ -2110,13 +2135,13 @@ function Gi() {
|
|
|
2110
2135
|
}
|
|
2111
2136
|
function Be(n, e) {
|
|
2112
2137
|
var t = {};
|
|
2113
|
-
return
|
|
2138
|
+
return $(n, function(r, o) {
|
|
2114
2139
|
(e && e(r, o, n, t) || r) && (t[o] = r);
|
|
2115
2140
|
}), t;
|
|
2116
2141
|
}
|
|
2117
|
-
function
|
|
2142
|
+
function Ft(n) {
|
|
2118
2143
|
var e = [];
|
|
2119
|
-
return
|
|
2144
|
+
return $(n, function(t, r) {
|
|
2120
2145
|
e.push([r, t]);
|
|
2121
2146
|
}), e;
|
|
2122
2147
|
}
|
|
@@ -2133,14 +2158,14 @@ function Gi() {
|
|
|
2133
2158
|
return !0;
|
|
2134
2159
|
}
|
|
2135
2160
|
function $t(n) {
|
|
2136
|
-
return
|
|
2137
|
-
return typeof e == "object" && (e = ae(e)), encodeURIComponent(
|
|
2161
|
+
return Wt(n, function(e) {
|
|
2162
|
+
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Rt(e.toString()));
|
|
2138
2163
|
});
|
|
2139
2164
|
}
|
|
2140
2165
|
function Vt(n) {
|
|
2141
2166
|
var e = Be(n, function(r) {
|
|
2142
2167
|
return r !== void 0;
|
|
2143
|
-
}), t =
|
|
2168
|
+
}), t = We(Ft($t(e)), U.method("join", "=")).join("&");
|
|
2144
2169
|
return t;
|
|
2145
2170
|
}
|
|
2146
2171
|
function Xt(n) {
|
|
@@ -2203,9 +2228,9 @@ function Gi() {
|
|
|
2203
2228
|
de.log ? de.log(r) : de.logToConsole && e.bind(this)(r);
|
|
2204
2229
|
}
|
|
2205
2230
|
}
|
|
2206
|
-
const
|
|
2231
|
+
const R = new Jt();
|
|
2207
2232
|
var Gt = function(n, e, t, r, o) {
|
|
2208
|
-
(t.headers !== void 0 || t.headersProvider != null) &&
|
|
2233
|
+
(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
2234
|
var c = n.nextAuthCallbackID.toString();
|
|
2210
2235
|
n.nextAuthCallbackID++;
|
|
2211
2236
|
var l = n.getDocument(), p = l.createElement("script");
|
|
@@ -2269,7 +2294,7 @@ function Gi() {
|
|
|
2269
2294
|
return r + "://" + o + t;
|
|
2270
2295
|
}
|
|
2271
2296
|
function be(n, e) {
|
|
2272
|
-
var t = "/app/" + n, r = "?protocol=" +
|
|
2297
|
+
var t = "/app/" + n, r = "?protocol=" + T.PROTOCOL + "&client=js&version=" + T.VERSION + (e ? "&" + e : "");
|
|
2273
2298
|
return t + r;
|
|
2274
2299
|
}
|
|
2275
2300
|
var nn = {
|
|
@@ -2314,7 +2339,7 @@ function Gi() {
|
|
|
2314
2339
|
}
|
|
2315
2340
|
removeCallback(e, t, r) {
|
|
2316
2341
|
ie(e, function(o) {
|
|
2317
|
-
this._callbacks[o] =
|
|
2342
|
+
this._callbacks[o] = Fe(this._callbacks[o] || [], function(c) {
|
|
2318
2343
|
return t && t !== c.fn || r && r !== c.context;
|
|
2319
2344
|
}), this._callbacks[o].length === 0 && delete this._callbacks[o];
|
|
2320
2345
|
}, this);
|
|
@@ -2328,7 +2353,7 @@ function Gi() {
|
|
|
2328
2353
|
function we(n) {
|
|
2329
2354
|
return "_" + n;
|
|
2330
2355
|
}
|
|
2331
|
-
class
|
|
2356
|
+
class V {
|
|
2332
2357
|
constructor(e) {
|
|
2333
2358
|
this.callbacks = new on(), this.global_callbacks = [], this.failThrough = e;
|
|
2334
2359
|
}
|
|
@@ -2342,7 +2367,7 @@ function Gi() {
|
|
|
2342
2367
|
return this.callbacks.remove(e, t, r), this;
|
|
2343
2368
|
}
|
|
2344
2369
|
unbind_global(e) {
|
|
2345
|
-
return e ? (this.global_callbacks =
|
|
2370
|
+
return e ? (this.global_callbacks = Fe(this.global_callbacks || [], (t) => t !== e), this) : (this.global_callbacks = [], this);
|
|
2346
2371
|
}
|
|
2347
2372
|
unbind_all() {
|
|
2348
2373
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -2358,7 +2383,7 @@ function Gi() {
|
|
|
2358
2383
|
return this;
|
|
2359
2384
|
}
|
|
2360
2385
|
}
|
|
2361
|
-
class an extends
|
|
2386
|
+
class an extends V {
|
|
2362
2387
|
constructor(e, t, r, o, c) {
|
|
2363
2388
|
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
2389
|
}
|
|
@@ -2379,7 +2404,7 @@ function Gi() {
|
|
|
2379
2404
|
this.onError(t), this.changeState("closed");
|
|
2380
2405
|
}), !1;
|
|
2381
2406
|
}
|
|
2382
|
-
return this.bindListeners(),
|
|
2407
|
+
return this.bindListeners(), R.debug("Connecting", { transport: this.name, url: e }), this.changeState("connecting"), !0;
|
|
2383
2408
|
}
|
|
2384
2409
|
close() {
|
|
2385
2410
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
@@ -2518,7 +2543,7 @@ function Gi() {
|
|
|
2518
2543
|
}, fn = new ee(j({}, Xe, Ye)), pn = new ee(j({}, Je, Ye));
|
|
2519
2544
|
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs = un;
|
|
2520
2545
|
const mn = ce;
|
|
2521
|
-
class gn extends
|
|
2546
|
+
class gn extends V {
|
|
2522
2547
|
constructor() {
|
|
2523
2548
|
super();
|
|
2524
2549
|
var e = this;
|
|
@@ -2611,7 +2636,7 @@ function Gi() {
|
|
|
2611
2636
|
} : null;
|
|
2612
2637
|
}
|
|
2613
2638
|
}, K = Ke;
|
|
2614
|
-
class bn extends
|
|
2639
|
+
class bn extends V {
|
|
2615
2640
|
constructor(e, t) {
|
|
2616
2641
|
super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
|
|
2617
2642
|
}
|
|
@@ -2623,7 +2648,7 @@ function Gi() {
|
|
|
2623
2648
|
}
|
|
2624
2649
|
send_event(e, t, r) {
|
|
2625
2650
|
var o = { event: e, data: t };
|
|
2626
|
-
return r && (o.channel = r),
|
|
2651
|
+
return r && (o.channel = r), R.debug("Event sent", o), this.send(K.encodeMessage(o));
|
|
2627
2652
|
}
|
|
2628
2653
|
ping() {
|
|
2629
2654
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -2645,7 +2670,7 @@ function Gi() {
|
|
|
2645
2670
|
});
|
|
2646
2671
|
}
|
|
2647
2672
|
if (o !== void 0) {
|
|
2648
|
-
switch (
|
|
2673
|
+
switch (R.debug("Event recd", o), o.event) {
|
|
2649
2674
|
case "pusher:error":
|
|
2650
2675
|
this.emit("error", {
|
|
2651
2676
|
type: "PusherError",
|
|
@@ -2672,11 +2697,11 @@ function Gi() {
|
|
|
2672
2697
|
t(), r && r.code && this.handleCloseEvent(r), this.transport = null, this.emit("closed");
|
|
2673
2698
|
}
|
|
2674
2699
|
}, t = () => {
|
|
2675
|
-
|
|
2700
|
+
$(e, (r, o) => {
|
|
2676
2701
|
this.transport.unbind(o, r);
|
|
2677
2702
|
});
|
|
2678
2703
|
};
|
|
2679
|
-
|
|
2704
|
+
$(e, (r, o) => {
|
|
2680
2705
|
this.transport.bind(o, r);
|
|
2681
2706
|
});
|
|
2682
2707
|
}
|
|
@@ -2727,10 +2752,10 @@ function Gi() {
|
|
|
2727
2752
|
this.timeline.isEmpty() || this.timeline.send(w.TimelineTransport.getAgent(this, e), t);
|
|
2728
2753
|
}
|
|
2729
2754
|
}
|
|
2730
|
-
class Ce extends
|
|
2755
|
+
class Ce extends V {
|
|
2731
2756
|
constructor(e, t) {
|
|
2732
2757
|
super(function(r, o) {
|
|
2733
|
-
|
|
2758
|
+
R.debug("No callbacks on " + e + " for " + r);
|
|
2734
2759
|
}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
2735
2760
|
}
|
|
2736
2761
|
authorize(e, t) {
|
|
@@ -2740,8 +2765,8 @@ function Gi() {
|
|
|
2740
2765
|
if (e.indexOf("client-") !== 0)
|
|
2741
2766
|
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2742
2767
|
if (!this.subscribed) {
|
|
2743
|
-
var r =
|
|
2744
|
-
|
|
2768
|
+
var r = E.buildLogSuffix("triggeringClientEvents");
|
|
2769
|
+
R.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2745
2770
|
}
|
|
2746
2771
|
return this.pusher.send_event(e, t, this.name);
|
|
2747
2772
|
}
|
|
@@ -2767,7 +2792,7 @@ function Gi() {
|
|
|
2767
2792
|
}
|
|
2768
2793
|
subscribe() {
|
|
2769
2794
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (e, t) => {
|
|
2770
|
-
e ? (this.subscriptionPending = !1,
|
|
2795
|
+
e ? (this.subscriptionPending = !1, R.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
2771
2796
|
type: "AuthError",
|
|
2772
2797
|
error: e.message
|
|
2773
2798
|
}, e instanceof H ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
@@ -2808,7 +2833,7 @@ function Gi() {
|
|
|
2808
2833
|
} : null;
|
|
2809
2834
|
}
|
|
2810
2835
|
each(e) {
|
|
2811
|
-
|
|
2836
|
+
$(this.members, (t, r) => {
|
|
2812
2837
|
e(this.get(r));
|
|
2813
2838
|
});
|
|
2814
2839
|
}
|
|
@@ -2829,7 +2854,7 @@ function Gi() {
|
|
|
2829
2854
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
2830
2855
|
}
|
|
2831
2856
|
}
|
|
2832
|
-
var
|
|
2857
|
+
var Tn = function(n, e, t, r) {
|
|
2833
2858
|
function o(c) {
|
|
2834
2859
|
return c instanceof t ? c : new t(function(l) {
|
|
2835
2860
|
l(c);
|
|
@@ -2839,15 +2864,15 @@ function Gi() {
|
|
|
2839
2864
|
function p(k) {
|
|
2840
2865
|
try {
|
|
2841
2866
|
_(r.next(k));
|
|
2842
|
-
} catch (
|
|
2843
|
-
l(
|
|
2867
|
+
} catch (P) {
|
|
2868
|
+
l(P);
|
|
2844
2869
|
}
|
|
2845
2870
|
}
|
|
2846
2871
|
function b(k) {
|
|
2847
2872
|
try {
|
|
2848
2873
|
_(r.throw(k));
|
|
2849
|
-
} catch (
|
|
2850
|
-
l(
|
|
2874
|
+
} catch (P) {
|
|
2875
|
+
l(P);
|
|
2851
2876
|
}
|
|
2852
2877
|
}
|
|
2853
2878
|
function _(k) {
|
|
@@ -2856,12 +2881,12 @@ function Gi() {
|
|
|
2856
2881
|
_((r = r.apply(n, e || [])).next());
|
|
2857
2882
|
});
|
|
2858
2883
|
};
|
|
2859
|
-
class
|
|
2884
|
+
class En extends Se {
|
|
2860
2885
|
constructor(e, t) {
|
|
2861
2886
|
super(e, t), this.members = new Sn();
|
|
2862
2887
|
}
|
|
2863
2888
|
authorize(e, t) {
|
|
2864
|
-
super.authorize(e, (r, o) =>
|
|
2889
|
+
super.authorize(e, (r, o) => Tn(this, void 0, void 0, function* () {
|
|
2865
2890
|
if (!r)
|
|
2866
2891
|
if (o = o, o.channel_data != null) {
|
|
2867
2892
|
var c = JSON.parse(o.channel_data);
|
|
@@ -2869,8 +2894,8 @@ function Gi() {
|
|
|
2869
2894
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
2870
2895
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2871
2896
|
else {
|
|
2872
|
-
let l =
|
|
2873
|
-
|
|
2897
|
+
let l = E.buildLogSuffix("authorizationEndpoint");
|
|
2898
|
+
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
2899
|
return;
|
|
2875
2900
|
}
|
|
2876
2901
|
t(r, o);
|
|
@@ -2911,7 +2936,7 @@ function Gi() {
|
|
|
2911
2936
|
this.members.reset(), super.disconnect();
|
|
2912
2937
|
}
|
|
2913
2938
|
}
|
|
2914
|
-
var
|
|
2939
|
+
var xn = y(978), Te = y(594);
|
|
2915
2940
|
class _n extends Se {
|
|
2916
2941
|
constructor(e, t, r) {
|
|
2917
2942
|
super(e, t), this.key = null, this.nacl = r;
|
|
@@ -2927,7 +2952,7 @@ function Gi() {
|
|
|
2927
2952
|
t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2928
2953
|
return;
|
|
2929
2954
|
}
|
|
2930
|
-
this.key = (0,
|
|
2955
|
+
this.key = (0, Te.decode)(c), delete o.shared_secret, t(null, o);
|
|
2931
2956
|
});
|
|
2932
2957
|
}
|
|
2933
2958
|
trigger(e, t) {
|
|
@@ -2943,32 +2968,32 @@ function Gi() {
|
|
|
2943
2968
|
}
|
|
2944
2969
|
handleEncryptedEvent(e, t) {
|
|
2945
2970
|
if (!this.key) {
|
|
2946
|
-
|
|
2971
|
+
R.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
2947
2972
|
return;
|
|
2948
2973
|
}
|
|
2949
2974
|
if (!t.ciphertext || !t.nonce) {
|
|
2950
|
-
|
|
2975
|
+
R.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
|
|
2951
2976
|
return;
|
|
2952
2977
|
}
|
|
2953
|
-
let r = (0,
|
|
2978
|
+
let r = (0, Te.decode)(t.ciphertext);
|
|
2954
2979
|
if (r.length < this.nacl.secretbox.overheadLength) {
|
|
2955
|
-
|
|
2980
|
+
R.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2956
2981
|
return;
|
|
2957
2982
|
}
|
|
2958
|
-
let o = (0,
|
|
2983
|
+
let o = (0, Te.decode)(t.nonce);
|
|
2959
2984
|
if (o.length < this.nacl.secretbox.nonceLength) {
|
|
2960
|
-
|
|
2985
|
+
R.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${o.length}`);
|
|
2961
2986
|
return;
|
|
2962
2987
|
}
|
|
2963
2988
|
let c = this.nacl.secretbox.open(r, o, this.key);
|
|
2964
2989
|
if (c === null) {
|
|
2965
|
-
|
|
2990
|
+
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
2991
|
if (l) {
|
|
2967
|
-
|
|
2992
|
+
R.error(`Failed to make a request to the authEndpoint: ${p}. Unable to fetch new key, so dropping encrypted event`);
|
|
2968
2993
|
return;
|
|
2969
2994
|
}
|
|
2970
2995
|
if (c = this.nacl.secretbox.open(r, o, this.key), c === null) {
|
|
2971
|
-
|
|
2996
|
+
R.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
2972
2997
|
return;
|
|
2973
2998
|
}
|
|
2974
2999
|
this.emit(e, this.getDataToEmit(c));
|
|
@@ -2978,7 +3003,7 @@ function Gi() {
|
|
|
2978
3003
|
this.emit(e, this.getDataToEmit(c));
|
|
2979
3004
|
}
|
|
2980
3005
|
getDataToEmit(e) {
|
|
2981
|
-
let t = (0,
|
|
3006
|
+
let t = (0, xn.D4)(e);
|
|
2982
3007
|
try {
|
|
2983
3008
|
return JSON.parse(t);
|
|
2984
3009
|
} catch {
|
|
@@ -2986,7 +3011,7 @@ function Gi() {
|
|
|
2986
3011
|
}
|
|
2987
3012
|
}
|
|
2988
3013
|
}
|
|
2989
|
-
class kn extends
|
|
3014
|
+
class kn extends V {
|
|
2990
3015
|
constructor(e, t) {
|
|
2991
3016
|
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
3017
|
var r = w.getNetwork();
|
|
@@ -3138,7 +3163,7 @@ function Gi() {
|
|
|
3138
3163
|
var r = this.state;
|
|
3139
3164
|
if (this.state = e, r !== e) {
|
|
3140
3165
|
var o = e;
|
|
3141
|
-
o === "connected" && (o += " with new socket ID " + t.socket_id),
|
|
3166
|
+
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
3167
|
}
|
|
3143
3168
|
}
|
|
3144
3169
|
shouldRetry() {
|
|
@@ -3163,7 +3188,7 @@ function Gi() {
|
|
|
3163
3188
|
return delete this.channels[e], t;
|
|
3164
3189
|
}
|
|
3165
3190
|
disconnect() {
|
|
3166
|
-
|
|
3191
|
+
$(this.channels, function(e) {
|
|
3167
3192
|
e.disconnect();
|
|
3168
3193
|
});
|
|
3169
3194
|
}
|
|
@@ -3171,20 +3196,20 @@ function Gi() {
|
|
|
3171
3196
|
function Ln(n, e) {
|
|
3172
3197
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3173
3198
|
if (e.config.nacl)
|
|
3174
|
-
return
|
|
3175
|
-
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r =
|
|
3199
|
+
return X.createEncryptedChannel(n, e, e.config.nacl);
|
|
3200
|
+
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = E.buildLogSuffix("encryptedChannelSupport");
|
|
3176
3201
|
throw new z(`${t}. ${r}`);
|
|
3177
3202
|
} else {
|
|
3178
3203
|
if (n.indexOf("private-") === 0)
|
|
3179
|
-
return
|
|
3204
|
+
return X.createPrivateChannel(n, e);
|
|
3180
3205
|
if (n.indexOf("presence-") === 0)
|
|
3181
|
-
return
|
|
3206
|
+
return X.createPresenceChannel(n, e);
|
|
3182
3207
|
if (n.indexOf("#") === 0)
|
|
3183
3208
|
throw new C('Cannot create a channel with name "' + n + '".');
|
|
3184
|
-
return
|
|
3209
|
+
return X.createChannel(n, e);
|
|
3185
3210
|
}
|
|
3186
3211
|
}
|
|
3187
|
-
var
|
|
3212
|
+
var Rn = {
|
|
3188
3213
|
createChannels() {
|
|
3189
3214
|
return new An();
|
|
3190
3215
|
},
|
|
@@ -3198,7 +3223,7 @@ function Gi() {
|
|
|
3198
3223
|
return new Se(n, e);
|
|
3199
3224
|
},
|
|
3200
3225
|
createPresenceChannel(n, e) {
|
|
3201
|
-
return new
|
|
3226
|
+
return new En(n, e);
|
|
3202
3227
|
},
|
|
3203
3228
|
createEncryptedChannel(n, e, t) {
|
|
3204
3229
|
return new _n(n, e, t);
|
|
@@ -3213,13 +3238,13 @@ function Gi() {
|
|
|
3213
3238
|
return new yn(n, e, t);
|
|
3214
3239
|
}
|
|
3215
3240
|
};
|
|
3216
|
-
const
|
|
3241
|
+
const X = Rn;
|
|
3217
3242
|
class Qe {
|
|
3218
3243
|
constructor(e) {
|
|
3219
3244
|
this.options = e || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
3220
3245
|
}
|
|
3221
3246
|
getAssistant(e) {
|
|
3222
|
-
return
|
|
3247
|
+
return X.createAssistantToTheTransportManager(this, e, {
|
|
3223
3248
|
minPingDelay: this.options.minPingDelay,
|
|
3224
3249
|
maxPingDelay: this.options.maxPingDelay
|
|
3225
3250
|
});
|
|
@@ -3267,7 +3292,7 @@ function Gi() {
|
|
|
3267
3292
|
};
|
|
3268
3293
|
}
|
|
3269
3294
|
}
|
|
3270
|
-
class
|
|
3295
|
+
class Ee {
|
|
3271
3296
|
constructor(e) {
|
|
3272
3297
|
this.strategies = e;
|
|
3273
3298
|
}
|
|
@@ -3275,7 +3300,7 @@ function Gi() {
|
|
|
3275
3300
|
return $e(this.strategies, U.method("isSupported"));
|
|
3276
3301
|
}
|
|
3277
3302
|
connect(e, t) {
|
|
3278
|
-
return
|
|
3303
|
+
return Pn(this.strategies, e, function(r, o) {
|
|
3279
3304
|
return function(c, l) {
|
|
3280
3305
|
if (o[r].error = c, c) {
|
|
3281
3306
|
In(o) && t(!0);
|
|
@@ -3288,8 +3313,8 @@ function Gi() {
|
|
|
3288
3313
|
});
|
|
3289
3314
|
}
|
|
3290
3315
|
}
|
|
3291
|
-
function
|
|
3292
|
-
var r =
|
|
3316
|
+
function Pn(n, e, t) {
|
|
3317
|
+
var r = We(n, function(o, c, l, p) {
|
|
3293
3318
|
return o.connect(e, t(c, p));
|
|
3294
3319
|
});
|
|
3295
3320
|
return {
|
|
@@ -3331,8 +3356,8 @@ function Gi() {
|
|
|
3331
3356
|
failFast: !0
|
|
3332
3357
|
}))) : c++);
|
|
3333
3358
|
}
|
|
3334
|
-
var b = U.now(), _ = l.pop().connect(e, function k(
|
|
3335
|
-
|
|
3359
|
+
var b = U.now(), _ = l.pop().connect(e, function k(P, ue) {
|
|
3360
|
+
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
3361
|
});
|
|
3337
3362
|
return {
|
|
3338
3363
|
abort: function() {
|
|
@@ -3344,14 +3369,14 @@ function Gi() {
|
|
|
3344
3369
|
};
|
|
3345
3370
|
}
|
|
3346
3371
|
}
|
|
3347
|
-
function
|
|
3372
|
+
function xe(n) {
|
|
3348
3373
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3349
3374
|
}
|
|
3350
3375
|
function Un(n) {
|
|
3351
3376
|
var e = w.getLocalStorage();
|
|
3352
3377
|
if (e)
|
|
3353
3378
|
try {
|
|
3354
|
-
var t = e[
|
|
3379
|
+
var t = e[xe(n)];
|
|
3355
3380
|
if (t)
|
|
3356
3381
|
return JSON.parse(t);
|
|
3357
3382
|
} catch {
|
|
@@ -3363,7 +3388,7 @@ function Gi() {
|
|
|
3363
3388
|
var o = w.getLocalStorage();
|
|
3364
3389
|
if (o)
|
|
3365
3390
|
try {
|
|
3366
|
-
o[
|
|
3391
|
+
o[xe(n)] = ae({
|
|
3367
3392
|
timestamp: U.now(),
|
|
3368
3393
|
transport: e,
|
|
3369
3394
|
latency: t,
|
|
@@ -3376,7 +3401,7 @@ function Gi() {
|
|
|
3376
3401
|
var e = w.getLocalStorage();
|
|
3377
3402
|
if (e)
|
|
3378
3403
|
try {
|
|
3379
|
-
delete e[
|
|
3404
|
+
delete e[xe(n)];
|
|
3380
3405
|
} catch {
|
|
3381
3406
|
}
|
|
3382
3407
|
}
|
|
@@ -3460,24 +3485,24 @@ function Gi() {
|
|
|
3460
3485
|
lives: 2,
|
|
3461
3486
|
minPingDelay: 1e4,
|
|
3462
3487
|
maxPingDelay: n.activityTimeout
|
|
3463
|
-
}),
|
|
3464
|
-
new re(se(ot), ot,
|
|
3488
|
+
}), 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([
|
|
3489
|
+
new re(se(ot), ot, Pi)
|
|
3465
3490
|
], b), lt = new Q([
|
|
3466
3491
|
new re(se(at), at, Ii)
|
|
3467
3492
|
], b), dt = new Q([
|
|
3468
|
-
new re(se(ht), new
|
|
3493
|
+
new re(se(ht), new Ee([
|
|
3469
3494
|
ht,
|
|
3470
3495
|
new he(lt, { delay: 4e3 })
|
|
3471
3496
|
]), lt)
|
|
3472
3497
|
], b), Ae = new re(se(dt), dt, qi), Le;
|
|
3473
|
-
return e.useTLS ? Le = new
|
|
3498
|
+
return e.useTLS ? Le = new Ee([
|
|
3474
3499
|
ct,
|
|
3475
3500
|
new he(Ae, { delay: 2e3 })
|
|
3476
|
-
]) : Le = new
|
|
3501
|
+
]) : Le = new Ee([
|
|
3477
3502
|
ct,
|
|
3478
3503
|
new he(Oi, { delay: 2e3 }),
|
|
3479
3504
|
new he(Ae, { delay: 5e3 })
|
|
3480
|
-
]), new qn(new Mn(new re(se(
|
|
3505
|
+
]), new qn(new Mn(new re(se(P), Le, Ae)), r, {
|
|
3481
3506
|
ttl: 18e5,
|
|
3482
3507
|
timeline: e.timeline,
|
|
3483
3508
|
useTLS: e.useTLS
|
|
@@ -3509,8 +3534,8 @@ function Gi() {
|
|
|
3509
3534
|
n.ontimeout = n.onerror = n.onprogress = n.onload = null, n.abort();
|
|
3510
3535
|
}
|
|
3511
3536
|
};
|
|
3512
|
-
const
|
|
3513
|
-
class Bn extends
|
|
3537
|
+
const Wn = Dn, Fn = 256 * 1024;
|
|
3538
|
+
class Bn extends V {
|
|
3514
3539
|
constructor(e, t, r) {
|
|
3515
3540
|
super(), this.hooks = e, this.method = t, this.url = r;
|
|
3516
3541
|
}
|
|
@@ -3538,7 +3563,7 @@ function Gi() {
|
|
|
3538
3563
|
return r !== -1 ? (this.position += r + 1, t.slice(0, r)) : null;
|
|
3539
3564
|
}
|
|
3540
3565
|
isBufferTooLong(e) {
|
|
3541
|
-
return this.position === e.length && e.length >
|
|
3566
|
+
return this.position === e.length && e.length > Fn;
|
|
3542
3567
|
}
|
|
3543
3568
|
}
|
|
3544
3569
|
var _e;
|
|
@@ -3731,13 +3756,13 @@ function Gi() {
|
|
|
3731
3756
|
};
|
|
3732
3757
|
const nt = ri;
|
|
3733
3758
|
nt.createXDR = function(n, e) {
|
|
3734
|
-
return this.createRequest(
|
|
3759
|
+
return this.createRequest(Wn, n, e);
|
|
3735
3760
|
};
|
|
3736
3761
|
var si = {
|
|
3737
3762
|
nextAuthCallbackID: 1,
|
|
3738
3763
|
auth_callbacks: {},
|
|
3739
3764
|
ScriptReceivers: S,
|
|
3740
|
-
DependenciesReceivers:
|
|
3765
|
+
DependenciesReceivers: W,
|
|
3741
3766
|
getDefaultStrategy: zn,
|
|
3742
3767
|
Transports: mn,
|
|
3743
3768
|
transportConnectionInitializer: Hn,
|
|
@@ -3888,15 +3913,15 @@ function Gi() {
|
|
|
3888
3913
|
var r = !1, o = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3889
3914
|
o.unbind("initialized", l), o.connect();
|
|
3890
3915
|
}, p = function() {
|
|
3891
|
-
c =
|
|
3892
|
-
r = !0, k(), t(null,
|
|
3916
|
+
c = X.createHandshake(o, function(P) {
|
|
3917
|
+
r = !0, k(), t(null, P);
|
|
3893
3918
|
});
|
|
3894
|
-
}, b = function(
|
|
3895
|
-
k(), t(
|
|
3919
|
+
}, b = function(P) {
|
|
3920
|
+
k(), t(P);
|
|
3896
3921
|
}, _ = function() {
|
|
3897
3922
|
k();
|
|
3898
|
-
var
|
|
3899
|
-
|
|
3923
|
+
var P;
|
|
3924
|
+
P = ae(o), t(new M(P));
|
|
3900
3925
|
}, k = function() {
|
|
3901
3926
|
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error", b), o.unbind("closed", _);
|
|
3902
3927
|
};
|
|
@@ -3904,8 +3929,8 @@ function Gi() {
|
|
|
3904
3929
|
abort: () => {
|
|
3905
3930
|
r || (k(), c ? c.close() : o.close());
|
|
3906
3931
|
},
|
|
3907
|
-
forceMinPriority: (
|
|
3908
|
-
r || this.priority <
|
|
3932
|
+
forceMinPriority: (P) => {
|
|
3933
|
+
r || this.priority < P && (c ? c.close() : o.close());
|
|
3909
3934
|
}
|
|
3910
3935
|
};
|
|
3911
3936
|
}
|
|
@@ -3949,7 +3974,7 @@ function Gi() {
|
|
|
3949
3974
|
throw "You must pass an options object";
|
|
3950
3975
|
if (n.cluster == null)
|
|
3951
3976
|
throw "Options object must provide a cluster";
|
|
3952
|
-
"disableStats" in n &&
|
|
3977
|
+
"disableStats" in n && R.warn("The disableStats option is deprecated in favor of enableStats");
|
|
3953
3978
|
}
|
|
3954
3979
|
const ui = (n, e) => {
|
|
3955
3980
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
@@ -4002,28 +4027,28 @@ function Gi() {
|
|
|
4002
4027
|
};
|
|
4003
4028
|
function rt(n, e) {
|
|
4004
4029
|
let t = {
|
|
4005
|
-
activityTimeout: n.activityTimeout ||
|
|
4030
|
+
activityTimeout: n.activityTimeout || T.activityTimeout,
|
|
4006
4031
|
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 ||
|
|
4032
|
+
httpPath: n.httpPath || T.httpPath,
|
|
4033
|
+
httpPort: n.httpPort || T.httpPort,
|
|
4034
|
+
httpsPort: n.httpsPort || T.httpsPort,
|
|
4035
|
+
pongTimeout: n.pongTimeout || T.pongTimeout,
|
|
4036
|
+
statsHost: n.statsHost || T.stats_host,
|
|
4037
|
+
unavailableTimeout: n.unavailableTimeout || T.unavailableTimeout,
|
|
4038
|
+
wsPath: n.wsPath || T.wsPath,
|
|
4039
|
+
wsPort: n.wsPort || T.wsPort,
|
|
4040
|
+
wssPort: n.wssPort || T.wssPort,
|
|
4016
4041
|
enableStats: Ci(n),
|
|
4017
4042
|
httpHost: vi(n),
|
|
4018
4043
|
useTLS: wi(n),
|
|
4019
4044
|
wsHost: yi(n),
|
|
4020
4045
|
userAuthenticator: Si(n),
|
|
4021
|
-
channelAuthorizer:
|
|
4046
|
+
channelAuthorizer: Ei(n, e)
|
|
4022
4047
|
};
|
|
4023
4048
|
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
4049
|
}
|
|
4025
4050
|
function vi(n) {
|
|
4026
|
-
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` :
|
|
4051
|
+
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` : T.httpHost;
|
|
4027
4052
|
}
|
|
4028
4053
|
function yi(n) {
|
|
4029
4054
|
return n.wsHost ? n.wsHost : bi(n.cluster);
|
|
@@ -4039,30 +4064,30 @@ function Gi() {
|
|
|
4039
4064
|
}
|
|
4040
4065
|
const st = (n) => "customHandler" in n && n.customHandler != null;
|
|
4041
4066
|
function Si(n) {
|
|
4042
|
-
const e = Object.assign(Object.assign({},
|
|
4067
|
+
const e = Object.assign(Object.assign({}, T.userAuthentication), n.userAuthentication);
|
|
4043
4068
|
return st(e) ? e.customHandler : fi(e);
|
|
4044
4069
|
}
|
|
4045
|
-
function
|
|
4070
|
+
function Ti(n, e) {
|
|
4046
4071
|
let t;
|
|
4047
4072
|
if ("channelAuthorization" in n)
|
|
4048
|
-
t = Object.assign(Object.assign({},
|
|
4073
|
+
t = Object.assign(Object.assign({}, T.channelAuthorization), n.channelAuthorization);
|
|
4049
4074
|
else if (t = {
|
|
4050
|
-
transport: n.authTransport ||
|
|
4051
|
-
endpoint: n.authEndpoint ||
|
|
4075
|
+
transport: n.authTransport || T.authTransport,
|
|
4076
|
+
endpoint: n.authEndpoint || T.authEndpoint
|
|
4052
4077
|
}, "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
4078
|
return {
|
|
4054
4079
|
customHandler: gi(e, t, n.authorizer)
|
|
4055
4080
|
};
|
|
4056
4081
|
return t;
|
|
4057
4082
|
}
|
|
4058
|
-
function
|
|
4059
|
-
const t =
|
|
4083
|
+
function Ei(n, e) {
|
|
4084
|
+
const t = Ti(n, e);
|
|
4060
4085
|
return st(t) ? t.customHandler : mi(t);
|
|
4061
4086
|
}
|
|
4062
|
-
class
|
|
4087
|
+
class xi extends V {
|
|
4063
4088
|
constructor(e) {
|
|
4064
4089
|
super(function(t, r) {
|
|
4065
|
-
|
|
4090
|
+
R.debug(`No callbacks on watchlist events for ${t}`);
|
|
4066
4091
|
}), this.pusher = e, this.bindWatchlistInternalEvent();
|
|
4067
4092
|
}
|
|
4068
4093
|
handleEvent(e) {
|
|
@@ -4084,13 +4109,13 @@ function Gi() {
|
|
|
4084
4109
|
}), resolve: n, reject: e };
|
|
4085
4110
|
}
|
|
4086
4111
|
const ki = _i;
|
|
4087
|
-
class Ai extends
|
|
4112
|
+
class Ai extends V {
|
|
4088
4113
|
constructor(e) {
|
|
4089
4114
|
super(function(t, r) {
|
|
4090
|
-
|
|
4115
|
+
R.debug("No callbacks on user for " + t);
|
|
4091
4116
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (t, r) => {
|
|
4092
4117
|
if (t) {
|
|
4093
|
-
|
|
4118
|
+
R.warn(`Error during signin: ${t}`), this._cleanup();
|
|
4094
4119
|
return;
|
|
4095
4120
|
}
|
|
4096
4121
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -4099,7 +4124,7 @@ function Gi() {
|
|
|
4099
4124
|
});
|
|
4100
4125
|
}, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: t, current: r }) => {
|
|
4101
4126
|
t !== "connected" && r === "connected" && this._signin(), t === "connected" && r !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
4102
|
-
}), this.watchlist = new
|
|
4127
|
+
}), this.watchlist = new xi(e), this.pusher.connection.bind("message", (t) => {
|
|
4103
4128
|
var r = t.event;
|
|
4104
4129
|
r === "pusher:signin_success" && this._onSigninSuccess(t.data), this.serverToUserChannel && this.serverToUserChannel.name === t.channel && this.serverToUserChannel.handleEvent(t);
|
|
4105
4130
|
});
|
|
@@ -4116,11 +4141,11 @@ function Gi() {
|
|
|
4116
4141
|
try {
|
|
4117
4142
|
this.user_data = JSON.parse(e.user_data);
|
|
4118
4143
|
} catch {
|
|
4119
|
-
|
|
4144
|
+
R.error(`Failed parsing user data after signin: ${e.user_data}`), this._cleanup();
|
|
4120
4145
|
return;
|
|
4121
4146
|
}
|
|
4122
4147
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
4123
|
-
|
|
4148
|
+
R.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
4124
4149
|
return;
|
|
4125
4150
|
}
|
|
4126
4151
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -4159,19 +4184,19 @@ function Gi() {
|
|
|
4159
4184
|
}));
|
|
4160
4185
|
}
|
|
4161
4186
|
constructor(e, t) {
|
|
4162
|
-
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels =
|
|
4187
|
+
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
4188
|
cluster: this.config.cluster,
|
|
4164
4189
|
features: I.getClientFeatures(),
|
|
4165
4190
|
params: this.config.timelineParams || {},
|
|
4166
4191
|
limit: 50,
|
|
4167
4192
|
level: le.INFO,
|
|
4168
|
-
version:
|
|
4169
|
-
}), this.config.enableStats && (this.timelineSender =
|
|
4193
|
+
version: T.VERSION
|
|
4194
|
+
}), this.config.enableStats && (this.timelineSender = X.createTimelineSender(this.timeline, {
|
|
4170
4195
|
host: this.config.statsHost,
|
|
4171
4196
|
path: "/timeline/v2/" + w.TimelineTransport.name
|
|
4172
4197
|
}));
|
|
4173
4198
|
var r = (o) => w.getDefaultStrategy(this.config, o, hi);
|
|
4174
|
-
this.connection =
|
|
4199
|
+
this.connection = X.createConnectionManager(this.key, {
|
|
4175
4200
|
getStrategy: r,
|
|
4176
4201
|
timeline: this.timeline,
|
|
4177
4202
|
activityTimeout: this.config.activityTimeout,
|
|
@@ -4192,7 +4217,7 @@ function Gi() {
|
|
|
4192
4217
|
}), this.connection.bind("disconnected", () => {
|
|
4193
4218
|
this.channels.disconnect();
|
|
4194
4219
|
}), this.connection.bind("error", (o) => {
|
|
4195
|
-
|
|
4220
|
+
R.warn(o);
|
|
4196
4221
|
}), I.instances.push(this), this.timeline.info({ instances: I.instances.length }), this.user = new Ai(this), I.isReady && this.connect();
|
|
4197
4222
|
}
|
|
4198
4223
|
switchCluster(e) {
|
|
@@ -4287,10 +4312,10 @@ function Gi() {
|
|
|
4287
4312
|
return d;
|
|
4288
4313
|
})()
|
|
4289
4314
|
));
|
|
4290
|
-
})(
|
|
4315
|
+
})(Re)), Re.exports;
|
|
4291
4316
|
}
|
|
4292
4317
|
var Yi = Gi();
|
|
4293
|
-
const Ki = /* @__PURE__ */ Ji(Yi),
|
|
4318
|
+
const Ki = /* @__PURE__ */ Ji(Yi), Pe = "/vendor/sendity-client/tailwind.css", Qi = {
|
|
4294
4319
|
labels: {
|
|
4295
4320
|
email: "Email",
|
|
4296
4321
|
whatsapp: "WhatsApp"
|
|
@@ -4302,6 +4327,7 @@ const Ki = /* @__PURE__ */ Ji(Yi), Re = "/vendor/sendity-client/tailwind.css", Q
|
|
|
4302
4327
|
toPrefix: "to",
|
|
4303
4328
|
footerWaiting: "Ready to receive your code…",
|
|
4304
4329
|
footerWaitingUntil: "Ready to receive your code…",
|
|
4330
|
+
footerReturnedWaiting: "Waiting for your message to arrive…",
|
|
4305
4331
|
codeExpired: "Code expired, request a new one.",
|
|
4306
4332
|
getNewCode: "Get new code"
|
|
4307
4333
|
},
|
|
@@ -4324,6 +4350,7 @@ Code: (Code)`,
|
|
|
4324
4350
|
toPrefix: "an",
|
|
4325
4351
|
footerWaiting: "Bereit zum Empfangen Deines Codes …",
|
|
4326
4352
|
footerWaitingUntil: "Bereit zum Empfangen Deines Codes …",
|
|
4353
|
+
footerReturnedWaiting: "Warte darauf, dass Deine Nachricht ankommt …",
|
|
4327
4354
|
codeExpired: "Code abgelaufen, fordere einen neuen an.",
|
|
4328
4355
|
getNewCode: "Neuen Code anfordern"
|
|
4329
4356
|
},
|
|
@@ -4346,6 +4373,7 @@ Code: (Code)`,
|
|
|
4346
4373
|
toPrefix: "à",
|
|
4347
4374
|
footerWaiting: "Prêt à recevoir votre code…",
|
|
4348
4375
|
footerWaitingUntil: "Prêt à recevoir votre code…",
|
|
4376
|
+
footerReturnedWaiting: "En attente de l’arrivée de votre message…",
|
|
4349
4377
|
codeExpired: "Code expiré, demandez-en un nouveau.",
|
|
4350
4378
|
getNewCode: "Nouveau code"
|
|
4351
4379
|
},
|
|
@@ -4357,7 +4385,7 @@ Code : (Code)`,
|
|
|
4357
4385
|
whatsappText: "Connectez-moi à (Host) avec ce code : (Code)"
|
|
4358
4386
|
}
|
|
4359
4387
|
};
|
|
4360
|
-
function
|
|
4388
|
+
function B(v) {
|
|
4361
4389
|
switch (v) {
|
|
4362
4390
|
case "de":
|
|
4363
4391
|
return Zi;
|
|
@@ -4368,7 +4396,7 @@ function X(v) {
|
|
|
4368
4396
|
}
|
|
4369
4397
|
}
|
|
4370
4398
|
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;
|
|
4399
|
+
`, 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
4400
|
function je(v, i) {
|
|
4373
4401
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4374
4402
|
}
|
|
@@ -4385,7 +4413,7 @@ function bt(v, i, s, a = Date.now()) {
|
|
|
4385
4413
|
return v.removeItem(h), null;
|
|
4386
4414
|
}
|
|
4387
4415
|
}
|
|
4388
|
-
function
|
|
4416
|
+
function cr(v, i, s, a, h = Date.now()) {
|
|
4389
4417
|
v.setItem(je(i, s), JSON.stringify({ ...a, createdAt: h }));
|
|
4390
4418
|
}
|
|
4391
4419
|
function wt(v, i, s) {
|
|
@@ -4394,10 +4422,10 @@ function wt(v, i, s) {
|
|
|
4394
4422
|
function me() {
|
|
4395
4423
|
return window.localStorage.removeItem(Me), window.sessionStorage;
|
|
4396
4424
|
}
|
|
4397
|
-
function
|
|
4398
|
-
return v.filter((s) =>
|
|
4425
|
+
function hr(v, i = window.location.origin) {
|
|
4426
|
+
return v.filter((s) => lr(s, i));
|
|
4399
4427
|
}
|
|
4400
|
-
function
|
|
4428
|
+
function lr(v, i) {
|
|
4401
4429
|
try {
|
|
4402
4430
|
const s = new URL(v, i);
|
|
4403
4431
|
return ["http:", "https:", "mailto:", "whatsapp:"].includes(s.protocol);
|
|
@@ -4405,12 +4433,14 @@ function hr(v, i) {
|
|
|
4405
4433
|
return !1;
|
|
4406
4434
|
}
|
|
4407
4435
|
}
|
|
4408
|
-
function
|
|
4436
|
+
function dr(v, i, s) {
|
|
4409
4437
|
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !s ? { start: !0, delayMs: 0 } : { start: !0, delayMs: At };
|
|
4410
4438
|
}
|
|
4411
4439
|
const ve = class ve extends HTMLElement {
|
|
4412
4440
|
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
|
|
4441
|
+
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 = () => {
|
|
4442
|
+
this.scheduleBrowserReturnCheck();
|
|
4443
|
+
}, this.handleSecondarySlotChange = () => this.syncSecondarySlotState();
|
|
4414
4444
|
const i = this.attachShadow({ mode: "open" });
|
|
4415
4445
|
this.injectTailwind(i);
|
|
4416
4446
|
const s = document.createElement("div");
|
|
@@ -4422,14 +4452,14 @@ const ve = class ve extends HTMLElement {
|
|
|
4422
4452
|
return ["server-url", "public-key", "lang", "transport", "hide-footer", "footer", "authenticated-event-delay-ms", "variant", "no-card"];
|
|
4423
4453
|
}
|
|
4424
4454
|
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();
|
|
4455
|
+
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
4456
|
try {
|
|
4427
4457
|
this.currentConfig = this.resolveConfig();
|
|
4428
4458
|
} catch (i) {
|
|
4429
4459
|
this.handleInitialError(i);
|
|
4430
4460
|
return;
|
|
4431
4461
|
}
|
|
4432
|
-
this.configureFooter(), this.dispatchPublicEvent("sendity:ready", {
|
|
4462
|
+
this.configureFooter(), this.bindBrowserReturnListeners(), this.dispatchPublicEvent("sendity:ready", {
|
|
4433
4463
|
transport: this.currentConfig.transport,
|
|
4434
4464
|
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
4435
4465
|
}), this.showPlaceholderCode(), this.startWhenVisible();
|
|
@@ -4465,7 +4495,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4465
4495
|
}));
|
|
4466
4496
|
}
|
|
4467
4497
|
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;
|
|
4498
|
+
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;
|
|
4499
|
+
}
|
|
4500
|
+
syncSecondarySlotState() {
|
|
4501
|
+
const i = (this.secondarySlotEl?.assignedNodes({ flatten: !0 }) ?? []).some((s) => s.nodeType === Node.TEXT_NODE ? (s.textContent ?? "").trim() !== "" : s.nodeType === Node.ELEMENT_NODE);
|
|
4502
|
+
this.secondarySlotContainerEl?.classList.toggle("sendity-secondary-slot--filled", i), this.secondarySlotContainerEl && (this.secondarySlotContainerEl.hidden = !i);
|
|
4469
4503
|
}
|
|
4470
4504
|
// Inject Tailwind CSS into the Shadow DOM so Tailwind utility classes
|
|
4471
4505
|
// used in sendity.html work within the component. We cache the processed
|
|
@@ -4480,11 +4514,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4480
4514
|
s.textContent = a.tailwindCssText;
|
|
4481
4515
|
else {
|
|
4482
4516
|
const h = document.createElement("link");
|
|
4483
|
-
h.rel = "stylesheet", h.href =
|
|
4517
|
+
h.rel = "stylesheet", h.href = Pe, i.insertBefore(h, s);
|
|
4484
4518
|
}
|
|
4485
4519
|
return;
|
|
4486
4520
|
}
|
|
4487
|
-
a.tailwindLoading || (a.tailwindLoading = fetch(
|
|
4521
|
+
a.tailwindLoading || (a.tailwindLoading = fetch(Pe).then((h) => h.ok ? h.text() : Promise.reject(new Error(`HTTP ${h.status}`))).then((h) => {
|
|
4488
4522
|
a.tailwindCssText = h;
|
|
4489
4523
|
}).catch((h) => {
|
|
4490
4524
|
console.warn("[sendity-auth] Failed to load Tailwind CSS for Shadow DOM", h), a.tailwindCssText = "";
|
|
@@ -4494,7 +4528,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4494
4528
|
s.textContent = a.tailwindCssText;
|
|
4495
4529
|
else {
|
|
4496
4530
|
const h = document.createElement("link");
|
|
4497
|
-
h.rel = "stylesheet", h.href =
|
|
4531
|
+
h.rel = "stylesheet", h.href = Pe, i.insertBefore(h, s);
|
|
4498
4532
|
}
|
|
4499
4533
|
});
|
|
4500
4534
|
}
|
|
@@ -4507,6 +4541,14 @@ const ve = class ve extends HTMLElement {
|
|
|
4507
4541
|
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
4542
|
}
|
|
4509
4543
|
}
|
|
4544
|
+
bindBrowserReturnListeners() {
|
|
4545
|
+
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);
|
|
4546
|
+
}
|
|
4547
|
+
scheduleBrowserReturnCheck() {
|
|
4548
|
+
this.destroyed || this.authenticated || !this.activeAuthRequestId || !this.activeAuthRequestSecret || document.visibilityState && document.visibilityState !== "visible" || (this.returnWaitTimer !== null && clearTimeout(this.returnWaitTimer), this.returnWaitTimer = window.setTimeout(() => {
|
|
4549
|
+
this.returnWaitTimer = null, !(this.destroyed || this.authenticated) && (this.showFooterWaitingState({ returnedFromClient: !0 }), this.step().catch((i) => console.warn("[sendity-auth] return check failed", i)));
|
|
4550
|
+
}, ar));
|
|
4551
|
+
}
|
|
4510
4552
|
isFooterHidden() {
|
|
4511
4553
|
const i = (this.getAttribute("footer") ?? "").trim().toLowerCase();
|
|
4512
4554
|
return this.hasAttribute("hide-footer") || ["false", "hidden", "none", "off", "0"].includes(i);
|
|
@@ -4527,8 +4569,8 @@ const ve = class ve extends HTMLElement {
|
|
|
4527
4569
|
setFooterIndicatorError() {
|
|
4528
4570
|
this.footerIndicatorEl && (this.footerIndicatorEl.classList.add("footer-indicator--error"), this.footerIndicatorEl.innerHTML = nr, this.footerIndicatorEl.removeAttribute("hidden"));
|
|
4529
4571
|
}
|
|
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(() => {
|
|
4572
|
+
showFooterWaitingState(i = {}) {
|
|
4573
|
+
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
4574
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4533
4575
|
}, pe), this.startCountdown());
|
|
4534
4576
|
}
|
|
@@ -4556,7 +4598,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4556
4598
|
showExpiredState() {
|
|
4557
4599
|
if (!(this.authenticated || this.destroyed || !this.currentConfig)) {
|
|
4558
4600
|
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 =
|
|
4601
|
+
const i = B(this.currentConfig.lang);
|
|
4560
4602
|
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
4603
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4562
4604
|
}, pe);
|
|
@@ -4566,7 +4608,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4566
4608
|
}
|
|
4567
4609
|
renderExpiredAction() {
|
|
4568
4610
|
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4569
|
-
const i =
|
|
4611
|
+
const i = B(this.currentConfig.lang);
|
|
4570
4612
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4571
4613
|
const s = document.createElement("button");
|
|
4572
4614
|
s.type = "button", s.className = "chan error", s.addEventListener("click", () => {
|
|
@@ -4599,7 +4641,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4599
4641
|
const i = {
|
|
4600
4642
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4601
4643
|
transport: "auto"
|
|
4602
|
-
}, s = (
|
|
4644
|
+
}, s = (x) => this.getAttribute(x) ?? void 0, a = s("server-url")?.trim() || ir, h = s("public-key")?.trim();
|
|
4603
4645
|
if (!h)
|
|
4604
4646
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4605
4647
|
let d = s("lang") || i.lang;
|
|
@@ -4627,7 +4669,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4627
4669
|
if (!d.id) throw new Error("Missing id from server response");
|
|
4628
4670
|
const m = this.extractClientSecret(d);
|
|
4629
4671
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4630
|
-
return
|
|
4672
|
+
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
4673
|
verificationId: String(d.id),
|
|
4632
4674
|
code: d.formattedCode ?? d.code ?? "",
|
|
4633
4675
|
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
@@ -4659,7 +4701,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4659
4701
|
const { transport: s } = this.currentConfig, a = i?.broadcasting, h = !!(a?.key && a.channel && a.authEndpoint);
|
|
4660
4702
|
let d = !1;
|
|
4661
4703
|
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 =
|
|
4704
|
+
const m = dr(s, h, d);
|
|
4663
4705
|
m.start && this.startPolling(m.delayMs);
|
|
4664
4706
|
}
|
|
4665
4707
|
subscribeToBroadcasting(i) {
|
|
@@ -4740,7 +4782,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4740
4782
|
return s.startsWith("mailto:") ? "email" : s.startsWith("whatsapp:") || s.startsWith("whatsapp://") ? "whatsapp" : "unknown";
|
|
4741
4783
|
}
|
|
4742
4784
|
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 =
|
|
4785
|
+
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
4786
|
h.length !== 0 && (this.activeVerifyUrls = [...new Set(h)], this.renderVerifiers(this.activeVerifyUrls));
|
|
4745
4787
|
}
|
|
4746
4788
|
authRequestStatusUrl(i, s) {
|
|
@@ -4765,7 +4807,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4765
4807
|
}
|
|
4766
4808
|
waitingFooterMessage() {
|
|
4767
4809
|
if (!this.currentConfig) return "";
|
|
4768
|
-
const i =
|
|
4810
|
+
const i = B(this.currentConfig.lang), s = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4769
4811
|
return s ? i.ui.footerWaitingUntil.replace("(Time)", s) : i.ui.footerWaiting;
|
|
4770
4812
|
}
|
|
4771
4813
|
formatExpiryTime(i, s) {
|
|
@@ -4825,7 +4867,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4825
4867
|
}
|
|
4826
4868
|
showCodeState() {
|
|
4827
4869
|
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 =
|
|
4870
|
+
const i = B(this.currentConfig.lang);
|
|
4829
4871
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4830
4872
|
}
|
|
4831
4873
|
this.successEl?.setAttribute("hidden", "");
|
|
@@ -4840,7 +4882,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4840
4882
|
this.footerMessageEl.textContent = this.verifiedSigningInMessage(a);
|
|
4841
4883
|
}
|
|
4842
4884
|
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 =
|
|
4885
|
+
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
4886
|
this.successEl.innerHTML = `
|
|
4845
4887
|
<span class="success-check" aria-hidden="true">
|
|
4846
4888
|
<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 +4941,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4899
4941
|
}
|
|
4900
4942
|
const y = document.createElement("span");
|
|
4901
4943
|
y.className = "label", y.textContent = this.channelLabel(a, s.lang), m.appendChild(y), d.appendChild(m);
|
|
4902
|
-
const
|
|
4903
|
-
if (
|
|
4944
|
+
const x = this.destinationText(a, s.lang);
|
|
4945
|
+
if (x) {
|
|
4904
4946
|
const S = document.createElement("a");
|
|
4905
|
-
S.className = "dest", S.href = m.href, S.target = "_blank", S.rel = "noopener noreferrer", S.textContent =
|
|
4947
|
+
S.className = "dest", S.href = m.href, S.target = "_blank", S.rel = "noopener noreferrer", S.textContent = x, d.appendChild(S);
|
|
4906
4948
|
}
|
|
4907
4949
|
this.verifiersEl.appendChild(d);
|
|
4908
4950
|
});
|
|
@@ -4919,7 +4961,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4919
4961
|
return "generic";
|
|
4920
4962
|
}
|
|
4921
4963
|
channelLabel(i, s) {
|
|
4922
|
-
const a =
|
|
4964
|
+
const a = B(s), h = this.channelClass(i);
|
|
4923
4965
|
if (h === "email") return a.labels.email;
|
|
4924
4966
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4925
4967
|
try {
|
|
@@ -4930,7 +4972,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4930
4972
|
}
|
|
4931
4973
|
}
|
|
4932
4974
|
destinationText(i, s) {
|
|
4933
|
-
const h =
|
|
4975
|
+
const h = B(s).ui.toPrefix ?? "to";
|
|
4934
4976
|
try {
|
|
4935
4977
|
const d = new URL(i, window.location.origin);
|
|
4936
4978
|
if (d.protocol === "mailto:") {
|
|
@@ -4961,7 +5003,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4961
5003
|
return null;
|
|
4962
5004
|
}
|
|
4963
5005
|
labelForUrl(i, s) {
|
|
4964
|
-
const a =
|
|
5006
|
+
const a = B(s);
|
|
4965
5007
|
try {
|
|
4966
5008
|
const h = new URL(i, window.location.origin);
|
|
4967
5009
|
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 +5012,17 @@ const ve = class ve extends HTMLElement {
|
|
|
4970
5012
|
}
|
|
4971
5013
|
}
|
|
4972
5014
|
buildLink(i, s) {
|
|
4973
|
-
const a = this.lastCode, h =
|
|
5015
|
+
const a = this.lastCode, h = B(s), d = window.location.host;
|
|
4974
5016
|
if (!a) return i;
|
|
4975
5017
|
if (i.startsWith("mailto:")) {
|
|
4976
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g),
|
|
4977
|
-
y.set("subject",
|
|
5018
|
+
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);
|
|
5019
|
+
y.set("subject", x), y.set("body", S);
|
|
4978
5020
|
const O = this.toQuery(y);
|
|
4979
5021
|
return `${m}?${O}`;
|
|
4980
5022
|
}
|
|
4981
5023
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) {
|
|
4982
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g),
|
|
4983
|
-
y.set("text",
|
|
5024
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), x = this.applyTemplate(h.templates.whatsappText, d, a);
|
|
5025
|
+
y.set("text", x);
|
|
4984
5026
|
const S = this.toQuery(y);
|
|
4985
5027
|
return `${m}?${S}`;
|
|
4986
5028
|
}
|