@braze/web-sdk 6.0.0 → 6.2.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 +103 -33
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +22 -22
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +19 -19
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +15 -15
- package/src/Banner/banner-factory.js +2 -1
- package/src/Banner/banner-provider-factory.js +7 -7
- package/src/Banner/banner-provider.js +92 -98
- package/src/Banner/banner.js +21 -18
- package/src/Banner/display/banner-to-html.js +9 -9
- package/src/Banner/display/destroy-banner-html.js +2 -2
- package/src/Banner/display/detect-banner-impressions.js +2 -2
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +7 -7
- package/src/Banner/log-banner-click.js +7 -7
- package/src/Banner/log-banner-impressions.js +9 -9
- package/src/Banner/request-banners-refresh.js +16 -20
- package/src/Banner/subscribe-to-banners-updates.js +7 -7
- package/src/Banner/ui/insert-banner.js +6 -6
- package/src/Card/card-manager-factory.js +7 -7
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +4 -4
- package/src/Card/log-content-card-click.js +4 -4
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +68 -68
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +18 -18
- package/src/Card/util/card-factory.js +35 -35
- package/src/ContentCards/content-cards-provider-factory.js +13 -13
- package/src/ContentCards/content-cards-provider.js +136 -136
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/show-content-cards.js +7 -7
- package/src/Core/add-sdk-metadata.js +3 -3
- package/src/Core/change-user.js +7 -7
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +8 -8
- package/src/Core/enable-sdk.js +6 -6
- package/src/Core/get-device-id.js +4 -4
- package/src/Core/handle-braze-action.js +5 -5
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +10 -10
- package/src/Core/log-purchase.js +13 -13
- package/src/Core/open-session.js +10 -10
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +20 -71
- package/src/FeatureFlags/feature-flags-provider-factory.js +12 -12
- package/src/FeatureFlags/feature-flags-provider.js +87 -87
- package/src/FeatureFlags/get-all-feature-flags.js +4 -4
- package/src/FeatureFlags/get-feature-flag.js +4 -4
- package/src/FeatureFlags/log-feature-flag-impression.js +9 -9
- package/src/FeatureFlags/refresh-feature-flags.js +2 -2
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +28 -28
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +15 -15
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +100 -100
- package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-impression.js +4 -4
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +35 -35
- package/src/InAppMessage/models/html-message.js +21 -21
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +75 -75
- package/src/InAppMessage/models/modal-message.js +34 -34
- package/src/InAppMessage/models/slide-up-message.js +31 -31
- 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 +19 -19
- package/src/Push/push-manager-factory.js +9 -9
- package/src/Push/push-manager.js +118 -118
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +20 -20
- package/src/User/user.js +44 -45
- package/src/common/base-provider.js +1 -1
- package/src/common/content-cards-display.js +18 -18
- package/src/common/event-logger.js +10 -10
- package/src/common/properties-base.js +56 -0
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +143 -143
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +172 -168
- package/src/managers/server-config-manager.js +73 -73
- package/src/managers/session-manager.js +40 -40
- package/src/managers/storage-manager-factory.js +6 -6
- package/src/managers/storage-manager.js +97 -97
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +5 -5
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +13 -13
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +159 -159
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +26 -26
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +37 -37
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +16 -16
- package/src/triggers/triggers-provider-factory.js +12 -12
- package/src/triggers/triggers-provider.js +61 -61
- package/src/ui/js/attach-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 +6 -6
- package/src/util/browser-detector.js +22 -13
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +1 -1
- package/src/util/deprecation-utils.js +2 -2
- package/src/util/device-constants.js +4 -4
- package/src/util/dom-utils.js +9 -9
- package/src/util/html-display-utils.js +7 -7
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +12 -12
- package/src/util/request-header-utils.js +22 -22
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +16 -16
- package/src/util/validation-utils.js +12 -12
- package/src/util/window-utils.js +2 -2
|
@@ -15,46 +15,46 @@ export default class ni {
|
|
|
15
15
|
n = { enabled: !0, capacity: hi, refill_rate: li, endpoint_overrides: {} },
|
|
16
16
|
o = null,
|
|
17
17
|
) {
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
18
|
+
(this.ol = t),
|
|
19
|
+
(this.bl = i),
|
|
20
|
+
(this.fl = s),
|
|
21
|
+
(this.vl = h),
|
|
22
|
+
(this.Cl = e),
|
|
23
|
+
(this.dl = l),
|
|
24
|
+
(this.gl = r),
|
|
25
|
+
(this.he = a),
|
|
26
|
+
(this.ml = 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.ol = t),
|
|
29
|
+
(this.bl = i),
|
|
30
|
+
(this.fl = s),
|
|
31
|
+
(this.vl = h),
|
|
32
|
+
(this.Cl = e),
|
|
33
|
+
(this.dl = l),
|
|
34
|
+
(this.gl = r),
|
|
35
|
+
(this.he = a),
|
|
36
|
+
(this.ml = n),
|
|
37
37
|
(this.banners = o);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
dt() {
|
|
40
40
|
return {
|
|
41
|
-
s: "6.
|
|
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: "6.2.0",
|
|
42
|
+
l: this.ol,
|
|
43
|
+
e: this.bl,
|
|
44
|
+
a: this.fl,
|
|
45
|
+
p: this.vl,
|
|
46
|
+
m: this.Cl,
|
|
47
|
+
v: this.dl,
|
|
48
|
+
c: this.gl,
|
|
49
|
+
f: this.he,
|
|
50
|
+
grl: this.ml,
|
|
51
51
|
b: this.banners,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
static
|
|
54
|
+
static qn(t) {
|
|
55
55
|
let i = t.l;
|
|
56
56
|
return (
|
|
57
|
-
"6.
|
|
57
|
+
"6.2.0" !== t.s && (i = 0),
|
|
58
58
|
new ni(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f, t.grl, t.b)
|
|
59
59
|
);
|
|
60
60
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from "./util/net.js";
|
|
2
2
|
import ue from "./models/braze-event.js";
|
|
3
3
|
import c from "./common/event-logger.js";
|
|
4
|
-
import { randomInclusive as
|
|
5
|
-
import
|
|
4
|
+
import { randomInclusive as l } from "./util/math.js";
|
|
5
|
+
import H from "./models/request-result.js";
|
|
6
6
|
import {
|
|
7
|
-
logger as
|
|
7
|
+
logger as E,
|
|
8
8
|
IndexedDBAdapter as et,
|
|
9
|
-
Guid as
|
|
10
|
-
EventTypes as
|
|
9
|
+
Guid as P,
|
|
10
|
+
EventTypes as m,
|
|
11
11
|
} from "../shared-lib/index.js";
|
|
12
12
|
import { STORAGE_KEYS as s } from "./managers/storage-manager.js";
|
|
13
13
|
import u from "./managers/subscription-manager.js";
|
|
@@ -15,78 +15,78 @@ import yt from "./Push/utils/push-utils.js";
|
|
|
15
15
|
import h from "./util/request-header-utils.js";
|
|
16
16
|
export default class Wt {
|
|
17
17
|
constructor(t, i, s, e, h, n, o, r, l, a) {
|
|
18
|
-
(this.
|
|
18
|
+
(this.sn = t),
|
|
19
19
|
(this.baseUrl = i),
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
20
|
+
(this.C = s),
|
|
21
|
+
(this.on = e),
|
|
22
22
|
(this.Cs = h),
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.$
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
23
|
+
(this.h = n),
|
|
24
|
+
(this.j = o),
|
|
25
|
+
(this.$l = r),
|
|
26
|
+
(this.Qh = l),
|
|
27
|
+
(this.B = a),
|
|
28
|
+
(this.sn = t),
|
|
29
29
|
(this.baseUrl = i),
|
|
30
|
-
(this.
|
|
30
|
+
(this.Tl = 0),
|
|
31
31
|
(this.fE = o.dE() || 0),
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
32
|
+
(this.Ll = null),
|
|
33
|
+
(this.C = s),
|
|
34
|
+
(this.on = e),
|
|
35
35
|
(this.Cs = h),
|
|
36
|
-
(this.
|
|
37
|
-
(this.
|
|
38
|
-
(this.
|
|
39
|
-
(this.
|
|
40
|
-
(this.$
|
|
41
|
-
(this.
|
|
42
|
-
(this.
|
|
43
|
-
(this.
|
|
44
|
-
(this.
|
|
45
|
-
(this.
|
|
36
|
+
(this.h = n),
|
|
37
|
+
(this.j = o),
|
|
38
|
+
(this.Qh = l),
|
|
39
|
+
(this.B = a),
|
|
40
|
+
(this.$l = r),
|
|
41
|
+
(this.Ml = new u()),
|
|
42
|
+
(this.Pl = null),
|
|
43
|
+
(this.Il = 50),
|
|
44
|
+
(this.Ol = !1),
|
|
45
|
+
(this.Ul = !1);
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
return !t && !i && this.
|
|
47
|
+
_l(t, i) {
|
|
48
|
+
return !t && !i && this.Qh.Hh() >= this.Il;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
let i = this.
|
|
50
|
+
Jl(t) {
|
|
51
|
+
let i = this.C.zl();
|
|
52
52
|
if (t.length > 0) {
|
|
53
53
|
const s = this.Cs.getUserId();
|
|
54
54
|
for (const e of t) {
|
|
55
55
|
const t = (!e.userId && !s) || e.userId === s;
|
|
56
|
-
e.type ===
|
|
56
|
+
e.type === m.Al && t && (i = !0);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
return i;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
i && this.
|
|
63
|
-
const c = this.
|
|
64
|
-
d = this.
|
|
61
|
+
Kl(t = !1, i = !0, e, n, o, r = !1, u = !1) {
|
|
62
|
+
i && this.Xl();
|
|
63
|
+
const c = this.j.RE(),
|
|
64
|
+
d = this.j.IE();
|
|
65
65
|
let m = !1;
|
|
66
66
|
const f = (t, r, u = -1) => {
|
|
67
67
|
const c = new Date().valueOf();
|
|
68
|
-
h.
|
|
68
|
+
h.K(this.j, h.H.Tu, c),
|
|
69
69
|
-1 !== u && r.push(["X-Braze-Req-Tokens-Remaining", u.toString()]);
|
|
70
70
|
let d = !1;
|
|
71
|
-
|
|
71
|
+
a.O({
|
|
72
72
|
url: this.baseUrl + "/data/",
|
|
73
73
|
data: t,
|
|
74
74
|
headers: r,
|
|
75
|
-
|
|
75
|
+
W: (i) => {
|
|
76
76
|
null != t.respond_with &&
|
|
77
77
|
t.respond_with.triggers &&
|
|
78
|
-
(this.
|
|
79
|
-
this.
|
|
80
|
-
? (this.
|
|
81
|
-
this.
|
|
78
|
+
(this.Tl = Math.max(this.Tl - 1, 0)),
|
|
79
|
+
this.B.Y(t, i, r)
|
|
80
|
+
? (this.Qh.Z(),
|
|
81
|
+
this.h.cl(i),
|
|
82
82
|
(null != t.respond_with &&
|
|
83
83
|
t.respond_with.user_id != this.Cs.getUserId()) ||
|
|
84
|
-
(null != t.device && this.
|
|
84
|
+
(null != t.device && this.j.ft(s.ct.Qa, t.device),
|
|
85
85
|
null != t.sdk_metadata &&
|
|
86
|
-
(this.
|
|
87
|
-
this.
|
|
88
|
-
this.$
|
|
89
|
-
h.
|
|
86
|
+
(this.j.ft(s.ct.au, t.sdk_metadata),
|
|
87
|
+
this.j.ft(s.ct.du, this.C.bt())),
|
|
88
|
+
this.$l(i),
|
|
89
|
+
h.Bu(this.j, h.H.Tu, 1),
|
|
90
90
|
"function" == typeof e && e()))
|
|
91
91
|
: i.auth_error && (d = !0);
|
|
92
92
|
},
|
|
@@ -94,13 +94,13 @@ export default class Wt {
|
|
|
94
94
|
(d = !0),
|
|
95
95
|
null != t.respond_with &&
|
|
96
96
|
t.respond_with.triggers &&
|
|
97
|
-
(this.
|
|
98
|
-
this.
|
|
97
|
+
(this.Tl = Math.max(this.Tl - 1, 0)),
|
|
98
|
+
this.B.fu(t.events, t.attributes),
|
|
99
99
|
"function" == typeof n && n();
|
|
100
100
|
},
|
|
101
|
-
|
|
101
|
+
tt: (t, s) => {
|
|
102
102
|
"function" == typeof o && o(!d);
|
|
103
|
-
const e = this.
|
|
103
|
+
const e = this.B.Fu(s);
|
|
104
104
|
let n = 0;
|
|
105
105
|
if (e)
|
|
106
106
|
switch (e.type) {
|
|
@@ -112,98 +112,98 @@ export default class Wt {
|
|
|
112
112
|
}
|
|
113
113
|
if (i && !m) {
|
|
114
114
|
if (d) {
|
|
115
|
-
h
|
|
116
|
-
let t = this.
|
|
115
|
+
h.Ku(this.j, h.H.Tu);
|
|
116
|
+
let t = this.Ll;
|
|
117
117
|
(null == t || t < 1e3 * this.fE) && (t = 1e3 * this.fE);
|
|
118
|
-
const i = Math.min(3e5,
|
|
119
|
-
this.
|
|
120
|
-
} else this.
|
|
118
|
+
const i = Math.min(3e5, l(1e3 * this.fE, 3 * t)) + n;
|
|
119
|
+
this.Ql(i);
|
|
120
|
+
} else this.Ql(Math.max(1e3 * this.fE, n));
|
|
121
121
|
m = !0;
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
});
|
|
125
125
|
},
|
|
126
|
-
g = this.
|
|
126
|
+
g = this.Jl(c),
|
|
127
127
|
v = t || g;
|
|
128
|
-
if (this.
|
|
129
|
-
return void
|
|
128
|
+
if (this._l(r, g))
|
|
129
|
+
return void E.info(
|
|
130
130
|
"Declining to flush data due to 50 consecutive authentication failures",
|
|
131
131
|
);
|
|
132
|
-
if (i && !this.
|
|
133
|
-
return this.
|
|
134
|
-
const p = this.
|
|
135
|
-
v && this.
|
|
132
|
+
if (i && !this.B.Au(c, d, v))
|
|
133
|
+
return this.Ql(), void ("function" == typeof o && o(!0));
|
|
134
|
+
const p = this.B.Du(v, c, d, u);
|
|
135
|
+
v && this.Tl++;
|
|
136
136
|
let b = !1;
|
|
137
137
|
if (p)
|
|
138
138
|
for (const t of p)
|
|
139
|
-
this.
|
|
139
|
+
this.B.J(
|
|
140
140
|
t.requestData,
|
|
141
141
|
(i) => f(t.requestData, t.headers, i),
|
|
142
|
-
h.
|
|
142
|
+
h.H.Tu,
|
|
143
143
|
n,
|
|
144
144
|
),
|
|
145
145
|
(b = !0);
|
|
146
|
-
this.
|
|
147
|
-
? this.
|
|
146
|
+
this.Qh.fh() && i && !b
|
|
147
|
+
? this.Ql()
|
|
148
148
|
: g &&
|
|
149
|
-
(
|
|
150
|
-
this.
|
|
151
|
-
(this.
|
|
149
|
+
(E.info("Invoking new session subscriptions"),
|
|
150
|
+
this.Ml.L(),
|
|
151
|
+
(this.Ul = !0));
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
return this.
|
|
153
|
+
Yl() {
|
|
154
|
+
return this.Tl > 0;
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
this.
|
|
158
|
-
(this.
|
|
159
|
-
(this.
|
|
156
|
+
Ql(t = 1e3 * this.fE) {
|
|
157
|
+
this.Ol ||
|
|
158
|
+
(this.Xl(),
|
|
159
|
+
(this.Pl = window.setTimeout(() => {
|
|
160
160
|
if (document.hidden) {
|
|
161
161
|
const t = "visibilitychange",
|
|
162
162
|
i = () => {
|
|
163
163
|
document.hidden ||
|
|
164
|
-
(document.removeEventListener(t, i, !1), this.
|
|
164
|
+
(document.removeEventListener(t, i, !1), this.Kl());
|
|
165
165
|
};
|
|
166
166
|
document.addEventListener(t, i, !1);
|
|
167
|
-
} else this.
|
|
167
|
+
} else this.Kl();
|
|
168
168
|
}, t)),
|
|
169
|
-
(this.
|
|
169
|
+
(this.Ll = t));
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
null != this.
|
|
171
|
+
Xl() {
|
|
172
|
+
null != this.Pl && (clearTimeout(this.Pl), (this.Pl = null));
|
|
173
173
|
}
|
|
174
174
|
initialize() {
|
|
175
|
-
(this.
|
|
175
|
+
(this.Ol = !1), this.Ql();
|
|
176
176
|
}
|
|
177
177
|
destroy() {
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
181
|
-
(this.
|
|
182
|
-
this.
|
|
183
|
-
(this.
|
|
184
|
-
(this.
|
|
178
|
+
this.Ml.removeAllSubscriptions(),
|
|
179
|
+
this.Qh.Bh(),
|
|
180
|
+
this.Xl(),
|
|
181
|
+
(this.Ol = !0),
|
|
182
|
+
this.Kl(void 0, !1, void 0, void 0, void 0, void 0, !0),
|
|
183
|
+
(this.Pl = null),
|
|
184
|
+
(this.Ul = !1);
|
|
185
185
|
}
|
|
186
186
|
rn(t) {
|
|
187
|
-
return this.
|
|
187
|
+
return this.Ul ? (t(), null) : this.Ml.wt(t);
|
|
188
188
|
}
|
|
189
189
|
openSession() {
|
|
190
|
-
const t = this.
|
|
191
|
-
t && (this.
|
|
192
|
-
this.
|
|
193
|
-
this.
|
|
190
|
+
const t = this.C.bt() !== this.C.qo();
|
|
191
|
+
t && (this.j.hE(s.iu.Jh), this.j.hE(s.iu.su)),
|
|
192
|
+
this.Kl(!1, void 0, () => {
|
|
193
|
+
this.j.Nt(s.ct.qe);
|
|
194
194
|
}),
|
|
195
|
-
this.
|
|
195
|
+
this.zn(),
|
|
196
196
|
t &&
|
|
197
197
|
import("./Push/push-manager-factory.js").then((t) => {
|
|
198
|
-
if (this.
|
|
198
|
+
if (this.Ol) return;
|
|
199
199
|
const i = t.default.ea();
|
|
200
200
|
if (
|
|
201
201
|
null != i &&
|
|
202
202
|
(yt.isPushPermissionGranted() || yt.isPushBlocked())
|
|
203
203
|
) {
|
|
204
204
|
const t = () => {
|
|
205
|
-
i.
|
|
206
|
-
?
|
|
205
|
+
i.mn()
|
|
206
|
+
? E.info(
|
|
207
207
|
"Push token maintenance is disabled, not refreshing token for backend.",
|
|
208
208
|
)
|
|
209
209
|
: i.subscribe();
|
|
@@ -212,89 +212,89 @@ export default class Wt {
|
|
|
212
212
|
s && t();
|
|
213
213
|
},
|
|
214
214
|
h = () => {
|
|
215
|
-
const i = this.
|
|
215
|
+
const i = this.j.lt(s.ct.In);
|
|
216
216
|
(null == i || i) && t();
|
|
217
217
|
},
|
|
218
|
-
n = et.
|
|
219
|
-
new et(n,
|
|
218
|
+
n = et.Us.Rs;
|
|
219
|
+
new et(n, E).jr(n.Fs.cu, e, h);
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
-
|
|
224
|
-
this.
|
|
223
|
+
Zl() {
|
|
224
|
+
this.j.Nt(s.ct.Ie), this.j.Nt(s.ct.Ps), this.j.Nt(s.ct.Nr);
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
hc() {
|
|
227
227
|
var t, i;
|
|
228
|
-
this.
|
|
229
|
-
const e = h.
|
|
228
|
+
this.j.Nt(s.ct.Lu), this.j.Nt(s.ct.SE);
|
|
229
|
+
const e = h.H;
|
|
230
230
|
for (const i in e) {
|
|
231
231
|
const s = e[i];
|
|
232
|
-
this.
|
|
232
|
+
this.B.Uu(s, null === (t = this.h) || void 0 === t ? void 0 : t.Vu(s));
|
|
233
233
|
}
|
|
234
|
-
this.
|
|
234
|
+
this.B.Iu(null === (i = this.h) || void 0 === i ? void 0 : i.Ju());
|
|
235
235
|
}
|
|
236
236
|
changeUser(t, i, e) {
|
|
237
237
|
const h = this.Cs.getUserId();
|
|
238
238
|
if (h !== t) {
|
|
239
|
-
this.
|
|
240
|
-
this.
|
|
241
|
-
null != h && this.
|
|
239
|
+
this.C.Bl(),
|
|
240
|
+
this.Zl(),
|
|
241
|
+
null != h && this.Kl(void 0, !1, void 0, void 0, void 0),
|
|
242
242
|
this.Cs.ou(t),
|
|
243
|
-
e ? this.
|
|
243
|
+
e ? this.Qh.setSdkAuthenticationSignature(e) : this.Qh.qh();
|
|
244
244
|
for (let t = 0; t < i.length; t++) i[t].changeUser(null == h);
|
|
245
|
-
this.
|
|
246
|
-
null != h && this.
|
|
247
|
-
this.
|
|
248
|
-
this.
|
|
249
|
-
this.
|
|
245
|
+
this.B.fo(),
|
|
246
|
+
null != h && this.j.Nt(s.ct.rE),
|
|
247
|
+
this.j.Nt(s.ct.Qa),
|
|
248
|
+
this.j.Nt(s.ct.uE),
|
|
249
|
+
this.hc(),
|
|
250
250
|
this.openSession(),
|
|
251
|
-
|
|
251
|
+
E.info('Changed user to "' + t + '".');
|
|
252
252
|
} else {
|
|
253
253
|
let i = "Doing nothing.";
|
|
254
254
|
e &&
|
|
255
|
-
this.
|
|
256
|
-
(this.
|
|
255
|
+
this.Qh.wh() !== e &&
|
|
256
|
+
(this.Qh.setSdkAuthenticationSignature(e),
|
|
257
257
|
(i = "Updated SDK authentication signature")),
|
|
258
|
-
|
|
258
|
+
E.info(`Current user is already ${t}. ${i}`);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
requestImmediateDataFlush(t) {
|
|
262
|
-
this.
|
|
263
|
-
this.
|
|
262
|
+
this.Xl(), this.C.qo();
|
|
263
|
+
this.Kl(
|
|
264
264
|
void 0,
|
|
265
265
|
void 0,
|
|
266
266
|
void 0,
|
|
267
267
|
() => {
|
|
268
|
-
|
|
268
|
+
E.error("Failed to flush data, request will be retried automatically.");
|
|
269
269
|
},
|
|
270
270
|
t,
|
|
271
271
|
!0,
|
|
272
272
|
);
|
|
273
273
|
}
|
|
274
|
-
|
|
275
|
-
this.
|
|
276
|
-
|
|
277
|
-
this.
|
|
274
|
+
$r(t, i) {
|
|
275
|
+
this.C.qo(),
|
|
276
|
+
E.info("Requesting explicit trigger refresh."),
|
|
277
|
+
this.Kl(!0, void 0, t, i);
|
|
278
278
|
}
|
|
279
279
|
En(t, i) {
|
|
280
|
-
const e =
|
|
280
|
+
const e = m.nc,
|
|
281
281
|
h = { a: t, l: i },
|
|
282
|
-
n = c.
|
|
282
|
+
n = c.rt(e, h);
|
|
283
283
|
return (
|
|
284
|
-
n && (
|
|
284
|
+
n && (E.info(`Logged alias ${t} with label ${i}`), this.j.ft(s.ct.uE, h)),
|
|
285
285
|
n
|
|
286
286
|
);
|
|
287
287
|
}
|
|
288
288
|
Ln(t, i, s) {
|
|
289
|
-
if (this.
|
|
289
|
+
if (this.h.hu(i))
|
|
290
290
|
return (
|
|
291
|
-
|
|
291
|
+
E.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new H()
|
|
292
292
|
);
|
|
293
293
|
const e = { key: i, value: s },
|
|
294
|
-
h = c.
|
|
294
|
+
h = c.rt(t, e);
|
|
295
295
|
if (h) {
|
|
296
296
|
const t = "object" == typeof s ? JSON.stringify(s, null, 2) : s;
|
|
297
|
-
|
|
297
|
+
E.info(`Logged custom attribute: ${i} with value: ${t}`);
|
|
298
298
|
}
|
|
299
299
|
return h;
|
|
300
300
|
}
|
|
@@ -303,52 +303,52 @@ export default class Wt {
|
|
|
303
303
|
null != e && (o.altitude = e),
|
|
304
304
|
null != h && (o.ll_accuracy = h),
|
|
305
305
|
null != n && (o.alt_accuracy = n);
|
|
306
|
-
const r = c.
|
|
306
|
+
const r = c.rt(m.lc, o, t || void 0);
|
|
307
307
|
return (
|
|
308
308
|
r &&
|
|
309
|
-
|
|
309
|
+
E.info(`Set user last known location as ${JSON.stringify(o, null, 2)}`),
|
|
310
310
|
r
|
|
311
311
|
);
|
|
312
312
|
}
|
|
313
|
-
|
|
314
|
-
const s = this.
|
|
315
|
-
return new ue(this.Cs.getUserId(),
|
|
313
|
+
kr(t, i) {
|
|
314
|
+
const s = this.C.qo();
|
|
315
|
+
return new ue(this.Cs.getUserId(), m.uc, t, s, { cid: i });
|
|
316
316
|
}
|
|
317
|
-
|
|
317
|
+
cc(t, i) {
|
|
318
318
|
return new et(t, i);
|
|
319
319
|
}
|
|
320
|
-
|
|
321
|
-
const t = et.
|
|
322
|
-
this.
|
|
320
|
+
zn() {
|
|
321
|
+
const t = et.Us.Rs;
|
|
322
|
+
this.cc(t, E).setItem(t.Fs.Tu, 1, {
|
|
323
323
|
baseUrl: this.baseUrl,
|
|
324
|
-
data: { api_key: this.
|
|
324
|
+
data: { api_key: this.sn, device_id: this.on.fe().id },
|
|
325
325
|
userId: this.Cs.getUserId(),
|
|
326
|
-
sdkAuthEnabled: this.
|
|
326
|
+
sdkAuthEnabled: this.Qh.fh(),
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
yr(t) {
|
|
330
330
|
for (const i of t)
|
|
331
|
-
if (i.api_key === this.
|
|
331
|
+
if (i.api_key === this.sn) this.B.fu(i.events, i.attributes);
|
|
332
332
|
else {
|
|
333
|
-
const t = et.
|
|
334
|
-
new et(t,
|
|
333
|
+
const t = et.Us.Rs;
|
|
334
|
+
new et(t, E).setItem(t.Fs.wr, P.oe(), i);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
Hn(t, i, s) {
|
|
338
|
-
if (this.
|
|
338
|
+
if (this.h.hu(t))
|
|
339
339
|
return (
|
|
340
|
-
|
|
340
|
+
E.info(`Custom Attribute "${t}" is blocklisted, ignoring.`), new H()
|
|
341
341
|
);
|
|
342
342
|
let e, h;
|
|
343
343
|
return (
|
|
344
344
|
null === i && null === s
|
|
345
|
-
? ((e =
|
|
346
|
-
: ((e =
|
|
347
|
-
c.
|
|
345
|
+
? ((e = m.dc), (h = { key: t }))
|
|
346
|
+
: ((e = m.mc), (h = { key: t, latitude: i, longitude: s })),
|
|
347
|
+
c.rt(e, h)
|
|
348
348
|
);
|
|
349
349
|
}
|
|
350
350
|
Kn(t, i) {
|
|
351
351
|
const s = { group_id: t, status: i };
|
|
352
|
-
return c.
|
|
352
|
+
return c.rt(m.fc, s);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fr from "./filter.js";
|
|
2
2
|
import { isArray as D } from "../../util/code-utils.js";
|
|
3
3
|
export default class is {
|
|
4
4
|
constructor(t) {
|
|
@@ -27,27 +27,27 @@ export default class is {
|
|
|
27
27
|
for (let e = 0; e < t.length; e++) {
|
|
28
28
|
const o = [],
|
|
29
29
|
s = t[e];
|
|
30
|
-
for (let t = 0; t < s.length; t++) o.push(
|
|
30
|
+
for (let t = 0; t < s.length; t++) o.push(fr.fromJson(s[t]));
|
|
31
31
|
r.push(o);
|
|
32
32
|
}
|
|
33
33
|
return new is(r);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
dt() {
|
|
36
36
|
const t = [];
|
|
37
37
|
for (let r = 0; r < this.filters.length; r++) {
|
|
38
38
|
const e = this.filters[r],
|
|
39
39
|
o = [];
|
|
40
|
-
for (let t = 0; t < e.length; t++) o.push(e[t].
|
|
40
|
+
for (let t = 0; t < e.length; t++) o.push(e[t].dt());
|
|
41
41
|
t.push(o);
|
|
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(
|
|
50
|
+
for (let t = 0; t < s.length; t++) o.push(fr.qn(s[t]));
|
|
51
51
|
r.push(o);
|
|
52
52
|
}
|
|
53
53
|
return new is(r);
|