@braze/web-sdk 5.1.1 → 5.3.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 +65 -10
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +52 -52
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +22 -21
- package/src/ContentCards/content-cards-provider.js +107 -135
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +2 -2
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/FeatureFlags/feature-flag.js +41 -30
- package/src/FeatureFlags/feature-flags-provider.js +88 -84
- 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 +2 -2
- package/src/Feed/feed-provider.js +24 -24
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +45 -42
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +23 -21
- package/src/InAppMessage/in-app-message-manager.js +95 -112
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +4 -2
- package/src/InAppMessage/models/full-screen-message.js +14 -11
- package/src/InAppMessage/models/html-message.js +11 -9
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +127 -120
- package/src/InAppMessage/models/modal-message.js +14 -11
- package/src/InAppMessage/models/slide-up-message.js +46 -21
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +37 -43
- package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +118 -110
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +19 -19
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +0 -2
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +12 -12
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +27 -27
- package/src/managers/braze-instance.js +119 -112
- package/src/managers/device-manager.js +19 -19
- package/src/managers/network-manager.js +215 -165
- package/src/managers/server-config-manager.js +46 -50
- package/src/managers/session-manager.js +21 -21
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +128 -125
- package/src/managers/utils.js +6 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +19 -11
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +34 -20
- package/src/models/push-token.js +4 -4
- package/src/models/server-config.js +24 -24
- package/src/request-controller.js +134 -124
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +56 -56
- package/src/triggers/models/in-app-message-click-data.js +8 -8
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +30 -30
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +84 -95
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +25 -24
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/component-utils.js +2 -2
- package/src/util/device-constants.js +2 -2
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +36 -37
- package/src/util/user-agent-parser.js +8 -8
- package/src/util/validation-utils.js +2 -0
- package/src/util/window-utils.js +3 -3
package/src/models/device.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class zt {
|
|
2
2
|
constructor(s) {
|
|
3
3
|
(this.id = s), (this.id = s);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Ir() {
|
|
6
6
|
const s = {};
|
|
7
7
|
return (
|
|
8
8
|
null != this.browser && (s.browser = this.browser),
|
|
9
|
-
null != this.
|
|
9
|
+
null != this.Ia && (s.browser_version = this.Ia),
|
|
10
10
|
null != this.os && (s.os_version = this.os),
|
|
11
11
|
null != this.resolution && (s.resolution = this.resolution),
|
|
12
12
|
null != this.language && (s.locale = this.language),
|
package/src/models/identifier.js
CHANGED
|
@@ -2,38 +2,52 @@ import { Guid as p, logger as r } from "../../shared-lib/index.js";
|
|
|
2
2
|
import { isArray as j } from "../util/code-utils.js";
|
|
3
3
|
import { getErrorMessage as si } from "../util/error-utils.js";
|
|
4
4
|
export default class _t {
|
|
5
|
-
constructor(t,
|
|
5
|
+
constructor(t, e, i) {
|
|
6
6
|
(this.eu = t),
|
|
7
7
|
null == t && (t = p.W()),
|
|
8
|
-
!
|
|
8
|
+
!i || isNaN(i) ? (this.Dl = new Date().valueOf()) : (this.Dl = i),
|
|
9
9
|
(this.eu = t),
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.Wl = new Date().valueOf()),
|
|
11
|
+
(this.Hl = e);
|
|
12
12
|
}
|
|
13
13
|
Y() {
|
|
14
|
-
return `g:${this.eu}|e:${this.
|
|
14
|
+
return `g:${encodeURIComponent(this.eu)}|e:${this.Hl}|c:${this.Dl}|l:${
|
|
15
|
+
this.Wl
|
|
16
|
+
}`;
|
|
15
17
|
}
|
|
16
|
-
static
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
static hE(t) {
|
|
19
|
+
if ("string" != typeof t) return null;
|
|
20
|
+
const e = t.lastIndexOf("|e:"),
|
|
21
|
+
i = t.substring(0, e),
|
|
22
|
+
r = i.split("g:")[1];
|
|
23
|
+
let n;
|
|
24
|
+
return (
|
|
25
|
+
(n = /[|:]/.test(r) ? encodeURIComponent(r) : r),
|
|
26
|
+
(t = t.replace(i, `g:${n}`))
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
static qn(t) {
|
|
30
|
+
let e;
|
|
31
|
+
if ("string" == typeof t)
|
|
21
32
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
const i = t.split("|");
|
|
34
|
+
if (!j(i) || 4 !== i.length) return null;
|
|
35
|
+
const r = (t) => t.split(":")[1],
|
|
36
|
+
n = (t) => {
|
|
37
|
+
const e = parseInt(r(t));
|
|
38
|
+
if (!isNaN(e)) return e;
|
|
26
39
|
};
|
|
27
|
-
(
|
|
28
|
-
|
|
40
|
+
(e = new _t(decodeURIComponent(r(i[0])), n(i[1]), n(i[2]))),
|
|
41
|
+
(e.Wl = n(i[3]));
|
|
42
|
+
} catch (e) {
|
|
29
43
|
r.info(
|
|
30
|
-
`Unable to parse cookie string ${t}, failed with error: ${si(
|
|
44
|
+
`Unable to parse cookie string ${t}, failed with error: ${si(e)}`,
|
|
31
45
|
);
|
|
32
46
|
}
|
|
33
|
-
|
|
47
|
+
else {
|
|
34
48
|
if (null == t || null == t.g) return null;
|
|
35
|
-
(
|
|
49
|
+
(e = new _t(t.g, t.e, t.c)), (e.Wl = t.l);
|
|
36
50
|
}
|
|
37
|
-
return
|
|
51
|
+
return e;
|
|
38
52
|
}
|
|
39
53
|
}
|
package/src/models/push-token.js
CHANGED
|
@@ -2,12 +2,12 @@ import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
|
|
|
2
2
|
export default class ti {
|
|
3
3
|
constructor(t, i, s, l, h) {
|
|
4
4
|
(this.endpoint = t),
|
|
5
|
-
(this.
|
|
5
|
+
(this.Vn = i),
|
|
6
6
|
(this.publicKey = s),
|
|
7
7
|
(this.Vl = l),
|
|
8
8
|
(this.cl = h),
|
|
9
9
|
(this.endpoint = t || null),
|
|
10
|
-
(this.
|
|
10
|
+
(this.Vn = i || null),
|
|
11
11
|
(this.publicKey = s || null),
|
|
12
12
|
(this.Vl = l || null),
|
|
13
13
|
(this.cl = h || null);
|
|
@@ -15,13 +15,13 @@ export default class ti {
|
|
|
15
15
|
Y() {
|
|
16
16
|
return {
|
|
17
17
|
e: this.endpoint,
|
|
18
|
-
c: this.
|
|
18
|
+
c: this.Vn,
|
|
19
19
|
p: this.publicKey,
|
|
20
20
|
u: this.Vl,
|
|
21
21
|
v: this.cl,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
static
|
|
24
|
+
static qn(t) {
|
|
25
25
|
return new ti(t.e, w(t.c), t.p, t.u, t.v);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -2,56 +2,56 @@ import {
|
|
|
2
2
|
GLOBAL_RATE_LIMIT_CAPACITY_DEFAULT as Qt,
|
|
3
3
|
GLOBAL_RATE_LIMIT_REFILL_RATE_DEFAULT as Yt,
|
|
4
4
|
} from "../common/constants.js";
|
|
5
|
-
export default class
|
|
5
|
+
export default class Ht {
|
|
6
6
|
constructor(
|
|
7
7
|
t = 0,
|
|
8
8
|
i = [],
|
|
9
9
|
s = [],
|
|
10
10
|
h = [],
|
|
11
11
|
e = null,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
r = null,
|
|
13
|
+
l = { enabled: !1 },
|
|
14
14
|
a = { enabled: !1, refresh_rate_limit: void 0 },
|
|
15
|
-
n = { enabled: !0, capacity: Qt, refill_rate: Yt },
|
|
15
|
+
n = { enabled: !0, capacity: Qt, refill_rate: Yt, endpoint_overrides: {} },
|
|
16
16
|
) {
|
|
17
|
-
(this.
|
|
17
|
+
(this.hl = t),
|
|
18
18
|
(this.gl = i),
|
|
19
19
|
(this.fl = s),
|
|
20
20
|
(this.bl = h),
|
|
21
|
-
(this.
|
|
22
|
-
(this.cl =
|
|
23
|
-
(this.ml =
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
21
|
+
(this.Rl = e),
|
|
22
|
+
(this.cl = r),
|
|
23
|
+
(this.ml = l),
|
|
24
|
+
(this.hi = a),
|
|
25
|
+
(this.ol = n),
|
|
26
|
+
(this.hl = t),
|
|
27
27
|
(this.gl = i),
|
|
28
28
|
(this.fl = s),
|
|
29
29
|
(this.bl = h),
|
|
30
|
-
(this.
|
|
31
|
-
(this.cl =
|
|
32
|
-
(this.ml =
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
30
|
+
(this.Rl = e),
|
|
31
|
+
(this.cl = r),
|
|
32
|
+
(this.ml = l),
|
|
33
|
+
(this.hi = a),
|
|
34
|
+
(this.ol = n);
|
|
35
35
|
}
|
|
36
36
|
Y() {
|
|
37
37
|
return {
|
|
38
|
-
s: "5.
|
|
39
|
-
l: this.
|
|
38
|
+
s: "5.3.0",
|
|
39
|
+
l: this.hl,
|
|
40
40
|
e: this.gl,
|
|
41
41
|
a: this.fl,
|
|
42
42
|
p: this.bl,
|
|
43
|
-
m: this.
|
|
43
|
+
m: this.Rl,
|
|
44
44
|
v: this.cl,
|
|
45
45
|
c: this.ml,
|
|
46
|
-
f: this.
|
|
47
|
-
grl: this.
|
|
46
|
+
f: this.hi,
|
|
47
|
+
grl: this.ol,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
static
|
|
50
|
+
static qn(t) {
|
|
51
51
|
let i = t.l;
|
|
52
52
|
return (
|
|
53
|
-
"5.
|
|
54
|
-
new
|
|
53
|
+
"5.3.0" !== t.s && (i = 0),
|
|
54
|
+
new Ht(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f, t.grl)
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import C from "./util/net.js";
|
|
2
2
|
import ue from "./models/braze-event.js";
|
|
3
3
|
import s from "./common/event-logger.js";
|
|
4
|
-
import { randomInclusive as
|
|
4
|
+
import { randomInclusive as U } from "./util/math.js";
|
|
5
5
|
import t from "./models/request-result.js";
|
|
6
6
|
import {
|
|
7
7
|
logger as r,
|
|
@@ -12,173 +12,180 @@ import {
|
|
|
12
12
|
import { STORAGE_KEYS as o } from "./managers/storage-manager.js";
|
|
13
13
|
import T from "./managers/subscription-manager.js";
|
|
14
14
|
import vt from "./Push/utils/push-utils.js";
|
|
15
|
-
import
|
|
15
|
+
import D from "./util/request-header-utils.js";
|
|
16
16
|
export default class Lt {
|
|
17
17
|
constructor(t, i, s, e, h, o, n, r, u, l) {
|
|
18
|
-
(this.
|
|
18
|
+
(this.rn = t),
|
|
19
19
|
(this.baseUrl = i),
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
20
|
+
(this.ri = s),
|
|
21
|
+
(this.on = e),
|
|
22
22
|
(this.wt = h),
|
|
23
23
|
(this.yt = o),
|
|
24
24
|
(this.u = n),
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
25
|
+
(this.wu = r),
|
|
26
|
+
(this.zo = u),
|
|
27
27
|
(this.qt = l),
|
|
28
|
-
(this.
|
|
28
|
+
(this.rn = t),
|
|
29
29
|
(this.baseUrl = i),
|
|
30
|
-
(this.
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
30
|
+
(this.yu = 0),
|
|
31
|
+
(this.fE = n.dE() || 0),
|
|
32
|
+
(this.ju = null),
|
|
33
|
+
(this.ri = s),
|
|
34
|
+
(this.on = e),
|
|
35
35
|
(this.wt = h),
|
|
36
36
|
(this.yt = o),
|
|
37
37
|
(this.u = n),
|
|
38
|
-
(this.
|
|
38
|
+
(this.zo = u),
|
|
39
39
|
(this.qt = l),
|
|
40
|
-
(this.
|
|
41
|
-
(this.
|
|
42
|
-
(this
|
|
43
|
-
(this.
|
|
44
|
-
(this.
|
|
40
|
+
(this.wu = r),
|
|
41
|
+
(this.Su = new T()),
|
|
42
|
+
(this.$u = null),
|
|
43
|
+
(this.Cu = 50),
|
|
44
|
+
(this.Fu = !1);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
return !t && !i && this.
|
|
46
|
+
Lu(t, i) {
|
|
47
|
+
return !t && !i && this.zo.Gh() >= this.Cu;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
let s = this.
|
|
49
|
+
Mu(t) {
|
|
50
|
+
let s = this.ri.Gl();
|
|
51
51
|
if (t.length > 0) {
|
|
52
52
|
const e = this.wt.getUserId();
|
|
53
53
|
for (const h of t) {
|
|
54
54
|
const t = (!h.userId && !e) || h.userId === e;
|
|
55
|
-
h.type === i.
|
|
55
|
+
h.type === i.ql && t && (s = !0);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
return s;
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
s && this.
|
|
62
|
-
const a = this.u.
|
|
63
|
-
c = this.u.
|
|
60
|
+
Pu(t = !1, i = !1, s = !0, e, h, n, u = !1, l = !1) {
|
|
61
|
+
s && this.xu();
|
|
62
|
+
const a = this.u.AE(),
|
|
63
|
+
c = this.u.OE();
|
|
64
64
|
let d = !1;
|
|
65
|
-
const
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const m = (t, i, r = -1) => {
|
|
66
|
+
let u = !1;
|
|
67
|
+
const l = new Date().valueOf();
|
|
68
|
+
D._s(this.u, D.Ps.$a, l),
|
|
69
|
+
-1 !== r && i.push(["X-Braze-Req-Tokens-Remaining", r.toString()]),
|
|
70
|
+
C.Gs({
|
|
69
71
|
url: this.baseUrl + "/data/",
|
|
70
72
|
data: t,
|
|
71
73
|
headers: i,
|
|
72
74
|
L: (s) => {
|
|
73
75
|
null != t.respond_with &&
|
|
74
76
|
t.respond_with.triggers &&
|
|
75
|
-
(this.
|
|
76
|
-
this.qt.
|
|
77
|
-
? (this.
|
|
78
|
-
this.yt.
|
|
77
|
+
(this.yu = Math.max(this.yu - 1, 0)),
|
|
78
|
+
this.qt.Ks(t, s, i)
|
|
79
|
+
? (this.zo.Os(),
|
|
80
|
+
this.yt.al(s),
|
|
79
81
|
(null != t.respond_with &&
|
|
80
82
|
t.respond_with.user_id != this.wt.getUserId()) ||
|
|
81
|
-
(null != t.device && this.u.k(o.C.
|
|
83
|
+
(null != t.device && this.u.k(o.C.Ca, t.device),
|
|
82
84
|
null != t.sdk_metadata &&
|
|
83
|
-
(this.u.k(o.C.
|
|
84
|
-
this.u.k(o.C
|
|
85
|
-
this.
|
|
86
|
-
|
|
85
|
+
(this.u.k(o.C.Yh, t.sdk_metadata),
|
|
86
|
+
this.u.k(o.C.Jh, this.ri.Si())),
|
|
87
|
+
this.wu(s),
|
|
88
|
+
D.Qs(this.u, D.Ps.$a, 1),
|
|
87
89
|
"function" == typeof e && e()))
|
|
88
|
-
: s.auth_error && (
|
|
90
|
+
: s.auth_error && (u = !0);
|
|
89
91
|
},
|
|
90
92
|
error: () => {
|
|
91
93
|
null != t.respond_with &&
|
|
92
94
|
t.respond_with.triggers &&
|
|
93
|
-
(this.
|
|
94
|
-
this.qt.
|
|
95
|
+
(this.yu = Math.max(this.yu - 1, 0)),
|
|
96
|
+
this.qt.Qh(t.events, t.attributes),
|
|
95
97
|
"function" == typeof h && h();
|
|
96
98
|
},
|
|
97
|
-
|
|
99
|
+
Ws: (t) => {
|
|
98
100
|
if (("function" == typeof n && n(t), s && !d)) {
|
|
99
|
-
if (t && !
|
|
101
|
+
if (t && !u) this.Iu();
|
|
100
102
|
else {
|
|
101
|
-
|
|
102
|
-
let t = this.
|
|
103
|
-
(null == t || t < 1e3 * this.
|
|
104
|
-
this.
|
|
103
|
+
D.Ys(this.u, D.Ps.$a);
|
|
104
|
+
let t = this.ju;
|
|
105
|
+
(null == t || t < 1e3 * this.fE) && (t = 1e3 * this.fE),
|
|
106
|
+
this.Iu(Math.min(3e5, U(1e3 * this.fE, 3 * t)));
|
|
105
107
|
}
|
|
106
108
|
d = !0;
|
|
107
109
|
}
|
|
108
110
|
},
|
|
109
111
|
});
|
|
110
112
|
},
|
|
111
|
-
|
|
112
|
-
g = i ||
|
|
113
|
-
if (this
|
|
113
|
+
f = this.Mu(a),
|
|
114
|
+
g = i || f;
|
|
115
|
+
if (this.Lu(u, f))
|
|
114
116
|
return void r.info(
|
|
115
117
|
"Declining to flush data due to 50 consecutive authentication failures",
|
|
116
118
|
);
|
|
117
|
-
if (s && !this.qt.
|
|
118
|
-
return this.
|
|
119
|
-
const v = this.qt.
|
|
120
|
-
g && this.
|
|
119
|
+
if (s && !this.qt.Na(a, c, t, g))
|
|
120
|
+
return this.Iu(), void ("function" == typeof n && n(!0));
|
|
121
|
+
const v = this.qt.Xa(t, g, a, c, l);
|
|
122
|
+
g && this.yu++;
|
|
121
123
|
let p = !1;
|
|
122
124
|
if (v)
|
|
123
125
|
for (const t of v)
|
|
124
|
-
this.qt.
|
|
126
|
+
this.qt.Xs(
|
|
127
|
+
t.requestData,
|
|
128
|
+
(i) => m(t.requestData, t.headers, i),
|
|
129
|
+
D.Ps.$a,
|
|
130
|
+
h,
|
|
131
|
+
),
|
|
125
132
|
(p = !0);
|
|
126
|
-
this.
|
|
127
|
-
? this.
|
|
128
|
-
:
|
|
133
|
+
this.zo.Fh() && s && !p
|
|
134
|
+
? this.Iu()
|
|
135
|
+
: f && (r.info("Invoking new session subscriptions"), this.Su.Dt());
|
|
129
136
|
}
|
|
130
|
-
|
|
131
|
-
return this.
|
|
137
|
+
Nu() {
|
|
138
|
+
return this.yu > 0;
|
|
132
139
|
}
|
|
133
|
-
|
|
134
|
-
this.
|
|
135
|
-
(this.
|
|
136
|
-
(this
|
|
140
|
+
Iu(t = 1e3 * this.fE) {
|
|
141
|
+
this.Fu ||
|
|
142
|
+
(this.xu(),
|
|
143
|
+
(this.$u = window.setTimeout(() => {
|
|
137
144
|
if (document.hidden) {
|
|
138
145
|
const t = "visibilitychange",
|
|
139
146
|
i = () => {
|
|
140
147
|
document.hidden ||
|
|
141
|
-
(document.removeEventListener(t, i, !1), this.
|
|
148
|
+
(document.removeEventListener(t, i, !1), this.Pu());
|
|
142
149
|
};
|
|
143
150
|
document.addEventListener(t, i, !1);
|
|
144
|
-
} else this.
|
|
151
|
+
} else this.Pu();
|
|
145
152
|
}, t)),
|
|
146
|
-
(this.
|
|
153
|
+
(this.ju = t));
|
|
147
154
|
}
|
|
148
|
-
|
|
149
|
-
null != this
|
|
155
|
+
xu() {
|
|
156
|
+
null != this.$u && (clearTimeout(this.$u), (this.$u = null));
|
|
150
157
|
}
|
|
151
158
|
initialize() {
|
|
152
|
-
(this.
|
|
159
|
+
(this.Fu = !1), this.Iu();
|
|
153
160
|
}
|
|
154
161
|
destroy() {
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
158
|
-
(this.
|
|
159
|
-
this.
|
|
160
|
-
(this
|
|
162
|
+
this.Su.removeAllSubscriptions(),
|
|
163
|
+
this.zo.yh(),
|
|
164
|
+
this.xu(),
|
|
165
|
+
(this.Fu = !0),
|
|
166
|
+
this.Pu(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
|
|
167
|
+
(this.$u = null);
|
|
161
168
|
}
|
|
162
169
|
mr(t) {
|
|
163
|
-
return this.
|
|
170
|
+
return this.Su.It(t);
|
|
164
171
|
}
|
|
165
172
|
openSession() {
|
|
166
|
-
const t = this.
|
|
167
|
-
t && (this.u.
|
|
168
|
-
this.
|
|
169
|
-
this.u.
|
|
173
|
+
const t = this.ri.Si() !== this.ri.wo();
|
|
174
|
+
t && (this.u.cE(o.iu.Uo), this.u.cE(o.iu.su)),
|
|
175
|
+
this.Pu(void 0, !1, void 0, () => {
|
|
176
|
+
this.u.ti(o.C.vi);
|
|
170
177
|
}),
|
|
171
|
-
this.
|
|
178
|
+
this.Mn(),
|
|
172
179
|
t &&
|
|
173
180
|
import("./Push/push-manager-factory.js").then((t) => {
|
|
174
|
-
if (this.
|
|
181
|
+
if (this.Fu) return;
|
|
175
182
|
const i = t.default.m();
|
|
176
183
|
if (
|
|
177
184
|
null != i &&
|
|
178
185
|
(vt.isPushPermissionGranted() || vt.isPushBlocked())
|
|
179
186
|
) {
|
|
180
187
|
const t = () => {
|
|
181
|
-
i.
|
|
188
|
+
i.mn()
|
|
182
189
|
? r.info(
|
|
183
190
|
"Push token maintenance is disabled, not refreshing token for backend.",
|
|
184
191
|
)
|
|
@@ -188,7 +195,7 @@ export default class Lt {
|
|
|
188
195
|
s && t();
|
|
189
196
|
},
|
|
190
197
|
e = () => {
|
|
191
|
-
const i = this.u.j(o.C.
|
|
198
|
+
const i = this.u.j(o.C.In);
|
|
192
199
|
(null == i || i) && t();
|
|
193
200
|
},
|
|
194
201
|
h = A.Yt.Qt;
|
|
@@ -196,35 +203,36 @@ export default class Lt {
|
|
|
196
203
|
}
|
|
197
204
|
});
|
|
198
205
|
}
|
|
199
|
-
|
|
200
|
-
this.u.
|
|
206
|
+
Ou() {
|
|
207
|
+
this.u.ti(o.C.gi), this.u.ti(o.C.ws), this.u.ti(o.C.Cr);
|
|
201
208
|
}
|
|
202
209
|
changeUser(t, i, s) {
|
|
203
210
|
const e = this.wt.getUserId();
|
|
204
211
|
if (e !== t) {
|
|
205
|
-
this.
|
|
206
|
-
this.
|
|
207
|
-
null != e && this.
|
|
212
|
+
this.ri.yl(),
|
|
213
|
+
this.Ou(),
|
|
214
|
+
null != e && this.Pu(void 0, !1, void 0, void 0, void 0),
|
|
208
215
|
this.wt.ou(t),
|
|
209
|
-
s ? this.
|
|
216
|
+
s ? this.zo.setSdkAuthenticationSignature(s) : this.zo.xh();
|
|
210
217
|
for (let t = 0; t < i.length; t++) i[t].changeUser(null == e);
|
|
211
|
-
null != e && this.u.
|
|
212
|
-
this.u.
|
|
213
|
-
this.u.
|
|
218
|
+
null != e && this.u.ti(o.C.J),
|
|
219
|
+
this.u.ti(o.C.Ca),
|
|
220
|
+
this.u.ti(o.C.nE),
|
|
221
|
+
this.u.ti(o.C._E),
|
|
214
222
|
this.openSession(),
|
|
215
223
|
r.info('Changed user to "' + t + '".');
|
|
216
224
|
} else {
|
|
217
225
|
let i = "Doing nothing.";
|
|
218
226
|
s &&
|
|
219
|
-
this.
|
|
220
|
-
(this.
|
|
227
|
+
this.zo.kh() !== s &&
|
|
228
|
+
(this.zo.setSdkAuthenticationSignature(s),
|
|
221
229
|
(i = "Updated SDK authentication signature")),
|
|
222
230
|
r.info(`Current user is already ${t}. ${i}`);
|
|
223
231
|
}
|
|
224
232
|
}
|
|
225
233
|
requestImmediateDataFlush(t) {
|
|
226
|
-
this.
|
|
227
|
-
this.
|
|
234
|
+
this.xu(), this.ri.wo();
|
|
235
|
+
this.Pu(
|
|
228
236
|
void 0,
|
|
229
237
|
void 0,
|
|
230
238
|
void 0,
|
|
@@ -237,20 +245,22 @@ export default class Lt {
|
|
|
237
245
|
);
|
|
238
246
|
}
|
|
239
247
|
requestFeedRefresh() {
|
|
240
|
-
this.
|
|
248
|
+
this.ri.wo(), this.Pu(!0);
|
|
241
249
|
}
|
|
242
250
|
$r(t, i) {
|
|
243
|
-
this.
|
|
251
|
+
this.ri.wo(),
|
|
244
252
|
r.info("Requesting explicit trigger refresh."),
|
|
245
|
-
this.
|
|
253
|
+
this.Pu(void 0, !0, void 0, t, i);
|
|
246
254
|
}
|
|
247
|
-
|
|
248
|
-
const h = i.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
return
|
|
255
|
+
Cn(t, e) {
|
|
256
|
+
const h = i.zu,
|
|
257
|
+
n = { a: t, l: e },
|
|
258
|
+
u = s.q(h, n);
|
|
259
|
+
return (
|
|
260
|
+
u && (r.info(`Logged alias ${t} with label ${e}`), this.u.k(o.C._E, n)), u
|
|
261
|
+
);
|
|
252
262
|
}
|
|
253
|
-
|
|
263
|
+
Fn(i, e, h) {
|
|
254
264
|
if (this.yt.hu(e))
|
|
255
265
|
return (
|
|
256
266
|
r.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
|
|
@@ -268,7 +278,7 @@ export default class Lt {
|
|
|
268
278
|
null != o && (l.altitude = o),
|
|
269
279
|
null != n && (l.ll_accuracy = n),
|
|
270
280
|
null != u && (l.alt_accuracy = u);
|
|
271
|
-
const a = s.q(i.
|
|
281
|
+
const a = s.q(i.Uu, l, t || void 0);
|
|
272
282
|
return (
|
|
273
283
|
a &&
|
|
274
284
|
r.info(`Set user last known location as ${JSON.stringify(l, null, 2)}`),
|
|
@@ -276,30 +286,30 @@ export default class Lt {
|
|
|
276
286
|
);
|
|
277
287
|
}
|
|
278
288
|
kr(t, s) {
|
|
279
|
-
const e = this.
|
|
280
|
-
return new ue(this.wt.getUserId(), i.
|
|
289
|
+
const e = this.ri.wo();
|
|
290
|
+
return new ue(this.wt.getUserId(), i._u, t, e, { cid: s });
|
|
281
291
|
}
|
|
282
|
-
|
|
292
|
+
Bu(t, i) {
|
|
283
293
|
return new A(t, i);
|
|
284
294
|
}
|
|
285
|
-
|
|
295
|
+
Mn() {
|
|
286
296
|
const t = A.Yt.Qt;
|
|
287
|
-
this.
|
|
297
|
+
this.Bu(t, r).setItem(t.ss.$a, 1, {
|
|
288
298
|
baseUrl: this.baseUrl,
|
|
289
|
-
data: { api_key: this.
|
|
299
|
+
data: { api_key: this.rn, device_id: this.on.ce().id },
|
|
290
300
|
userId: this.wt.getUserId(),
|
|
291
|
-
sdkAuthEnabled: this.
|
|
301
|
+
sdkAuthEnabled: this.zo.Fh(),
|
|
292
302
|
});
|
|
293
303
|
}
|
|
294
304
|
yr(t) {
|
|
295
305
|
for (const i of t)
|
|
296
|
-
if (i.api_key === this.
|
|
306
|
+
if (i.api_key === this.rn) this.qt.Qh(i.events, i.attributes);
|
|
297
307
|
else {
|
|
298
308
|
const t = A.Yt.Qt;
|
|
299
309
|
new A(t, r).setItem(t.ss.wr, p.W(), i);
|
|
300
310
|
}
|
|
301
311
|
}
|
|
302
|
-
|
|
312
|
+
Gn(e, h, o) {
|
|
303
313
|
if (this.yt.hu(e))
|
|
304
314
|
return (
|
|
305
315
|
r.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
|
|
@@ -307,13 +317,13 @@ export default class Lt {
|
|
|
307
317
|
let n, u;
|
|
308
318
|
return (
|
|
309
319
|
null === h && null === o
|
|
310
|
-
? ((n = i.
|
|
311
|
-
: ((n = i.
|
|
320
|
+
? ((n = i.Eu), (u = { key: e }))
|
|
321
|
+
: ((n = i.Ju), (u = { key: e, latitude: h, longitude: o })),
|
|
312
322
|
s.q(n, u)
|
|
313
323
|
);
|
|
314
324
|
}
|
|
315
|
-
|
|
325
|
+
Hn(t, e) {
|
|
316
326
|
const h = { group_id: t, status: e };
|
|
317
|
-
return s.q(i.
|
|
327
|
+
return s.q(i.Ku, h);
|
|
318
328
|
}
|
|
319
329
|
}
|
|
@@ -42,12 +42,12 @@ export default class ts {
|
|
|
42
42
|
}
|
|
43
43
|
return t;
|
|
44
44
|
}
|
|
45
|
-
static
|
|
45
|
+
static qn(t) {
|
|
46
46
|
const r = [];
|
|
47
47
|
for (let e = 0; e < t.length; e++) {
|
|
48
48
|
const o = [],
|
|
49
49
|
s = t[e];
|
|
50
|
-
for (let t = 0; t < s.length; t++) o.push(lr.
|
|
50
|
+
for (let t = 0; t < s.length; t++) o.push(lr.qn(s[t]));
|
|
51
51
|
r.push(o);
|
|
52
52
|
}
|
|
53
53
|
return new ts(r);
|