@braze/web-sdk 5.9.0 → 6.0.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 +109 -253
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +24 -26
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +19 -19
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +21 -22
- package/src/Banner/display/banner-to-html.js +13 -25
- package/src/Banner/display/destroy-banner-html.js +2 -2
- package/src/Banner/display/detect-banner-impressions.js +11 -11
- package/src/Banner/index.js +0 -1
- package/src/Banner/request-banners-refresh.js +8 -8
- package/src/Banner/subscribe-to-banners-updates.js +2 -2
- package/src/Banner/ui/insert-banner.js +7 -7
- package/src/Card/card-manager.js +35 -37
- package/src/Card/display/card-display.js +76 -74
- package/src/Card/index.js +0 -2
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-content-card-click.js +9 -2
- package/src/Card/log-content-card-impressions.js +11 -2
- package/src/Card/models/captioned-image.js +20 -20
- package/src/Card/models/card.js +110 -104
- package/src/Card/models/classic-card.js +20 -20
- package/src/Card/models/control-card.js +14 -14
- package/src/Card/models/image-only.js +19 -20
- package/src/Card/util/card-factory.js +57 -78
- package/src/ContentCards/content-cards-provider-factory.js +10 -10
- package/src/ContentCards/content-cards-provider.js +109 -109
- package/src/ContentCards/content-cards.js +21 -13
- 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/hide-content-cards.js +5 -5
- package/src/ContentCards/ui/show-content-cards.js +34 -34
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +7 -7
- package/src/Core/disable-sdk.js +6 -6
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +7 -7
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +9 -9
- package/src/Core/log-purchase.js +7 -7
- package/src/Core/open-session.js +12 -12
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +7 -7
- 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 +1 -1
- 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/refresh-feature-flags.js +2 -2
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +37 -37
- package/src/InAppMessage/display/in-app-message-to-html.js +139 -133
- package/src/InAppMessage/display/modal-utils.js +39 -41
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +22 -14
- package/src/InAppMessage/in-app-message-manager.js +90 -88
- package/src/InAppMessage/log-in-app-message-button-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +40 -34
- package/src/InAppMessage/models/html-message.js +23 -21
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +137 -133
- package/src/InAppMessage/models/modal-message.js +39 -33
- package/src/InAppMessage/models/slide-up-message.js +36 -30
- 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 +56 -62
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +8 -8
- package/src/Push/push-manager.js +90 -90
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/utils/push-utils.js +25 -15
- package/src/User/user-manager.js +14 -14
- package/src/User/user.js +55 -55
- package/src/common/content-cards-display.js +211 -0
- package/src/common/event-logger.js +6 -6
- package/src/index.js +0 -1
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/l10n/l10n-manager.js +6 -6
- package/src/managers/auth-manager.js +27 -27
- package/src/managers/braze-instance.js +136 -137
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +180 -183
- package/src/managers/server-config-manager.js +63 -63
- package/src/managers/session-manager.js +34 -34
- package/src/managers/storage-manager-factory.js +11 -11
- package/src/managers/storage-manager.js +139 -141
- package/src/managers/subscription-manager.js +3 -3
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +15 -15
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +13 -13
- package/src/models/push-token.js +12 -12
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +29 -29
- package/src/request-controller.js +181 -169
- package/src/triggers/models/custom-event-data.js +6 -6
- package/src/triggers/models/custom-event-property-data.js +7 -7
- package/src/triggers/models/filter-set.js +8 -8
- package/src/triggers/models/filter.js +45 -45
- package/src/triggers/models/in-app-message-click-data.js +3 -3
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +47 -47
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +15 -15
- package/src/triggers/triggers-provider-factory.js +4 -4
- package/src/triggers/triggers-provider.js +44 -44
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/banner-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +4 -4
- package/src/util/braze-actions.js +8 -14
- package/src/util/browser-detector.js +12 -12
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/component-utils.js +14 -14
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +6 -6
- package/src/util/html-display-utils.js +37 -37
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +17 -17
- package/src/util/user-agent-parser.js +4 -4
- package/src/util/validation-utils.js +20 -20
- package/src/util/window-utils.js +1 -1
- package/src/Card/log-card-click.js +0 -11
- package/src/Card/log-card-impressions.js +0 -13
- package/src/Feed/feed-provider-factory.js +0 -18
- package/src/Feed/feed-provider.js +0 -90
- package/src/Feed/feed.js +0 -20
- package/src/Feed/get-cached-feed.js +0 -5
- package/src/Feed/index.js +0 -8
- package/src/Feed/log-feed-displayed.js +0 -7
- package/src/Feed/request-feed-refresh.js +0 -5
- package/src/Feed/subscribe-to-feed-updates.js +0 -5
- package/src/Feed/types.js +0 -1
- package/src/Feed/ui/hide-feed.js +0 -7
- package/src/Feed/ui/show-feed.js +0 -96
- package/src/Feed/ui/toggle-feed.js +0 -8
- package/src/common/base-feed.js +0 -29
- package/src/common/feed-display.js +0 -211
|
@@ -1,203 +1,208 @@
|
|
|
1
1
|
import l from "./util/net.js";
|
|
2
|
-
import
|
|
2
|
+
import ue from "./models/braze-event.js";
|
|
3
3
|
import c from "./common/event-logger.js";
|
|
4
4
|
import { randomInclusive as a } from "./util/math.js";
|
|
5
|
-
import
|
|
5
|
+
import G from "./models/request-result.js";
|
|
6
6
|
import {
|
|
7
7
|
logger as N,
|
|
8
|
-
IndexedDBAdapter as
|
|
9
|
-
Guid as
|
|
8
|
+
IndexedDBAdapter as et,
|
|
9
|
+
Guid as O,
|
|
10
10
|
EventTypes as d,
|
|
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";
|
|
14
|
-
import
|
|
14
|
+
import yt from "./Push/utils/push-utils.js";
|
|
15
15
|
import h from "./util/request-header-utils.js";
|
|
16
|
-
export default class
|
|
17
|
-
constructor(t, i, s, e, h,
|
|
18
|
-
(this.
|
|
16
|
+
export default class Wt {
|
|
17
|
+
constructor(t, i, s, e, h, n, o, r, l, a) {
|
|
18
|
+
(this.on = t),
|
|
19
19
|
(this.baseUrl = i),
|
|
20
20
|
(this.T = s),
|
|
21
|
-
(this.
|
|
21
|
+
(this.un = e),
|
|
22
22
|
(this.Cs = h),
|
|
23
|
-
(this.B =
|
|
24
|
-
(this.C =
|
|
25
|
-
(this.$
|
|
26
|
-
(this.
|
|
23
|
+
(this.B = n),
|
|
24
|
+
(this.C = o),
|
|
25
|
+
(this.$u = r),
|
|
26
|
+
(this.Na = l),
|
|
27
27
|
(this.S = a),
|
|
28
|
-
(this.
|
|
28
|
+
(this.on = t),
|
|
29
29
|
(this.baseUrl = i),
|
|
30
|
-
(this.
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
30
|
+
(this.Tu = 0),
|
|
31
|
+
(this.fE = o.dE() || 0),
|
|
32
|
+
(this.Mu = null),
|
|
33
33
|
(this.T = s),
|
|
34
|
-
(this.
|
|
34
|
+
(this.un = e),
|
|
35
35
|
(this.Cs = h),
|
|
36
|
-
(this.B =
|
|
37
|
-
(this.C =
|
|
38
|
-
(this.
|
|
36
|
+
(this.B = n),
|
|
37
|
+
(this.C = o),
|
|
38
|
+
(this.Na = l),
|
|
39
39
|
(this.S = a),
|
|
40
|
-
(this.$
|
|
41
|
-
(this.
|
|
42
|
-
(this.
|
|
43
|
-
(this.
|
|
44
|
-
(this.
|
|
40
|
+
(this.$u = r),
|
|
41
|
+
(this.Pu = new u()),
|
|
42
|
+
(this.Ou = null),
|
|
43
|
+
(this.Uu = 50),
|
|
44
|
+
(this._u = !1),
|
|
45
|
+
(this.Xu = !1);
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
return !t && !i && this.
|
|
47
|
+
Qu(t, i) {
|
|
48
|
+
return !t && !i && this.Na.Jh() >= this.Uu;
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
let i = this.T.
|
|
50
|
+
Yu(t) {
|
|
51
|
+
let i = this.T.zu();
|
|
51
52
|
if (t.length > 0) {
|
|
52
53
|
const s = this.Cs.getUserId();
|
|
53
54
|
for (const e of t) {
|
|
54
55
|
const t = (!e.userId && !s) || e.userId === s;
|
|
55
|
-
e.type === d.
|
|
56
|
+
e.type === d.Iu && t && (i = !0);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
return i;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
let
|
|
65
|
-
const
|
|
61
|
+
Zu(t = !1, i = !0, e, n, o, r = !1, u = !1) {
|
|
62
|
+
i && this.sc();
|
|
63
|
+
const c = this.C.RE(),
|
|
64
|
+
d = this.C.IE();
|
|
65
|
+
let m = !1;
|
|
66
|
+
const f = (t, r, u = -1) => {
|
|
66
67
|
const c = new Date().valueOf();
|
|
67
|
-
h.W(this.C, h.O.
|
|
68
|
-
-1 !== u &&
|
|
68
|
+
h.W(this.C, h.O.gl, c),
|
|
69
|
+
-1 !== u && r.push(["X-Braze-Req-Tokens-Remaining", u.toString()]);
|
|
69
70
|
let d = !1;
|
|
70
71
|
l.Y({
|
|
71
72
|
url: this.baseUrl + "/data/",
|
|
72
73
|
data: t,
|
|
73
|
-
headers:
|
|
74
|
-
tt: (
|
|
74
|
+
headers: r,
|
|
75
|
+
tt: (i) => {
|
|
75
76
|
null != t.respond_with &&
|
|
76
77
|
t.respond_with.triggers &&
|
|
77
|
-
(this.
|
|
78
|
-
this.S.st(t,
|
|
79
|
-
? (this.
|
|
80
|
-
this.B.
|
|
78
|
+
(this.Tu = Math.max(this.Tu - 1, 0)),
|
|
79
|
+
this.S.st(t, i, r)
|
|
80
|
+
? (this.Na.it(),
|
|
81
|
+
this.B.fu(i),
|
|
81
82
|
(null != t.respond_with &&
|
|
82
83
|
t.respond_with.user_id != this.Cs.getUserId()) ||
|
|
83
|
-
(null != t.device && this.C.Bt(s.gt.
|
|
84
|
+
(null != t.device && this.C.Bt(s.gt.Za, t.device),
|
|
84
85
|
null != t.sdk_metadata &&
|
|
85
|
-
(this.C.Bt(s.gt.
|
|
86
|
-
this.C.Bt(s.gt.
|
|
87
|
-
this.$
|
|
88
|
-
h.
|
|
89
|
-
"function" == typeof
|
|
90
|
-
:
|
|
86
|
+
(this.C.Bt(s.gt.rl, t.sdk_metadata),
|
|
87
|
+
this.C.Bt(s.gt.ol, this.T.St())),
|
|
88
|
+
this.$u(i),
|
|
89
|
+
h.yl(this.C, h.O.gl, 1),
|
|
90
|
+
"function" == typeof e && e()))
|
|
91
|
+
: i.auth_error && (d = !0);
|
|
91
92
|
},
|
|
92
93
|
error: () => {
|
|
93
94
|
(d = !0),
|
|
94
95
|
null != t.respond_with &&
|
|
95
96
|
t.respond_with.triggers &&
|
|
96
|
-
(this.
|
|
97
|
-
this.S.
|
|
97
|
+
(this.Tu = Math.max(this.Tu - 1, 0)),
|
|
98
|
+
this.S.al(t.events, t.attributes),
|
|
98
99
|
"function" == typeof n && n();
|
|
99
100
|
},
|
|
100
|
-
nt: (t,
|
|
101
|
-
"function" == typeof
|
|
102
|
-
const
|
|
103
|
-
let
|
|
104
|
-
if (
|
|
105
|
-
switch (
|
|
101
|
+
nt: (t, s) => {
|
|
102
|
+
"function" == typeof o && o(!d);
|
|
103
|
+
const e = this.S.Ml(s);
|
|
104
|
+
let n = 0;
|
|
105
|
+
if (e)
|
|
106
|
+
switch (e.type) {
|
|
106
107
|
case "date":
|
|
107
|
-
|
|
108
|
+
n = Math.max(e.value - new Date().valueOf(), 0);
|
|
108
109
|
break;
|
|
109
110
|
case "timestamp":
|
|
110
|
-
|
|
111
|
+
n = e.value;
|
|
111
112
|
}
|
|
112
|
-
if (
|
|
113
|
+
if (i && !m) {
|
|
113
114
|
if (d) {
|
|
114
|
-
h
|
|
115
|
-
let t = this.
|
|
116
|
-
(null == t || t < 1e3 * this.
|
|
117
|
-
const i = Math.min(3e5, a(1e3 * this.
|
|
118
|
-
this.
|
|
119
|
-
} else this.
|
|
120
|
-
|
|
115
|
+
h.$l(this.C, h.O.gl);
|
|
116
|
+
let t = this.Mu;
|
|
117
|
+
(null == t || t < 1e3 * this.fE) && (t = 1e3 * this.fE);
|
|
118
|
+
const i = Math.min(3e5, a(1e3 * this.fE, 3 * t)) + n;
|
|
119
|
+
this.hc(i);
|
|
120
|
+
} else this.hc(Math.max(1e3 * this.fE, n));
|
|
121
|
+
m = !0;
|
|
121
122
|
}
|
|
122
123
|
},
|
|
123
124
|
});
|
|
124
125
|
},
|
|
125
|
-
|
|
126
|
-
v =
|
|
127
|
-
if (this.
|
|
126
|
+
g = this.Yu(c),
|
|
127
|
+
v = t || g;
|
|
128
|
+
if (this.Qu(r, g))
|
|
128
129
|
return void N.info(
|
|
129
130
|
"Declining to flush data due to 50 consecutive authentication failures",
|
|
130
131
|
);
|
|
131
|
-
if (
|
|
132
|
-
return this.
|
|
133
|
-
const
|
|
134
|
-
v && this.
|
|
135
|
-
let
|
|
136
|
-
if (
|
|
137
|
-
for (const t of
|
|
132
|
+
if (i && !this.S.vl(c, d, v))
|
|
133
|
+
return this.hc(), void ("function" == typeof o && o(!0));
|
|
134
|
+
const p = this.S.Rl(v, c, d, u);
|
|
135
|
+
v && this.Tu++;
|
|
136
|
+
let b = !1;
|
|
137
|
+
if (p)
|
|
138
|
+
for (const t of p)
|
|
138
139
|
this.S.V(
|
|
139
140
|
t.requestData,
|
|
140
|
-
(i) =>
|
|
141
|
-
h.O.
|
|
141
|
+
(i) => f(t.requestData, t.headers, i),
|
|
142
|
+
h.O.gl,
|
|
142
143
|
n,
|
|
143
144
|
),
|
|
144
|
-
(
|
|
145
|
-
this.
|
|
146
|
-
? this.
|
|
147
|
-
:
|
|
145
|
+
(b = !0);
|
|
146
|
+
this.Na.wh() && i && !b
|
|
147
|
+
? this.hc()
|
|
148
|
+
: g &&
|
|
149
|
+
(N.info("Invoking new session subscriptions"),
|
|
150
|
+
this.Pu.X(),
|
|
151
|
+
(this.Xu = !0));
|
|
148
152
|
}
|
|
149
|
-
|
|
150
|
-
return this.
|
|
153
|
+
nc() {
|
|
154
|
+
return this.Tu > 0;
|
|
151
155
|
}
|
|
152
|
-
|
|
153
|
-
this.
|
|
154
|
-
(this.
|
|
155
|
-
(this.
|
|
156
|
+
hc(t = 1e3 * this.fE) {
|
|
157
|
+
this._u ||
|
|
158
|
+
(this.sc(),
|
|
159
|
+
(this.Ou = window.setTimeout(() => {
|
|
156
160
|
if (document.hidden) {
|
|
157
161
|
const t = "visibilitychange",
|
|
158
162
|
i = () => {
|
|
159
163
|
document.hidden ||
|
|
160
|
-
(document.removeEventListener(t, i, !1), this.
|
|
164
|
+
(document.removeEventListener(t, i, !1), this.Zu());
|
|
161
165
|
};
|
|
162
166
|
document.addEventListener(t, i, !1);
|
|
163
|
-
} else this.
|
|
167
|
+
} else this.Zu();
|
|
164
168
|
}, t)),
|
|
165
|
-
(this.
|
|
169
|
+
(this.Mu = t));
|
|
166
170
|
}
|
|
167
|
-
|
|
168
|
-
null != this.
|
|
171
|
+
sc() {
|
|
172
|
+
null != this.Ou && (clearTimeout(this.Ou), (this.Ou = null));
|
|
169
173
|
}
|
|
170
174
|
initialize() {
|
|
171
|
-
(this.
|
|
175
|
+
(this._u = !1), this.hc();
|
|
172
176
|
}
|
|
173
177
|
destroy() {
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
(this.
|
|
178
|
-
this.
|
|
179
|
-
(this.
|
|
178
|
+
this.Pu.removeAllSubscriptions(),
|
|
179
|
+
this.Na.Gh(),
|
|
180
|
+
this.sc(),
|
|
181
|
+
(this._u = !0),
|
|
182
|
+
this.Zu(void 0, !1, void 0, void 0, void 0, void 0, !0),
|
|
183
|
+
(this.Ou = null),
|
|
184
|
+
(this.Xu = !1);
|
|
180
185
|
}
|
|
181
|
-
|
|
182
|
-
return this.
|
|
186
|
+
rn(t) {
|
|
187
|
+
return this.Xu ? (t(), null) : this.Pu.Dt(t);
|
|
183
188
|
}
|
|
184
189
|
openSession() {
|
|
185
|
-
const t = this.T.St() !== this.T.
|
|
186
|
-
t && (this.C.
|
|
187
|
-
this.
|
|
190
|
+
const t = this.T.St() !== this.T.Vo();
|
|
191
|
+
t && (this.C.hE(s.iu.Qh), this.C.hE(s.iu.su)),
|
|
192
|
+
this.Zu(!1, void 0, () => {
|
|
188
193
|
this.C.Ut(s.gt.Ge);
|
|
189
194
|
}),
|
|
190
|
-
this.
|
|
195
|
+
this.Jn(),
|
|
191
196
|
t &&
|
|
192
197
|
import("./Push/push-manager-factory.js").then((t) => {
|
|
193
|
-
if (this.
|
|
198
|
+
if (this._u) return;
|
|
194
199
|
const i = t.default.ea();
|
|
195
200
|
if (
|
|
196
201
|
null != i &&
|
|
197
|
-
(
|
|
202
|
+
(yt.isPushPermissionGranted() || yt.isPushBlocked())
|
|
198
203
|
) {
|
|
199
204
|
const t = () => {
|
|
200
|
-
i.
|
|
205
|
+
i.gn()
|
|
201
206
|
? N.info(
|
|
202
207
|
"Push token maintenance is disabled, not refreshing token for backend.",
|
|
203
208
|
)
|
|
@@ -207,45 +212,55 @@ export default class Lt {
|
|
|
207
212
|
s && t();
|
|
208
213
|
},
|
|
209
214
|
h = () => {
|
|
210
|
-
const i = this.C.ft(s.gt.
|
|
215
|
+
const i = this.C.ft(s.gt.Vn);
|
|
211
216
|
(null == i || i) && t();
|
|
212
217
|
},
|
|
213
|
-
|
|
214
|
-
new
|
|
218
|
+
n = et.Ds.Us;
|
|
219
|
+
new et(n, N).jr(n.Ls.cu, e, h);
|
|
215
220
|
}
|
|
216
221
|
});
|
|
217
222
|
}
|
|
218
|
-
|
|
219
|
-
this.C.Ut(s.gt.Xe), this.C.Ut(s.gt.
|
|
223
|
+
lc() {
|
|
224
|
+
this.C.Ut(s.gt.Xe), this.C.Ut(s.gt.Xs), this.C.Ut(s.gt.Fr);
|
|
225
|
+
}
|
|
226
|
+
uc() {
|
|
227
|
+
var t, i;
|
|
228
|
+
this.C.Ut(s.gt.zl), this.C.Ut(s.gt.SE);
|
|
229
|
+
const e = h.O;
|
|
230
|
+
for (const i in e) {
|
|
231
|
+
const s = e[i];
|
|
232
|
+
this.S.El(s, null === (t = this.B) || void 0 === t ? void 0 : t._l(s));
|
|
233
|
+
}
|
|
234
|
+
this.S.Xl(null === (i = this.B) || void 0 === i ? void 0 : i.Ol());
|
|
220
235
|
}
|
|
221
236
|
changeUser(t, i, e) {
|
|
222
237
|
const h = this.Cs.getUserId();
|
|
223
238
|
if (h !== t) {
|
|
224
|
-
this.T.
|
|
225
|
-
this.
|
|
226
|
-
null != h && this.
|
|
239
|
+
this.T.Ju(),
|
|
240
|
+
this.lc(),
|
|
241
|
+
null != h && this.Zu(void 0, !1, void 0, void 0, void 0),
|
|
227
242
|
this.Cs.ou(t),
|
|
228
|
-
e ? this.
|
|
243
|
+
e ? this.Na.setSdkAuthenticationSignature(e) : this.Na.yh();
|
|
229
244
|
for (let t = 0; t < i.length; t++) i[t].changeUser(null == h);
|
|
230
245
|
this.S.fo(),
|
|
231
|
-
null != h && this.C.Ut(s.gt.
|
|
232
|
-
this.C.Ut(s.gt.
|
|
233
|
-
this.C.Ut(s.gt.
|
|
246
|
+
null != h && this.C.Ut(s.gt.rE),
|
|
247
|
+
this.C.Ut(s.gt.Za),
|
|
248
|
+
this.C.Ut(s.gt.uE),
|
|
249
|
+
this.uc(),
|
|
234
250
|
this.openSession(),
|
|
235
251
|
N.info('Changed user to "' + t + '".');
|
|
236
252
|
} else {
|
|
237
253
|
let i = "Doing nothing.";
|
|
238
254
|
e &&
|
|
239
|
-
this.
|
|
240
|
-
(this.
|
|
255
|
+
this.Na.jh() !== e &&
|
|
256
|
+
(this.Na.setSdkAuthenticationSignature(e),
|
|
241
257
|
(i = "Updated SDK authentication signature")),
|
|
242
258
|
N.info(`Current user is already ${t}. ${i}`);
|
|
243
259
|
}
|
|
244
260
|
}
|
|
245
261
|
requestImmediateDataFlush(t) {
|
|
246
|
-
this.
|
|
247
|
-
this.
|
|
248
|
-
void 0,
|
|
262
|
+
this.sc(), this.T.Vo();
|
|
263
|
+
this.Zu(
|
|
249
264
|
void 0,
|
|
250
265
|
void 0,
|
|
251
266
|
void 0,
|
|
@@ -256,27 +271,24 @@ export default class Lt {
|
|
|
256
271
|
!0,
|
|
257
272
|
);
|
|
258
273
|
}
|
|
259
|
-
|
|
260
|
-
this.T.
|
|
261
|
-
}
|
|
262
|
-
br(t, i) {
|
|
263
|
-
this.T.Qo(),
|
|
274
|
+
vr(t, i) {
|
|
275
|
+
this.T.Vo(),
|
|
264
276
|
N.info("Requesting explicit trigger refresh."),
|
|
265
|
-
this.
|
|
277
|
+
this.Zu(!0, void 0, t, i);
|
|
266
278
|
}
|
|
267
|
-
|
|
268
|
-
const e = d.
|
|
279
|
+
En(t, i) {
|
|
280
|
+
const e = d.cc,
|
|
269
281
|
h = { a: t, l: i },
|
|
270
|
-
|
|
282
|
+
n = c.ut(e, h);
|
|
271
283
|
return (
|
|
272
|
-
|
|
273
|
-
|
|
284
|
+
n && (N.info(`Logged alias ${t} with label ${i}`), this.C.Bt(s.gt.uE, h)),
|
|
285
|
+
n
|
|
274
286
|
);
|
|
275
287
|
}
|
|
276
288
|
Ln(t, i, s) {
|
|
277
289
|
if (this.B.hu(i))
|
|
278
290
|
return (
|
|
279
|
-
N.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new
|
|
291
|
+
N.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new G()
|
|
280
292
|
);
|
|
281
293
|
const e = { key: i, value: s },
|
|
282
294
|
h = c.ut(t, e);
|
|
@@ -286,57 +298,57 @@ export default class Lt {
|
|
|
286
298
|
}
|
|
287
299
|
return h;
|
|
288
300
|
}
|
|
289
|
-
setLastKnownLocation(t, i, s, e, h,
|
|
290
|
-
const
|
|
291
|
-
null != e && (
|
|
292
|
-
null != h && (
|
|
293
|
-
null !=
|
|
294
|
-
const r = c.ut(d.
|
|
301
|
+
setLastKnownLocation(t, i, s, e, h, n) {
|
|
302
|
+
const o = { latitude: i, longitude: s };
|
|
303
|
+
null != e && (o.altitude = e),
|
|
304
|
+
null != h && (o.ll_accuracy = h),
|
|
305
|
+
null != n && (o.alt_accuracy = n);
|
|
306
|
+
const r = c.ut(d.dc, o, t || void 0);
|
|
295
307
|
return (
|
|
296
308
|
r &&
|
|
297
|
-
N.info(`Set user last known location as ${JSON.stringify(
|
|
309
|
+
N.info(`Set user last known location as ${JSON.stringify(o, null, 2)}`),
|
|
298
310
|
r
|
|
299
311
|
);
|
|
300
312
|
}
|
|
301
|
-
|
|
302
|
-
const s = this.T.
|
|
303
|
-
return new
|
|
313
|
+
br(t, i) {
|
|
314
|
+
const s = this.T.Vo();
|
|
315
|
+
return new ue(this.Cs.getUserId(), d.mc, t, s, { cid: i });
|
|
304
316
|
}
|
|
305
|
-
|
|
306
|
-
return new
|
|
317
|
+
fc(t, i) {
|
|
318
|
+
return new et(t, i);
|
|
307
319
|
}
|
|
308
|
-
|
|
309
|
-
const t =
|
|
310
|
-
this.
|
|
320
|
+
Jn() {
|
|
321
|
+
const t = et.Ds.Us;
|
|
322
|
+
this.fc(t, N).setItem(t.Ls.gl, 1, {
|
|
311
323
|
baseUrl: this.baseUrl,
|
|
312
|
-
data: { api_key: this.
|
|
324
|
+
data: { api_key: this.on, device_id: this.un.ve().id },
|
|
313
325
|
userId: this.Cs.getUserId(),
|
|
314
|
-
sdkAuthEnabled: this.
|
|
326
|
+
sdkAuthEnabled: this.Na.wh(),
|
|
315
327
|
});
|
|
316
328
|
}
|
|
317
|
-
|
|
329
|
+
wr(t) {
|
|
318
330
|
for (const i of t)
|
|
319
|
-
if (i.api_key === this.
|
|
331
|
+
if (i.api_key === this.on) this.S.al(i.events, i.attributes);
|
|
320
332
|
else {
|
|
321
|
-
const t =
|
|
322
|
-
new
|
|
333
|
+
const t = et.Ds.Us;
|
|
334
|
+
new et(t, N).setItem(t.Ls.$r, O.ce(), i);
|
|
323
335
|
}
|
|
324
336
|
}
|
|
325
|
-
|
|
337
|
+
Hn(t, i, s) {
|
|
326
338
|
if (this.B.hu(t))
|
|
327
339
|
return (
|
|
328
|
-
N.info(`Custom Attribute "${t}" is blocklisted, ignoring.`), new
|
|
340
|
+
N.info(`Custom Attribute "${t}" is blocklisted, ignoring.`), new G()
|
|
329
341
|
);
|
|
330
342
|
let e, h;
|
|
331
343
|
return (
|
|
332
344
|
null === i && null === s
|
|
333
|
-
? ((e = d.
|
|
334
|
-
: ((e = d.
|
|
345
|
+
? ((e = d.gc), (h = { key: t }))
|
|
346
|
+
: ((e = d.vc), (h = { key: t, latitude: i, longitude: s })),
|
|
335
347
|
c.ut(e, h)
|
|
336
348
|
);
|
|
337
349
|
}
|
|
338
|
-
|
|
350
|
+
Kn(t, i) {
|
|
339
351
|
const s = { group_id: t, status: i };
|
|
340
|
-
return c.ut(d.
|
|
352
|
+
return c.ut(d.bc, s);
|
|
341
353
|
}
|
|
342
354
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class rs {
|
|
2
2
|
constructor(t) {
|
|
3
|
-
(this.
|
|
3
|
+
(this.wc = t), (this.wc = t);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
return null == this.
|
|
5
|
+
xc(t) {
|
|
6
|
+
return null == this.wc || this.wc === t[0];
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
|
-
return new
|
|
9
|
+
return new rs(t ? t.event_name : null);
|
|
10
10
|
}
|
|
11
11
|
bt() {
|
|
12
|
-
return this.
|
|
12
|
+
return this.wc;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import is from "./filter-set.js";
|
|
2
|
-
export default class
|
|
2
|
+
export default class ls {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.wc = t), (this.tf = s), (this.wc = t), (this.tf = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
6
|
+
xc(t) {
|
|
7
|
+
if (null == this.wc || null == this.tf) return !1;
|
|
8
8
|
const s = t[0],
|
|
9
9
|
i = t[1];
|
|
10
|
-
return s === this.
|
|
10
|
+
return s === this.wc && this.tf.xc(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
|
-
return new
|
|
13
|
+
return new ls(
|
|
14
14
|
t ? t.event_name : null,
|
|
15
15
|
t ? is.fromJson(t.property_filters) : null,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
bt() {
|
|
19
|
-
return { e: this.
|
|
19
|
+
return { e: this.wc, pf: this.tf ? this.tf.bt() : null };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isArray as
|
|
1
|
+
import lr from "./filter.js";
|
|
2
|
+
import { isArray as D } 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
|
+
xc(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].xc(t)) {
|
|
14
14
|
s = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -22,12 +22,12 @@ export default class is {
|
|
|
22
22
|
return r;
|
|
23
23
|
}
|
|
24
24
|
static fromJson(t) {
|
|
25
|
-
if (null == t || !
|
|
25
|
+
if (null == t || !D(t)) return null;
|
|
26
26
|
const r = [];
|
|
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(lr.fromJson(s[t]));
|
|
31
31
|
r.push(o);
|
|
32
32
|
}
|
|
33
33
|
return new is(r);
|
|
@@ -42,12 +42,12 @@ export default class is {
|
|
|
42
42
|
}
|
|
43
43
|
return t;
|
|
44
44
|
}
|
|
45
|
-
static
|
|
45
|
+
static zn(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(lr.zn(s[t]));
|
|
51
51
|
r.push(o);
|
|
52
52
|
}
|
|
53
53
|
return new is(r);
|