@braze/web-sdk 6.4.0 → 6.5.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 +6 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +30 -30
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +58 -58
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +14 -14
- package/src/Banner/banner-provider.js +95 -81
- package/src/Banner/banner.js +9 -9
- package/src/Banner/constants.js +4 -0
- package/src/Banner/display/banner-to-html.js +1 -1
- package/src/Banner/display/destroy-banner-html.js +3 -3
- package/src/Banner/display/detect-banner-impressions.js +14 -14
- package/src/Banner/get-all-banners.js +4 -4
- package/src/Banner/get-banner.js +5 -4
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +6 -6
- package/src/Banner/request-banners-refresh.js +18 -20
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Banner/ui/insert-banner.js +17 -14
- package/src/Card/card-manager-factory.js +3 -3
- package/src/Card/card-manager.js +32 -32
- package/src/Card/constants.js +1 -0
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-content-card-click.js +2 -2
- package/src/Card/log-content-card-impressions.js +5 -5
- package/src/Card/models/captioned-image.js +3 -3
- package/src/Card/models/card.js +16 -16
- package/src/Card/models/classic-card.js +3 -3
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +3 -3
- package/src/Card/util/card-factory.js +6 -6
- package/src/ContentCards/content-cards-provider-factory.js +11 -11
- package/src/ContentCards/content-cards-provider.js +110 -96
- 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 +5 -5
- package/src/ContentCards/ui/show-content-cards.js +5 -5
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +4 -4
- 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/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +13 -13
- package/src/Core/log-purchase.js +10 -10
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-connection-core.js +23 -0
- package/src/DUST/dust-provider-factory.js +10 -8
- package/src/DUST/dust-provider.js +408 -176
- package/src/DUST/dust-shared-worker-code.js +2 -0
- package/src/DUST/dust-shared-worker-impl.js +240 -0
- package/src/DUST/dust-worker-bridge.js +136 -0
- package/src/DUST/index.js +10 -0
- package/src/DUST/subscribe-to-dust.js +13 -13
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +6 -6
- package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +98 -84
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +7 -7
- package/src/FeatureFlags/refresh-feature-flags.js +2 -2
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/constants.js +4 -0
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +40 -40
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +97 -97
- package/src/InAppMessage/log-in-app-message-button-click.js +14 -14
- package/src/InAppMessage/log-in-app-message-click.js +13 -13
- package/src/InAppMessage/log-in-app-message-html-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-impression.js +8 -8
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +17 -17
- package/src/InAppMessage/models/html-message.js +19 -19
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +121 -119
- package/src/InAppMessage/models/modal-message.js +17 -17
- package/src/InAppMessage/models/slide-up-message.js +22 -22
- 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 +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +34 -34
- package/src/Push/push-manager-factory.js +14 -14
- package/src/Push/push-manager.js +90 -90
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +32 -32
- package/src/User/user.js +71 -71
- package/src/common/constants.js +8 -11
- package/src/common/content-cards-display.js +32 -32
- package/src/common/event-logger.js +10 -10
- package/src/common/properties-base.js +16 -16
- package/src/l10n/l10n-manager-factory.js +11 -11
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +14 -14
- package/src/managers/braze-instance.js +152 -152
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +153 -153
- package/src/managers/server-config-manager.js +116 -88
- package/src/managers/session-manager.js +41 -41
- package/src/managers/storage-manager-factory.js +10 -10
- package/src/managers/storage-manager.js +137 -135
- 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 +10 -10
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +17 -17
- package/src/models/push-token.js +14 -14
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +41 -37
- package/src/request-controller.js +163 -160
- 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 +7 -7
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +2 -2
- 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 +47 -47
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +42 -42
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +66 -66
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +8 -8
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +33 -33
- package/src/util/client-hints-parser.js +10 -10
- package/src/util/component-utils.js +5 -5
- package/src/util/dom-utils.js +13 -13
- package/src/util/html-display-utils.js +7 -7
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +5 -5
- package/src/util/request-header-utils.js +26 -26
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +16 -16
- package/src/util/window-utils.js +3 -3
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { randomInclusive as
|
|
5
|
-
import
|
|
1
|
+
import l from "./util/net.js";
|
|
2
|
+
import De from "./models/braze-event.js";
|
|
3
|
+
import v from "./common/event-logger.js";
|
|
4
|
+
import { randomInclusive as a } from "./util/math.js";
|
|
5
|
+
import H from "./models/request-result.js";
|
|
6
6
|
import {
|
|
7
7
|
logger as E,
|
|
8
|
-
IndexedDBAdapter as
|
|
9
|
-
Guid as
|
|
10
|
-
EventTypes as
|
|
8
|
+
IndexedDBAdapter as et,
|
|
9
|
+
Guid as P,
|
|
10
|
+
EventTypes as f,
|
|
11
11
|
} from "../shared-lib/index.js";
|
|
12
12
|
import { STORAGE_KEYS as s } from "./managers/storage-manager.js";
|
|
13
|
-
import
|
|
13
|
+
import m from "./managers/subscription-manager.js";
|
|
14
14
|
import vt from "./Push/utils/push-utils.js";
|
|
15
15
|
import h from "./util/request-header-utils.js";
|
|
16
|
-
import { removeAllVisibleInAppMessages as
|
|
16
|
+
import { removeAllVisibleInAppMessages as di } from "./InAppMessage/ui/remove-all-visible-in-app-messages.js";
|
|
17
17
|
export default class Wt {
|
|
18
|
-
constructor(t, i, s, e, h, n, o, r, l,
|
|
19
|
-
(this.
|
|
18
|
+
constructor(t, i, s, e, h, n, o, r, l, u) {
|
|
19
|
+
(this.tu = t),
|
|
20
20
|
(this.baseUrl = i),
|
|
21
21
|
(this.C = s),
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
22
|
+
(this.eu = e),
|
|
23
|
+
(this.vs = h),
|
|
24
24
|
(this.h = n),
|
|
25
|
-
(this.
|
|
26
|
-
(this
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
25
|
+
(this.B = o),
|
|
26
|
+
(this.$c = r),
|
|
27
|
+
(this.hl = l),
|
|
28
|
+
(this.j = u),
|
|
29
|
+
(this.tu = t),
|
|
30
30
|
(this.baseUrl = i),
|
|
31
|
-
(this.
|
|
31
|
+
(this.Zc = 0),
|
|
32
32
|
(this.bE = o.dE() || 0),
|
|
33
|
-
(this.
|
|
33
|
+
(this.sd = null),
|
|
34
34
|
(this.C = s),
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
35
|
+
(this.eu = e),
|
|
36
|
+
(this.vs = h),
|
|
37
37
|
(this.h = n),
|
|
38
|
-
(this.
|
|
39
|
-
(this.
|
|
40
|
-
(this.
|
|
41
|
-
(this
|
|
42
|
-
(this.
|
|
43
|
-
(this.
|
|
44
|
-
(this.
|
|
45
|
-
(this.
|
|
46
|
-
(this.
|
|
38
|
+
(this.B = o),
|
|
39
|
+
(this.hl = l),
|
|
40
|
+
(this.j = u),
|
|
41
|
+
(this.$c = r),
|
|
42
|
+
(this.hd = new m()),
|
|
43
|
+
(this.nd = null),
|
|
44
|
+
(this.rd = 50),
|
|
45
|
+
(this.ld = !1),
|
|
46
|
+
(this.ud = !1);
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
return !t && !i && this.
|
|
48
|
+
ad(t, i) {
|
|
49
|
+
return !t && !i && this.hl.Jh() >= this.rd;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
let i = this.C.
|
|
51
|
+
md(t) {
|
|
52
|
+
let i = this.C.am();
|
|
53
53
|
if (t.length > 0) {
|
|
54
|
-
const s = this.
|
|
54
|
+
const s = this.vs.getUserId();
|
|
55
55
|
for (const e of t) {
|
|
56
56
|
const t = (!e.userId && !s) || e.userId === s;
|
|
57
|
-
e.type ===
|
|
57
|
+
e.type === f.Sm && t && (i = !0);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
return i;
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
i && this.
|
|
64
|
-
const c = this.
|
|
65
|
-
d = this.
|
|
62
|
+
fd(t = !1, i = !0, e, n, o, r = !1, u = !1) {
|
|
63
|
+
i && this.gd();
|
|
64
|
+
const c = this.B.RE(),
|
|
65
|
+
d = this.B.IE();
|
|
66
66
|
let m = !1;
|
|
67
67
|
const f = (t, r, u = -1) => {
|
|
68
68
|
const c = new Date().valueOf();
|
|
69
|
-
h.K(this.
|
|
69
|
+
h.K(this.B, h.H.Ze, c),
|
|
70
70
|
-1 !== u && r.push(["X-Braze-Req-Tokens-Remaining", u.toString()]);
|
|
71
71
|
let d = !1;
|
|
72
|
-
|
|
72
|
+
l.O({
|
|
73
73
|
url: this.baseUrl + "/data/",
|
|
74
74
|
data: t,
|
|
75
75
|
headers: r,
|
|
76
76
|
W: (i) => {
|
|
77
77
|
null != t.respond_with &&
|
|
78
78
|
t.respond_with.triggers &&
|
|
79
|
-
(this.
|
|
80
|
-
this.
|
|
81
|
-
? (this.
|
|
82
|
-
this.h.
|
|
79
|
+
(this.Zc = Math.max(this.Zc - 1, 0)),
|
|
80
|
+
this.j.Y(t, i, r)
|
|
81
|
+
? (this.hl.Z(),
|
|
82
|
+
this.h.Sc(i),
|
|
83
83
|
(null != t.respond_with &&
|
|
84
|
-
t.respond_with.user_id != this.
|
|
85
|
-
(null != t.device && this.
|
|
84
|
+
t.respond_with.user_id != this.vs.getUserId()) ||
|
|
85
|
+
(null != t.device && this.B.bt(s.ft.ac, t.device),
|
|
86
86
|
null != t.sdk_metadata &&
|
|
87
|
-
(this.
|
|
88
|
-
this.
|
|
89
|
-
this
|
|
90
|
-
h.
|
|
87
|
+
(this.B.bt(s.ft.Dl, t.sdk_metadata),
|
|
88
|
+
this.B.bt(s.ft.Tl, this.C.yt())),
|
|
89
|
+
this.$c(i),
|
|
90
|
+
h.xl(this.B, h.H.Ze, 1),
|
|
91
91
|
"function" == typeof e && e()))
|
|
92
92
|
: i.auth_error && (d = !0);
|
|
93
93
|
},
|
|
@@ -95,13 +95,13 @@ export default class Wt {
|
|
|
95
95
|
(d = !0),
|
|
96
96
|
null != t.respond_with &&
|
|
97
97
|
t.respond_with.triggers &&
|
|
98
|
-
(this.
|
|
99
|
-
this.
|
|
98
|
+
(this.Zc = Math.max(this.Zc - 1, 0)),
|
|
99
|
+
this.j.kl(t.events, t.attributes),
|
|
100
100
|
"function" == typeof n && n();
|
|
101
101
|
},
|
|
102
102
|
tt: (t, s) => {
|
|
103
103
|
"function" == typeof o && o(!d);
|
|
104
|
-
const e = this.
|
|
104
|
+
const e = this.j.Vl(s);
|
|
105
105
|
let n = 0;
|
|
106
106
|
if (e)
|
|
107
107
|
switch (e.type) {
|
|
@@ -113,97 +113,100 @@ export default class Wt {
|
|
|
113
113
|
}
|
|
114
114
|
if (i && !m) {
|
|
115
115
|
if (d) {
|
|
116
|
-
h.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
this.
|
|
121
|
-
|
|
116
|
+
h.Zl(this.B, h.H.Ze);
|
|
117
|
+
const t = this.h.st(),
|
|
118
|
+
i = this.h.it(),
|
|
119
|
+
s = this.h.nt();
|
|
120
|
+
let e = this.sd;
|
|
121
|
+
(null == e || e < t) && (e = t);
|
|
122
|
+
const o = Math.min(s, a(t, e * i)) + n;
|
|
123
|
+
this.pd(o);
|
|
124
|
+
} else this.pd(Math.max(1e3 * this.bE, n));
|
|
122
125
|
m = !0;
|
|
123
126
|
}
|
|
124
127
|
},
|
|
125
128
|
});
|
|
126
129
|
},
|
|
127
|
-
g = this.
|
|
130
|
+
g = this.md(c),
|
|
128
131
|
p = t || g;
|
|
129
|
-
if (this.
|
|
132
|
+
if (this.ad(r, g))
|
|
130
133
|
return void E.info(
|
|
131
134
|
"Declining to flush data due to 50 consecutive authentication failures",
|
|
132
135
|
);
|
|
133
|
-
if (i && !this.
|
|
134
|
-
return this.
|
|
135
|
-
const v = this.
|
|
136
|
-
p && this.
|
|
136
|
+
if (i && !this.j.Ml(c, d, p))
|
|
137
|
+
return this.pd(), void ("function" == typeof o && o(!0));
|
|
138
|
+
const v = this.j.$l(p, c, d, u);
|
|
139
|
+
p && this.Zc++;
|
|
137
140
|
let b = !1;
|
|
138
141
|
if (v)
|
|
139
142
|
for (const t of v)
|
|
140
|
-
this.
|
|
143
|
+
this.j.J(
|
|
141
144
|
t.requestData,
|
|
142
145
|
(i) => f(t.requestData, t.headers, i),
|
|
143
|
-
h.H.
|
|
146
|
+
h.H.Ze,
|
|
144
147
|
n,
|
|
145
148
|
),
|
|
146
149
|
(b = !0);
|
|
147
|
-
this.
|
|
148
|
-
? this.
|
|
150
|
+
this.hl.wh() && i && !b
|
|
151
|
+
? this.pd()
|
|
149
152
|
: g &&
|
|
150
153
|
(E.info("Invoking new session subscriptions"),
|
|
151
|
-
this.
|
|
152
|
-
(this.
|
|
154
|
+
this.hd.L(),
|
|
155
|
+
(this.ud = !0));
|
|
153
156
|
}
|
|
154
|
-
|
|
155
|
-
return this.
|
|
157
|
+
vd() {
|
|
158
|
+
return this.Zc > 0;
|
|
156
159
|
}
|
|
157
|
-
|
|
158
|
-
this.
|
|
159
|
-
(this.
|
|
160
|
-
(this.
|
|
160
|
+
pd(t = 1e3 * this.bE) {
|
|
161
|
+
this.ld ||
|
|
162
|
+
(this.gd(),
|
|
163
|
+
(this.nd = window.setTimeout(() => {
|
|
161
164
|
if (document.hidden) {
|
|
162
165
|
const t = "visibilitychange",
|
|
163
166
|
i = () => {
|
|
164
167
|
document.hidden ||
|
|
165
|
-
(document.removeEventListener(t, i, !1), this
|
|
168
|
+
(document.removeEventListener(t, i, !1), this.fd());
|
|
166
169
|
};
|
|
167
170
|
document.addEventListener(t, i, !1);
|
|
168
|
-
} else this
|
|
171
|
+
} else this.fd();
|
|
169
172
|
}, t)),
|
|
170
|
-
(this.
|
|
173
|
+
(this.sd = t));
|
|
171
174
|
}
|
|
172
|
-
|
|
173
|
-
null != this.
|
|
175
|
+
gd() {
|
|
176
|
+
null != this.nd && (clearTimeout(this.nd), (this.nd = null));
|
|
174
177
|
}
|
|
175
178
|
initialize() {
|
|
176
|
-
(this.
|
|
179
|
+
(this.ld = !1), this.pd();
|
|
177
180
|
}
|
|
178
181
|
destroy() {
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
181
|
-
this.
|
|
182
|
-
(this.
|
|
183
|
-
this
|
|
184
|
-
(this.
|
|
185
|
-
(this.
|
|
182
|
+
this.hd.removeAllSubscriptions(),
|
|
183
|
+
this.hl.Gh(),
|
|
184
|
+
this.gd(),
|
|
185
|
+
(this.ld = !0),
|
|
186
|
+
this.fd(void 0, !1, void 0, void 0, void 0, void 0, !0),
|
|
187
|
+
(this.nd = null),
|
|
188
|
+
(this.ud = !1);
|
|
186
189
|
}
|
|
187
190
|
rn(t) {
|
|
188
|
-
return this.
|
|
191
|
+
return this.ud ? (t(), null) : this.hd.Rt(t);
|
|
189
192
|
}
|
|
190
193
|
openSession() {
|
|
191
|
-
const t = this.C.
|
|
192
|
-
t && (this.
|
|
193
|
-
this
|
|
194
|
-
t && (this.
|
|
194
|
+
const t = this.C.yt() !== this.C.el();
|
|
195
|
+
t && (this.B.hE(s.Ou.tl), this.B.hE(s.Ou.Cu)),
|
|
196
|
+
this.fd(!1, void 0, () => {
|
|
197
|
+
t && (this.B.zt(s.ft.vo), this.B.zt(s.ft.Dt));
|
|
195
198
|
}),
|
|
196
|
-
this.
|
|
199
|
+
this.Ya(),
|
|
197
200
|
t &&
|
|
198
201
|
import("./Push/push-manager-factory.js").then((t) => {
|
|
199
|
-
if (this.
|
|
200
|
-
const i = t.default.
|
|
202
|
+
if (this.ld) return;
|
|
203
|
+
const i = t.default.ra();
|
|
201
204
|
if (
|
|
202
205
|
null != i &&
|
|
203
206
|
(vt.isPushPermissionGranted() || vt.isPushBlocked())
|
|
204
207
|
) {
|
|
205
208
|
const t = () => {
|
|
206
|
-
i.
|
|
209
|
+
i.du()
|
|
207
210
|
? E.info(
|
|
208
211
|
"Push token maintenance is disabled, not refreshing token for backend.",
|
|
209
212
|
)
|
|
@@ -213,56 +216,56 @@ export default class Wt {
|
|
|
213
216
|
s && t();
|
|
214
217
|
},
|
|
215
218
|
h = () => {
|
|
216
|
-
const i = this.
|
|
219
|
+
const i = this.B.dt(s.ft.Uu);
|
|
217
220
|
(null == i || i) && t();
|
|
218
221
|
},
|
|
219
|
-
n =
|
|
220
|
-
new
|
|
222
|
+
n = et.Us.Rs;
|
|
223
|
+
new et(n, E).kr(n.Fs.Fu, e, h);
|
|
221
224
|
}
|
|
222
225
|
});
|
|
223
226
|
}
|
|
224
|
-
|
|
225
|
-
this.
|
|
227
|
+
bd() {
|
|
228
|
+
this.B.zt(s.ft.lo), this.B.zt(s.ft.Ps), this.B.zt(s.ft.Wn);
|
|
226
229
|
}
|
|
227
|
-
|
|
230
|
+
wd() {
|
|
228
231
|
var t, i;
|
|
229
|
-
this.
|
|
232
|
+
this.B.zt(s.ft.Jl), this.B.zt(s.ft.lE);
|
|
230
233
|
const e = h.H;
|
|
231
234
|
for (const i in e) {
|
|
232
235
|
const s = e[i];
|
|
233
|
-
this.
|
|
236
|
+
this.j.lc(s, null === (t = this.h) || void 0 === t ? void 0 : t.Dc(s));
|
|
234
237
|
}
|
|
235
|
-
this.
|
|
238
|
+
this.j.hc(null === (i = this.h) || void 0 === i ? void 0 : i.qc());
|
|
236
239
|
}
|
|
237
240
|
changeUser(t, i, e) {
|
|
238
|
-
const h = this.
|
|
241
|
+
const h = this.vs.getUserId();
|
|
239
242
|
if (h !== t) {
|
|
240
|
-
this.C.
|
|
241
|
-
this.
|
|
242
|
-
|
|
243
|
-
null != h && this
|
|
244
|
-
this.
|
|
245
|
-
e ? this.
|
|
243
|
+
this.C.jm(),
|
|
244
|
+
this.bd(),
|
|
245
|
+
di(),
|
|
246
|
+
null != h && this.fd(void 0, !1, void 0, void 0, void 0),
|
|
247
|
+
this.vs.Ju(t),
|
|
248
|
+
e ? this.hl.setSdkAuthenticationSignature(e) : this.hl.yh();
|
|
246
249
|
for (let t = 0; t < i.length; t++) i[t].changeUser(null == h);
|
|
247
|
-
this.
|
|
248
|
-
null != h && this.
|
|
249
|
-
this.
|
|
250
|
-
this.
|
|
251
|
-
this.
|
|
250
|
+
this.j.fo(),
|
|
251
|
+
null != h && this.B.zt(s.ft.rE),
|
|
252
|
+
this.B.zt(s.ft.ac),
|
|
253
|
+
this.B.zt(s.ft.uE),
|
|
254
|
+
this.wd(),
|
|
252
255
|
this.openSession(),
|
|
253
256
|
E.info('Changed user to "' + t + '".');
|
|
254
257
|
} else {
|
|
255
258
|
let i = "Doing nothing.";
|
|
256
259
|
e &&
|
|
257
|
-
this.
|
|
258
|
-
(this.
|
|
260
|
+
this.hl.jh() !== e &&
|
|
261
|
+
(this.hl.setSdkAuthenticationSignature(e),
|
|
259
262
|
(i = "Updated SDK authentication signature")),
|
|
260
263
|
E.info(`Current user is already ${t}. ${i}`);
|
|
261
264
|
}
|
|
262
265
|
}
|
|
263
266
|
requestImmediateDataFlush(t) {
|
|
264
|
-
this.
|
|
265
|
-
this
|
|
267
|
+
this.gd(), this.C.el();
|
|
268
|
+
this.fd(
|
|
266
269
|
void 0,
|
|
267
270
|
void 0,
|
|
268
271
|
void 0,
|
|
@@ -274,26 +277,26 @@ export default class Wt {
|
|
|
274
277
|
);
|
|
275
278
|
}
|
|
276
279
|
yr(t, i) {
|
|
277
|
-
this.C.
|
|
280
|
+
this.C.el(),
|
|
278
281
|
E.info("Requesting explicit trigger refresh."),
|
|
279
|
-
this
|
|
282
|
+
this.fd(!0, void 0, t, i);
|
|
280
283
|
}
|
|
281
|
-
|
|
282
|
-
const e =
|
|
284
|
+
Gu(t, i) {
|
|
285
|
+
const e = f.kd,
|
|
283
286
|
h = { a: t, l: i },
|
|
284
|
-
n =
|
|
287
|
+
n = v.lt(e, h);
|
|
285
288
|
return (
|
|
286
|
-
n && (E.info(`Logged alias ${t} with label ${i}`), this.
|
|
289
|
+
n && (E.info(`Logged alias ${t} with label ${i}`), this.B.bt(s.ft.uE, h)),
|
|
287
290
|
n
|
|
288
291
|
);
|
|
289
292
|
}
|
|
290
|
-
|
|
291
|
-
if (this.h.
|
|
293
|
+
Mu(t, i, s) {
|
|
294
|
+
if (this.h.qu(i))
|
|
292
295
|
return (
|
|
293
|
-
E.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new
|
|
296
|
+
E.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new H()
|
|
294
297
|
);
|
|
295
298
|
const e = { key: i, value: s },
|
|
296
|
-
h =
|
|
299
|
+
h = v.lt(t, e);
|
|
297
300
|
if (h) {
|
|
298
301
|
const t = "object" == typeof s ? JSON.stringify(s, null, 2) : s;
|
|
299
302
|
E.info(`Logged custom attribute: ${i} with value: ${t}`);
|
|
@@ -305,7 +308,7 @@ export default class Wt {
|
|
|
305
308
|
null != e && (o.altitude = e),
|
|
306
309
|
null != h && (o.ll_accuracy = h),
|
|
307
310
|
null != n && (o.alt_accuracy = n);
|
|
308
|
-
const r =
|
|
311
|
+
const r = v.lt(f.yd, o, t || void 0);
|
|
309
312
|
return (
|
|
310
313
|
r &&
|
|
311
314
|
E.info(`Set user last known location as ${JSON.stringify(o, null, 2)}`),
|
|
@@ -313,44 +316,44 @@ export default class Wt {
|
|
|
313
316
|
);
|
|
314
317
|
}
|
|
315
318
|
$r(t, i) {
|
|
316
|
-
const s = this.C.
|
|
317
|
-
return new
|
|
319
|
+
const s = this.C.el();
|
|
320
|
+
return new De(this.vs.getUserId(), f.jd, t, s, { cid: i });
|
|
318
321
|
}
|
|
319
|
-
|
|
320
|
-
return new
|
|
322
|
+
Sd(t, i) {
|
|
323
|
+
return new et(t, i);
|
|
321
324
|
}
|
|
322
|
-
|
|
323
|
-
const t =
|
|
324
|
-
this.
|
|
325
|
+
Ya() {
|
|
326
|
+
const t = et.Us.Rs;
|
|
327
|
+
this.Sd(t, E).setItem(t.Fs.Ze, 1, {
|
|
325
328
|
baseUrl: this.baseUrl,
|
|
326
|
-
data: { api_key: this.
|
|
327
|
-
userId: this.
|
|
328
|
-
sdkAuthEnabled: this.
|
|
329
|
+
data: { api_key: this.tu, device_id: this.eu.ve().id },
|
|
330
|
+
userId: this.vs.getUserId(),
|
|
331
|
+
sdkAuthEnabled: this.hl.wh(),
|
|
329
332
|
});
|
|
330
333
|
}
|
|
331
334
|
Fr(t) {
|
|
332
335
|
for (const i of t)
|
|
333
|
-
if (i.api_key === this.
|
|
336
|
+
if (i.api_key === this.tu) this.j.kl(i.events, i.attributes);
|
|
334
337
|
else {
|
|
335
|
-
const t =
|
|
336
|
-
new
|
|
338
|
+
const t = et.Us.Rs;
|
|
339
|
+
new et(t, E).setItem(t.Fs.zr, P.se(), i);
|
|
337
340
|
}
|
|
338
341
|
}
|
|
339
|
-
|
|
340
|
-
if (this.h.
|
|
342
|
+
Na(t, i, s) {
|
|
343
|
+
if (this.h.qu(t))
|
|
341
344
|
return (
|
|
342
|
-
E.info(`Custom Attribute "${t}" is blocklisted, ignoring.`), new
|
|
345
|
+
E.info(`Custom Attribute "${t}" is blocklisted, ignoring.`), new H()
|
|
343
346
|
);
|
|
344
347
|
let e, h;
|
|
345
348
|
return (
|
|
346
349
|
null === i && null === s
|
|
347
|
-
? ((e =
|
|
348
|
-
: ((e =
|
|
349
|
-
|
|
350
|
+
? ((e = f.Ad), (h = { key: t }))
|
|
351
|
+
: ((e = f.Dd), (h = { key: t, latitude: i, longitude: s })),
|
|
352
|
+
v.lt(e, h)
|
|
350
353
|
);
|
|
351
354
|
}
|
|
352
|
-
|
|
355
|
+
Ra(t, i) {
|
|
353
356
|
const s = { group_id: t, status: i };
|
|
354
|
-
return
|
|
357
|
+
return v.lt(f.$d, s);
|
|
355
358
|
}
|
|
356
359
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default class rs {
|
|
2
2
|
constructor(t) {
|
|
3
|
-
(this.
|
|
3
|
+
(this.tf = t), (this.tf = t);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
return null == this.
|
|
5
|
+
sf(t) {
|
|
6
|
+
return null == this.tf || this.tf === t[0];
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
9
|
return new rs(t ? t.event_name : null);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
return this.
|
|
11
|
+
gt() {
|
|
12
|
+
return this.tf;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import is from "./filter-set.js";
|
|
2
2
|
export default class ls {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.tf = t), (this.if = s), (this.tf = t), (this.if = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
6
|
+
sf(t) {
|
|
7
|
+
if (null == this.tf || null == this.if) return !1;
|
|
8
8
|
const s = t[0],
|
|
9
9
|
i = t[1];
|
|
10
|
-
return s === this.
|
|
10
|
+
return s === this.tf && this.if.sf(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
13
|
return new ls(
|
|
@@ -15,7 +15,7 @@ export default class ls {
|
|
|
15
15
|
t ? is.fromJson(t.property_filters) : null,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return { e: this.
|
|
18
|
+
gt() {
|
|
19
|
+
return { e: this.tf, pf: this.if ? this.if.gt() : null };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import cr from "./filter.js";
|
|
2
|
-
import { isArray as
|
|
2
|
+
import { isArray as R } from "../../util/code-utils.js";
|
|
3
3
|
export default class is {
|
|
4
4
|
constructor(t) {
|
|
5
5
|
(this.filters = t), (this.filters = t);
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
sf(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].sf(t)) {
|
|
14
14
|
s = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -22,7 +22,7 @@ export default class is {
|
|
|
22
22
|
return r;
|
|
23
23
|
}
|
|
24
24
|
static fromJson(t) {
|
|
25
|
-
if (null == t || !
|
|
25
|
+
if (null == t || !R(t)) return null;
|
|
26
26
|
const r = [];
|
|
27
27
|
for (let e = 0; e < t.length; e++) {
|
|
28
28
|
const o = [],
|
|
@@ -32,22 +32,22 @@ export default class is {
|
|
|
32
32
|
}
|
|
33
33
|
return new is(r);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
gt() {
|
|
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].gt());
|
|
41
41
|
t.push(o);
|
|
42
42
|
}
|
|
43
43
|
return t;
|
|
44
44
|
}
|
|
45
|
-
static
|
|
45
|
+
static _u(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(cr.
|
|
50
|
+
for (let t = 0; t < s.length; t++) o.push(cr._u(s[t]));
|
|
51
51
|
r.push(o);
|
|
52
52
|
}
|
|
53
53
|
return new is(r);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDate as Nt } from "../../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
|
-
convertMsToSeconds as
|
|
4
|
-
dateFromUnixTimestamp as
|
|
3
|
+
convertMsToSeconds as X,
|
|
4
|
+
dateFromUnixTimestamp as V,
|
|
5
5
|
secondsAgo as es,
|
|
6
6
|
secondsInTheFuture as hs,
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
@@ -20,9 +20,9 @@ export default class cr {
|
|
|
20
20
|
this.comparator !== cr.BE.jE &&
|
|
21
21
|
this.comparator !== cr.BE.zE &&
|
|
22
22
|
this.comparator !== cr.BE.FE &&
|
|
23
|
-
(this.LE =
|
|
23
|
+
(this.LE = V(this.LE));
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
sf(t) {
|
|
26
26
|
let s = null;
|
|
27
27
|
switch ((null != t && (s = t[this.yE]), this.comparator)) {
|
|
28
28
|
case cr.BE.kE:
|
|
@@ -74,14 +74,14 @@ export default class cr {
|
|
|
74
74
|
t.property_value,
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
gt() {
|
|
78
78
|
let t = this.LE;
|
|
79
79
|
return (
|
|
80
|
-
Nt(this.LE) && (t =
|
|
80
|
+
Nt(this.LE) && (t = X(t.valueOf())),
|
|
81
81
|
{ k: this.yE, t: this.HE, c: this.comparator, v: t }
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
|
-
static
|
|
84
|
+
static _u(t) {
|
|
85
85
|
return new cr(t.k, t.t, t.c, t.v);
|
|
86
86
|
}
|
|
87
87
|
}
|