@braze/web-sdk 4.8.3 → 4.9.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 +121 -6
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +7 -7
- package/shared-lib/encoding-utils.js +4 -4
- package/shared-lib/event-types.js +22 -21
- package/shared-lib/guid.js +7 -7
- package/shared-lib/indexed-db-adapter.js +172 -135
- package/shared-lib/logger.js +26 -26
- package/shared-lib/supported-options.js +15 -15
- package/shared-lib/types.js +1 -0
- package/src/Card/card-manager-factory.js +1 -1
- package/src/Card/card-manager.js +2 -2
- package/src/Card/display/card-display.js +5 -4
- package/src/Card/models/banner.js +10 -10
- package/src/Card/models/captioned-image.js +7 -7
- package/src/Card/models/card.js +37 -36
- package/src/Card/models/classic-card.js +7 -7
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +32 -0
- package/src/Card/models/index.js +1 -0
- package/src/Card/util/card-factory.js +16 -16
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +102 -102
- 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 +4 -4
- package/src/ContentCards/ui/show-content-cards.js +15 -12
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/braze-sdk-metadata.js +1 -1
- package/src/Core/change-user.js +1 -1
- package/src/Core/device-properties.js +1 -1
- package/src/Core/disable-sdk.js +10 -7
- package/src/Core/enable-sdk.js +5 -2
- package/src/Core/get-device-id.js +3 -3
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +4 -4
- package/src/Core/log-purchase.js +9 -9
- package/src/Core/open-session.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +5 -3
- package/src/FeatureFlags/feature-flag.js +17 -14
- package/src/FeatureFlags/feature-flags-provider-factory.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +56 -43
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/index.js +1 -0
- package/src/FeatureFlags/log-feature-flag-impression.js +23 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +20 -20
- 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 +13 -10
- package/src/InAppMessage/defer-in-app-message.js +13 -0
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +47 -47
- package/src/InAppMessage/display/in-app-message-to-html.js +92 -91
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +5 -0
- package/src/InAppMessage/in-app-message-factory.js +77 -57
- package/src/InAppMessage/in-app-message-manager-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +121 -82
- package/src/InAppMessage/index.js +2 -0
- package/src/InAppMessage/log-in-app-message-button-click.js +17 -9
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +65 -29
- package/src/InAppMessage/models/html-message.js +32 -13
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +203 -134
- package/src/InAppMessage/models/modal-message.js +64 -29
- package/src/InAppMessage/models/slide-up-message.js +52 -24
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +49 -47
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
- 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 +19 -19
- package/src/Push/push-manager.js +131 -131
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +12 -10
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +57 -57
- package/src/common/base-feed.js +1 -1
- package/src/common/constants.js +1 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +34 -34
- package/src/common/translations.js +33 -33
- package/src/l10n/l10n-manager-factory.js +8 -8
- package/src/l10n/l10n-manager.js +6 -2
- package/src/l10n/types.js +1 -0
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +125 -125
- package/src/managers/device-manager.js +20 -20
- package/src/managers/network-manager.js +100 -98
- package/src/managers/server-config-manager.js +23 -23
- package/src/managers/session-manager.js +5 -5
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +132 -129
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +6 -6
- package/src/models/braze-event.js +11 -11
- package/src/models/braze-sdk-metadata.js +1 -1
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +5 -5
- package/src/models/server-config.js +7 -7
- package/src/request-controller.js +191 -178
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +7 -7
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +64 -60
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +55 -59
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +47 -35
- package/src/triggers/triggers-provider-factory.js +10 -6
- package/src/triggers/triggers-provider.js +203 -185
- package/src/triggers/types.js +1 -0
- package/src/ui/js/attach-css.js +5 -4
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +5 -5
- 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 +35 -30
- package/src/util/browser-detector.js +30 -31
- package/src/util/client-hints-parser.js +30 -24
- package/src/util/code-utils.js +22 -21
- package/src/util/color-utils.js +19 -13
- package/src/util/component-utils.js +4 -4
- package/src/util/date-utils.js +4 -3
- package/src/util/device-constants.js +10 -10
- package/src/util/dom-utils.js +32 -28
- package/src/util/error-utils.js +1 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +53 -57
- package/src/util/request-header-utils.js +34 -11
- package/src/util/string-utils.js +14 -14
- package/src/util/types.js +1 -0
- package/src/util/url-utils.js +1 -4
- package/src/util/user-agent-parser.js +39 -39
- package/src/util/validation-utils.js +32 -32
- package/src/util/window-utils.js +11 -12
|
@@ -7,7 +7,7 @@ export default class Kt {
|
|
|
7
7
|
e = null,
|
|
8
8
|
l = null,
|
|
9
9
|
r = { enabled: !1 },
|
|
10
|
-
a = { enabled: !1, refresh_rate_limit:
|
|
10
|
+
a = { enabled: !1, refresh_rate_limit: void 0 },
|
|
11
11
|
) {
|
|
12
12
|
(this.ol = t),
|
|
13
13
|
(this.cl = i),
|
|
@@ -16,7 +16,7 @@ export default class Kt {
|
|
|
16
16
|
(this.bl = e),
|
|
17
17
|
(this.al = l),
|
|
18
18
|
(this.ml = r),
|
|
19
|
-
(this.
|
|
19
|
+
(this.pi = a),
|
|
20
20
|
(this.ol = t),
|
|
21
21
|
(this.cl = i),
|
|
22
22
|
(this.gl = s),
|
|
@@ -24,11 +24,11 @@ export default class Kt {
|
|
|
24
24
|
(this.bl = e),
|
|
25
25
|
(this.al = l),
|
|
26
26
|
(this.ml = r),
|
|
27
|
-
(this.
|
|
27
|
+
(this.pi = a);
|
|
28
28
|
}
|
|
29
29
|
ss() {
|
|
30
30
|
return {
|
|
31
|
-
s: "4.
|
|
31
|
+
s: "4.9.0",
|
|
32
32
|
l: this.ol,
|
|
33
33
|
e: this.cl,
|
|
34
34
|
a: this.gl,
|
|
@@ -36,13 +36,13 @@ export default class Kt {
|
|
|
36
36
|
m: this.bl,
|
|
37
37
|
v: this.al,
|
|
38
38
|
c: this.ml,
|
|
39
|
-
f: this.
|
|
39
|
+
f: this.pi,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
static
|
|
42
|
+
static Yn(t) {
|
|
43
43
|
let i = t.l;
|
|
44
44
|
return (
|
|
45
|
-
"4.
|
|
45
|
+
"4.9.0" !== t.s && (i = 0), new Kt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,294 +1,307 @@
|
|
|
1
1
|
import C from "./util/net.js";
|
|
2
|
-
import
|
|
2
|
+
import be from "./models/braze-event.js";
|
|
3
3
|
import s from "./common/event-logger.js";
|
|
4
4
|
import { randomInclusive as D } from "./util/math.js";
|
|
5
5
|
import t from "./models/request-result.js";
|
|
6
6
|
import r from "../shared-lib/braze-shared-lib.js";
|
|
7
7
|
import { STORAGE_KEYS as i } from "./managers/storage-manager.js";
|
|
8
8
|
import E from "./managers/subscription-manager.js";
|
|
9
|
-
import
|
|
9
|
+
import jt from "./Push/utils/push-utils.js";
|
|
10
10
|
import T from "./util/request-header-utils.js";
|
|
11
11
|
export default class Rt {
|
|
12
|
-
constructor(t,
|
|
13
|
-
(this
|
|
14
|
-
(this.
|
|
15
|
-
(this.
|
|
16
|
-
(this.
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.Xl = n),
|
|
21
|
-
(this.Zl = l),
|
|
22
|
-
(this.yh = h),
|
|
12
|
+
constructor(t, i, s, e, o, h, n, r, u, l) {
|
|
13
|
+
(this.cn = t),
|
|
14
|
+
(this.baseUrl = i),
|
|
15
|
+
(this._e = s),
|
|
16
|
+
(this.fn = e),
|
|
17
|
+
(this.ft = o),
|
|
18
|
+
(this.wt = h),
|
|
19
|
+
(this.u = n),
|
|
23
20
|
(this.$h = r),
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
21
|
+
(this.Do = u),
|
|
22
|
+
(this.gt = l),
|
|
23
|
+
(this.cn = t),
|
|
24
|
+
(this.baseUrl = i),
|
|
25
|
+
(this.Kh = 0),
|
|
26
|
+
(this.gE = n.RE() || 0),
|
|
27
|
+
(this.Wh = null),
|
|
28
|
+
(this._e = s),
|
|
29
|
+
(this.fn = e),
|
|
30
|
+
(this.ft = o),
|
|
31
|
+
(this.wt = h),
|
|
32
|
+
(this.u = n),
|
|
33
|
+
(this.Do = u),
|
|
34
|
+
(this.gt = l),
|
|
35
|
+
(this.$h = r),
|
|
36
|
+
(this.Qh = new E()),
|
|
37
|
+
(this.Vh = null),
|
|
38
|
+
(this.Yh = 50),
|
|
39
|
+
(this.Zh = !1);
|
|
28
40
|
}
|
|
29
|
-
|
|
30
|
-
return !t && !
|
|
41
|
+
fu(t, i) {
|
|
42
|
+
return !t && !i && this.Do.Jh() >= this.Yh;
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
let
|
|
44
|
+
gu(t) {
|
|
45
|
+
let i = this._e.El();
|
|
34
46
|
if (t.length > 0) {
|
|
35
|
-
const
|
|
47
|
+
const s = this.ft.getUserId();
|
|
36
48
|
for (const e of t) {
|
|
37
|
-
const t = (!e.userId && !
|
|
38
|
-
e.type === r.q.Wl && t && (
|
|
49
|
+
const t = (!e.userId && !s) || e.userId === s;
|
|
50
|
+
e.type === r.q.Wl && t && (i = !0);
|
|
39
51
|
}
|
|
40
52
|
}
|
|
41
|
-
return
|
|
53
|
+
return i;
|
|
42
54
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
const
|
|
49
|
-
let
|
|
50
|
-
T.
|
|
51
|
-
C.
|
|
52
|
-
url: this.
|
|
55
|
+
vu(t = !1, s = !1, e = !0, o, h, n, u = !1, l = !1) {
|
|
56
|
+
e && this.wu();
|
|
57
|
+
const a = this.u.cE(),
|
|
58
|
+
c = this.u.AE();
|
|
59
|
+
let d = !1;
|
|
60
|
+
const f = (t, s) => {
|
|
61
|
+
let r = !1;
|
|
62
|
+
T.Ws(this.u, T.Os.Ja, new Date().valueOf()),
|
|
63
|
+
C.Xs({
|
|
64
|
+
url: this.baseUrl + "/data/",
|
|
53
65
|
data: t,
|
|
54
66
|
headers: s,
|
|
55
|
-
O: e => {
|
|
67
|
+
O: (e) => {
|
|
56
68
|
null != t.respond_with &&
|
|
57
69
|
t.respond_with.triggers &&
|
|
58
|
-
(this.
|
|
59
|
-
this.
|
|
60
|
-
? (this
|
|
61
|
-
this.
|
|
70
|
+
(this.Kh = Math.max(this.Kh - 1, 0)),
|
|
71
|
+
this.gt.Zs(t, e, s)
|
|
72
|
+
? (this.Do.ti(),
|
|
73
|
+
this.wt.ul(e),
|
|
62
74
|
(null != t.respond_with &&
|
|
63
|
-
t.respond_with.user_id != this.
|
|
64
|
-
(null != t.device && this.
|
|
75
|
+
t.respond_with.user_id != this.ft.getUserId()) ||
|
|
76
|
+
(null != t.device && this.u.D(i.k.Ca, t.device),
|
|
65
77
|
null != t.sdk_metadata &&
|
|
66
|
-
(this.
|
|
67
|
-
this.
|
|
68
|
-
this
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
(this.u.D(i.k.Xa, t.sdk_metadata),
|
|
79
|
+
this.u.D(i.k.Ea, this._e.Pa())),
|
|
80
|
+
this.$h(e),
|
|
81
|
+
T.si(this.u, T.Os.Ja, 1),
|
|
82
|
+
"function" == typeof o && o()))
|
|
83
|
+
: e.auth_error && (r = !0);
|
|
71
84
|
},
|
|
72
85
|
error: () => {
|
|
73
86
|
null != t.respond_with &&
|
|
74
87
|
t.respond_with.triggers &&
|
|
75
|
-
(this.
|
|
76
|
-
this.
|
|
77
|
-
"function" == typeof
|
|
88
|
+
(this.Kh = Math.max(this.Kh - 1, 0)),
|
|
89
|
+
this.gt.$a(t.events, t.attributes),
|
|
90
|
+
"function" == typeof h && h();
|
|
78
91
|
},
|
|
79
|
-
ei: t => {
|
|
80
|
-
if (("function" == typeof
|
|
81
|
-
if (t && !
|
|
92
|
+
ei: (t) => {
|
|
93
|
+
if (("function" == typeof n && n(t), e && !d)) {
|
|
94
|
+
if (t && !r) this.ku();
|
|
82
95
|
else {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
96
|
+
T.hi(this.u, T.Os.Ja);
|
|
97
|
+
let t = this.Wh;
|
|
98
|
+
(null == t || t < 1e3 * this.gE) && (t = 1e3 * this.gE),
|
|
99
|
+
this.ku(Math.min(3e5, D(1e3 * this.gE, 3 * t)));
|
|
86
100
|
}
|
|
87
|
-
|
|
101
|
+
d = !0;
|
|
88
102
|
}
|
|
89
|
-
}
|
|
103
|
+
},
|
|
90
104
|
});
|
|
91
105
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (this.
|
|
106
|
+
m = this.gu(a),
|
|
107
|
+
g = s || m;
|
|
108
|
+
if (this.fu(u, m))
|
|
95
109
|
return void r.j.info(
|
|
96
|
-
"Declining to flush data due to 50 consecutive authentication failures"
|
|
110
|
+
"Declining to flush data due to 50 consecutive authentication failures",
|
|
97
111
|
);
|
|
98
|
-
if (e && !this.
|
|
99
|
-
return this.
|
|
100
|
-
const
|
|
101
|
-
|
|
112
|
+
if (e && !this.gt.Wa(a, c, t, g))
|
|
113
|
+
return this.ku(), void ("function" == typeof n && n(!0));
|
|
114
|
+
const v = this.gt.Ya(t, g, a, c, l);
|
|
115
|
+
g && this.Kh++;
|
|
102
116
|
let p = !1;
|
|
103
|
-
if (
|
|
104
|
-
for (const t of
|
|
105
|
-
this.
|
|
106
|
-
this
|
|
107
|
-
? this.
|
|
108
|
-
:
|
|
117
|
+
if (v)
|
|
118
|
+
for (const t of v)
|
|
119
|
+
this.gt.Qs(t.requestData, () => f(t.requestData, t.headers)), (p = !0);
|
|
120
|
+
this.Do.wh() && e && !p
|
|
121
|
+
? this.ku()
|
|
122
|
+
: m && (r.j.info("Invoking new session subscriptions"), this.Qh.Et());
|
|
109
123
|
}
|
|
110
|
-
|
|
111
|
-
return this.
|
|
124
|
+
yu() {
|
|
125
|
+
return this.Kh > 0;
|
|
112
126
|
}
|
|
113
|
-
|
|
114
|
-
this.
|
|
115
|
-
(
|
|
116
|
-
this.
|
|
117
|
-
(this.Yh = setTimeout(() => {
|
|
127
|
+
ku(t = 1e3 * this.gE) {
|
|
128
|
+
this.Zh ||
|
|
129
|
+
(this.wu(),
|
|
130
|
+
(this.Vh = window.setTimeout(() => {
|
|
118
131
|
if (document.hidden) {
|
|
119
132
|
const t = "visibilitychange",
|
|
120
|
-
|
|
133
|
+
i = () => {
|
|
121
134
|
document.hidden ||
|
|
122
|
-
(document.removeEventListener(t,
|
|
135
|
+
(document.removeEventListener(t, i, !1), this.vu());
|
|
123
136
|
};
|
|
124
|
-
document.addEventListener(t,
|
|
125
|
-
} else this.
|
|
137
|
+
document.addEventListener(t, i, !1);
|
|
138
|
+
} else this.vu();
|
|
126
139
|
}, t)),
|
|
127
|
-
(this.
|
|
140
|
+
(this.Wh = t));
|
|
128
141
|
}
|
|
129
|
-
|
|
130
|
-
null != this.
|
|
142
|
+
wu() {
|
|
143
|
+
null != this.Vh && (clearTimeout(this.Vh), (this.Vh = null));
|
|
131
144
|
}
|
|
132
145
|
initialize() {
|
|
133
|
-
(this.
|
|
146
|
+
(this.Zh = !1), this.ku();
|
|
134
147
|
}
|
|
135
148
|
destroy() {
|
|
136
|
-
this.
|
|
137
|
-
this
|
|
138
|
-
this.
|
|
139
|
-
(this.
|
|
140
|
-
this.
|
|
141
|
-
(this.
|
|
149
|
+
this.Qh.removeAllSubscriptions(),
|
|
150
|
+
this.Do.Gh(),
|
|
151
|
+
this.wu(),
|
|
152
|
+
(this.Zh = !0),
|
|
153
|
+
this.vu(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
|
|
154
|
+
(this.Vh = null);
|
|
142
155
|
}
|
|
143
156
|
pr(t) {
|
|
144
|
-
return this.
|
|
157
|
+
return this.Qh.lt(t);
|
|
145
158
|
}
|
|
146
159
|
openSession() {
|
|
147
|
-
const t = this.
|
|
148
|
-
t && (this.
|
|
149
|
-
this.
|
|
150
|
-
this.
|
|
160
|
+
const t = this._e.Pa() !== this._e.co();
|
|
161
|
+
t && (this.u.uE(i.eu.Xo), this.u.uE(i.eu.su), this.u.ni(i.k.qi)),
|
|
162
|
+
this.vu(void 0, !1, void 0, void 0, void 0),
|
|
163
|
+
this.pu(),
|
|
151
164
|
t &&
|
|
152
|
-
import("./Push/push-manager-factory.js").then(t => {
|
|
153
|
-
if (this.
|
|
165
|
+
import("./Push/push-manager-factory.js").then((t) => {
|
|
166
|
+
if (this.Zh) return;
|
|
154
167
|
const s = t.default.m();
|
|
155
168
|
if (
|
|
156
169
|
null != s &&
|
|
157
|
-
(
|
|
170
|
+
(jt.isPushPermissionGranted() || jt.isPushBlocked())
|
|
158
171
|
) {
|
|
159
172
|
const t = () => {
|
|
160
|
-
s.
|
|
173
|
+
s.Sn()
|
|
161
174
|
? r.j.info(
|
|
162
|
-
"Push token maintenance is disabled, not refreshing token for backend."
|
|
175
|
+
"Push token maintenance is disabled, not refreshing token for backend.",
|
|
163
176
|
)
|
|
164
177
|
: s.subscribe();
|
|
165
178
|
},
|
|
166
|
-
e = (
|
|
167
|
-
|
|
179
|
+
e = (i, s) => {
|
|
180
|
+
s && t();
|
|
168
181
|
},
|
|
169
|
-
|
|
170
|
-
const s = this.
|
|
182
|
+
o = () => {
|
|
183
|
+
const s = this.u.v(i.k.Bn);
|
|
171
184
|
(null == s || s) && t();
|
|
172
185
|
},
|
|
173
|
-
|
|
174
|
-
new r.xt(
|
|
186
|
+
h = r.zt.Ft;
|
|
187
|
+
new r.xt(h, r.j).hr(h.Jt.cu, e, o);
|
|
175
188
|
}
|
|
176
189
|
});
|
|
177
190
|
}
|
|
178
191
|
changeUser(t, s, e) {
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
181
|
-
this.
|
|
182
|
-
null !=
|
|
183
|
-
this.
|
|
184
|
-
e ? this
|
|
185
|
-
for (let t = 0; t < s.length; t++) s[t].changeUser(null ==
|
|
186
|
-
null !=
|
|
187
|
-
this.
|
|
192
|
+
const o = this.ft.getUserId();
|
|
193
|
+
if (o !== t) {
|
|
194
|
+
this._e.kl(),
|
|
195
|
+
null != o && this.vu(void 0, !1, void 0, void 0, void 0),
|
|
196
|
+
this.ft.ru(t),
|
|
197
|
+
e ? this.Do.setSdkAuthenticationSignature(e) : this.Do.yh();
|
|
198
|
+
for (let t = 0; t < s.length; t++) s[t].changeUser(null == o);
|
|
199
|
+
null != o && this.u.ni(i.k.L),
|
|
200
|
+
this.u.ni(i.k.Ca),
|
|
188
201
|
this.openSession(),
|
|
189
202
|
r.j.info('Changed user to "' + t + '".');
|
|
190
203
|
} else {
|
|
191
|
-
let
|
|
204
|
+
let i = "Doing nothing.";
|
|
192
205
|
e &&
|
|
193
|
-
this
|
|
194
|
-
(this
|
|
195
|
-
(
|
|
196
|
-
r.j.info(`Current user is already ${t}. ${
|
|
206
|
+
this.Do.jh() !== e &&
|
|
207
|
+
(this.Do.setSdkAuthenticationSignature(e),
|
|
208
|
+
(i = "Updated SDK authentication signature")),
|
|
209
|
+
r.j.info(`Current user is already ${t}. ${i}`);
|
|
197
210
|
}
|
|
198
211
|
}
|
|
199
212
|
requestImmediateDataFlush(t) {
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
213
|
+
this.wu(), this._e.co();
|
|
214
|
+
this.vu(
|
|
215
|
+
void 0,
|
|
216
|
+
void 0,
|
|
217
|
+
void 0,
|
|
218
|
+
void 0,
|
|
206
219
|
() => {
|
|
207
220
|
r.j.error(
|
|
208
|
-
"Failed to flush data, request will be retried automatically."
|
|
221
|
+
"Failed to flush data, request will be retried automatically.",
|
|
209
222
|
);
|
|
210
223
|
},
|
|
211
224
|
t,
|
|
212
|
-
!0
|
|
225
|
+
!0,
|
|
213
226
|
);
|
|
214
227
|
}
|
|
215
228
|
requestFeedRefresh() {
|
|
216
|
-
this.
|
|
229
|
+
this._e.co(), this.vu(!0);
|
|
217
230
|
}
|
|
218
|
-
$r(t,
|
|
219
|
-
this.
|
|
231
|
+
$r(t, i) {
|
|
232
|
+
this._e.co(),
|
|
220
233
|
r.j.info("Requesting explicit trigger refresh."),
|
|
221
|
-
this.
|
|
234
|
+
this.vu(void 0, !0, void 0, t, i);
|
|
222
235
|
}
|
|
223
|
-
|
|
224
|
-
const e = r.q.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return
|
|
236
|
+
$n(t, i) {
|
|
237
|
+
const e = r.q.ju,
|
|
238
|
+
o = { a: t, l: i },
|
|
239
|
+
h = s.N(e, o);
|
|
240
|
+
return h && r.j.info(`Logged alias ${t} with label ${i}`), h;
|
|
228
241
|
}
|
|
229
|
-
|
|
230
|
-
if (this.
|
|
242
|
+
Gn(i, e, o) {
|
|
243
|
+
if (this.wt.hu(e))
|
|
231
244
|
return (
|
|
232
245
|
r.j.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
|
|
233
246
|
);
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
const t = "object" == typeof
|
|
247
|
+
const h = { key: e, value: o },
|
|
248
|
+
n = s.N(i, h);
|
|
249
|
+
if (n) {
|
|
250
|
+
const t = "object" == typeof o ? JSON.stringify(o, null, 2) : o;
|
|
238
251
|
r.j.info(`Logged custom attribute: ${e} with value: ${t}`);
|
|
239
252
|
}
|
|
240
|
-
return
|
|
253
|
+
return n;
|
|
241
254
|
}
|
|
242
|
-
setLastKnownLocation(t, i, e,
|
|
243
|
-
const
|
|
244
|
-
null !=
|
|
245
|
-
null !=
|
|
246
|
-
null !=
|
|
247
|
-
const
|
|
255
|
+
setLastKnownLocation(t, i, e, o, h, n) {
|
|
256
|
+
const u = { latitude: i, longitude: e };
|
|
257
|
+
null != o && (u.altitude = o),
|
|
258
|
+
null != h && (u.ll_accuracy = h),
|
|
259
|
+
null != n && (u.alt_accuracy = n);
|
|
260
|
+
const l = s.N(r.q.Su, u, t || void 0);
|
|
248
261
|
return (
|
|
249
|
-
|
|
262
|
+
l &&
|
|
250
263
|
r.j.info(
|
|
251
|
-
`Set user last known location as ${JSON.stringify(
|
|
264
|
+
`Set user last known location as ${JSON.stringify(u, null, 2)}`,
|
|
252
265
|
),
|
|
253
|
-
|
|
266
|
+
l
|
|
254
267
|
);
|
|
255
268
|
}
|
|
256
|
-
vr(t,
|
|
257
|
-
const
|
|
258
|
-
return new
|
|
269
|
+
vr(t, i) {
|
|
270
|
+
const s = this._e.co();
|
|
271
|
+
return new be(this.ft.getUserId(), r.q.$u, t, s, { cid: i });
|
|
259
272
|
}
|
|
260
|
-
|
|
273
|
+
pu() {
|
|
261
274
|
const t = r.zt.Ft;
|
|
262
|
-
new r.xt(t, r.j).setItem(t.Jt.
|
|
263
|
-
baseUrl: this.
|
|
264
|
-
data: { api_key: this
|
|
265
|
-
userId: this.
|
|
266
|
-
sdkAuthEnabled: this
|
|
275
|
+
new r.xt(t, r.j).setItem(t.Jt.Ja, 1, {
|
|
276
|
+
baseUrl: this.baseUrl,
|
|
277
|
+
data: { api_key: this.cn, device_id: this.fn.ce().id },
|
|
278
|
+
userId: this.ft.getUserId(),
|
|
279
|
+
sdkAuthEnabled: this.Do.wh(),
|
|
267
280
|
});
|
|
268
281
|
}
|
|
269
|
-
|
|
270
|
-
for (const
|
|
271
|
-
if (
|
|
282
|
+
yr(t) {
|
|
283
|
+
for (const i of t)
|
|
284
|
+
if (i.api_key === this.cn) this.gt.$a(i.events, i.attributes);
|
|
272
285
|
else {
|
|
273
286
|
const t = r.zt.Ft;
|
|
274
|
-
new r.xt(t, r.j).setItem(t.Jt.
|
|
287
|
+
new r.xt(t, r.j).setItem(t.Jt.wr, r.Z.Y(), i);
|
|
275
288
|
}
|
|
276
289
|
}
|
|
277
|
-
|
|
278
|
-
if (this.
|
|
290
|
+
Zn(i, e, o) {
|
|
291
|
+
if (this.wt.hu(i))
|
|
279
292
|
return (
|
|
280
293
|
r.j.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t()
|
|
281
294
|
);
|
|
282
|
-
let
|
|
295
|
+
let h, n;
|
|
283
296
|
return (
|
|
284
|
-
null === e && null ===
|
|
285
|
-
? ((
|
|
286
|
-
: ((
|
|
287
|
-
s.N(
|
|
297
|
+
null === e && null === o
|
|
298
|
+
? ((h = r.q.qu), (n = { key: i }))
|
|
299
|
+
: ((h = r.q.Au), (n = { key: i, latitude: e, longitude: o })),
|
|
300
|
+
s.N(h, n)
|
|
288
301
|
);
|
|
289
302
|
}
|
|
290
|
-
|
|
303
|
+
au(t, i) {
|
|
291
304
|
const e = { group_id: t, status: i };
|
|
292
|
-
return s.N(r.q.
|
|
305
|
+
return s.N(r.q.Cu, e);
|
|
293
306
|
}
|
|
294
307
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default class Qt {
|
|
2
2
|
constructor(t) {
|
|
3
|
-
this.
|
|
3
|
+
(this.yl = t), (this.yl = t);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
return null == this.
|
|
5
|
+
Bl(t) {
|
|
6
|
+
return null == this.yl || this.yl === t[0];
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
9
|
return new Qt(t ? t.event_name : null);
|
|
10
10
|
}
|
|
11
11
|
ss() {
|
|
12
|
-
return this.
|
|
12
|
+
return this.yl;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import Yt from "./filter-set.js";
|
|
2
2
|
export default class Zt {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.yl = t), (this.Jl = s), (this.yl = t), (this.Jl = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
6
|
+
Bl(t) {
|
|
7
|
+
if (null == this.yl || null == this.Jl) return !1;
|
|
8
8
|
const s = t[0],
|
|
9
|
-
|
|
10
|
-
return s === this.
|
|
9
|
+
i = t[1];
|
|
10
|
+
return s === this.yl && this.Jl.Bl(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
13
|
return new Zt(
|
|
14
14
|
t ? t.event_name : null,
|
|
15
|
-
t ? Yt.fromJson(t.property_filters) : null
|
|
15
|
+
t ? Yt.fromJson(t.property_filters) : null,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
ss() {
|
|
19
|
-
return { e: this.
|
|
19
|
+
return { e: this.yl, pf: this.Jl ? this.Jl.ss() : null };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -2,15 +2,15 @@ import sr from "./filter.js";
|
|
|
2
2
|
import { isArray as p } from "../../util/code-utils.js";
|
|
3
3
|
export default class Yt {
|
|
4
4
|
constructor(t) {
|
|
5
|
-
this.filters = t;
|
|
5
|
+
(this.filters = t), (this.filters = t);
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
Bl(t) {
|
|
8
8
|
let r = !0;
|
|
9
9
|
for (let e = 0; e < this.filters.length; e++) {
|
|
10
10
|
const o = this.filters[e];
|
|
11
11
|
let s = !1;
|
|
12
12
|
for (let r = 0; r < o.length; r++)
|
|
13
|
-
if (o[r].
|
|
13
|
+
if (o[r].Bl(t)) {
|
|
14
14
|
s = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -42,12 +42,12 @@ export default class Yt {
|
|
|
42
42
|
}
|
|
43
43
|
return t;
|
|
44
44
|
}
|
|
45
|
-
static
|
|
45
|
+
static Yn(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(sr.
|
|
50
|
+
for (let t = 0; t < s.length; t++) o.push(sr.Yn(s[t]));
|
|
51
51
|
r.push(o);
|
|
52
52
|
}
|
|
53
53
|
return new Yt(r);
|