@braze/web-sdk 5.6.0 → 5.7.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 +14 -4
- 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 +15 -15
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +14 -14
- package/src/Banner/banner-provider.js +53 -50
- package/src/Banner/banner.js +1 -1
- package/src/Banner/get-all-banners.js +2 -2
- package/src/Banner/get-banner.js +2 -2
- 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 +2 -2
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Card/card-manager.js +10 -10
- 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.js +139 -180
- 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 +3 -3
- package/src/Core/disable-sdk.js +3 -3
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/log-custom-event.js +3 -3
- package/src/Core/log-purchase.js +1 -1
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +4 -4
- package/src/FeatureFlags/feature-flag.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +81 -78
- 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 +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +34 -34
- 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 +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +9 -9
- package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
- package/src/InAppMessage/display/modal-utils.js +5 -5
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- 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 +2 -2
- 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/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 +37 -37
- package/src/InAppMessage/models/modal-message.js +5 -5
- package/src/InAppMessage/models/slide-up-message.js +7 -7
- 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 +14 -14
- 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.js +88 -88
- package/src/Push/utils/push-utils.js +12 -12
- package/src/User/user-manager.js +10 -10
- package/src/User/user.js +46 -34
- package/src/common/constants.js +1 -1
- package/src/common/event-logger.js +3 -3
- package/src/common/feed-display.js +10 -10
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +10 -10
- package/src/managers/braze-instance.js +110 -110
- package/src/managers/device-manager.js +17 -17
- package/src/managers/network-manager.js +180 -143
- package/src/managers/server-config-manager.js +65 -65
- package/src/managers/session-manager.js +22 -22
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +134 -134
- package/src/managers/subscription-manager.js +8 -8
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +8 -8
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +10 -10
- package/src/models/push-token.js +8 -8
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +158 -146
- 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 +6 -6
- 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 +36 -36
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +37 -37
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +11 -10
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/component-utils.js +2 -2
- package/src/util/dom-utils.js +3 -3
- 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 +23 -20
- package/src/util/user-agent-parser.js +14 -14
- package/src/util/validation-utils.js +14 -14
- package/src/util/window-utils.js +2 -2
package/src/models/identifier.js
CHANGED
|
@@ -5,17 +5,17 @@ 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.zl = new Date().valueOf()) : (this.zl = i),
|
|
9
9
|
(this.eu = t),
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.Il = new Date().valueOf()),
|
|
11
|
+
(this.Al = e);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
return `g:${encodeURIComponent(this.eu)}|e:${this.
|
|
15
|
-
this.
|
|
13
|
+
bs() {
|
|
14
|
+
return `g:${encodeURIComponent(this.eu)}|e:${this.Al}|c:${this.zl}|l:${
|
|
15
|
+
this.Il
|
|
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,7 +26,7 @@ export default class _t {
|
|
|
26
26
|
(t = t.replace(i, `g:${n}`))
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
static
|
|
29
|
+
static Yn(t) {
|
|
30
30
|
let e;
|
|
31
31
|
if ("string" == typeof t)
|
|
32
32
|
try {
|
|
@@ -38,7 +38,7 @@ export default class _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.Il = 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.Il = 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.Mn = i),
|
|
6
6
|
(this.publicKey = s),
|
|
7
7
|
(this.Vl = l),
|
|
8
|
-
(this.
|
|
8
|
+
(this.vl = h),
|
|
9
9
|
(this.endpoint = t || null),
|
|
10
|
-
(this.
|
|
10
|
+
(this.Mn = i || null),
|
|
11
11
|
(this.publicKey = s || null),
|
|
12
12
|
(this.Vl = l || null),
|
|
13
|
-
(this.
|
|
13
|
+
(this.vl = h || null);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
bs() {
|
|
16
16
|
return {
|
|
17
17
|
e: this.endpoint,
|
|
18
|
-
c: this.
|
|
18
|
+
c: this.Mn,
|
|
19
19
|
p: this.publicKey,
|
|
20
20
|
u: this.Vl,
|
|
21
|
-
v: this.
|
|
21
|
+
v: this.vl,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
static
|
|
24
|
+
static Yn(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.Rl = t),
|
|
19
|
+
(this.yl = i),
|
|
20
|
+
(this.Ll = s),
|
|
21
|
+
(this.Bl = h),
|
|
22
|
+
(this.Tl = e),
|
|
23
|
+
(this.vl = l),
|
|
24
|
+
(this.wl = r),
|
|
25
|
+
(this.je = a),
|
|
26
|
+
(this.El = 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.Rl = t),
|
|
29
|
+
(this.yl = i),
|
|
30
|
+
(this.Ll = s),
|
|
31
|
+
(this.Bl = h),
|
|
32
|
+
(this.Tl = e),
|
|
33
|
+
(this.vl = l),
|
|
34
|
+
(this.wl = r),
|
|
35
|
+
(this.je = a),
|
|
36
|
+
(this.El = 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.7.0",
|
|
42
|
+
l: this.Rl,
|
|
43
|
+
e: this.yl,
|
|
44
|
+
a: this.Ll,
|
|
45
|
+
p: this.Bl,
|
|
46
|
+
m: this.Tl,
|
|
47
|
+
v: this.vl,
|
|
48
|
+
c: this.wl,
|
|
49
|
+
f: this.je,
|
|
50
|
+
grl: this.El,
|
|
51
51
|
b: this.banners,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
static
|
|
54
|
+
static Yn(t) {
|
|
55
55
|
let i = t.l;
|
|
56
56
|
return (
|
|
57
|
-
"5.
|
|
57
|
+
"5.7.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.fn = t),
|
|
19
19
|
(this.baseUrl = i),
|
|
20
20
|
(this.T = s),
|
|
21
|
-
(this.
|
|
21
|
+
(this.dn = 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.Qh = l),
|
|
27
27
|
(this.S = a),
|
|
28
|
-
(this.
|
|
28
|
+
(this.fn = t),
|
|
29
29
|
(this.baseUrl = i),
|
|
30
30
|
(this.Pl = 0),
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
31
|
+
(this.dE = n.IE() || 0),
|
|
32
|
+
(this.Ul = null),
|
|
33
33
|
(this.T = s),
|
|
34
|
-
(this.
|
|
34
|
+
(this.dn = e),
|
|
35
35
|
(this.As = h),
|
|
36
36
|
(this.B = o),
|
|
37
37
|
(this.C = n),
|
|
38
|
-
(this.
|
|
38
|
+
(this.Qh = l),
|
|
39
39
|
(this.S = a),
|
|
40
40
|
(this.$l = r),
|
|
41
|
-
(this.
|
|
42
|
-
(this.
|
|
43
|
-
(this.
|
|
44
|
-
(this.
|
|
41
|
+
(this._l = new u()),
|
|
42
|
+
(this.Xl = null),
|
|
43
|
+
(this.Ql = 50),
|
|
44
|
+
(this.Yl = !1);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
return !t && !i && this.
|
|
46
|
+
Zl(t, i) {
|
|
47
|
+
return !t && !i && this.Qh.Kh() >= this.Ql;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
let i = this.T.
|
|
49
|
+
sc(t) {
|
|
50
|
+
let i = this.T.Wl();
|
|
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.Kl && 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
|
+
hc(i = !1, s = !1, e = !0, o, n, r, u = !1, c = !1) {
|
|
61
|
+
e && this.uc();
|
|
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.zu, 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.Pl = Math.max(this.Pl - 1, 0)),
|
|
78
|
+
this.S.ts(i, e, s)
|
|
79
|
+
? (this.Qh.es(),
|
|
80
|
+
this.B.Cl(e),
|
|
81
|
+
(null != i.respond_with &&
|
|
82
|
+
i.respond_with.user_id != this.As.getUserId()) ||
|
|
83
|
+
(null != i.device && this.C.Bs(t.gs.$a, i.device),
|
|
84
|
+
null != i.sdk_metadata &&
|
|
85
|
+
(this.C.Bs(t.gs.qu, i.sdk_metadata),
|
|
86
|
+
this.C.Bs(t.gs.Au, this.T.Ss())),
|
|
87
|
+
this.$l(e),
|
|
88
|
+
h.Lu(this.C, h.O.zu, 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
96
|
(this.Pl = Math.max(this.Pl - 1, 0)),
|
|
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;
|
|
97
|
+
this.S.Du(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.Ou(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.Gu(this.C, h.O.zu);
|
|
115
|
+
let t = this.Ul;
|
|
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.lc(i);
|
|
119
|
+
} else this.lc(Math.max(1e3 * this.dE, o));
|
|
120
|
+
f = !0;
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
});
|
|
112
124
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (this.
|
|
125
|
+
p = this.sc(d),
|
|
126
|
+
v = s || p;
|
|
127
|
+
if (this.Zl(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.Su(d, m, i, v))
|
|
132
|
+
return this.lc(), void ("function" == typeof r && r(!0));
|
|
133
|
+
const b = this.S.Bu(i, v, d, m, c);
|
|
134
|
+
v && this.Pl++;
|
|
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.zu,
|
|
130
142
|
n,
|
|
131
143
|
),
|
|
132
144
|
(w = !0);
|
|
133
|
-
this.
|
|
134
|
-
? this.
|
|
135
|
-
:
|
|
145
|
+
this.Qh.jh() && e && !w
|
|
146
|
+
? this.lc()
|
|
147
|
+
: p && (N.info("Invoking new session subscriptions"), this._l.X());
|
|
136
148
|
}
|
|
137
|
-
|
|
149
|
+
cc() {
|
|
138
150
|
return this.Pl > 0;
|
|
139
151
|
}
|
|
140
|
-
|
|
141
|
-
this.
|
|
142
|
-
(this.
|
|
143
|
-
(this.
|
|
152
|
+
lc(t = 1e3 * this.dE) {
|
|
153
|
+
this.Yl ||
|
|
154
|
+
(this.uc(),
|
|
155
|
+
(this.Xl = 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.hc());
|
|
149
161
|
};
|
|
150
162
|
document.addEventListener(t, i, !1);
|
|
151
|
-
} else this.
|
|
163
|
+
} else this.hc();
|
|
152
164
|
}, t)),
|
|
153
|
-
(this.
|
|
165
|
+
(this.Ul = t));
|
|
154
166
|
}
|
|
155
|
-
|
|
156
|
-
null != this.
|
|
167
|
+
uc() {
|
|
168
|
+
null != this.Xl && (clearTimeout(this.Xl), (this.Xl = null));
|
|
157
169
|
}
|
|
158
170
|
initialize() {
|
|
159
|
-
(this.
|
|
171
|
+
(this.Yl = !1), this.lc();
|
|
160
172
|
}
|
|
161
173
|
destroy() {
|
|
162
|
-
this.
|
|
163
|
-
this.
|
|
164
|
-
this.
|
|
165
|
-
(this.
|
|
166
|
-
this.
|
|
167
|
-
(this.
|
|
174
|
+
this._l.removeAllSubscriptions(),
|
|
175
|
+
this.Qh.Hh(),
|
|
176
|
+
this.uc(),
|
|
177
|
+
(this.Yl = !0),
|
|
178
|
+
this.hc(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
|
|
179
|
+
(this.Xl = null);
|
|
168
180
|
}
|
|
169
181
|
rn(t) {
|
|
170
|
-
return this.
|
|
182
|
+
return this._l.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.$h), this.C.TE(t.iu.su)),
|
|
187
|
+
this.hc(void 0, !1, void 0, () => {
|
|
188
|
+
this.C.Es(t.gs.$e);
|
|
177
189
|
}),
|
|
178
|
-
this.
|
|
190
|
+
this.bu(),
|
|
179
191
|
i &&
|
|
180
192
|
import("./Push/push-manager-factory.js").then((i) => {
|
|
181
|
-
if (this.
|
|
193
|
+
if (this.Yl) 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.jn()
|
|
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.Bn);
|
|
199
211
|
(null == s || s) && i();
|
|
200
212
|
},
|
|
201
|
-
o =
|
|
202
|
-
new
|
|
213
|
+
o = tt._s.Xs;
|
|
214
|
+
new tt(o, N).jr(o.Ks.cu, e, h);
|
|
203
215
|
}
|
|
204
216
|
});
|
|
205
217
|
}
|
|
206
|
-
|
|
207
|
-
this.C.
|
|
218
|
+
dc() {
|
|
219
|
+
this.C.Es(t.gs.xe), this.C.Es(t.gs.di), this.C.Es(t.gs.on);
|
|
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.Ml(),
|
|
225
|
+
this.dc(),
|
|
226
|
+
null != h && this.hc(void 0, !1, void 0, void 0, void 0),
|
|
215
227
|
this.As.ou(i),
|
|
216
|
-
e ? this.
|
|
228
|
+
e ? this.Qh.setSdkAuthenticationSignature(e) : this.Qh.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.$a),
|
|
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.Qh.xh() !== e &&
|
|
239
|
+
(this.Qh.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.uc(), this.T.Eo();
|
|
246
|
+
this.hc(
|
|
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.hc(!0);
|
|
248
260
|
}
|
|
249
261
|
vr(t, i) {
|
|
250
|
-
this.T.
|
|
262
|
+
this.T.Eo(),
|
|
251
263
|
N.info("Requesting explicit trigger refresh."),
|
|
252
|
-
this.
|
|
264
|
+
this.hc(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,7 +290,7 @@ 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)}`),
|
|
@@ -286,30 +298,30 @@ export default class Lt {
|
|
|
286
298
|
);
|
|
287
299
|
}
|
|
288
300
|
br(t, i) {
|
|
289
|
-
const s = this.T.
|
|
290
|
-
return new ve(this.As.getUserId(), d.
|
|
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
|
+
bu() {
|
|
308
|
+
const t = tt._s.Xs;
|
|
309
|
+
this.vc(t, N).setItem(t.Ks.zu, 1, {
|
|
298
310
|
baseUrl: this.baseUrl,
|
|
299
|
-
data: { api_key: this.
|
|
311
|
+
data: { api_key: this.fn, device_id: this.dn.ce().id },
|
|
300
312
|
userId: this.As.getUserId(),
|
|
301
|
-
sdkAuthEnabled: this.
|
|
313
|
+
sdkAuthEnabled: this.Qh.jh(),
|
|
302
314
|
});
|
|
303
315
|
}
|
|
304
316
|
wr(t) {
|
|
305
317
|
for (const i of t)
|
|
306
|
-
if (i.api_key === this.
|
|
318
|
+
if (i.api_key === this.fn) this.S.Du(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.$r, G.Rt(), i);
|
|
310
322
|
}
|
|
311
323
|
}
|
|
312
|
-
|
|
324
|
+
Zn(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
|
+
au(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
|
}
|