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