@sendity/client 0.1.5 → 0.1.6
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 +5 -1
- package/dist/sendity-client.js +357 -291
- package/dist/tailwind.css +1 -1
- package/package.json +1 -1
package/dist/sendity-client.js
CHANGED
|
@@ -95,9 +95,10 @@ const pt = `<template id="sendity-tpl">
|
|
|
95
95
|
--sendity-whatsapp-bg-hover:#bbf3d6;
|
|
96
96
|
|
|
97
97
|
--sendity-btn-font-size: var(--sendity-font-size-sm);
|
|
98
|
-
--sendity-btn-
|
|
98
|
+
--sendity-btn-min-height: 2.25rem; /* 36 — Flux default button height */
|
|
99
|
+
--sendity-btn-padding: 0.5rem 0.875rem;
|
|
99
100
|
--sendity-btn-border-radius: 0.5625rem; /* 9 */
|
|
100
|
-
--sendity-btn-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.
|
|
101
|
+
--sendity-btn-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.2), 0 1px 2px 0 rgb(28 25 23 / 0.10);
|
|
101
102
|
|
|
102
103
|
--sendity-success-check-bg: var(--sendity-success-bg);
|
|
103
104
|
--sendity-success-check-color: var(--sendity-success-color);
|
|
@@ -110,15 +111,68 @@ const pt = `<template id="sendity-tpl">
|
|
|
110
111
|
|
|
111
112
|
/* Card layout */
|
|
112
113
|
--sendity-width: 320px;
|
|
113
|
-
--sendity-body-
|
|
114
|
+
--sendity-body-height: 14.125rem;
|
|
115
|
+
--sendity-footer-height: 2.75rem;
|
|
114
116
|
--sendity-crossfade-duration: 220ms;
|
|
115
117
|
|
|
116
118
|
color-scheme: light;
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
max-width: 100%;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:host([variant="no-card"]),
|
|
124
|
+
:host([no-card]) {
|
|
125
|
+
display: flex;
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 100%;
|
|
128
|
+
max-width: 100%;
|
|
129
|
+
min-height: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
:host([variant="no-card"]) .sendity,
|
|
133
|
+
:host([no-card]) .sendity,
|
|
134
|
+
.sendity.sendity--no-card {
|
|
135
|
+
width: 100%;
|
|
136
|
+
height: 100%;
|
|
137
|
+
min-height: calc(var(--sendity-body-height) + var(--sendity-footer-height));
|
|
138
|
+
border: 0;
|
|
139
|
+
border-radius: 0;
|
|
140
|
+
box-shadow: none;
|
|
141
|
+
background: transparent;
|
|
142
|
+
overflow: visible;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([variant="no-card"]) .sendity.sendity--verified,
|
|
146
|
+
:host([variant="no-card"]) .sendity.sendity--expired,
|
|
147
|
+
:host([no-card]) .sendity.sendity--verified,
|
|
148
|
+
:host([no-card]) .sendity.sendity--expired,
|
|
149
|
+
.sendity.sendity--no-card.sendity--verified,
|
|
150
|
+
.sendity.sendity--no-card.sendity--expired {
|
|
151
|
+
box-shadow: none;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([variant="no-card"]) .sendity-body,
|
|
155
|
+
:host([no-card]) .sendity-body,
|
|
156
|
+
.sendity.sendity--no-card .sendity-body {
|
|
157
|
+
flex: 1 1 auto;
|
|
158
|
+
height: auto;
|
|
159
|
+
min-height: 0;
|
|
160
|
+
padding: 0 0 1rem;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:host([variant="no-card"]) .sendity-footer,
|
|
164
|
+
:host([no-card]) .sendity-footer,
|
|
165
|
+
.sendity.sendity--no-card .sendity-footer {
|
|
166
|
+
margin-top: auto;
|
|
167
|
+
flex: 0 0 var(--sendity-footer-height);
|
|
168
|
+
border-top-color: var(--sendity-border);
|
|
169
|
+
padding-inline: 0.625rem 0;
|
|
117
170
|
}
|
|
118
171
|
|
|
119
172
|
.sendity {
|
|
120
173
|
width: var(--sendity-width);
|
|
121
174
|
max-width: 100%;
|
|
175
|
+
box-sizing: border-box;
|
|
122
176
|
display: inline-flex;
|
|
123
177
|
flex-direction: column;
|
|
124
178
|
background: var(--sendity-surface);
|
|
@@ -142,10 +196,12 @@ const pt = `<template id="sendity-tpl">
|
|
|
142
196
|
|
|
143
197
|
.sendity-body {
|
|
144
198
|
position: relative;
|
|
199
|
+
box-sizing: border-box;
|
|
145
200
|
flex: 1;
|
|
146
201
|
display: flex;
|
|
147
202
|
flex-direction: column;
|
|
148
|
-
|
|
203
|
+
height: var(--sendity-body-height);
|
|
204
|
+
min-height: var(--sendity-body-height);
|
|
149
205
|
padding: 1.25rem 1.25rem 1rem;
|
|
150
206
|
gap: 0.875rem;
|
|
151
207
|
}
|
|
@@ -180,7 +236,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
180
236
|
text-align: center;
|
|
181
237
|
gap: 0.5rem;
|
|
182
238
|
overflow: hidden;
|
|
183
|
-
transition: opacity var(--sendity-crossfade-duration) ease, transform var(--sendity-crossfade-duration) ease, background-color var(--sendity-crossfade-duration) ease, border-color var(--sendity-crossfade-duration) ease, color var(--sendity-crossfade-duration) ease
|
|
239
|
+
transition: opacity var(--sendity-crossfade-duration) ease, transform var(--sendity-crossfade-duration) ease, background-color var(--sendity-crossfade-duration) ease, border-color var(--sendity-crossfade-duration) ease, color var(--sendity-crossfade-duration) ease;
|
|
184
240
|
}
|
|
185
241
|
|
|
186
242
|
.sendity .code--exiting {
|
|
@@ -189,15 +245,6 @@ const pt = `<template id="sendity-tpl">
|
|
|
189
245
|
pointer-events: none;
|
|
190
246
|
}
|
|
191
247
|
|
|
192
|
-
.sendity .code--collapsed {
|
|
193
|
-
max-height: 0;
|
|
194
|
-
min-height: 0;
|
|
195
|
-
padding-top: 0;
|
|
196
|
-
padding-bottom: 0;
|
|
197
|
-
margin: 0;
|
|
198
|
-
border-width: 0;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
248
|
.sendity .spinner {
|
|
202
249
|
width: 1.125rem;
|
|
203
250
|
height: 1.125rem;
|
|
@@ -279,6 +326,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
279
326
|
text-decoration: none;
|
|
280
327
|
border: 1px solid;
|
|
281
328
|
border-radius: var(--sendity-btn-border-radius);
|
|
329
|
+
min-height: var(--sendity-btn-min-height);
|
|
282
330
|
padding: var(--sendity-btn-padding);
|
|
283
331
|
box-shadow: var(--sendity-btn-shadow);
|
|
284
332
|
cursor: pointer;
|
|
@@ -454,6 +502,7 @@ const pt = `<template id="sendity-tpl">
|
|
|
454
502
|
}
|
|
455
503
|
|
|
456
504
|
.sendity .sendity-footer {
|
|
505
|
+
box-sizing: border-box;
|
|
457
506
|
border-top: 1px solid var(--sendity-border);
|
|
458
507
|
padding: 0.8125rem 1.125rem;
|
|
459
508
|
display: grid;
|
|
@@ -461,7 +510,8 @@ const pt = `<template id="sendity-tpl">
|
|
|
461
510
|
align-items: center;
|
|
462
511
|
justify-content: stretch;
|
|
463
512
|
gap: 0.5rem;
|
|
464
|
-
|
|
513
|
+
height: var(--sendity-footer-height);
|
|
514
|
+
min-height: var(--sendity-footer-height);
|
|
465
515
|
color: var(--sendity-fg-3);
|
|
466
516
|
font-size: var(--sendity-font-size-xs);
|
|
467
517
|
line-height: 1rem;
|
|
@@ -510,10 +560,24 @@ const pt = `<template id="sendity-tpl">
|
|
|
510
560
|
transform: translateY(0);
|
|
511
561
|
}
|
|
512
562
|
|
|
563
|
+
.sendity .sendity-footer.footer--verified .footer-status {
|
|
564
|
+
justify-content: center;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.sendity .sendity-footer.footer--verified .footer-status-left {
|
|
568
|
+
width: 100%;
|
|
569
|
+
justify-content: center;
|
|
570
|
+
}
|
|
571
|
+
|
|
513
572
|
.sendity .sendity-footer.footer--verified .footer-spinner {
|
|
514
573
|
display: none;
|
|
515
574
|
}
|
|
516
575
|
|
|
576
|
+
.sendity .sendity-footer.footer--verified .footer-message {
|
|
577
|
+
white-space: nowrap;
|
|
578
|
+
text-align: center;
|
|
579
|
+
}
|
|
580
|
+
|
|
517
581
|
.sendity .footer-status-left {
|
|
518
582
|
display: inline-flex;
|
|
519
583
|
align-items: center;
|
|
@@ -791,7 +855,7 @@ class Fi extends St {
|
|
|
791
855
|
}), this;
|
|
792
856
|
}
|
|
793
857
|
}
|
|
794
|
-
class
|
|
858
|
+
class xt extends qe {
|
|
795
859
|
/**
|
|
796
860
|
* Create a new class instance.
|
|
797
861
|
*/
|
|
@@ -867,7 +931,7 @@ class Tt extends qe {
|
|
|
867
931
|
)), (!s || this.listeners[i].length === 0) && (this.events[i] && (this.socket.removeListener(i, this.events[i]), delete this.events[i]), delete this.listeners[i]);
|
|
868
932
|
}
|
|
869
933
|
}
|
|
870
|
-
class
|
|
934
|
+
class Tt extends xt {
|
|
871
935
|
/**
|
|
872
936
|
* Send a whisper event to other clients in the channel.
|
|
873
937
|
*/
|
|
@@ -879,7 +943,7 @@ class xt extends Tt {
|
|
|
879
943
|
}), this;
|
|
880
944
|
}
|
|
881
945
|
}
|
|
882
|
-
class Wi extends
|
|
946
|
+
class Wi extends Tt {
|
|
883
947
|
/**
|
|
884
948
|
* Register a callback to be called anytime the member list changes.
|
|
885
949
|
*/
|
|
@@ -1187,7 +1251,7 @@ class fe extends Ne {
|
|
|
1187
1251
|
this.pusher.disconnect();
|
|
1188
1252
|
}
|
|
1189
1253
|
}
|
|
1190
|
-
class
|
|
1254
|
+
class Vi extends Ne {
|
|
1191
1255
|
constructor() {
|
|
1192
1256
|
super(...arguments), this.channels = {};
|
|
1193
1257
|
}
|
|
@@ -1227,7 +1291,7 @@ class Xi extends Ne {
|
|
|
1227
1291
|
* Get a channel instance by name.
|
|
1228
1292
|
*/
|
|
1229
1293
|
channel(i) {
|
|
1230
|
-
return this.channels[i] || (this.channels[i] = new
|
|
1294
|
+
return this.channels[i] || (this.channels[i] = new xt(
|
|
1231
1295
|
this.socket,
|
|
1232
1296
|
i,
|
|
1233
1297
|
this.options
|
|
@@ -1237,7 +1301,7 @@ class Xi extends Ne {
|
|
|
1237
1301
|
* Get a private channel instance by name.
|
|
1238
1302
|
*/
|
|
1239
1303
|
privateChannel(i) {
|
|
1240
|
-
return this.channels["private-" + i] || (this.channels["private-" + i] = new
|
|
1304
|
+
return this.channels["private-" + i] || (this.channels["private-" + i] = new Tt(
|
|
1241
1305
|
this.socket,
|
|
1242
1306
|
"private-" + i,
|
|
1243
1307
|
this.options
|
|
@@ -1383,7 +1447,7 @@ class mt extends Ne {
|
|
|
1383
1447
|
disconnect() {
|
|
1384
1448
|
}
|
|
1385
1449
|
}
|
|
1386
|
-
class
|
|
1450
|
+
class Xi {
|
|
1387
1451
|
/**
|
|
1388
1452
|
* Create a new class instance.
|
|
1389
1453
|
*/
|
|
@@ -1414,7 +1478,7 @@ class Vi {
|
|
|
1414
1478
|
broadcaster: "pusher"
|
|
1415
1479
|
});
|
|
1416
1480
|
else if (this.options.broadcaster === "socket.io")
|
|
1417
|
-
this.connector = new
|
|
1481
|
+
this.connector = new Vi(this.options);
|
|
1418
1482
|
else if (this.options.broadcaster === "null")
|
|
1419
1483
|
this.connector = new mt(this.options);
|
|
1420
1484
|
else if (typeof this.options.broadcaster == "function" && Hi(this.options.broadcaster))
|
|
@@ -1557,140 +1621,140 @@ function Gi() {
|
|
|
1557
1621
|
/***/
|
|
1558
1622
|
594(m, g) {
|
|
1559
1623
|
var y = this && this.__extends || /* @__PURE__ */ (function() {
|
|
1560
|
-
var
|
|
1561
|
-
return
|
|
1562
|
-
|
|
1563
|
-
} || function(
|
|
1564
|
-
for (var q in L) L.hasOwnProperty(q) && (
|
|
1565
|
-
},
|
|
1624
|
+
var T = function(u, f) {
|
|
1625
|
+
return T = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(C, L) {
|
|
1626
|
+
C.__proto__ = L;
|
|
1627
|
+
} || function(C, L) {
|
|
1628
|
+
for (var q in L) L.hasOwnProperty(q) && (C[q] = L[q]);
|
|
1629
|
+
}, T(u, f);
|
|
1566
1630
|
};
|
|
1567
1631
|
return function(u, f) {
|
|
1568
|
-
|
|
1569
|
-
function
|
|
1632
|
+
T(u, f);
|
|
1633
|
+
function C() {
|
|
1570
1634
|
this.constructor = u;
|
|
1571
1635
|
}
|
|
1572
|
-
u.prototype = f === null ? Object.create(f) : (
|
|
1636
|
+
u.prototype = f === null ? Object.create(f) : (C.prototype = f.prototype, new C());
|
|
1573
1637
|
};
|
|
1574
1638
|
})();
|
|
1575
1639
|
Object.defineProperty(g, "__esModule", { value: !0 });
|
|
1576
|
-
var E = 256,
|
|
1640
|
+
var E = 256, S = (
|
|
1577
1641
|
/** @class */
|
|
1578
1642
|
(function() {
|
|
1579
|
-
function
|
|
1643
|
+
function T(u) {
|
|
1580
1644
|
u === void 0 && (u = "="), this._paddingCharacter = u;
|
|
1581
1645
|
}
|
|
1582
|
-
return
|
|
1646
|
+
return T.prototype.encodedLength = function(u) {
|
|
1583
1647
|
return this._paddingCharacter ? (u + 2) / 3 * 4 | 0 : (u * 8 + 5) / 6 | 0;
|
|
1584
|
-
},
|
|
1585
|
-
for (var f = "",
|
|
1586
|
-
var L = u[
|
|
1648
|
+
}, T.prototype.encode = function(u) {
|
|
1649
|
+
for (var f = "", C = 0; C < u.length - 2; C += 3) {
|
|
1650
|
+
var L = u[C] << 16 | u[C + 1] << 8 | u[C + 2];
|
|
1587
1651
|
f += this._encodeByte(L >>> 18 & 63), f += this._encodeByte(L >>> 12 & 63), f += this._encodeByte(L >>> 6 & 63), f += this._encodeByte(L >>> 0 & 63);
|
|
1588
1652
|
}
|
|
1589
|
-
var q = u.length -
|
|
1653
|
+
var q = u.length - C;
|
|
1590
1654
|
if (q > 0) {
|
|
1591
|
-
var L = u[
|
|
1655
|
+
var L = u[C] << 16 | (q === 2 ? u[C + 1] << 8 : 0);
|
|
1592
1656
|
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 || "";
|
|
1593
1657
|
}
|
|
1594
1658
|
return f;
|
|
1595
|
-
},
|
|
1659
|
+
}, T.prototype.maxDecodedLength = function(u) {
|
|
1596
1660
|
return this._paddingCharacter ? u / 4 * 3 | 0 : (u * 6 + 7) / 8 | 0;
|
|
1597
|
-
},
|
|
1661
|
+
}, T.prototype.decodedLength = function(u) {
|
|
1598
1662
|
return this.maxDecodedLength(u.length - this._getPaddingLength(u));
|
|
1599
|
-
},
|
|
1663
|
+
}, T.prototype.decode = function(u) {
|
|
1600
1664
|
if (u.length === 0)
|
|
1601
1665
|
return new Uint8Array(0);
|
|
1602
|
-
for (var f = this._getPaddingLength(u),
|
|
1666
|
+
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)
|
|
1603
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 & E, z |= D & E, z |= H & E, z |= G & E;
|
|
1604
|
-
if (M <
|
|
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 & E, z |= D & E), M < C - 2 && (H = this._decodeChar(u.charCodeAt(M + 2)), L[q++] = D << 4 | H >>> 2, z |= H & E), M < C - 3 && (G = this._decodeChar(u.charCodeAt(M + 3)), L[q++] = H << 6 | G, z |= G & E), z !== 0)
|
|
1605
1669
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
1606
1670
|
return L;
|
|
1607
|
-
},
|
|
1671
|
+
}, T.prototype._encodeByte = function(u) {
|
|
1608
1672
|
var f = u;
|
|
1609
1673
|
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);
|
|
1610
|
-
},
|
|
1674
|
+
}, T.prototype._decodeChar = function(u) {
|
|
1611
1675
|
var f = E;
|
|
1612
1676
|
return f += (42 - u & u - 44) >>> 8 & -E + u - 43 + 62, f += (46 - u & u - 48) >>> 8 & -E + u - 47 + 63, f += (47 - u & u - 58) >>> 8 & -E + u - 48 + 52, f += (64 - u & u - 91) >>> 8 & -E + u - 65 + 0, f += (96 - u & u - 123) >>> 8 & -E + u - 97 + 26, f;
|
|
1613
|
-
},
|
|
1677
|
+
}, T.prototype._getPaddingLength = function(u) {
|
|
1614
1678
|
var f = 0;
|
|
1615
1679
|
if (this._paddingCharacter) {
|
|
1616
|
-
for (var
|
|
1680
|
+
for (var C = u.length - 1; C >= 0 && u[C] === this._paddingCharacter; C--)
|
|
1617
1681
|
f++;
|
|
1618
1682
|
if (u.length < 4 || f > 2)
|
|
1619
1683
|
throw new Error("Base64Coder: incorrect padding");
|
|
1620
1684
|
}
|
|
1621
1685
|
return f;
|
|
1622
|
-
},
|
|
1686
|
+
}, T;
|
|
1623
1687
|
})()
|
|
1624
1688
|
);
|
|
1625
|
-
g.Coder =
|
|
1626
|
-
var
|
|
1627
|
-
function T
|
|
1628
|
-
return
|
|
1689
|
+
g.Coder = S;
|
|
1690
|
+
var O = new S();
|
|
1691
|
+
function x(T) {
|
|
1692
|
+
return O.encode(T);
|
|
1629
1693
|
}
|
|
1630
|
-
g.encode =
|
|
1631
|
-
function A(
|
|
1632
|
-
return
|
|
1694
|
+
g.encode = x;
|
|
1695
|
+
function A(T) {
|
|
1696
|
+
return O.decode(T);
|
|
1633
1697
|
}
|
|
1634
1698
|
g.decode = A;
|
|
1635
1699
|
var F = (
|
|
1636
1700
|
/** @class */
|
|
1637
|
-
(function(
|
|
1638
|
-
y(u,
|
|
1701
|
+
(function(T) {
|
|
1702
|
+
y(u, T);
|
|
1639
1703
|
function u() {
|
|
1640
|
-
return
|
|
1704
|
+
return T !== null && T.apply(this, arguments) || this;
|
|
1641
1705
|
}
|
|
1642
1706
|
return u.prototype._encodeByte = function(f) {
|
|
1643
|
-
var
|
|
1644
|
-
return
|
|
1707
|
+
var C = f;
|
|
1708
|
+
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);
|
|
1645
1709
|
}, u.prototype._decodeChar = function(f) {
|
|
1646
|
-
var
|
|
1647
|
-
return
|
|
1710
|
+
var C = E;
|
|
1711
|
+
return C += (44 - f & f - 46) >>> 8 & -E + f - 45 + 62, C += (94 - f & f - 96) >>> 8 & -E + f - 95 + 63, C += (47 - f & f - 58) >>> 8 & -E + f - 48 + 52, C += (64 - f & f - 91) >>> 8 & -E + f - 65 + 0, C += (96 - f & f - 123) >>> 8 & -E + f - 97 + 26, C;
|
|
1648
1712
|
}, u;
|
|
1649
|
-
})(
|
|
1713
|
+
})(S)
|
|
1650
1714
|
);
|
|
1651
1715
|
g.URLSafeCoder = F;
|
|
1652
1716
|
var N = new F();
|
|
1653
|
-
function W(
|
|
1654
|
-
return N.encode(
|
|
1717
|
+
function W(T) {
|
|
1718
|
+
return N.encode(T);
|
|
1655
1719
|
}
|
|
1656
1720
|
g.encodeURLSafe = W;
|
|
1657
|
-
function te(
|
|
1658
|
-
return N.decode(
|
|
1721
|
+
function te(T) {
|
|
1722
|
+
return N.decode(T);
|
|
1659
1723
|
}
|
|
1660
|
-
g.decodeURLSafe = te, g.encodedLength = function(
|
|
1661
|
-
return
|
|
1662
|
-
}, g.maxDecodedLength = function(
|
|
1663
|
-
return
|
|
1664
|
-
}, g.decodedLength = function(
|
|
1665
|
-
return
|
|
1724
|
+
g.decodeURLSafe = te, g.encodedLength = function(T) {
|
|
1725
|
+
return O.encodedLength(T);
|
|
1726
|
+
}, g.maxDecodedLength = function(T) {
|
|
1727
|
+
return O.maxDecodedLength(T);
|
|
1728
|
+
}, g.decodedLength = function(T) {
|
|
1729
|
+
return O.decodedLength(T);
|
|
1666
1730
|
};
|
|
1667
1731
|
},
|
|
1668
1732
|
/***/
|
|
1669
1733
|
978(m, g) {
|
|
1670
1734
|
var y = "utf8: invalid source encoding";
|
|
1671
|
-
function E(
|
|
1672
|
-
for (var
|
|
1673
|
-
var A =
|
|
1735
|
+
function E(S) {
|
|
1736
|
+
for (var O = [], x = 0; x < S.length; x++) {
|
|
1737
|
+
var A = S[x];
|
|
1674
1738
|
if (A & 128) {
|
|
1675
1739
|
var F = void 0;
|
|
1676
1740
|
if (A < 224) {
|
|
1677
|
-
if (
|
|
1741
|
+
if (x >= S.length)
|
|
1678
1742
|
throw new Error(y);
|
|
1679
|
-
var N =
|
|
1743
|
+
var N = S[++x];
|
|
1680
1744
|
if ((N & 192) !== 128)
|
|
1681
1745
|
throw new Error(y);
|
|
1682
1746
|
A = (A & 31) << 6 | N & 63, F = 128;
|
|
1683
1747
|
} else if (A < 240) {
|
|
1684
|
-
if (
|
|
1748
|
+
if (x >= S.length - 1)
|
|
1685
1749
|
throw new Error(y);
|
|
1686
|
-
var N =
|
|
1750
|
+
var N = S[++x], W = S[++x];
|
|
1687
1751
|
if ((N & 192) !== 128 || (W & 192) !== 128)
|
|
1688
1752
|
throw new Error(y);
|
|
1689
1753
|
A = (A & 15) << 12 | (N & 63) << 6 | W & 63, F = 2048;
|
|
1690
1754
|
} else if (A < 248) {
|
|
1691
|
-
if (
|
|
1755
|
+
if (x >= S.length - 2)
|
|
1692
1756
|
throw new Error(y);
|
|
1693
|
-
var N =
|
|
1757
|
+
var N = S[++x], W = S[++x], te = S[++x];
|
|
1694
1758
|
if ((N & 192) !== 128 || (W & 192) !== 128 || (te & 192) !== 128)
|
|
1695
1759
|
throw new Error(y);
|
|
1696
1760
|
A = (A & 15) << 18 | (N & 63) << 12 | (W & 63) << 6 | te & 63, F = 65536;
|
|
@@ -1701,12 +1765,12 @@ function Gi() {
|
|
|
1701
1765
|
if (A >= 65536) {
|
|
1702
1766
|
if (A > 1114111)
|
|
1703
1767
|
throw new Error(y);
|
|
1704
|
-
A -= 65536,
|
|
1768
|
+
A -= 65536, O.push(String.fromCharCode(55296 | A >> 10)), A = 56320 | A & 1023;
|
|
1705
1769
|
}
|
|
1706
1770
|
}
|
|
1707
|
-
|
|
1771
|
+
O.push(String.fromCharCode(A));
|
|
1708
1772
|
}
|
|
1709
|
-
return
|
|
1773
|
+
return O.join("");
|
|
1710
1774
|
}
|
|
1711
1775
|
g.D4 = E;
|
|
1712
1776
|
},
|
|
@@ -1737,7 +1801,7 @@ function Gi() {
|
|
|
1737
1801
|
delete this[e.number];
|
|
1738
1802
|
}
|
|
1739
1803
|
}
|
|
1740
|
-
var
|
|
1804
|
+
var S = new E("_pusher_script_", "Pusher.ScriptReceivers"), O = {
|
|
1741
1805
|
VERSION: "8.5.0",
|
|
1742
1806
|
PROTOCOL: 7,
|
|
1743
1807
|
wsPort: 80,
|
|
@@ -1765,10 +1829,10 @@ function Gi() {
|
|
|
1765
1829
|
cdn_https: "https://js.pusher.com",
|
|
1766
1830
|
dependency_suffix: ""
|
|
1767
1831
|
};
|
|
1768
|
-
const
|
|
1832
|
+
const x = O;
|
|
1769
1833
|
class A {
|
|
1770
1834
|
constructor(e) {
|
|
1771
|
-
this.options = e, this.receivers = e.receivers ||
|
|
1835
|
+
this.options = e, this.receivers = e.receivers || S, this.loading = {};
|
|
1772
1836
|
}
|
|
1773
1837
|
load(e, t, r) {
|
|
1774
1838
|
var o = this;
|
|
@@ -1776,12 +1840,12 @@ function Gi() {
|
|
|
1776
1840
|
o.loading[e].push(r);
|
|
1777
1841
|
else {
|
|
1778
1842
|
o.loading[e] = [r];
|
|
1779
|
-
var c =
|
|
1843
|
+
var c = w.createScriptRequest(o.getPath(e, t)), l = o.receivers.create(function(p) {
|
|
1780
1844
|
if (o.receivers.remove(l), o.loading[e]) {
|
|
1781
1845
|
var b = o.loading[e];
|
|
1782
1846
|
delete o.loading[e];
|
|
1783
|
-
for (var _ = function(
|
|
1784
|
-
|
|
1847
|
+
for (var _ = function(R) {
|
|
1848
|
+
R || c.cleanup();
|
|
1785
1849
|
}, k = 0; k < b.length; k++)
|
|
1786
1850
|
b[k](p, _);
|
|
1787
1851
|
}
|
|
@@ -1790,7 +1854,7 @@ function Gi() {
|
|
|
1790
1854
|
}
|
|
1791
1855
|
}
|
|
1792
1856
|
getRoot(e) {
|
|
1793
|
-
var t, r =
|
|
1857
|
+
var t, r = w.getDocument().location.protocol;
|
|
1794
1858
|
return e && e.useTLS || r === "https:" ? t = this.options.cdn_https : t = this.options.cdn_http, t.replace(/\/*$/, "") + "/" + this.options.version;
|
|
1795
1859
|
}
|
|
1796
1860
|
getPath(e, t) {
|
|
@@ -1798,10 +1862,10 @@ function Gi() {
|
|
|
1798
1862
|
}
|
|
1799
1863
|
}
|
|
1800
1864
|
var F = new E("_pusher_dependencies", "Pusher.DependenciesReceivers"), N = new A({
|
|
1801
|
-
cdn_http:
|
|
1802
|
-
cdn_https:
|
|
1803
|
-
version:
|
|
1804
|
-
suffix:
|
|
1865
|
+
cdn_http: x.cdn_http,
|
|
1866
|
+
cdn_https: x.cdn_https,
|
|
1867
|
+
version: x.VERSION,
|
|
1868
|
+
suffix: x.dependency_suffix,
|
|
1805
1869
|
receivers: F
|
|
1806
1870
|
});
|
|
1807
1871
|
const W = {
|
|
@@ -1823,7 +1887,7 @@ function Gi() {
|
|
|
1823
1887
|
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
1824
1888
|
}
|
|
1825
1889
|
}
|
|
1826
|
-
},
|
|
1890
|
+
}, T = { buildLogSuffix: function(n) {
|
|
1827
1891
|
const e = "See:", t = W.urls[n];
|
|
1828
1892
|
if (!t)
|
|
1829
1893
|
return "";
|
|
@@ -1839,7 +1903,7 @@ function Gi() {
|
|
|
1839
1903
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1840
1904
|
}
|
|
1841
1905
|
}
|
|
1842
|
-
class
|
|
1906
|
+
class C extends Error {
|
|
1843
1907
|
constructor(e) {
|
|
1844
1908
|
super(e), Object.setPrototypeOf(this, new.target.prototype);
|
|
1845
1909
|
}
|
|
@@ -1880,7 +1944,7 @@ function Gi() {
|
|
|
1880
1944
|
}
|
|
1881
1945
|
}
|
|
1882
1946
|
const Lt = function(n, e, t, r, o) {
|
|
1883
|
-
const c =
|
|
1947
|
+
const c = w.createXHR();
|
|
1884
1948
|
c.open("POST", t.endpoint, !0), c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
1885
1949
|
for (var l in t.headers)
|
|
1886
1950
|
c.setRequestHeader(l, t.headers[l]);
|
|
@@ -1903,10 +1967,10 @@ function Gi() {
|
|
|
1903
1967
|
let p = "";
|
|
1904
1968
|
switch (r) {
|
|
1905
1969
|
case u.UserAuthentication:
|
|
1906
|
-
p =
|
|
1970
|
+
p = T.buildLogSuffix("authenticationEndpoint");
|
|
1907
1971
|
break;
|
|
1908
1972
|
case u.ChannelAuthorization:
|
|
1909
|
-
p = `Clients must be authorized to join private or presence channels. ${
|
|
1973
|
+
p = `Clients must be authorized to join private or presence channels. ${T.buildLogSuffix("authorizationEndpoint")}`;
|
|
1910
1974
|
break;
|
|
1911
1975
|
}
|
|
1912
1976
|
o(new H(c.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${p}`), null);
|
|
@@ -2073,13 +2137,13 @@ function Gi() {
|
|
|
2073
2137
|
return typeof e == "object" && (e = ae(e)), encodeURIComponent(Pt(e.toString()));
|
|
2074
2138
|
});
|
|
2075
2139
|
}
|
|
2076
|
-
function
|
|
2140
|
+
function Vt(n) {
|
|
2077
2141
|
var e = Be(n, function(r) {
|
|
2078
2142
|
return r !== void 0;
|
|
2079
2143
|
}), t = Fe(Wt($t(e)), U.method("join", "=")).join("&");
|
|
2080
2144
|
return t;
|
|
2081
2145
|
}
|
|
2082
|
-
function
|
|
2146
|
+
function Xt(n) {
|
|
2083
2147
|
var e = [], t = [];
|
|
2084
2148
|
return (function r(o, c) {
|
|
2085
2149
|
var l, p, b;
|
|
@@ -2110,7 +2174,7 @@ function Gi() {
|
|
|
2110
2174
|
try {
|
|
2111
2175
|
return JSON.stringify(n);
|
|
2112
2176
|
} catch {
|
|
2113
|
-
return JSON.stringify(
|
|
2177
|
+
return JSON.stringify(Xt(n));
|
|
2114
2178
|
}
|
|
2115
2179
|
}
|
|
2116
2180
|
class Jt {
|
|
@@ -2180,8 +2244,8 @@ function Gi() {
|
|
|
2180
2244
|
}
|
|
2181
2245
|
send(e) {
|
|
2182
2246
|
if (!this.request) {
|
|
2183
|
-
var t =
|
|
2184
|
-
this.request =
|
|
2247
|
+
var t = Vt(this.data), r = this.url + "/" + e.number + "?" + t;
|
|
2248
|
+
this.request = w.createScriptRequest(r), this.request.send(e);
|
|
2185
2249
|
}
|
|
2186
2250
|
}
|
|
2187
2251
|
cleanup() {
|
|
@@ -2190,8 +2254,8 @@ function Gi() {
|
|
|
2190
2254
|
}
|
|
2191
2255
|
var Zt = function(n, e) {
|
|
2192
2256
|
return function(t, r) {
|
|
2193
|
-
var o = "http" + (e ? "s" : "") + "://", c = o + (n.host || n.options.host) + n.options.path, l =
|
|
2194
|
-
|
|
2257
|
+
var o = "http" + (e ? "s" : "") + "://", c = o + (n.host || n.options.host) + n.options.path, l = w.createJSONPRequest(c, t), p = w.ScriptReceivers.create(function(b, _) {
|
|
2258
|
+
S.remove(p), l.cleanup(), _ && _.host && (n.host = _.host), r && r(b, _);
|
|
2195
2259
|
});
|
|
2196
2260
|
l.send(p);
|
|
2197
2261
|
};
|
|
@@ -2205,7 +2269,7 @@ function Gi() {
|
|
|
2205
2269
|
return r + "://" + o + t;
|
|
2206
2270
|
}
|
|
2207
2271
|
function be(n, e) {
|
|
2208
|
-
var t = "/app/" + n, r = "?protocol=" +
|
|
2272
|
+
var t = "/app/" + n, r = "?protocol=" + x.PROTOCOL + "&client=js&version=" + x.VERSION + (e ? "&" + e : "");
|
|
2209
2273
|
return t + r;
|
|
2210
2274
|
}
|
|
2211
2275
|
var nn = {
|
|
@@ -2296,7 +2360,7 @@ function Gi() {
|
|
|
2296
2360
|
}
|
|
2297
2361
|
class an extends $ {
|
|
2298
2362
|
constructor(e, t, r, o, c) {
|
|
2299
|
-
super(), this.initialize =
|
|
2363
|
+
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();
|
|
2300
2364
|
}
|
|
2301
2365
|
handlesActivityChecks() {
|
|
2302
2366
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -2389,34 +2453,34 @@ function Gi() {
|
|
|
2389
2453
|
handlesActivityChecks: !1,
|
|
2390
2454
|
supportsPing: !1,
|
|
2391
2455
|
isInitialized: function() {
|
|
2392
|
-
return !!
|
|
2456
|
+
return !!w.getWebSocketAPI();
|
|
2393
2457
|
},
|
|
2394
2458
|
isSupported: function() {
|
|
2395
|
-
return !!
|
|
2459
|
+
return !!w.getWebSocketAPI();
|
|
2396
2460
|
},
|
|
2397
2461
|
getSocket: function(n) {
|
|
2398
|
-
return
|
|
2462
|
+
return w.createWebSocket(n);
|
|
2399
2463
|
}
|
|
2400
|
-
}),
|
|
2464
|
+
}), Ve = {
|
|
2401
2465
|
urls: rn,
|
|
2402
2466
|
handlesActivityChecks: !1,
|
|
2403
2467
|
supportsPing: !0,
|
|
2404
2468
|
isInitialized: function() {
|
|
2405
2469
|
return !0;
|
|
2406
2470
|
}
|
|
2407
|
-
},
|
|
2471
|
+
}, Xe = j({
|
|
2408
2472
|
getSocket: function(n) {
|
|
2409
|
-
return
|
|
2473
|
+
return w.HTTPFactory.createStreamingSocket(n);
|
|
2410
2474
|
}
|
|
2411
|
-
},
|
|
2475
|
+
}, Ve), Je = j({
|
|
2412
2476
|
getSocket: function(n) {
|
|
2413
|
-
return
|
|
2477
|
+
return w.HTTPFactory.createPollingSocket(n);
|
|
2414
2478
|
}
|
|
2415
|
-
},
|
|
2479
|
+
}, Ve), Ge = {
|
|
2416
2480
|
isSupported: function() {
|
|
2417
|
-
return
|
|
2481
|
+
return w.isXHRSupported();
|
|
2418
2482
|
}
|
|
2419
|
-
}, hn = new ee(j({},
|
|
2483
|
+
}, hn = new ee(j({}, Xe, Ge)), ln = new ee(j({}, Je, Ge)), dn = {
|
|
2420
2484
|
ws: cn,
|
|
2421
2485
|
xhr_streaming: hn,
|
|
2422
2486
|
xhr_polling: ln
|
|
@@ -2448,10 +2512,10 @@ function Gi() {
|
|
|
2448
2512
|
}
|
|
2449
2513
|
}), Ye = {
|
|
2450
2514
|
isSupported: function(n) {
|
|
2451
|
-
var e =
|
|
2515
|
+
var e = w.isXDRSupported(n.useTLS);
|
|
2452
2516
|
return e;
|
|
2453
2517
|
}
|
|
2454
|
-
}, fn = new ee(j({},
|
|
2518
|
+
}, fn = new ee(j({}, Xe, Ye)), pn = new ee(j({}, Je, Ye));
|
|
2455
2519
|
ce.xdr_streaming = fn, ce.xdr_polling = pn, ce.sockjs = un;
|
|
2456
2520
|
const mn = ce;
|
|
2457
2521
|
class gn extends $ {
|
|
@@ -2660,7 +2724,7 @@ function Gi() {
|
|
|
2660
2724
|
this.timeline = e, this.options = t || {};
|
|
2661
2725
|
}
|
|
2662
2726
|
send(e, t) {
|
|
2663
|
-
this.timeline.isEmpty() || this.timeline.send(
|
|
2727
|
+
this.timeline.isEmpty() || this.timeline.send(w.TimelineTransport.getAgent(this, e), t);
|
|
2664
2728
|
}
|
|
2665
2729
|
}
|
|
2666
2730
|
class Ce extends $ {
|
|
@@ -2676,7 +2740,7 @@ function Gi() {
|
|
|
2676
2740
|
if (e.indexOf("client-") !== 0)
|
|
2677
2741
|
throw new f("Event '" + e + "' does not start with 'client-'");
|
|
2678
2742
|
if (!this.subscribed) {
|
|
2679
|
-
var r =
|
|
2743
|
+
var r = T.buildLogSuffix("triggeringClientEvents");
|
|
2680
2744
|
P.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`);
|
|
2681
2745
|
}
|
|
2682
2746
|
return this.pusher.send_event(e, t, this.name);
|
|
@@ -2765,7 +2829,7 @@ function Gi() {
|
|
|
2765
2829
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
2766
2830
|
}
|
|
2767
2831
|
}
|
|
2768
|
-
var
|
|
2832
|
+
var xn = function(n, e, t, r) {
|
|
2769
2833
|
function o(c) {
|
|
2770
2834
|
return c instanceof t ? c : new t(function(l) {
|
|
2771
2835
|
l(c);
|
|
@@ -2775,15 +2839,15 @@ function Gi() {
|
|
|
2775
2839
|
function p(k) {
|
|
2776
2840
|
try {
|
|
2777
2841
|
_(r.next(k));
|
|
2778
|
-
} catch (
|
|
2779
|
-
l(
|
|
2842
|
+
} catch (R) {
|
|
2843
|
+
l(R);
|
|
2780
2844
|
}
|
|
2781
2845
|
}
|
|
2782
2846
|
function b(k) {
|
|
2783
2847
|
try {
|
|
2784
2848
|
_(r.throw(k));
|
|
2785
|
-
} catch (
|
|
2786
|
-
l(
|
|
2849
|
+
} catch (R) {
|
|
2850
|
+
l(R);
|
|
2787
2851
|
}
|
|
2788
2852
|
}
|
|
2789
2853
|
function _(k) {
|
|
@@ -2792,12 +2856,12 @@ function Gi() {
|
|
|
2792
2856
|
_((r = r.apply(n, e || [])).next());
|
|
2793
2857
|
});
|
|
2794
2858
|
};
|
|
2795
|
-
class
|
|
2859
|
+
class Tn extends Se {
|
|
2796
2860
|
constructor(e, t) {
|
|
2797
2861
|
super(e, t), this.members = new Sn();
|
|
2798
2862
|
}
|
|
2799
2863
|
authorize(e, t) {
|
|
2800
|
-
super.authorize(e, (r, o) =>
|
|
2864
|
+
super.authorize(e, (r, o) => xn(this, void 0, void 0, function* () {
|
|
2801
2865
|
if (!r)
|
|
2802
2866
|
if (o = o, o.channel_data != null) {
|
|
2803
2867
|
var c = JSON.parse(o.channel_data);
|
|
@@ -2805,7 +2869,7 @@ function Gi() {
|
|
|
2805
2869
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
2806
2870
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2807
2871
|
else {
|
|
2808
|
-
let l =
|
|
2872
|
+
let l = T.buildLogSuffix("authorizationEndpoint");
|
|
2809
2873
|
P.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${l}, or the user should be signed in.`), t("Invalid auth response");
|
|
2810
2874
|
return;
|
|
2811
2875
|
}
|
|
@@ -2847,7 +2911,7 @@ function Gi() {
|
|
|
2847
2911
|
this.members.reset(), super.disconnect();
|
|
2848
2912
|
}
|
|
2849
2913
|
}
|
|
2850
|
-
var En = y(978),
|
|
2914
|
+
var En = y(978), xe = y(594);
|
|
2851
2915
|
class _n extends Se {
|
|
2852
2916
|
constructor(e, t, r) {
|
|
2853
2917
|
super(e, t), this.key = null, this.nacl = r;
|
|
@@ -2863,7 +2927,7 @@ function Gi() {
|
|
|
2863
2927
|
t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2864
2928
|
return;
|
|
2865
2929
|
}
|
|
2866
|
-
this.key = (0,
|
|
2930
|
+
this.key = (0, xe.decode)(c), delete o.shared_secret, t(null, o);
|
|
2867
2931
|
});
|
|
2868
2932
|
}
|
|
2869
2933
|
trigger(e, t) {
|
|
@@ -2886,12 +2950,12 @@ function Gi() {
|
|
|
2886
2950
|
P.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
|
|
2887
2951
|
return;
|
|
2888
2952
|
}
|
|
2889
|
-
let r = (0,
|
|
2953
|
+
let r = (0, xe.decode)(t.ciphertext);
|
|
2890
2954
|
if (r.length < this.nacl.secretbox.overheadLength) {
|
|
2891
2955
|
P.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);
|
|
2892
2956
|
return;
|
|
2893
2957
|
}
|
|
2894
|
-
let o = (0,
|
|
2958
|
+
let o = (0, xe.decode)(t.nonce);
|
|
2895
2959
|
if (o.length < this.nacl.secretbox.nonceLength) {
|
|
2896
2960
|
P.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${o.length}`);
|
|
2897
2961
|
return;
|
|
@@ -2925,7 +2989,7 @@ function Gi() {
|
|
|
2925
2989
|
class kn extends $ {
|
|
2926
2990
|
constructor(e, t) {
|
|
2927
2991
|
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);
|
|
2928
|
-
var r =
|
|
2992
|
+
var r = w.getNetwork();
|
|
2929
2993
|
r.bind("online", () => {
|
|
2930
2994
|
this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
|
|
2931
2995
|
}), r.bind("offline", () => {
|
|
@@ -3107,17 +3171,17 @@ function Gi() {
|
|
|
3107
3171
|
function Ln(n, e) {
|
|
3108
3172
|
if (n.indexOf("private-encrypted-") === 0) {
|
|
3109
3173
|
if (e.config.nacl)
|
|
3110
|
-
return
|
|
3111
|
-
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r =
|
|
3174
|
+
return V.createEncryptedChannel(n, e, e.config.nacl);
|
|
3175
|
+
let t = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", r = T.buildLogSuffix("encryptedChannelSupport");
|
|
3112
3176
|
throw new z(`${t}. ${r}`);
|
|
3113
3177
|
} else {
|
|
3114
3178
|
if (n.indexOf("private-") === 0)
|
|
3115
|
-
return
|
|
3179
|
+
return V.createPrivateChannel(n, e);
|
|
3116
3180
|
if (n.indexOf("presence-") === 0)
|
|
3117
|
-
return
|
|
3181
|
+
return V.createPresenceChannel(n, e);
|
|
3118
3182
|
if (n.indexOf("#") === 0)
|
|
3119
|
-
throw new
|
|
3120
|
-
return
|
|
3183
|
+
throw new C('Cannot create a channel with name "' + n + '".');
|
|
3184
|
+
return V.createChannel(n, e);
|
|
3121
3185
|
}
|
|
3122
3186
|
}
|
|
3123
3187
|
var Pn = {
|
|
@@ -3134,7 +3198,7 @@ function Gi() {
|
|
|
3134
3198
|
return new Se(n, e);
|
|
3135
3199
|
},
|
|
3136
3200
|
createPresenceChannel(n, e) {
|
|
3137
|
-
return new
|
|
3201
|
+
return new Tn(n, e);
|
|
3138
3202
|
},
|
|
3139
3203
|
createEncryptedChannel(n, e, t) {
|
|
3140
3204
|
return new _n(n, e, t);
|
|
@@ -3149,13 +3213,13 @@ function Gi() {
|
|
|
3149
3213
|
return new yn(n, e, t);
|
|
3150
3214
|
}
|
|
3151
3215
|
};
|
|
3152
|
-
const
|
|
3216
|
+
const V = Pn;
|
|
3153
3217
|
class Qe {
|
|
3154
3218
|
constructor(e) {
|
|
3155
3219
|
this.options = e || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
3156
3220
|
}
|
|
3157
3221
|
getAssistant(e) {
|
|
3158
|
-
return
|
|
3222
|
+
return V.createAssistantToTheTransportManager(this, e, {
|
|
3159
3223
|
minPingDelay: this.options.minPingDelay,
|
|
3160
3224
|
maxPingDelay: this.options.maxPingDelay
|
|
3161
3225
|
});
|
|
@@ -3203,7 +3267,7 @@ function Gi() {
|
|
|
3203
3267
|
};
|
|
3204
3268
|
}
|
|
3205
3269
|
}
|
|
3206
|
-
class
|
|
3270
|
+
class Te {
|
|
3207
3271
|
constructor(e) {
|
|
3208
3272
|
this.strategies = e;
|
|
3209
3273
|
}
|
|
@@ -3267,8 +3331,8 @@ function Gi() {
|
|
|
3267
3331
|
failFast: !0
|
|
3268
3332
|
}))) : c++);
|
|
3269
3333
|
}
|
|
3270
|
-
var b = U.now(), _ = l.pop().connect(e, function k(
|
|
3271
|
-
|
|
3334
|
+
var b = U.now(), _ = l.pop().connect(e, function k(R, ue) {
|
|
3335
|
+
R ? (Ze(r), l.length > 0 ? (b = U.now(), _ = l.pop().connect(e, k)) : t(R)) : (Nn(r, ue.transport.name, U.now() - b, c), t(null, ue));
|
|
3272
3336
|
});
|
|
3273
3337
|
return {
|
|
3274
3338
|
abort: function() {
|
|
@@ -3284,7 +3348,7 @@ function Gi() {
|
|
|
3284
3348
|
return "pusherTransport" + (n ? "TLS" : "NonTLS");
|
|
3285
3349
|
}
|
|
3286
3350
|
function Un(n) {
|
|
3287
|
-
var e =
|
|
3351
|
+
var e = w.getLocalStorage();
|
|
3288
3352
|
if (e)
|
|
3289
3353
|
try {
|
|
3290
3354
|
var t = e[Ee(n)];
|
|
@@ -3296,7 +3360,7 @@ function Gi() {
|
|
|
3296
3360
|
return null;
|
|
3297
3361
|
}
|
|
3298
3362
|
function Nn(n, e, t, r) {
|
|
3299
|
-
var o =
|
|
3363
|
+
var o = w.getLocalStorage();
|
|
3300
3364
|
if (o)
|
|
3301
3365
|
try {
|
|
3302
3366
|
o[Ee(n)] = ae({
|
|
@@ -3309,7 +3373,7 @@ function Gi() {
|
|
|
3309
3373
|
}
|
|
3310
3374
|
}
|
|
3311
3375
|
function Ze(n) {
|
|
3312
|
-
var e =
|
|
3376
|
+
var e = w.getLocalStorage();
|
|
3313
3377
|
if (e)
|
|
3314
3378
|
try {
|
|
3315
3379
|
delete e[Ee(n)];
|
|
@@ -3396,24 +3460,24 @@ function Gi() {
|
|
|
3396
3460
|
lives: 2,
|
|
3397
3461
|
minPingDelay: 1e4,
|
|
3398
3462
|
maxPingDelay: n.activityTimeout
|
|
3399
|
-
}),
|
|
3463
|
+
}), R = o("ws", "ws", 3, c, _), ue = o("wss", "ws", 3, l, _), Pi = o("sockjs", "sockjs", 1, p), ot = o("xhr_streaming", "xhr_streaming", 1, p, k), Ri = 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([R], b), Oi = new Q([ue], b), qi = new Q([Pi], b), ht = new Q([
|
|
3400
3464
|
new re(se(ot), ot, Ri)
|
|
3401
3465
|
], b), lt = new Q([
|
|
3402
3466
|
new re(se(at), at, Ii)
|
|
3403
3467
|
], b), dt = new Q([
|
|
3404
|
-
new re(se(ht), new
|
|
3468
|
+
new re(se(ht), new Te([
|
|
3405
3469
|
ht,
|
|
3406
3470
|
new he(lt, { delay: 4e3 })
|
|
3407
3471
|
]), lt)
|
|
3408
3472
|
], b), Ae = new re(se(dt), dt, qi), Le;
|
|
3409
|
-
return e.useTLS ? Le = new
|
|
3473
|
+
return e.useTLS ? Le = new Te([
|
|
3410
3474
|
ct,
|
|
3411
3475
|
new he(Ae, { delay: 2e3 })
|
|
3412
|
-
]) : Le = new
|
|
3476
|
+
]) : Le = new Te([
|
|
3413
3477
|
ct,
|
|
3414
3478
|
new he(Oi, { delay: 2e3 }),
|
|
3415
3479
|
new he(Ae, { delay: 5e3 })
|
|
3416
|
-
]), new qn(new Mn(new re(se(
|
|
3480
|
+
]), new qn(new Mn(new re(se(R), Le, Ae)), r, {
|
|
3417
3481
|
ttl: 18e5,
|
|
3418
3482
|
timeline: e.timeline,
|
|
3419
3483
|
useTLS: e.useTLS
|
|
@@ -3453,10 +3517,10 @@ function Gi() {
|
|
|
3453
3517
|
start(e) {
|
|
3454
3518
|
this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
|
|
3455
3519
|
this.close();
|
|
3456
|
-
},
|
|
3520
|
+
}, w.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(e);
|
|
3457
3521
|
}
|
|
3458
3522
|
close() {
|
|
3459
|
-
this.unloader && (
|
|
3523
|
+
this.unloader && (w.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
|
|
3460
3524
|
}
|
|
3461
3525
|
onChunk(e, t) {
|
|
3462
3526
|
for (; ; ) {
|
|
@@ -3483,9 +3547,9 @@ function Gi() {
|
|
|
3483
3547
|
})(_e || (_e = {}));
|
|
3484
3548
|
const Z = _e;
|
|
3485
3549
|
var $n = 1;
|
|
3486
|
-
class
|
|
3550
|
+
class Vn {
|
|
3487
3551
|
constructor(e, t) {
|
|
3488
|
-
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location =
|
|
3552
|
+
this.hooks = e, this.session = tt(1e3) + "/" + Yn(8), this.location = Xn(t), this.readyState = Z.CONNECTING, this.openStream();
|
|
3489
3553
|
}
|
|
3490
3554
|
send(e) {
|
|
3491
3555
|
return this.sendRaw(JSON.stringify([e]));
|
|
@@ -3499,7 +3563,7 @@ function Gi() {
|
|
|
3499
3563
|
sendRaw(e) {
|
|
3500
3564
|
if (this.readyState === Z.OPEN)
|
|
3501
3565
|
try {
|
|
3502
|
-
return
|
|
3566
|
+
return w.createSocketRequest("POST", et(Jn(this.location, this.session))).start(e), !0;
|
|
3503
3567
|
} catch {
|
|
3504
3568
|
return !1;
|
|
3505
3569
|
}
|
|
@@ -3554,7 +3618,7 @@ function Gi() {
|
|
|
3554
3618
|
this.onerror && this.onerror(e);
|
|
3555
3619
|
}
|
|
3556
3620
|
openStream() {
|
|
3557
|
-
this.stream =
|
|
3621
|
+
this.stream = w.createSocketRequest("POST", et(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (e) => {
|
|
3558
3622
|
this.onChunk(e);
|
|
3559
3623
|
}), this.stream.bind("finished", (e) => {
|
|
3560
3624
|
this.hooks.onFinished(this, e);
|
|
@@ -3573,7 +3637,7 @@ function Gi() {
|
|
|
3573
3637
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
3574
3638
|
}
|
|
3575
3639
|
}
|
|
3576
|
-
function
|
|
3640
|
+
function Xn(n) {
|
|
3577
3641
|
var e = /([^\?]*)\/*(\??.*)/.exec(n);
|
|
3578
3642
|
return {
|
|
3579
3643
|
base: e[1],
|
|
@@ -3592,14 +3656,14 @@ function Gi() {
|
|
|
3592
3656
|
return t[1] + e + t[3];
|
|
3593
3657
|
}
|
|
3594
3658
|
function tt(n) {
|
|
3595
|
-
return
|
|
3659
|
+
return w.randomInt(n);
|
|
3596
3660
|
}
|
|
3597
3661
|
function Yn(n) {
|
|
3598
3662
|
for (var e = [], t = 0; t < n; t++)
|
|
3599
3663
|
e.push(tt(32).toString(32));
|
|
3600
3664
|
return e.join("");
|
|
3601
3665
|
}
|
|
3602
|
-
const Kn =
|
|
3666
|
+
const Kn = Vn;
|
|
3603
3667
|
var Qn = {
|
|
3604
3668
|
getReceiveURL: function(n, e) {
|
|
3605
3669
|
return n.base + "/" + e + "/xhr_streaming" + n.queryString;
|
|
@@ -3631,7 +3695,7 @@ function Gi() {
|
|
|
3631
3695
|
const ti = ei;
|
|
3632
3696
|
var ni = {
|
|
3633
3697
|
getRequest: function(n) {
|
|
3634
|
-
var e =
|
|
3698
|
+
var e = w.getXHRAPI(), t = new e();
|
|
3635
3699
|
return t.onreadystatechange = t.onprogress = function() {
|
|
3636
3700
|
switch (t.readyState) {
|
|
3637
3701
|
case 3:
|
|
@@ -3672,7 +3736,7 @@ function Gi() {
|
|
|
3672
3736
|
var si = {
|
|
3673
3737
|
nextAuthCallbackID: 1,
|
|
3674
3738
|
auth_callbacks: {},
|
|
3675
|
-
ScriptReceivers:
|
|
3739
|
+
ScriptReceivers: S,
|
|
3676
3740
|
DependenciesReceivers: F,
|
|
3677
3741
|
getDefaultStrategy: zn,
|
|
3678
3742
|
Transports: mn,
|
|
@@ -3763,7 +3827,7 @@ function Gi() {
|
|
|
3763
3827
|
}() * n);
|
|
3764
3828
|
}
|
|
3765
3829
|
};
|
|
3766
|
-
const
|
|
3830
|
+
const w = si;
|
|
3767
3831
|
var ke;
|
|
3768
3832
|
(function(n) {
|
|
3769
3833
|
n[n.ERROR = 3] = "ERROR", n[n.INFO = 6] = "INFO", n[n.DEBUG = 7] = "DEBUG";
|
|
@@ -3824,15 +3888,15 @@ function Gi() {
|
|
|
3824
3888
|
var r = !1, o = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), c = null, l = function() {
|
|
3825
3889
|
o.unbind("initialized", l), o.connect();
|
|
3826
3890
|
}, p = function() {
|
|
3827
|
-
c =
|
|
3828
|
-
r = !0, k(), t(null,
|
|
3891
|
+
c = V.createHandshake(o, function(R) {
|
|
3892
|
+
r = !0, k(), t(null, R);
|
|
3829
3893
|
});
|
|
3830
|
-
}, b = function(
|
|
3831
|
-
k(), t(
|
|
3894
|
+
}, b = function(R) {
|
|
3895
|
+
k(), t(R);
|
|
3832
3896
|
}, _ = function() {
|
|
3833
3897
|
k();
|
|
3834
|
-
var
|
|
3835
|
-
|
|
3898
|
+
var R;
|
|
3899
|
+
R = ae(o), t(new M(R));
|
|
3836
3900
|
}, k = function() {
|
|
3837
3901
|
o.unbind("initialized", l), o.unbind("open", p), o.unbind("error", b), o.unbind("closed", _);
|
|
3838
3902
|
};
|
|
@@ -3840,8 +3904,8 @@ function Gi() {
|
|
|
3840
3904
|
abort: () => {
|
|
3841
3905
|
r || (k(), c ? c.close() : o.close());
|
|
3842
3906
|
},
|
|
3843
|
-
forceMinPriority: (
|
|
3844
|
-
r || this.priority <
|
|
3907
|
+
forceMinPriority: (R) => {
|
|
3908
|
+
r || this.priority < R && (c ? c.close() : o.close());
|
|
3845
3909
|
}
|
|
3846
3910
|
};
|
|
3847
3911
|
}
|
|
@@ -3856,7 +3920,7 @@ function Gi() {
|
|
|
3856
3920
|
}
|
|
3857
3921
|
};
|
|
3858
3922
|
}
|
|
3859
|
-
const { Transports: ci } =
|
|
3923
|
+
const { Transports: ci } = w;
|
|
3860
3924
|
var hi = function(n, e, t, r, o, c) {
|
|
3861
3925
|
var l = ci[t];
|
|
3862
3926
|
if (!l)
|
|
@@ -3898,11 +3962,11 @@ function Gi() {
|
|
|
3898
3962
|
}
|
|
3899
3963
|
return t;
|
|
3900
3964
|
}, fi = (n) => {
|
|
3901
|
-
if (typeof
|
|
3965
|
+
if (typeof w.getAuthorizers()[n.transport] > "u")
|
|
3902
3966
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3903
3967
|
return (e, t) => {
|
|
3904
3968
|
const r = ui(e, n);
|
|
3905
|
-
|
|
3969
|
+
w.getAuthorizers()[n.transport](w, r, n, u.UserAuthentication, t);
|
|
3906
3970
|
};
|
|
3907
3971
|
}, pi = (n, e) => {
|
|
3908
3972
|
var t = "socket_id=" + encodeURIComponent(n.socketId);
|
|
@@ -3916,11 +3980,11 @@ function Gi() {
|
|
|
3916
3980
|
}
|
|
3917
3981
|
return t;
|
|
3918
3982
|
}, mi = (n) => {
|
|
3919
|
-
if (typeof
|
|
3983
|
+
if (typeof w.getAuthorizers()[n.transport] > "u")
|
|
3920
3984
|
throw `'${n.transport}' is not a recognized auth transport`;
|
|
3921
3985
|
return (e, t) => {
|
|
3922
3986
|
const r = pi(e, n);
|
|
3923
|
-
|
|
3987
|
+
w.getAuthorizers()[n.transport](w, r, n, u.ChannelAuthorization, t);
|
|
3924
3988
|
};
|
|
3925
3989
|
}, gi = (n, e, t) => {
|
|
3926
3990
|
const r = {
|
|
@@ -3938,28 +4002,28 @@ function Gi() {
|
|
|
3938
4002
|
};
|
|
3939
4003
|
function rt(n, e) {
|
|
3940
4004
|
let t = {
|
|
3941
|
-
activityTimeout: n.activityTimeout ||
|
|
4005
|
+
activityTimeout: n.activityTimeout || x.activityTimeout,
|
|
3942
4006
|
cluster: n.cluster,
|
|
3943
|
-
httpPath: n.httpPath ||
|
|
3944
|
-
httpPort: n.httpPort ||
|
|
3945
|
-
httpsPort: n.httpsPort ||
|
|
3946
|
-
pongTimeout: n.pongTimeout ||
|
|
3947
|
-
statsHost: n.statsHost ||
|
|
3948
|
-
unavailableTimeout: n.unavailableTimeout ||
|
|
3949
|
-
wsPath: n.wsPath ||
|
|
3950
|
-
wsPort: n.wsPort ||
|
|
3951
|
-
wssPort: n.wssPort ||
|
|
4007
|
+
httpPath: n.httpPath || x.httpPath,
|
|
4008
|
+
httpPort: n.httpPort || x.httpPort,
|
|
4009
|
+
httpsPort: n.httpsPort || x.httpsPort,
|
|
4010
|
+
pongTimeout: n.pongTimeout || x.pongTimeout,
|
|
4011
|
+
statsHost: n.statsHost || x.stats_host,
|
|
4012
|
+
unavailableTimeout: n.unavailableTimeout || x.unavailableTimeout,
|
|
4013
|
+
wsPath: n.wsPath || x.wsPath,
|
|
4014
|
+
wsPort: n.wsPort || x.wsPort,
|
|
4015
|
+
wssPort: n.wssPort || x.wssPort,
|
|
3952
4016
|
enableStats: Ci(n),
|
|
3953
4017
|
httpHost: vi(n),
|
|
3954
4018
|
useTLS: wi(n),
|
|
3955
4019
|
wsHost: yi(n),
|
|
3956
4020
|
userAuthenticator: Si(n),
|
|
3957
|
-
channelAuthorizer:
|
|
4021
|
+
channelAuthorizer: Ti(n, e)
|
|
3958
4022
|
};
|
|
3959
4023
|
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;
|
|
3960
4024
|
}
|
|
3961
4025
|
function vi(n) {
|
|
3962
|
-
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` :
|
|
4026
|
+
return n.httpHost ? n.httpHost : n.cluster ? `sockjs-${n.cluster}.pusher.com` : x.httpHost;
|
|
3963
4027
|
}
|
|
3964
4028
|
function yi(n) {
|
|
3965
4029
|
return n.wsHost ? n.wsHost : bi(n.cluster);
|
|
@@ -3968,31 +4032,31 @@ function Gi() {
|
|
|
3968
4032
|
return `ws-${n}.pusher.com`;
|
|
3969
4033
|
}
|
|
3970
4034
|
function wi(n) {
|
|
3971
|
-
return
|
|
4035
|
+
return w.getProtocol() === "https:" ? !0 : n.forceTLS !== !1;
|
|
3972
4036
|
}
|
|
3973
4037
|
function Ci(n) {
|
|
3974
4038
|
return "enableStats" in n ? n.enableStats : "disableStats" in n ? !n.disableStats : !1;
|
|
3975
4039
|
}
|
|
3976
4040
|
const st = (n) => "customHandler" in n && n.customHandler != null;
|
|
3977
4041
|
function Si(n) {
|
|
3978
|
-
const e = Object.assign(Object.assign({},
|
|
4042
|
+
const e = Object.assign(Object.assign({}, x.userAuthentication), n.userAuthentication);
|
|
3979
4043
|
return st(e) ? e.customHandler : fi(e);
|
|
3980
4044
|
}
|
|
3981
|
-
function
|
|
4045
|
+
function xi(n, e) {
|
|
3982
4046
|
let t;
|
|
3983
4047
|
if ("channelAuthorization" in n)
|
|
3984
|
-
t = Object.assign(Object.assign({},
|
|
4048
|
+
t = Object.assign(Object.assign({}, x.channelAuthorization), n.channelAuthorization);
|
|
3985
4049
|
else if (t = {
|
|
3986
|
-
transport: n.authTransport ||
|
|
3987
|
-
endpoint: n.authEndpoint ||
|
|
4050
|
+
transport: n.authTransport || x.authTransport,
|
|
4051
|
+
endpoint: n.authEndpoint || x.authEndpoint
|
|
3988
4052
|
}, "auth" in n && ("params" in n.auth && (t.params = n.auth.params), "headers" in n.auth && (t.headers = n.auth.headers)), "authorizer" in n)
|
|
3989
4053
|
return {
|
|
3990
4054
|
customHandler: gi(e, t, n.authorizer)
|
|
3991
4055
|
};
|
|
3992
4056
|
return t;
|
|
3993
4057
|
}
|
|
3994
|
-
function
|
|
3995
|
-
const t =
|
|
4058
|
+
function Ti(n, e) {
|
|
4059
|
+
const t = xi(n, e);
|
|
3996
4060
|
return st(t) ? t.customHandler : mi(t);
|
|
3997
4061
|
}
|
|
3998
4062
|
class Ei extends $ {
|
|
@@ -4083,31 +4147,31 @@ function Gi() {
|
|
|
4083
4147
|
e.then(r).catch(r), this.signinDonePromise = e, this._signinDoneResolve = t;
|
|
4084
4148
|
}
|
|
4085
4149
|
}
|
|
4086
|
-
class
|
|
4150
|
+
class I {
|
|
4087
4151
|
static ready() {
|
|
4088
|
-
|
|
4089
|
-
for (var e = 0, t =
|
|
4090
|
-
|
|
4152
|
+
I.isReady = !0;
|
|
4153
|
+
for (var e = 0, t = I.instances.length; e < t; e++)
|
|
4154
|
+
I.instances[e].connect();
|
|
4091
4155
|
}
|
|
4092
4156
|
static getClientFeatures() {
|
|
4093
|
-
return De(Be({ ws:
|
|
4157
|
+
return De(Be({ ws: w.Transports.ws }, function(e) {
|
|
4094
4158
|
return e.isSupported({});
|
|
4095
4159
|
}));
|
|
4096
4160
|
}
|
|
4097
4161
|
constructor(e, t) {
|
|
4098
|
-
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels =
|
|
4162
|
+
Li(e), di(t), this.key = e, this.options = t, this.config = rt(this.options, this), this.channels = V.createChannels(), this.global_emitter = new $(), this.sessionID = w.randomInt(1e9), this.timeline = new oi(this.key, this.sessionID, {
|
|
4099
4163
|
cluster: this.config.cluster,
|
|
4100
|
-
features:
|
|
4164
|
+
features: I.getClientFeatures(),
|
|
4101
4165
|
params: this.config.timelineParams || {},
|
|
4102
4166
|
limit: 50,
|
|
4103
4167
|
level: le.INFO,
|
|
4104
|
-
version:
|
|
4105
|
-
}), this.config.enableStats && (this.timelineSender =
|
|
4168
|
+
version: x.VERSION
|
|
4169
|
+
}), this.config.enableStats && (this.timelineSender = V.createTimelineSender(this.timeline, {
|
|
4106
4170
|
host: this.config.statsHost,
|
|
4107
|
-
path: "/timeline/v2/" +
|
|
4171
|
+
path: "/timeline/v2/" + w.TimelineTransport.name
|
|
4108
4172
|
}));
|
|
4109
|
-
var r = (o) =>
|
|
4110
|
-
this.connection =
|
|
4173
|
+
var r = (o) => w.getDefaultStrategy(this.config, o, hi);
|
|
4174
|
+
this.connection = V.createConnectionManager(this.key, {
|
|
4111
4175
|
getStrategy: r,
|
|
4112
4176
|
timeline: this.timeline,
|
|
4113
4177
|
activityTimeout: this.config.activityTimeout,
|
|
@@ -4129,7 +4193,7 @@ function Gi() {
|
|
|
4129
4193
|
this.channels.disconnect();
|
|
4130
4194
|
}), this.connection.bind("error", (o) => {
|
|
4131
4195
|
P.warn(o);
|
|
4132
|
-
}),
|
|
4196
|
+
}), I.instances.push(this), this.timeline.info({ instances: I.instances.length }), this.user = new Ai(this), I.isReady && this.connect();
|
|
4133
4197
|
}
|
|
4134
4198
|
switchCluster(e) {
|
|
4135
4199
|
const { appKey: t, cluster: r } = e;
|
|
@@ -4190,13 +4254,13 @@ function Gi() {
|
|
|
4190
4254
|
this.user.signin();
|
|
4191
4255
|
}
|
|
4192
4256
|
}
|
|
4193
|
-
|
|
4194
|
-
const de =
|
|
4257
|
+
I.instances = [], I.isReady = !1, I.logToConsole = !1, I.Runtime = w, I.ScriptReceivers = w.ScriptReceivers, I.DependenciesReceivers = w.DependenciesReceivers, I.auth_callbacks = w.auth_callbacks;
|
|
4258
|
+
const de = I;
|
|
4195
4259
|
function Li(n) {
|
|
4196
4260
|
if (n == null)
|
|
4197
4261
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
4198
4262
|
}
|
|
4199
|
-
|
|
4263
|
+
w.setup(I);
|
|
4200
4264
|
}
|
|
4201
4265
|
/******/
|
|
4202
4266
|
}, a = {};
|
|
@@ -4293,7 +4357,7 @@ Code : (Code)`,
|
|
|
4293
4357
|
whatsappText: "Connectez-moi à (Host) avec ce code : (Code)"
|
|
4294
4358
|
}
|
|
4295
4359
|
};
|
|
4296
|
-
function
|
|
4360
|
+
function X(v) {
|
|
4297
4361
|
switch (v) {
|
|
4298
4362
|
case "de":
|
|
4299
4363
|
return Zi;
|
|
@@ -4304,7 +4368,7 @@ function V(v) {
|
|
|
4304
4368
|
}
|
|
4305
4369
|
}
|
|
4306
4370
|
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>
|
|
4307
|
-
`, 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 =
|
|
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;
|
|
4308
4372
|
function je(v, i) {
|
|
4309
4373
|
return `sendity:auth-request:${encodeURIComponent(v)}:${encodeURIComponent(i)}`;
|
|
4310
4374
|
}
|
|
@@ -4316,12 +4380,12 @@ function bt(v, i, s, a = Date.now()) {
|
|
|
4316
4380
|
const m = JSON.parse(d);
|
|
4317
4381
|
if (typeof m.id != "string" || typeof m.clientSecret != "string" || typeof m.createdAt != "number")
|
|
4318
4382
|
throw new Error("invalid stored auth request");
|
|
4319
|
-
return a - m.createdAt >=
|
|
4383
|
+
return a - m.createdAt >= rr ? (v.removeItem(h), null) : { id: m.id, clientSecret: m.clientSecret };
|
|
4320
4384
|
} catch {
|
|
4321
4385
|
return v.removeItem(h), null;
|
|
4322
4386
|
}
|
|
4323
4387
|
}
|
|
4324
|
-
function
|
|
4388
|
+
function ar(v, i, s, a, h = Date.now()) {
|
|
4325
4389
|
v.setItem(je(i, s), JSON.stringify({ ...a, createdAt: h }));
|
|
4326
4390
|
}
|
|
4327
4391
|
function wt(v, i, s) {
|
|
@@ -4330,10 +4394,10 @@ function wt(v, i, s) {
|
|
|
4330
4394
|
function me() {
|
|
4331
4395
|
return window.localStorage.removeItem(Me), window.sessionStorage;
|
|
4332
4396
|
}
|
|
4333
|
-
function
|
|
4334
|
-
return v.filter((s) =>
|
|
4397
|
+
function cr(v, i = window.location.origin) {
|
|
4398
|
+
return v.filter((s) => hr(s, i));
|
|
4335
4399
|
}
|
|
4336
|
-
function
|
|
4400
|
+
function hr(v, i) {
|
|
4337
4401
|
try {
|
|
4338
4402
|
const s = new URL(v, i);
|
|
4339
4403
|
return ["http:", "https:", "mailto:", "whatsapp:"].includes(s.protocol);
|
|
@@ -4341,12 +4405,12 @@ function lr(v, i) {
|
|
|
4341
4405
|
return !1;
|
|
4342
4406
|
}
|
|
4343
4407
|
}
|
|
4344
|
-
function
|
|
4408
|
+
function lr(v, i, s) {
|
|
4345
4409
|
return v === "push" ? { start: !1, delayMs: 0 } : v === "polling" || !i || !s ? { start: !0, delayMs: 0 } : { start: !0, delayMs: At };
|
|
4346
4410
|
}
|
|
4347
4411
|
const ve = class ve extends HTMLElement {
|
|
4348
4412
|
constructor() {
|
|
4349
|
-
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.authenticated = !1;
|
|
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;
|
|
4350
4414
|
const i = this.attachShadow({ mode: "open" });
|
|
4351
4415
|
this.injectTailwind(i);
|
|
4352
4416
|
const s = document.createElement("div");
|
|
@@ -4355,10 +4419,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4355
4419
|
d.textContent = zi, i.appendChild(d), i.appendChild(h);
|
|
4356
4420
|
}
|
|
4357
4421
|
static get observedAttributes() {
|
|
4358
|
-
return ["server-url", "public-key", "
|
|
4422
|
+
return ["server-url", "public-key", "lang", "transport", "hide-footer", "footer", "authenticated-event-delay-ms", "variant", "no-card"];
|
|
4359
4423
|
}
|
|
4360
4424
|
connectedCallback() {
|
|
4361
|
-
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");
|
|
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();
|
|
4362
4426
|
try {
|
|
4363
4427
|
this.currentConfig = this.resolveConfig();
|
|
4364
4428
|
} catch (i) {
|
|
@@ -4367,14 +4431,20 @@ const ve = class ve extends HTMLElement {
|
|
|
4367
4431
|
}
|
|
4368
4432
|
this.configureFooter(), this.dispatchPublicEvent("sendity:ready", {
|
|
4369
4433
|
transport: this.currentConfig.transport,
|
|
4370
|
-
channel: this.primaryChannel(this.
|
|
4371
|
-
}), this.showPlaceholderCode(), this.
|
|
4434
|
+
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
4435
|
+
}), this.showPlaceholderCode(), this.startWhenVisible();
|
|
4372
4436
|
}
|
|
4373
4437
|
disconnectedCallback() {
|
|
4374
4438
|
this.stop(), this.destroyed = !0;
|
|
4375
4439
|
}
|
|
4376
4440
|
attributeChangedCallback() {
|
|
4377
|
-
this.isConnected && (this.currentConfig = this.resolveConfig(), this.configureFooter()
|
|
4441
|
+
this.isConnected && (this.syncLayoutVariant(), this.currentConfig = this.resolveConfig(), this.configureFooter());
|
|
4442
|
+
}
|
|
4443
|
+
isNoCardVariant() {
|
|
4444
|
+
return this.getAttribute("variant") === "no-card" || this.hasAttribute("no-card");
|
|
4445
|
+
}
|
|
4446
|
+
syncLayoutVariant() {
|
|
4447
|
+
this.rootEl?.classList.toggle("sendity--no-card", this.isNoCardVariant());
|
|
4378
4448
|
}
|
|
4379
4449
|
startWhenVisible() {
|
|
4380
4450
|
if (!(this.authFlowStarted || this.destroyed)) {
|
|
@@ -4449,7 +4519,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4449
4519
|
scheduleFooterWaitingState() {
|
|
4450
4520
|
this.footerWaitTimer !== null || this.isFooterHidden() || (this.footerWaitTimer = window.setTimeout(() => {
|
|
4451
4521
|
this.footerWaitTimer = null, this.showFooterWaitingState();
|
|
4452
|
-
},
|
|
4522
|
+
}, or));
|
|
4453
4523
|
}
|
|
4454
4524
|
setFooterIndicatorWaiting() {
|
|
4455
4525
|
this.footerIndicatorEl && (this.footerIndicatorEl.classList.remove("footer-indicator--error"), this.footerIndicatorEl.innerHTML = "", this.footerIndicatorEl.removeAttribute("hidden"));
|
|
@@ -4486,7 +4556,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4486
4556
|
showExpiredState() {
|
|
4487
4557
|
if (!(this.authenticated || this.destroyed || !this.currentConfig)) {
|
|
4488
4558
|
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()) {
|
|
4489
|
-
const i =
|
|
4559
|
+
const i = X(this.currentConfig.lang);
|
|
4490
4560
|
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(() => {
|
|
4491
4561
|
this.footerTransitionTimer = null, this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl?.setAttribute("hidden", "");
|
|
4492
4562
|
}, pe);
|
|
@@ -4496,7 +4566,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4496
4566
|
}
|
|
4497
4567
|
renderExpiredAction() {
|
|
4498
4568
|
if (!this.verifiersEl || !this.currentConfig) return;
|
|
4499
|
-
const i =
|
|
4569
|
+
const i = X(this.currentConfig.lang);
|
|
4500
4570
|
this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden");
|
|
4501
4571
|
const s = document.createElement("button");
|
|
4502
4572
|
s.type = "button", s.className = "chan error", s.addEventListener("click", () => {
|
|
@@ -4514,7 +4584,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4514
4584
|
const i = this.currentConfig;
|
|
4515
4585
|
this.stopAuthTransports(), this.stopCountdown(), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.setFooterIndicatorWaiting(), this.codeContainerEl?.classList.remove("code--expired");
|
|
4516
4586
|
const s = await this.createAuthRequest(i.serverUrl, i.publicKey, me());
|
|
4517
|
-
this.
|
|
4587
|
+
this.showFooterWaitingState(), this.configureRealtime(s);
|
|
4518
4588
|
}
|
|
4519
4589
|
handleInitialError(i) {
|
|
4520
4590
|
console.error("[sendity-auth] Unable to initialize authentication", i), this.renderError("Unable to initialize authentication, see console for details"), this.dispatchEvent(
|
|
@@ -4529,24 +4599,13 @@ const ve = class ve extends HTMLElement {
|
|
|
4529
4599
|
const i = {
|
|
4530
4600
|
lang: navigator.language?.startsWith("de") ? "de" : navigator.language?.startsWith("fr") ? "fr" : "en",
|
|
4531
4601
|
transport: "auto"
|
|
4532
|
-
}, s = (
|
|
4602
|
+
}, s = (E) => this.getAttribute(E) ?? void 0, a = s("server-url")?.trim() || ir, h = s("public-key")?.trim();
|
|
4533
4603
|
if (!h)
|
|
4534
4604
|
throw new Error("Missing required sendity-auth attribute: public-key");
|
|
4535
|
-
let d =
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
if (d = JSON.parse(m), !Array.isArray(d)) throw new Error("verify-urls not array");
|
|
4540
|
-
d = d.map(String);
|
|
4541
|
-
} catch {
|
|
4542
|
-
d = m.split(",").map((R) => R.trim()).filter(Boolean);
|
|
4543
|
-
}
|
|
4544
|
-
if (d = hr(d), d.length === 0)
|
|
4545
|
-
throw new Error("Missing required sendity-auth attribute: verify-urls");
|
|
4546
|
-
let g = s("lang") || i.lang;
|
|
4547
|
-
g !== "en" && g !== "de" && g !== "fr" && (g = i.lang);
|
|
4548
|
-
const y = s("transport"), E = y === "push" || y === "polling" ? y : i.transport, w = this.parseAuthenticatedEventDelayMs(s("authenticated-event-delay-ms"));
|
|
4549
|
-
return { serverUrl: a, publicKey: h, verifyUrls: d, lang: g, transport: E, authenticatedEventDelayMs: w };
|
|
4605
|
+
let d = s("lang") || i.lang;
|
|
4606
|
+
d !== "en" && d !== "de" && d !== "fr" && (d = i.lang);
|
|
4607
|
+
const m = s("transport"), g = m === "push" || m === "polling" ? m : i.transport, y = this.parseAuthenticatedEventDelayMs(s("authenticated-event-delay-ms"));
|
|
4608
|
+
return { serverUrl: a, publicKey: h, lang: d, transport: g, authenticatedEventDelayMs: y };
|
|
4550
4609
|
}
|
|
4551
4610
|
parseAuthenticatedEventDelayMs(i) {
|
|
4552
4611
|
if (i === void 0 || i.trim() === "") return Ie;
|
|
@@ -4568,10 +4627,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4568
4627
|
if (!d.id) throw new Error("Missing id from server response");
|
|
4569
4628
|
const m = this.extractClientSecret(d);
|
|
4570
4629
|
if (!m) throw new Error("Missing client secret from server response");
|
|
4571
|
-
return
|
|
4630
|
+
return ar(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", {
|
|
4572
4631
|
verificationId: String(d.id),
|
|
4573
4632
|
code: d.formattedCode ?? d.code ?? "",
|
|
4574
|
-
channel: this.primaryChannel(this.
|
|
4633
|
+
channel: this.primaryChannel(this.activeVerifyUrls)
|
|
4575
4634
|
}), d;
|
|
4576
4635
|
}
|
|
4577
4636
|
async step() {
|
|
@@ -4587,7 +4646,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4587
4646
|
if (m.status !== 200)
|
|
4588
4647
|
return wt(a, i, s), await this.step();
|
|
4589
4648
|
const g = await m.json();
|
|
4590
|
-
if (g.status === "verified")
|
|
4649
|
+
if (this.applyVerifyUrlsFromResponse(g), g.status === "verified")
|
|
4591
4650
|
return this.handleAuthenticated(g), g;
|
|
4592
4651
|
if (g.status === "expired")
|
|
4593
4652
|
return this.updateActiveAuthRequestExpiry(g), this.updateCode(g.formattedCode ?? g.code), this.showExpiredState(), g;
|
|
@@ -4600,7 +4659,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4600
4659
|
const { transport: s } = this.currentConfig, a = i?.broadcasting, h = !!(a?.key && a.channel && a.authEndpoint);
|
|
4601
4660
|
let d = !1;
|
|
4602
4661
|
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");
|
|
4603
|
-
const m =
|
|
4662
|
+
const m = lr(s, h, d);
|
|
4604
4663
|
m.start && this.startPolling(m.delayMs);
|
|
4605
4664
|
}
|
|
4606
4665
|
subscribeToBroadcasting(i) {
|
|
@@ -4608,7 +4667,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4608
4667
|
try {
|
|
4609
4668
|
window.Pusher = Ki;
|
|
4610
4669
|
const s = (i.scheme ?? "https") === "https", a = i.port ?? (s ? 443 : 80);
|
|
4611
|
-
return this.echo = new
|
|
4670
|
+
return this.echo = new Xi({
|
|
4612
4671
|
broadcaster: "reverb",
|
|
4613
4672
|
key: i.key,
|
|
4614
4673
|
wsHost: i.host ?? new URL(this.currentConfig.serverUrl).hostname,
|
|
@@ -4639,7 +4698,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4639
4698
|
const s = () => {
|
|
4640
4699
|
this.pollTimer !== null || this.authenticated || this.destroyed || (this.pollTimer = window.setInterval(() => {
|
|
4641
4700
|
this.step().catch((a) => console.warn("[sendity-auth] poll failed", a));
|
|
4642
|
-
},
|
|
4701
|
+
}, sr));
|
|
4643
4702
|
};
|
|
4644
4703
|
i > 0 ? this.fallbackPollTimer = window.setTimeout(() => {
|
|
4645
4704
|
this.fallbackPollTimer = null, s();
|
|
@@ -4666,7 +4725,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4666
4725
|
this.dispatchEvent(new CustomEvent(i, { bubbles: !0, composed: !0, detail: s }));
|
|
4667
4726
|
}
|
|
4668
4727
|
toPublicAuthenticatedDetail(i) {
|
|
4669
|
-
const s = String(i.auth_request_id ?? i.authRequestId ?? this.activeAuthRequestId ?? ""), a = i.channel ?? this.primaryChannel(this.
|
|
4728
|
+
const s = String(i.auth_request_id ?? i.authRequestId ?? this.activeAuthRequestId ?? ""), a = i.channel ?? this.primaryChannel(this.activeVerifyUrls), h = i.expires_at ?? i.expiresAt;
|
|
4670
4729
|
return {
|
|
4671
4730
|
sessionId: s,
|
|
4672
4731
|
channel: a,
|
|
@@ -4680,6 +4739,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4680
4739
|
const s = i[0] ?? "";
|
|
4681
4740
|
return s.startsWith("mailto:") ? "email" : s.startsWith("whatsapp:") || s.startsWith("whatsapp://") ? "whatsapp" : "unknown";
|
|
4682
4741
|
}
|
|
4742
|
+
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 = cr([...s, ...a].map(String));
|
|
4744
|
+
h.length !== 0 && (this.activeVerifyUrls = [...new Set(h)], this.renderVerifiers(this.activeVerifyUrls));
|
|
4745
|
+
}
|
|
4683
4746
|
authRequestStatusUrl(i, s) {
|
|
4684
4747
|
return new URL(this.joinUrl(i, `/auth-requests/${encodeURIComponent(s)}`)).toString();
|
|
4685
4748
|
}
|
|
@@ -4702,7 +4765,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4702
4765
|
}
|
|
4703
4766
|
waitingFooterMessage() {
|
|
4704
4767
|
if (!this.currentConfig) return "";
|
|
4705
|
-
const i =
|
|
4768
|
+
const i = X(this.currentConfig.lang), s = this.formatExpiryTime(this.activeAuthRequestExpiresAt, this.currentConfig.lang);
|
|
4706
4769
|
return s ? i.ui.footerWaitingUntil.replace("(Time)", s) : i.ui.footerWaiting;
|
|
4707
4770
|
}
|
|
4708
4771
|
formatExpiryTime(i, s) {
|
|
@@ -4745,24 +4808,24 @@ const ve = class ve extends HTMLElement {
|
|
|
4745
4808
|
this.lastCode = a, this.codeEl.textContent = a, this.codeContainerEl?.classList.remove("code--expired", "code--placeholder"), this.showCodeState();
|
|
4746
4809
|
} else
|
|
4747
4810
|
this.lastCode = void 0, this.showPlaceholderCode();
|
|
4748
|
-
this.currentConfig && this.renderVerifiers(this.
|
|
4811
|
+
this.currentConfig && this.renderVerifiers(this.activeVerifyUrls);
|
|
4749
4812
|
}
|
|
4750
4813
|
showPlaceholderCode() {
|
|
4751
|
-
this.codeEl && (this.lastCode = void 0, this.spinnerEl?.setAttribute("hidden", ""), this.codeEl.textContent = this.randomPlaceholderCode(), this.codeEl.removeAttribute("hidden"), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--exiting"
|
|
4814
|
+
this.codeEl && (this.lastCode = void 0, this.spinnerEl?.setAttribute("hidden", ""), this.codeEl.textContent = this.randomPlaceholderCode(), this.codeEl.removeAttribute("hidden"), this.rootEl?.classList.remove("sendity--expired", "sendity--verified"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--exiting"), this.codeContainerEl?.classList.add("code--placeholder"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""));
|
|
4752
4815
|
}
|
|
4753
4816
|
randomPlaceholderCode() {
|
|
4754
4817
|
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", s = () => i[Math.floor(Math.random() * i.length)], a = () => `${s()}${s()}${s()}`;
|
|
4755
4818
|
return `SDY-${a()}-${a()}`;
|
|
4756
4819
|
}
|
|
4757
4820
|
renderError(i) {
|
|
4758
|
-
this.codeEl && (this.codeEl.textContent = i), this.verifiersEl && (this.verifiersEl.innerHTML = "");
|
|
4821
|
+
this.rootEl?.classList.remove("sendity--verified"), this.rootEl?.classList.add("sendity--expired"), this.spinnerEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", ""), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--placeholder", "code--exiting"), this.codeContainerEl?.classList.add("code--expired"), this.codeContainerEl?.removeAttribute("aria-hidden"), this.codeEl && (this.codeEl.textContent = i, this.codeEl.removeAttribute("hidden")), this.verifiersEl && (this.verifiersEl.innerHTML = "", this.verifiersEl.classList.remove("is-two", "verifiers--exiting"), this.verifiersEl.removeAttribute("aria-hidden")), this.isFooterHidden() || (this.setFooterIndicatorError(), this.footerMessageEl && (this.footerMessageEl.textContent = i), this.footerEl?.classList.add("footer--waiting"), this.footerBrandEl?.setAttribute("hidden", ""), this.footerStatusEl?.removeAttribute("hidden"), this.footerTimerEl?.setAttribute("hidden", ""));
|
|
4759
4822
|
}
|
|
4760
4823
|
showLoading() {
|
|
4761
4824
|
this.spinnerEl?.removeAttribute("hidden"), this.codeContainerEl?.classList.remove("code--active", "code--verified", "code--expired", "code--placeholder"), this.codeEl?.setAttribute("hidden", ""), this.promptEl?.setAttribute("hidden", ""), this.successEl?.setAttribute("hidden", "");
|
|
4762
4825
|
}
|
|
4763
4826
|
showCodeState() {
|
|
4764
|
-
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"
|
|
4765
|
-
const i =
|
|
4827
|
+
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 = X(this.currentConfig.lang);
|
|
4766
4829
|
this.promptEl.textContent = i.ui.sendCodePrompt, this.promptEl.classList.remove("prompt--exiting"), this.promptEl.removeAttribute("aria-hidden"), this.promptEl.removeAttribute("hidden");
|
|
4767
4830
|
}
|
|
4768
4831
|
this.successEl?.setAttribute("hidden", "");
|
|
@@ -4773,11 +4836,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4773
4836
|
if (this.footerEl && (this.footerEl.hidden = s, this.footerEl.classList.remove("footer--leaving"), s || (this.footerEl.classList.add("footer--waiting", "footer--transitioning", "footer--verified"), window.setTimeout(() => {
|
|
4774
4837
|
this.footerEl?.classList.remove("footer--transitioning"), this.footerBrandEl && (this.footerBrandEl.hidden = !0);
|
|
4775
4838
|
}, pe))), this.footerStatusEl && (this.footerStatusEl.hidden = s), this.footerMessageEl) {
|
|
4776
|
-
const a = i.
|
|
4777
|
-
this.footerMessageEl.textContent = a
|
|
4839
|
+
const a = i.channel ?? this.primaryChannel(this.activeVerifyUrls);
|
|
4840
|
+
this.footerMessageEl.textContent = this.verifiedSigningInMessage(a);
|
|
4778
4841
|
}
|
|
4779
|
-
if (this.footerTimerEl && (this.footerTimerEl.hidden = !
|
|
4780
|
-
const a =
|
|
4842
|
+
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 = X(this.currentConfig.lang), h = i.name && i.name.trim().length > 0 ? a.ui.successGreeting.replace("(Name)", i.name) : "You're in!";
|
|
4781
4844
|
this.successEl.innerHTML = `
|
|
4782
4845
|
<span class="success-check" aria-hidden="true">
|
|
4783
4846
|
<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>
|
|
@@ -4789,8 +4852,11 @@ const ve = class ve extends HTMLElement {
|
|
|
4789
4852
|
this.successTransitionTimer = null, this.verifiersEl && this.verifiersEl.setAttribute("aria-hidden", "true"), this.codeContainerEl?.setAttribute("aria-hidden", "true"), this.promptEl?.setAttribute("aria-hidden", "true");
|
|
4790
4853
|
}, pe);
|
|
4791
4854
|
}
|
|
4855
|
+
verifiedSigningInMessage(i) {
|
|
4856
|
+
return `Verified ${i === "whatsapp" ? "your phone number" : "your email address"} · signing you in...`;
|
|
4857
|
+
}
|
|
4792
4858
|
destinationAddressForChannel(i) {
|
|
4793
|
-
const s = this.
|
|
4859
|
+
const s = this.activeVerifyUrls, a = s.find((h) => this.channelClass(h) === i) ?? s[0];
|
|
4794
4860
|
if (!a) return null;
|
|
4795
4861
|
try {
|
|
4796
4862
|
const h = new URL(a, window.location.origin);
|
|
@@ -4815,10 +4881,10 @@ const ve = class ve extends HTMLElement {
|
|
|
4815
4881
|
const s = this.currentConfig;
|
|
4816
4882
|
i.forEach((a, h) => {
|
|
4817
4883
|
if (h > 0 && i.length === 2) {
|
|
4818
|
-
const
|
|
4819
|
-
|
|
4820
|
-
const
|
|
4821
|
-
|
|
4884
|
+
const S = document.createElement("div");
|
|
4885
|
+
S.className = "divider", S.setAttribute("aria-hidden", "true");
|
|
4886
|
+
const O = document.createElement("span");
|
|
4887
|
+
O.textContent = s.lang === "de" ? "oder" : s.lang === "fr" ? "ou" : "or", S.appendChild(O), this.verifiersEl.appendChild(S);
|
|
4822
4888
|
}
|
|
4823
4889
|
const d = document.createElement("div");
|
|
4824
4890
|
d.className = "opt";
|
|
@@ -4828,15 +4894,15 @@ const ve = class ve extends HTMLElement {
|
|
|
4828
4894
|
});
|
|
4829
4895
|
const g = this.iconForUrl(a);
|
|
4830
4896
|
if (g) {
|
|
4831
|
-
const
|
|
4832
|
-
|
|
4897
|
+
const S = document.createElement("span");
|
|
4898
|
+
S.className = "icon", S.setAttribute("aria-hidden", "true"), S.innerHTML = g, m.appendChild(S);
|
|
4833
4899
|
}
|
|
4834
4900
|
const y = document.createElement("span");
|
|
4835
4901
|
y.className = "label", y.textContent = this.channelLabel(a, s.lang), m.appendChild(y), d.appendChild(m);
|
|
4836
4902
|
const E = this.destinationText(a, s.lang);
|
|
4837
4903
|
if (E) {
|
|
4838
|
-
const
|
|
4839
|
-
|
|
4904
|
+
const S = document.createElement("a");
|
|
4905
|
+
S.className = "dest", S.href = m.href, S.target = "_blank", S.rel = "noopener noreferrer", S.textContent = E, d.appendChild(S);
|
|
4840
4906
|
}
|
|
4841
4907
|
this.verifiersEl.appendChild(d);
|
|
4842
4908
|
});
|
|
@@ -4853,7 +4919,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4853
4919
|
return "generic";
|
|
4854
4920
|
}
|
|
4855
4921
|
channelLabel(i, s) {
|
|
4856
|
-
const a =
|
|
4922
|
+
const a = X(s), h = this.channelClass(i);
|
|
4857
4923
|
if (h === "email") return a.labels.email;
|
|
4858
4924
|
if (h === "whatsapp") return a.labels.whatsapp;
|
|
4859
4925
|
try {
|
|
@@ -4864,7 +4930,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4864
4930
|
}
|
|
4865
4931
|
}
|
|
4866
4932
|
destinationText(i, s) {
|
|
4867
|
-
const h =
|
|
4933
|
+
const h = X(s).ui.toPrefix ?? "to";
|
|
4868
4934
|
try {
|
|
4869
4935
|
const d = new URL(i, window.location.origin);
|
|
4870
4936
|
if (d.protocol === "mailto:") {
|
|
@@ -4895,7 +4961,7 @@ const ve = class ve extends HTMLElement {
|
|
|
4895
4961
|
return null;
|
|
4896
4962
|
}
|
|
4897
4963
|
labelForUrl(i, s) {
|
|
4898
|
-
const a =
|
|
4964
|
+
const a = X(s);
|
|
4899
4965
|
try {
|
|
4900
4966
|
const h = new URL(i, window.location.origin);
|
|
4901
4967
|
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(":", "");
|
|
@@ -4904,19 +4970,19 @@ const ve = class ve extends HTMLElement {
|
|
|
4904
4970
|
}
|
|
4905
4971
|
}
|
|
4906
4972
|
buildLink(i, s) {
|
|
4907
|
-
const a = this.lastCode, h =
|
|
4973
|
+
const a = this.lastCode, h = X(s), d = window.location.host;
|
|
4908
4974
|
if (!a) return i;
|
|
4909
4975
|
if (i.startsWith("mailto:")) {
|
|
4910
|
-
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), E = this.applyTemplate(h.templates.emailSubject, d, a),
|
|
4911
|
-
y.set("subject", E), y.set("body",
|
|
4912
|
-
const
|
|
4913
|
-
return `${m}?${
|
|
4976
|
+
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), E = this.applyTemplate(h.templates.emailSubject, d, a), S = this.applyTemplate(h.templates.emailBody, d, a);
|
|
4977
|
+
y.set("subject", E), y.set("body", S);
|
|
4978
|
+
const O = this.toQuery(y);
|
|
4979
|
+
return `${m}?${O}`;
|
|
4914
4980
|
}
|
|
4915
4981
|
if (i.startsWith("whatsapp:") || i.startsWith("whatsapp://")) {
|
|
4916
4982
|
const [m, g = ""] = i.split("?"), y = new URLSearchParams(g), E = this.applyTemplate(h.templates.whatsappText, d, a);
|
|
4917
4983
|
y.set("text", E);
|
|
4918
|
-
const
|
|
4919
|
-
return `${m}?${
|
|
4984
|
+
const S = this.toQuery(y);
|
|
4985
|
+
return `${m}?${S}`;
|
|
4920
4986
|
}
|
|
4921
4987
|
return i;
|
|
4922
4988
|
}
|