@braze/web-sdk 5.6.1 → 5.8.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/README.md +1 -1
- package/index.d.ts +15 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +23 -23
- package/shared-lib/indexed-db-adapter.js +20 -20
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +17 -17
- package/src/Banner/banner-provider.js +53 -50
- package/src/Banner/banner.js +1 -1
- package/src/Banner/get-all-banners.js +3 -4
- package/src/Banner/get-banner.js +11 -11
- package/src/Banner/log-banner-click.js +1 -1
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +21 -13
- package/src/Banner/subscribe-to-banners-updates.js +14 -13
- package/src/Banner/ui/insert-banner.js +11 -9
- package/src/Card/card-manager.js +10 -10
- package/src/Card/log-card-impressions.js +2 -2
- package/src/Card/models/captioned-image.js +1 -1
- package/src/Card/models/card.js +3 -3
- package/src/Card/models/classic-card.js +1 -1
- package/src/Card/models/control-card.js +1 -1
- package/src/Card/models/image-only.js +1 -1
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +139 -180
- package/src/ContentCards/content-cards.js +3 -3
- 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 +10 -10
- package/src/ContentCards/ui/show-content-cards.js +8 -8
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +3 -3
- package/src/Core/disable-sdk.js +7 -7
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/get-user.js +1 -1
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +3 -3
- package/src/Core/log-purchase.js +1 -1
- package/src/Core/open-session.js +9 -9
- package/src/Core/wipe-data.js +5 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +18 -18
- package/src/FeatureFlags/feature-flags-provider.js +81 -78
- package/src/FeatureFlags/get-all-feature-flags.js +6 -7
- package/src/FeatureFlags/get-feature-flag.js +5 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +34 -34
- package/src/Feed/feed.js +2 -2
- package/src/Feed/get-cached-feed.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 +5 -5
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
- package/src/InAppMessage/display/modal-utils.js +6 -6
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +115 -91
- 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 +4 -4
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/control-message.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +5 -5
- package/src/InAppMessage/models/html-message.js +10 -10
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +42 -42
- package/src/InAppMessage/models/modal-message.js +5 -5
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- 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 +24 -24
- 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 +8 -8
- package/src/Push/push-manager.js +90 -90
- package/src/Push/utils/push-utils.js +12 -12
- package/src/User/user-manager.js +12 -12
- package/src/User/user.js +48 -36
- package/src/common/base-feed.js +3 -3
- package/src/common/constants.js +1 -1
- package/src/common/event-logger.js +4 -4
- package/src/common/feed-display.js +14 -14
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +10 -10
- package/src/managers/braze-instance.js +128 -128
- package/src/managers/device-manager.js +18 -18
- package/src/managers/network-manager.js +184 -147
- package/src/managers/server-config-manager.js +63 -63
- package/src/managers/session-manager.js +27 -27
- package/src/managers/storage-manager-factory.js +10 -10
- package/src/managers/storage-manager.js +146 -146
- package/src/managers/subscription-manager.js +8 -8
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +4 -4
- package/src/models/braze-event.js +8 -8
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +8 -8
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +163 -151
- package/src/triggers/models/custom-event-data.js +5 -5
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +8 -8
- package/src/triggers/models/filter.js +16 -16
- package/src/triggers/models/in-app-message-click-data.js +2 -2
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +37 -37
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +39 -39
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +3 -3
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +6 -6
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +2 -2
- package/src/util/dom-utils.js +6 -6
- package/src/util/html-display-utils.js +1 -0
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +22 -23
- package/src/util/request-header-utils.js +25 -22
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +17 -17
- package/src/util/window-utils.js +2 -2
package/src/models/identifier.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Guid as G, logger as N } from "../../shared-lib/index.js";
|
|
2
|
-
import { isArray as
|
|
2
|
+
import { isArray as z } from "../util/code-utils.js";
|
|
3
3
|
import { getErrorMessage as si } from "../util/error-utils.js";
|
|
4
4
|
export default class _t {
|
|
5
5
|
constructor(t, e, i) {
|
|
6
6
|
(this.eu = t),
|
|
7
7
|
null == t && (t = G.Rt()),
|
|
8
|
-
!i || isNaN(i) ? (this.
|
|
8
|
+
!i || isNaN(i) ? (this.Gl = new Date().valueOf()) : (this.Gl = i),
|
|
9
9
|
(this.eu = t),
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.ql = new Date().valueOf()),
|
|
11
|
+
(this.kl = e);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
return `g:${encodeURIComponent(this.eu)}|e:${this.
|
|
15
|
-
this.
|
|
13
|
+
bs() {
|
|
14
|
+
return `g:${encodeURIComponent(this.eu)}|e:${this.kl}|c:${this.Gl}|l:${
|
|
15
|
+
this.ql
|
|
16
16
|
}`;
|
|
17
17
|
}
|
|
18
|
-
static
|
|
18
|
+
static hE(t) {
|
|
19
19
|
if ("string" != typeof t) return null;
|
|
20
20
|
const e = t.lastIndexOf("|e:"),
|
|
21
21
|
i = t.substring(0, e),
|
|
@@ -26,19 +26,19 @@ export default class _t {
|
|
|
26
26
|
(t = t.replace(i, `g:${n}`))
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
static
|
|
29
|
+
static Bn(t) {
|
|
30
30
|
let e;
|
|
31
31
|
if ("string" == typeof t)
|
|
32
32
|
try {
|
|
33
33
|
const i = t.split("|");
|
|
34
|
-
if (!
|
|
34
|
+
if (!z(i) || 4 !== i.length) return null;
|
|
35
35
|
const r = (t) => t.split(":")[1],
|
|
36
36
|
n = (t) => {
|
|
37
37
|
const e = parseInt(r(t));
|
|
38
38
|
if (!isNaN(e)) return e;
|
|
39
39
|
};
|
|
40
40
|
(e = new _t(decodeURIComponent(r(i[0])), n(i[1]), n(i[2]))),
|
|
41
|
-
(e.
|
|
41
|
+
(e.ql = n(i[3]));
|
|
42
42
|
} catch (e) {
|
|
43
43
|
N.info(
|
|
44
44
|
`Unable to parse cookie string ${t}, failed with error: ${si(e)}`,
|
|
@@ -46,7 +46,7 @@ export default class _t {
|
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
if (null == t || null == t.g) return null;
|
|
49
|
-
(e = new _t(t.g, t.e, t.c)), (e.
|
|
49
|
+
(e = new _t(t.g, t.e, t.c)), (e.ql = t.l);
|
|
50
50
|
}
|
|
51
51
|
return e;
|
|
52
52
|
}
|
package/src/models/push-token.js
CHANGED
|
@@ -2,26 +2,26 @@ import { rehydrateDateAfterJsonization as V } 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.On = i),
|
|
6
6
|
(this.publicKey = s),
|
|
7
7
|
(this.Vl = l),
|
|
8
|
-
(this.
|
|
8
|
+
(this.Cl = h),
|
|
9
9
|
(this.endpoint = t || null),
|
|
10
|
-
(this.
|
|
10
|
+
(this.On = i || null),
|
|
11
11
|
(this.publicKey = s || null),
|
|
12
12
|
(this.Vl = l || null),
|
|
13
|
-
(this.
|
|
13
|
+
(this.Cl = h || null);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
bs() {
|
|
16
16
|
return {
|
|
17
17
|
e: this.endpoint,
|
|
18
|
-
c: this.
|
|
18
|
+
c: this.On,
|
|
19
19
|
p: this.publicKey,
|
|
20
20
|
u: this.Vl,
|
|
21
|
-
v: this.
|
|
21
|
+
v: this.Cl,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
static
|
|
24
|
+
static Bn(t) {
|
|
25
25
|
return new ti(t.e, V(t.c), t.p, t.u, t.v);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -15,46 +15,46 @@ export default class Jt {
|
|
|
15
15
|
n = { enabled: !0, capacity: Zt, refill_rate: hi, endpoint_overrides: {} },
|
|
16
16
|
o = { enabled: !1, max_placements: 0 },
|
|
17
17
|
) {
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
18
|
+
(this.fl = t),
|
|
19
|
+
(this.vl = i),
|
|
20
|
+
(this.wl = s),
|
|
21
|
+
(this.yl = h),
|
|
22
|
+
(this.Bl = e),
|
|
23
|
+
(this.Cl = l),
|
|
24
|
+
(this.El = r),
|
|
25
|
+
(this.we = a),
|
|
26
|
+
(this.Rl = n),
|
|
27
27
|
(this.banners = o),
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
30
|
-
(this.
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
28
|
+
(this.fl = t),
|
|
29
|
+
(this.vl = i),
|
|
30
|
+
(this.wl = s),
|
|
31
|
+
(this.yl = h),
|
|
32
|
+
(this.Bl = e),
|
|
33
|
+
(this.Cl = l),
|
|
34
|
+
(this.El = r),
|
|
35
|
+
(this.we = a),
|
|
36
|
+
(this.Rl = n),
|
|
37
37
|
(this.banners = o);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
bs() {
|
|
40
40
|
return {
|
|
41
|
-
s: "5.
|
|
42
|
-
l: this.
|
|
43
|
-
e: this.
|
|
44
|
-
a: this.
|
|
45
|
-
p: this.
|
|
46
|
-
m: this.
|
|
47
|
-
v: this.
|
|
48
|
-
c: this.
|
|
49
|
-
f: this.
|
|
50
|
-
grl: this.
|
|
41
|
+
s: "5.8.0",
|
|
42
|
+
l: this.fl,
|
|
43
|
+
e: this.vl,
|
|
44
|
+
a: this.wl,
|
|
45
|
+
p: this.yl,
|
|
46
|
+
m: this.Bl,
|
|
47
|
+
v: this.Cl,
|
|
48
|
+
c: this.El,
|
|
49
|
+
f: this.we,
|
|
50
|
+
grl: this.Rl,
|
|
51
51
|
b: this.banners,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
static
|
|
54
|
+
static Bn(t) {
|
|
55
55
|
let i = t.l;
|
|
56
56
|
return (
|
|
57
|
-
"5.
|
|
57
|
+
"5.8.0" !== t.s && (i = 0),
|
|
58
58
|
new Jt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f, t.grl, t.b)
|
|
59
59
|
);
|
|
60
60
|
}
|
|
@@ -5,187 +5,199 @@ import { randomInclusive as a } from "./util/math.js";
|
|
|
5
5
|
import E from "./models/request-result.js";
|
|
6
6
|
import {
|
|
7
7
|
logger as N,
|
|
8
|
-
IndexedDBAdapter as
|
|
8
|
+
IndexedDBAdapter as tt,
|
|
9
9
|
Guid as G,
|
|
10
10
|
EventTypes as d,
|
|
11
11
|
} from "../shared-lib/index.js";
|
|
12
12
|
import { STORAGE_KEYS as t } from "./managers/storage-manager.js";
|
|
13
13
|
import u from "./managers/subscription-manager.js";
|
|
14
|
-
import
|
|
14
|
+
import vt from "./Push/utils/push-utils.js";
|
|
15
15
|
import h from "./util/request-header-utils.js";
|
|
16
16
|
export default class Lt {
|
|
17
17
|
constructor(t, i, s, e, h, o, n, r, l, a) {
|
|
18
|
-
(this.
|
|
18
|
+
(this.cn = t),
|
|
19
19
|
(this.baseUrl = i),
|
|
20
20
|
(this.T = s),
|
|
21
|
-
(this.
|
|
21
|
+
(this.fn = e),
|
|
22
22
|
(this.As = h),
|
|
23
23
|
(this.B = o),
|
|
24
24
|
(this.C = n),
|
|
25
25
|
(this.$l = r),
|
|
26
|
-
(this.
|
|
26
|
+
(this.Na = l),
|
|
27
27
|
(this.S = a),
|
|
28
|
-
(this.
|
|
28
|
+
(this.cn = t),
|
|
29
29
|
(this.baseUrl = i),
|
|
30
|
-
(this.
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
30
|
+
(this.Ml = 0),
|
|
31
|
+
(this.dE = n.IE() || 0),
|
|
32
|
+
(this.Pl = null),
|
|
33
33
|
(this.T = s),
|
|
34
|
-
(this.
|
|
34
|
+
(this.fn = e),
|
|
35
35
|
(this.As = h),
|
|
36
36
|
(this.B = o),
|
|
37
37
|
(this.C = n),
|
|
38
|
-
(this.
|
|
38
|
+
(this.Na = l),
|
|
39
39
|
(this.S = a),
|
|
40
40
|
(this.$l = r),
|
|
41
|
-
(this.
|
|
42
|
-
(this.
|
|
43
|
-
(this.
|
|
44
|
-
(this.
|
|
41
|
+
(this.Ol = new u()),
|
|
42
|
+
(this.Ul = null),
|
|
43
|
+
(this._l = 50),
|
|
44
|
+
(this.Xl = !1);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
return !t && !i && this.
|
|
46
|
+
Ql(t, i) {
|
|
47
|
+
return !t && !i && this.Na.Kh() >= this._l;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
let i = this.T.
|
|
49
|
+
Yl(t) {
|
|
50
|
+
let i = this.T.zl();
|
|
51
51
|
if (t.length > 0) {
|
|
52
52
|
const s = this.As.getUserId();
|
|
53
53
|
for (const e of t) {
|
|
54
54
|
const t = (!e.userId && !s) || e.userId === s;
|
|
55
|
-
e.type === d.
|
|
55
|
+
e.type === d.Il && t && (i = !0);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
return i;
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
e && this.
|
|
62
|
-
const d = this.C.
|
|
63
|
-
m = this.C.
|
|
60
|
+
Zl(i = !1, s = !1, e = !0, o, n, r, u = !1, c = !1) {
|
|
61
|
+
e && this.sc();
|
|
62
|
+
const d = this.C.AE(),
|
|
63
|
+
m = this.C.OE();
|
|
64
64
|
let f = !1;
|
|
65
65
|
const g = (i, s, u = -1) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
const c = new Date().valueOf();
|
|
67
|
+
h.W(this.C, h.O.Su, c),
|
|
68
|
+
-1 !== u && s.push(["X-Braze-Req-Tokens-Remaining", u.toString()]);
|
|
69
|
+
let d = !1;
|
|
70
|
+
l.Y({
|
|
71
|
+
url: this.baseUrl + "/data/",
|
|
72
|
+
data: i,
|
|
73
|
+
headers: s,
|
|
74
|
+
ss: (e) => {
|
|
75
|
+
null != i.respond_with &&
|
|
76
|
+
i.respond_with.triggers &&
|
|
77
|
+
(this.Ml = Math.max(this.Ml - 1, 0)),
|
|
78
|
+
this.S.ts(i, e, s)
|
|
79
|
+
? (this.Na.es(),
|
|
80
|
+
this.B.dl(e),
|
|
81
|
+
(null != i.respond_with &&
|
|
82
|
+
i.respond_with.user_id != this.As.getUserId()) ||
|
|
83
|
+
(null != i.device && this.C.Bs(t.gs.ec, i.device),
|
|
84
|
+
null != i.sdk_metadata &&
|
|
85
|
+
(this.C.Bs(t.gs.gu, i.sdk_metadata),
|
|
86
|
+
this.C.Bs(t.gs.bu, this.T.Ss())),
|
|
87
|
+
this.$l(e),
|
|
88
|
+
h.$u(this.C, h.O.Su, 1),
|
|
89
|
+
"function" == typeof o && o()))
|
|
90
|
+
: e.auth_error && (d = !0);
|
|
91
|
+
},
|
|
92
|
+
error: () => {
|
|
93
|
+
(d = !0),
|
|
75
94
|
null != i.respond_with &&
|
|
76
95
|
i.respond_with.triggers &&
|
|
77
|
-
(this.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
error: () => {
|
|
93
|
-
null != i.respond_with &&
|
|
94
|
-
i.respond_with.triggers &&
|
|
95
|
-
(this.Pl = Math.max(this.Pl - 1, 0)),
|
|
96
|
-
this.S.Du(i.events, i.attributes),
|
|
97
|
-
"function" == typeof n && n();
|
|
98
|
-
},
|
|
99
|
-
os: (t) => {
|
|
100
|
-
if (("function" == typeof r && r(t), e && !f)) {
|
|
101
|
-
if (t && !c) this.nc();
|
|
102
|
-
else {
|
|
103
|
-
h.hs(this.C, h.O.Xu);
|
|
104
|
-
let t = this.Ol;
|
|
105
|
-
(null == t || t < 1e3 * this.IE) && (t = 1e3 * this.IE),
|
|
106
|
-
this.nc(Math.min(3e5, a(1e3 * this.IE, 3 * t)));
|
|
107
|
-
}
|
|
108
|
-
f = !0;
|
|
96
|
+
(this.Ml = Math.max(this.Ml - 1, 0)),
|
|
97
|
+
this.S.qu(i.events, i.attributes),
|
|
98
|
+
"function" == typeof n && n();
|
|
99
|
+
},
|
|
100
|
+
rs: (t, i) => {
|
|
101
|
+
"function" == typeof r && r(!d);
|
|
102
|
+
const s = this.S.xu(i);
|
|
103
|
+
let o = 0;
|
|
104
|
+
if (s)
|
|
105
|
+
switch (s.type) {
|
|
106
|
+
case "date":
|
|
107
|
+
o = Math.max(s.value - new Date().valueOf(), 0);
|
|
108
|
+
break;
|
|
109
|
+
case "timestamp":
|
|
110
|
+
o = s.value;
|
|
109
111
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
if (e && !f) {
|
|
113
|
+
if (d) {
|
|
114
|
+
h.Hu(this.C, h.O.Su);
|
|
115
|
+
let t = this.Pl;
|
|
116
|
+
(null == t || t < 1e3 * this.dE) && (t = 1e3 * this.dE);
|
|
117
|
+
const i = Math.min(3e5, a(1e3 * this.dE, 3 * t)) + o;
|
|
118
|
+
this.hc(i);
|
|
119
|
+
} else this.hc(Math.max(1e3 * this.dE, o));
|
|
120
|
+
f = !0;
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
});
|
|
112
124
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (this.
|
|
125
|
+
p = this.Yl(d),
|
|
126
|
+
v = s || p;
|
|
127
|
+
if (this.Ql(u, p))
|
|
116
128
|
return void N.info(
|
|
117
129
|
"Declining to flush data due to 50 consecutive authentication failures",
|
|
118
130
|
);
|
|
119
|
-
if (e && !this.S.
|
|
120
|
-
return this.
|
|
121
|
-
const b = this.S.
|
|
122
|
-
|
|
131
|
+
if (e && !this.S.wu(d, m, i, v))
|
|
132
|
+
return this.hc(), void ("function" == typeof r && r(!0));
|
|
133
|
+
const b = this.S.Cu(i, v, d, m, c);
|
|
134
|
+
v && this.Ml++;
|
|
123
135
|
let w = !1;
|
|
124
136
|
if (b)
|
|
125
137
|
for (const t of b)
|
|
126
138
|
this.S.V(
|
|
127
139
|
t.requestData,
|
|
128
140
|
(i) => g(t.requestData, t.headers, i),
|
|
129
|
-
h.O.
|
|
141
|
+
h.O.Su,
|
|
130
142
|
n,
|
|
131
143
|
),
|
|
132
144
|
(w = !0);
|
|
133
|
-
this.
|
|
134
|
-
? this.
|
|
135
|
-
:
|
|
145
|
+
this.Na.jh() && e && !w
|
|
146
|
+
? this.hc()
|
|
147
|
+
: p && (N.info("Invoking new session subscriptions"), this.Ol.X());
|
|
136
148
|
}
|
|
137
149
|
uc() {
|
|
138
|
-
return this.
|
|
150
|
+
return this.Ml > 0;
|
|
139
151
|
}
|
|
140
|
-
|
|
141
|
-
this.
|
|
142
|
-
(this.
|
|
143
|
-
(this.
|
|
152
|
+
hc(t = 1e3 * this.dE) {
|
|
153
|
+
this.Xl ||
|
|
154
|
+
(this.sc(),
|
|
155
|
+
(this.Ul = window.setTimeout(() => {
|
|
144
156
|
if (document.hidden) {
|
|
145
157
|
const t = "visibilitychange",
|
|
146
158
|
i = () => {
|
|
147
159
|
document.hidden ||
|
|
148
|
-
(document.removeEventListener(t, i, !1), this.
|
|
160
|
+
(document.removeEventListener(t, i, !1), this.Zl());
|
|
149
161
|
};
|
|
150
162
|
document.addEventListener(t, i, !1);
|
|
151
|
-
} else this.
|
|
163
|
+
} else this.Zl();
|
|
152
164
|
}, t)),
|
|
153
|
-
(this.
|
|
165
|
+
(this.Pl = t));
|
|
154
166
|
}
|
|
155
|
-
|
|
156
|
-
null != this.
|
|
167
|
+
sc() {
|
|
168
|
+
null != this.Ul && (clearTimeout(this.Ul), (this.Ul = null));
|
|
157
169
|
}
|
|
158
170
|
initialize() {
|
|
159
|
-
(this.
|
|
171
|
+
(this.Xl = !1), this.hc();
|
|
160
172
|
}
|
|
161
173
|
destroy() {
|
|
162
|
-
this.
|
|
163
|
-
this.
|
|
164
|
-
this.
|
|
165
|
-
(this.
|
|
166
|
-
this.
|
|
167
|
-
(this.
|
|
174
|
+
this.Ol.removeAllSubscriptions(),
|
|
175
|
+
this.Na.Hh(),
|
|
176
|
+
this.sc(),
|
|
177
|
+
(this.Xl = !0),
|
|
178
|
+
this.Zl(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
|
|
179
|
+
(this.Ul = null);
|
|
168
180
|
}
|
|
169
181
|
rn(t) {
|
|
170
|
-
return this.
|
|
182
|
+
return this.Ol.Fs(t);
|
|
171
183
|
}
|
|
172
184
|
openSession() {
|
|
173
|
-
const i = this.T.Ss() !== this.T.
|
|
174
|
-
i && (this.C.
|
|
175
|
-
this.
|
|
176
|
-
this.C.
|
|
185
|
+
const i = this.T.Ss() !== this.T.Eo();
|
|
186
|
+
i && (this.C.TE(t.iu.Xh), this.C.TE(t.iu.su)),
|
|
187
|
+
this.Zl(void 0, !1, void 0, () => {
|
|
188
|
+
this.C.Es(t.gs.Be);
|
|
177
189
|
}),
|
|
178
|
-
this.
|
|
190
|
+
this.du(),
|
|
179
191
|
i &&
|
|
180
192
|
import("./Push/push-manager-factory.js").then((i) => {
|
|
181
|
-
if (this.
|
|
193
|
+
if (this.Xl) return;
|
|
182
194
|
const s = i.default.ea();
|
|
183
195
|
if (
|
|
184
196
|
null != s &&
|
|
185
|
-
(
|
|
197
|
+
(vt.isPushPermissionGranted() || vt.isPushBlocked())
|
|
186
198
|
) {
|
|
187
199
|
const i = () => {
|
|
188
|
-
s.
|
|
200
|
+
s.Sn()
|
|
189
201
|
? N.info(
|
|
190
202
|
"Push token maintenance is disabled, not refreshing token for backend.",
|
|
191
203
|
)
|
|
@@ -195,43 +207,43 @@ export default class Lt {
|
|
|
195
207
|
s && i();
|
|
196
208
|
},
|
|
197
209
|
h = () => {
|
|
198
|
-
const s = this.C.
|
|
210
|
+
const s = this.C.vs(t.gs.Fn);
|
|
199
211
|
(null == s || s) && i();
|
|
200
212
|
},
|
|
201
|
-
o =
|
|
202
|
-
new
|
|
213
|
+
o = tt._s.Xs;
|
|
214
|
+
new tt(o, N).cr(o.Ks.cu, e, h);
|
|
203
215
|
}
|
|
204
216
|
});
|
|
205
217
|
}
|
|
206
|
-
|
|
207
|
-
this.C.
|
|
218
|
+
dc() {
|
|
219
|
+
this.C.Es(t.gs.$e), this.C.Es(t.gs.di), this.C.Es(t.gs.Zr);
|
|
208
220
|
}
|
|
209
221
|
changeUser(i, s, e) {
|
|
210
222
|
const h = this.As.getUserId();
|
|
211
223
|
if (h !== i) {
|
|
212
|
-
this.T.
|
|
213
|
-
this.
|
|
214
|
-
null != h && this.
|
|
224
|
+
this.T.Jl(),
|
|
225
|
+
this.dc(),
|
|
226
|
+
null != h && this.Zl(void 0, !1, void 0, void 0, void 0),
|
|
215
227
|
this.As.ou(i),
|
|
216
|
-
e ? this.
|
|
228
|
+
e ? this.Na.setSdkAuthenticationSignature(e) : this.Na.Bh();
|
|
217
229
|
for (let t = 0; t < s.length; t++) s[t].changeUser(null == h);
|
|
218
|
-
null != h && this.C.
|
|
219
|
-
this.C.
|
|
220
|
-
this.C.
|
|
230
|
+
null != h && this.C.Es(t.gs.Ct),
|
|
231
|
+
this.C.Es(t.gs.ec),
|
|
232
|
+
this.C.Es(t.gs._E),
|
|
221
233
|
this.openSession(),
|
|
222
234
|
N.info('Changed user to "' + i + '".');
|
|
223
235
|
} else {
|
|
224
236
|
let t = "Doing nothing.";
|
|
225
237
|
e &&
|
|
226
|
-
this.
|
|
227
|
-
(this.
|
|
238
|
+
this.Na.xh() !== e &&
|
|
239
|
+
(this.Na.setSdkAuthenticationSignature(e),
|
|
228
240
|
(t = "Updated SDK authentication signature")),
|
|
229
241
|
N.info(`Current user is already ${i}. ${t}`);
|
|
230
242
|
}
|
|
231
243
|
}
|
|
232
244
|
requestImmediateDataFlush(t) {
|
|
233
|
-
this.
|
|
234
|
-
this.
|
|
245
|
+
this.sc(), this.T.Eo();
|
|
246
|
+
this.Zl(
|
|
235
247
|
void 0,
|
|
236
248
|
void 0,
|
|
237
249
|
void 0,
|
|
@@ -244,29 +256,29 @@ export default class Lt {
|
|
|
244
256
|
);
|
|
245
257
|
}
|
|
246
258
|
requestFeedRefresh() {
|
|
247
|
-
this.T.
|
|
259
|
+
this.T.Eo(), this.Zl(!0);
|
|
248
260
|
}
|
|
249
|
-
|
|
250
|
-
this.T.
|
|
261
|
+
br(t, i) {
|
|
262
|
+
this.T.Eo(),
|
|
251
263
|
N.info("Requesting explicit trigger refresh."),
|
|
252
|
-
this.
|
|
264
|
+
this.Zl(void 0, !0, void 0, t, i);
|
|
253
265
|
}
|
|
254
|
-
|
|
255
|
-
const e = d.
|
|
266
|
+
Ln(i, s) {
|
|
267
|
+
const e = d.mc,
|
|
256
268
|
h = { a: i, l: s },
|
|
257
|
-
o = c.
|
|
269
|
+
o = c.cs(e, h);
|
|
258
270
|
return (
|
|
259
|
-
o && (N.info(`Logged alias ${i} with label ${s}`), this.C.
|
|
271
|
+
o && (N.info(`Logged alias ${i} with label ${s}`), this.C.Bs(t.gs._E, h)),
|
|
260
272
|
o
|
|
261
273
|
);
|
|
262
274
|
}
|
|
263
|
-
|
|
275
|
+
Gn(t, i, s) {
|
|
264
276
|
if (this.B.hu(i))
|
|
265
277
|
return (
|
|
266
278
|
N.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new E()
|
|
267
279
|
);
|
|
268
280
|
const e = { key: i, value: s },
|
|
269
|
-
h = c.
|
|
281
|
+
h = c.cs(t, e);
|
|
270
282
|
if (h) {
|
|
271
283
|
const t = "object" == typeof s ? JSON.stringify(s, null, 2) : s;
|
|
272
284
|
N.info(`Logged custom attribute: ${i} with value: ${t}`);
|
|
@@ -278,38 +290,38 @@ export default class Lt {
|
|
|
278
290
|
null != e && (n.altitude = e),
|
|
279
291
|
null != h && (n.ll_accuracy = h),
|
|
280
292
|
null != o && (n.alt_accuracy = o);
|
|
281
|
-
const r = c.
|
|
293
|
+
const r = c.cs(d.fc, n, t || void 0);
|
|
282
294
|
return (
|
|
283
295
|
r &&
|
|
284
296
|
N.info(`Set user last known location as ${JSON.stringify(n, null, 2)}`),
|
|
285
297
|
r
|
|
286
298
|
);
|
|
287
299
|
}
|
|
288
|
-
|
|
289
|
-
const s = this.T.
|
|
290
|
-
return new ve(this.As.getUserId(), d.
|
|
300
|
+
lr(t, i) {
|
|
301
|
+
const s = this.T.Eo();
|
|
302
|
+
return new ve(this.As.getUserId(), d.gc, t, s, { cid: i });
|
|
291
303
|
}
|
|
292
|
-
|
|
293
|
-
return new
|
|
304
|
+
vc(t, i) {
|
|
305
|
+
return new tt(t, i);
|
|
294
306
|
}
|
|
295
|
-
|
|
296
|
-
const t =
|
|
297
|
-
this.
|
|
307
|
+
du() {
|
|
308
|
+
const t = tt._s.Xs;
|
|
309
|
+
this.vc(t, N).setItem(t.Ks.Su, 1, {
|
|
298
310
|
baseUrl: this.baseUrl,
|
|
299
|
-
data: { api_key: this.
|
|
311
|
+
data: { api_key: this.cn, device_id: this.fn.de().id },
|
|
300
312
|
userId: this.As.getUserId(),
|
|
301
|
-
sdkAuthEnabled: this.
|
|
313
|
+
sdkAuthEnabled: this.Na.jh(),
|
|
302
314
|
});
|
|
303
315
|
}
|
|
304
|
-
|
|
316
|
+
vr(t) {
|
|
305
317
|
for (const i of t)
|
|
306
|
-
if (i.api_key === this.
|
|
318
|
+
if (i.api_key === this.cn) this.S.qu(i.events, i.attributes);
|
|
307
319
|
else {
|
|
308
|
-
const t =
|
|
309
|
-
new
|
|
320
|
+
const t = tt._s.Xs;
|
|
321
|
+
new tt(t, N).setItem(t.Ks.kr, G.Rt(), i);
|
|
310
322
|
}
|
|
311
323
|
}
|
|
312
|
-
|
|
324
|
+
Qn(t, i, s) {
|
|
313
325
|
if (this.B.hu(t))
|
|
314
326
|
return (
|
|
315
327
|
N.info(`Custom Attribute "${t}" is blocklisted, ignoring.`), new E()
|
|
@@ -317,13 +329,13 @@ export default class Lt {
|
|
|
317
329
|
let e, h;
|
|
318
330
|
return (
|
|
319
331
|
null === i && null === s
|
|
320
|
-
? ((e = d.
|
|
321
|
-
: ((e = d.
|
|
322
|
-
c.
|
|
332
|
+
? ((e = d.bc), (h = { key: t }))
|
|
333
|
+
: ((e = d.wc), (h = { key: t, latitude: i, longitude: s })),
|
|
334
|
+
c.cs(e, h)
|
|
323
335
|
);
|
|
324
336
|
}
|
|
325
|
-
|
|
337
|
+
Xn(t, i) {
|
|
326
338
|
const s = { group_id: t, status: i };
|
|
327
|
-
return c.
|
|
339
|
+
return c.cs(d.kc, s);
|
|
328
340
|
}
|
|
329
341
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default class ts {
|
|
2
2
|
constructor(t) {
|
|
3
|
-
(this.
|
|
3
|
+
(this.xc = t), (this.xc = t);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
return null == this.
|
|
5
|
+
yc(t) {
|
|
6
|
+
return null == this.xc || this.xc === t[0];
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
9
|
return new ts(t ? t.event_name : null);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
return this.
|
|
11
|
+
bs() {
|
|
12
|
+
return this.xc;
|
|
13
13
|
}
|
|
14
14
|
}
|