@braze/web-sdk 6.11.0 → 6.12.0
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/index.d.ts +36 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +4 -4
- package/shared-lib/indexed-db-adapter.js +51 -51
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +9 -9
- package/src/DUST/dust-config-store.js +89 -0
- package/src/DUST/dust-connection-core.js +7 -21
- package/src/DUST/dust-message-dedup.js +33 -0
- package/src/DUST/dust-provider.js +367 -397
- package/src/DUST/dust-tab-identity.js +30 -0
- package/src/DUST/index.js +7 -9
- package/src/DUST/subscribe-to-dust.js +5 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +5 -5
- package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
- package/src/FeatureFlags/feature-flags-provider.js +74 -74
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +42 -42
- package/src/InAppMessage/display/modal-utils.js +14 -14
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +73 -73
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +9 -9
- package/src/InAppMessage/models/html-message.js +4 -4
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +52 -52
- package/src/InAppMessage/models/modal-message.js +7 -7
- package/src/InAppMessage/models/slide-up-message.js +11 -11
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/show-in-app-message.js +36 -36
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +6 -6
- package/src/Push/push-manager.js +14 -14
- package/src/Push/unregister-push-token-on-server.js +3 -3
- package/src/Push/utils/push-utils.js +10 -10
- package/src/User/user.js +19 -19
- package/src/common/content-cards-display.js +21 -21
- package/src/common/event-logger.js +2 -2
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +5 -5
- package/src/managers/auth-manager.js +1 -1
- package/src/managers/braze-instance.js +41 -41
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +108 -108
- package/src/managers/server-config-manager.js +83 -83
- package/src/managers/session-manager.js +6 -6
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +127 -125
- package/src/managers/subscription-manager.js +1 -1
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +39 -39
- package/src/triggers/models/filter.js +58 -58
- package/src/triggers/models/in-app-message-click-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger.js +37 -37
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +50 -50
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +2 -2
- package/src/util/browser-detector.js +15 -15
- package/src/util/client-hints-parser.js +5 -5
- package/src/util/component-utils.js +4 -4
- package/src/util/dom-utils.js +5 -5
- package/src/util/ecommerce-event-validation.js +77 -48
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +20 -20
- package/src/util/string-utils.js +5 -0
- package/src/util/user-agent-parser.js +18 -18
- package/src/util/validation-utils.js +4 -4
- package/src/util/window-utils.js +2 -2
- package/src/DUST/dust-shared-worker-code.js +0 -2
- package/src/DUST/dust-shared-worker-impl.js +0 -234
- package/src/DUST/dust-worker-bridge.js +0 -151
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
const oe = self;
|
|
2
|
-
let te = null,
|
|
3
|
-
le = null,
|
|
4
|
-
ce = 0,
|
|
5
|
-
ae = null,
|
|
6
|
-
ie = !1;
|
|
7
|
-
const se = new Map();
|
|
8
|
-
let ue = null,
|
|
9
|
-
me = null,
|
|
10
|
-
de = null,
|
|
11
|
-
fe = null,
|
|
12
|
-
pe = null;
|
|
13
|
-
const Te = { Tn: null, qe: null };
|
|
14
|
-
function Re(e) {
|
|
15
|
-
se.forEach((n, o) => {
|
|
16
|
-
try {
|
|
17
|
-
n.port.postMessage(e);
|
|
18
|
-
} catch (e) {
|
|
19
|
-
se.delete(o);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function a(e, n) {
|
|
24
|
-
return Math.floor(Math.random() * (n - e + 1)) + e;
|
|
25
|
-
}
|
|
26
|
-
function ge() {
|
|
27
|
-
if (fe && se.has(fe)) return;
|
|
28
|
-
const e = se.keys().next().value;
|
|
29
|
-
(fe = e || null),
|
|
30
|
-
fe && console.log("[Braze Real-Time] Elected leader port:", fe);
|
|
31
|
-
}
|
|
32
|
-
function he(e) {
|
|
33
|
-
if ((ge(), !fe))
|
|
34
|
-
return void console.warn("[Braze Real-Time] No leader to send message to");
|
|
35
|
-
const n = se.get(fe);
|
|
36
|
-
if (n)
|
|
37
|
-
try {
|
|
38
|
-
n.port.postMessage(e);
|
|
39
|
-
} catch (n) {
|
|
40
|
-
se.delete(fe), (fe = null), he(e);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function ze() {
|
|
44
|
-
(ie = !1),
|
|
45
|
-
null !== ae && (clearTimeout(ae), (ae = null)),
|
|
46
|
-
null !== de && (clearTimeout(de), (de = null)),
|
|
47
|
-
null !== pe && (clearTimeout(pe), (pe = null)),
|
|
48
|
-
te && (te.close(), (te = null), Re({ type: "disconnected" }));
|
|
49
|
-
}
|
|
50
|
-
function Be() {
|
|
51
|
-
if (!le) return;
|
|
52
|
-
ce++;
|
|
53
|
-
const { Rn: e, zn: n, Bn: o } = le.Mn;
|
|
54
|
-
let t = ue;
|
|
55
|
-
(null == t || t < e) && (t = e);
|
|
56
|
-
const l = Math.min(n, a(e, t * o));
|
|
57
|
-
(ue = l),
|
|
58
|
-
console.log(`[Braze Real-Time] Retrying in ${l}ms (attempt ${ce}/5)`),
|
|
59
|
-
(ae = setTimeout(function () {
|
|
60
|
-
(ae = null), Te.Tn();
|
|
61
|
-
}, l));
|
|
62
|
-
}
|
|
63
|
-
function ye(e) {
|
|
64
|
-
if (!le) return;
|
|
65
|
-
if (te && !e)
|
|
66
|
-
return void console.warn("[Braze Real-Time] Connection already exists");
|
|
67
|
-
if (ie && !e)
|
|
68
|
-
return void console.warn(
|
|
69
|
-
"[Braze Real-Time] Connection attempt already in progress",
|
|
70
|
-
);
|
|
71
|
-
ie = !0;
|
|
72
|
-
const { Wi: n, mite: o, auth: t } = le,
|
|
73
|
-
l = /^https?:\/\//i.test(n) ? n : `https://${n}`;
|
|
74
|
-
let c = `mite=${encodeURIComponent(o)}&attempts=${ce}`;
|
|
75
|
-
t && (c += `&auth=${encodeURIComponent(t)}`),
|
|
76
|
-
me && (c += `&rcs=${encodeURIComponent(me)}`);
|
|
77
|
-
const r = `${l}/sse?${c}`;
|
|
78
|
-
try {
|
|
79
|
-
const n = new EventSource(r);
|
|
80
|
-
(n.onopen = function () {
|
|
81
|
-
e
|
|
82
|
-
? (console.log(
|
|
83
|
-
"[Braze Real-Time] Gapless reconnection: new connection established, closing old connection",
|
|
84
|
-
),
|
|
85
|
-
e.close())
|
|
86
|
-
: console.log("[Braze Real-Time] Connection established"),
|
|
87
|
-
(te = n),
|
|
88
|
-
(ie = !1),
|
|
89
|
-
(ce = 0),
|
|
90
|
-
(ue = null),
|
|
91
|
-
Re({ type: "connected" });
|
|
92
|
-
}),
|
|
93
|
-
n.addEventListener("msg", function (e) {
|
|
94
|
-
Te.qe(e.data);
|
|
95
|
-
}),
|
|
96
|
-
(n.onerror = function () {
|
|
97
|
-
if (
|
|
98
|
-
(0 === (n ? n.readyState : -1)
|
|
99
|
-
? console.log("[Braze Real-Time] Failed to connect")
|
|
100
|
-
: console.log("[Braze Real-Time] Connection lost"),
|
|
101
|
-
e && te !== n)
|
|
102
|
-
)
|
|
103
|
-
return (
|
|
104
|
-
console.log(
|
|
105
|
-
"[Braze Real-Time] Gapless reconnection failed, keeping old connection",
|
|
106
|
-
),
|
|
107
|
-
n.close(),
|
|
108
|
-
(ie = !1),
|
|
109
|
-
void (ce < 5 && Be())
|
|
110
|
-
);
|
|
111
|
-
ze(),
|
|
112
|
-
ce < 5
|
|
113
|
-
? Be()
|
|
114
|
-
: (console.error("[Braze Real-Time] Max retries reached"),
|
|
115
|
-
Re({ type: "error", error: "Max retry attempts reached" }));
|
|
116
|
-
});
|
|
117
|
-
} catch (e) {
|
|
118
|
-
(ie = !1),
|
|
119
|
-
console.error("[Braze Real-Time] Failed to create EventSource:", e),
|
|
120
|
-
Re({ type: "error", error: String(e) });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function $e(e, n, o) {
|
|
124
|
-
switch (o.type) {
|
|
125
|
-
case "connect":
|
|
126
|
-
!le ||
|
|
127
|
-
(le.mite === o.Cn.mite && le.Wi === o.Cn.Wi) ||
|
|
128
|
-
(console.log("[Braze Real-Time] Config changed, reconnecting"),
|
|
129
|
-
ze(),
|
|
130
|
-
(ce = 0),
|
|
131
|
-
(ue = null),
|
|
132
|
-
(me = null)),
|
|
133
|
-
(le = o.Cn),
|
|
134
|
-
se.has(n) || se.set(n, { port: e }),
|
|
135
|
-
ge(),
|
|
136
|
-
te || ie ? te && e.postMessage({ type: "connected" }) : ye();
|
|
137
|
-
break;
|
|
138
|
-
case "disconnect":
|
|
139
|
-
se.delete(n),
|
|
140
|
-
n === fe && ((fe = null), ge()),
|
|
141
|
-
0 === se.size &&
|
|
142
|
-
(console.log("[Braze Real-Time] No more ports, closing connection"),
|
|
143
|
-
ze(),
|
|
144
|
-
(le = null),
|
|
145
|
-
(me = null),
|
|
146
|
-
(fe = null));
|
|
147
|
-
break;
|
|
148
|
-
case "tab_active":
|
|
149
|
-
!(function (e) {
|
|
150
|
-
se.has(e) &&
|
|
151
|
-
fe !== e &&
|
|
152
|
-
((fe = e),
|
|
153
|
-
console.log(
|
|
154
|
-
"[Braze Real-Time] Promoted to leader (tab became active):",
|
|
155
|
-
e,
|
|
156
|
-
));
|
|
157
|
-
})(n);
|
|
158
|
-
break;
|
|
159
|
-
case "ping":
|
|
160
|
-
e.postMessage({ type: "pong" });
|
|
161
|
-
break;
|
|
162
|
-
default:
|
|
163
|
-
console.warn("[Braze Real-Time] Unknown message type:", o.type);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
(Te.Tn = ye),
|
|
167
|
-
(Te.qe = function (e) {
|
|
168
|
-
try {
|
|
169
|
-
const t = JSON.parse(e);
|
|
170
|
-
if (!t.type)
|
|
171
|
-
return void console.warn("[Braze Real-Time] Message without type:", t);
|
|
172
|
-
if ("ttl" === t.type && t.body)
|
|
173
|
-
return (
|
|
174
|
-
(n = t.body.t_ms),
|
|
175
|
-
(o = t.body.rcs),
|
|
176
|
-
void (
|
|
177
|
-
"number" == typeof n &&
|
|
178
|
-
("string" == typeof o && (me = o),
|
|
179
|
-
console.log(
|
|
180
|
-
`[Braze Real-Time] TTL set to ${n}ms, will perform gapless reconnection when expired`,
|
|
181
|
-
),
|
|
182
|
-
null !== de && clearTimeout(de),
|
|
183
|
-
(de = setTimeout(function () {
|
|
184
|
-
(de = null),
|
|
185
|
-
console.log(
|
|
186
|
-
"[Braze Real-Time] TTL expired, performing gapless reconnection",
|
|
187
|
-
),
|
|
188
|
-
ye(te || void 0);
|
|
189
|
-
}, n)))
|
|
190
|
-
)
|
|
191
|
-
);
|
|
192
|
-
if ("ddr" === t.type && t.body)
|
|
193
|
-
return void (function (e, n) {
|
|
194
|
-
if ("number" != typeof e) return;
|
|
195
|
-
const o = null == le ? void 0 : le.Mn,
|
|
196
|
-
t = (null == o ? void 0 : o.Rn) || 1e4,
|
|
197
|
-
l = (null == o ? void 0 : o.Bn) || 3,
|
|
198
|
-
c = (null == o ? void 0 : o.zn) || 3e5,
|
|
199
|
-
r = Math.min(c, a(t, t * l)),
|
|
200
|
-
i = Math.round(e + r),
|
|
201
|
-
s = n ? ` (${n})` : "";
|
|
202
|
-
console.log(
|
|
203
|
-
`[Braze Real-Time] Admin requested disconnect${s}, reconnecting in ${i}ms (r_ms=${e} + backoff=${r})`,
|
|
204
|
-
),
|
|
205
|
-
null !== pe && clearTimeout(pe),
|
|
206
|
-
ze(),
|
|
207
|
-
(pe = setTimeout(function () {
|
|
208
|
-
(pe = null), Te.Tn();
|
|
209
|
-
}, i));
|
|
210
|
-
})(t.body.r_ms, t.body.e);
|
|
211
|
-
console.log(`[Braze Real-Time] Routing '${t.type}' message to leader`),
|
|
212
|
-
he({ type: "message", data: t });
|
|
213
|
-
} catch (e) {
|
|
214
|
-
console.warn("[Braze Real-Time] Failed to parse message:", e);
|
|
215
|
-
}
|
|
216
|
-
var n, o;
|
|
217
|
-
}),
|
|
218
|
-
(oe.onconnect = function (e) {
|
|
219
|
-
const n = e.ports[0],
|
|
220
|
-
o = `port-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
221
|
-
se.set(o, { port: n }),
|
|
222
|
-
(n.onmessage = function (e) {
|
|
223
|
-
try {
|
|
224
|
-
$e(n, o, e.data);
|
|
225
|
-
} catch (e) {
|
|
226
|
-
console.error("[Braze Real-Time] Error handling message:", e);
|
|
227
|
-
}
|
|
228
|
-
}),
|
|
229
|
-
(n.onmessageerror = function () {
|
|
230
|
-
console.warn("[Braze Real-Time] Message error from port:", o),
|
|
231
|
-
se.delete(o);
|
|
232
|
-
}),
|
|
233
|
-
n.start();
|
|
234
|
-
});
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { logger as b } from "../../shared-lib/index.js";
|
|
2
|
-
import { DUST_SHARED_WORKER_CODE as ri } from "./dust-shared-worker-code.js";
|
|
3
|
-
export function isSharedWorkerSupported() {
|
|
4
|
-
return "undefined" != typeof SharedWorker;
|
|
5
|
-
}
|
|
6
|
-
export class DustWorkerBridge {
|
|
7
|
-
constructor(i) {
|
|
8
|
-
(this.Wr = null),
|
|
9
|
-
(this.Rr = null),
|
|
10
|
-
(this.isConnected = !1),
|
|
11
|
-
(this.Mr = null),
|
|
12
|
-
(this.Lr = null),
|
|
13
|
-
(this.Pe = i.Pe),
|
|
14
|
-
(this.He = i.He),
|
|
15
|
-
(this.Le = i.Le),
|
|
16
|
-
(this.Oe = i.Oe);
|
|
17
|
-
}
|
|
18
|
-
initialize() {
|
|
19
|
-
if (!isSharedWorkerSupported())
|
|
20
|
-
return (
|
|
21
|
-
b.info("SharedWorker not supported, will use direct connection"), !1
|
|
22
|
-
);
|
|
23
|
-
try {
|
|
24
|
-
const i = new Blob([ri], { type: "application/javascript" });
|
|
25
|
-
return (
|
|
26
|
-
(this.Rr = URL.createObjectURL(i)),
|
|
27
|
-
(this.Wr = new SharedWorker(this.Rr, { name: "braze-dust-worker" })),
|
|
28
|
-
(this.Wr.port.onmessage = (i) => {
|
|
29
|
-
this.Ir(i.data);
|
|
30
|
-
}),
|
|
31
|
-
(this.Wr.port.onmessageerror = () => {
|
|
32
|
-
b.warn("Message error from real-time messaging worker");
|
|
33
|
-
}),
|
|
34
|
-
(this.Wr.onerror = (i) => {
|
|
35
|
-
var e;
|
|
36
|
-
b.error(
|
|
37
|
-
`Real-time messaging worker error: ${i.message || "unknown error"}`,
|
|
38
|
-
),
|
|
39
|
-
null === (e = this.Oe) ||
|
|
40
|
-
void 0 === e ||
|
|
41
|
-
e.call(this, "SharedWorker error");
|
|
42
|
-
}),
|
|
43
|
-
this.Wr.port.start(),
|
|
44
|
-
this.Ur(),
|
|
45
|
-
this.Vr(),
|
|
46
|
-
b.info("Real-time messaging worker initialized"),
|
|
47
|
-
!0
|
|
48
|
-
);
|
|
49
|
-
} catch (i) {
|
|
50
|
-
return (
|
|
51
|
-
b.error(
|
|
52
|
-
`Failed to create real-time messaging worker: ${
|
|
53
|
-
i instanceof Error ? i.message : String(i)
|
|
54
|
-
}`,
|
|
55
|
-
),
|
|
56
|
-
this._r(),
|
|
57
|
-
!1
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
Ir(i) {
|
|
62
|
-
var e, t, s;
|
|
63
|
-
switch (i.type) {
|
|
64
|
-
case "connected":
|
|
65
|
-
b.info("Real-time messaging connection established via SharedWorker"),
|
|
66
|
-
(this.isConnected = !0),
|
|
67
|
-
null === (e = this.He) || void 0 === e || e.call(this);
|
|
68
|
-
break;
|
|
69
|
-
case "disconnected":
|
|
70
|
-
b.info("Real-time messaging connection closed via SharedWorker"),
|
|
71
|
-
(this.isConnected = !1),
|
|
72
|
-
null === (t = this.Le) || void 0 === t || t.call(this);
|
|
73
|
-
break;
|
|
74
|
-
case "message": {
|
|
75
|
-
const e = i.data,
|
|
76
|
-
t = { type: e.type };
|
|
77
|
-
null != e.body && (t.body = e.body), this.Pe(t);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
case "error":
|
|
81
|
-
b.error(`Real-time messaging error: ${i.error}`),
|
|
82
|
-
null === (s = this.Oe) || void 0 === s || s.call(this, i.error);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
Ur() {
|
|
86
|
-
this.Mr = window.setInterval(() => {
|
|
87
|
-
this.Wr && this.Gr({ type: "ping" });
|
|
88
|
-
}, 3e4);
|
|
89
|
-
}
|
|
90
|
-
Jr() {
|
|
91
|
-
null !== this.Mr && (window.clearInterval(this.Mr), (this.Mr = null));
|
|
92
|
-
}
|
|
93
|
-
Vr() {
|
|
94
|
-
(this.Lr = () => {
|
|
95
|
-
"visible" === document.visibilityState &&
|
|
96
|
-
this.Wr &&
|
|
97
|
-
this.Gr({ type: "tab_active" });
|
|
98
|
-
}),
|
|
99
|
-
document.addEventListener("visibilitychange", this.Lr);
|
|
100
|
-
}
|
|
101
|
-
Kr() {
|
|
102
|
-
this.Lr &&
|
|
103
|
-
(document.removeEventListener("visibilitychange", this.Lr),
|
|
104
|
-
(this.Lr = null));
|
|
105
|
-
}
|
|
106
|
-
Gr(i) {
|
|
107
|
-
this.Wr && this.Wr.port.postMessage(i);
|
|
108
|
-
}
|
|
109
|
-
connect(i) {
|
|
110
|
-
this.Wr
|
|
111
|
-
? (this.Gr({
|
|
112
|
-
type: "connect",
|
|
113
|
-
config: {
|
|
114
|
-
mite: i.mite,
|
|
115
|
-
dustHost: i.dustHost,
|
|
116
|
-
auth: i.auth,
|
|
117
|
-
backoff: {
|
|
118
|
-
minSleepMs: i.backoff.minSleepMs,
|
|
119
|
-
maxSleepMs: i.backoff.maxSleepMs,
|
|
120
|
-
scaleFactor: i.backoff.scaleFactor,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
}),
|
|
124
|
-
b.info("Connecting to real-time messaging"))
|
|
125
|
-
: b.error("Cannot connect: real-time messaging worker not initialized");
|
|
126
|
-
}
|
|
127
|
-
disconnect() {
|
|
128
|
-
this.Wr &&
|
|
129
|
-
(this.Gr({ type: "disconnect" }),
|
|
130
|
-
(this.isConnected = !1),
|
|
131
|
-
b.info("Disconnecting from real-time messaging"));
|
|
132
|
-
}
|
|
133
|
-
Ke() {
|
|
134
|
-
return this.isConnected;
|
|
135
|
-
}
|
|
136
|
-
isInitialized() {
|
|
137
|
-
return null !== this.Wr;
|
|
138
|
-
}
|
|
139
|
-
_r() {
|
|
140
|
-
this.Jr(),
|
|
141
|
-
this.Kr(),
|
|
142
|
-
this.Wr && (this.Wr.port.close(), (this.Wr = null)),
|
|
143
|
-
this.Rr && (URL.revokeObjectURL(this.Rr), (this.Rr = null)),
|
|
144
|
-
(this.isConnected = !1);
|
|
145
|
-
}
|
|
146
|
-
destroy() {
|
|
147
|
-
this.disconnect(),
|
|
148
|
-
this._r(),
|
|
149
|
-
b.info("Real-time messaging worker destroyed");
|
|
150
|
-
}
|
|
151
|
-
}
|