@braze/web-sdk 5.4.0 → 5.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/index.d.ts +3 -3
- package/package.json +1 -1
- package/shared-lib/event-types.js +12 -12
- package/shared-lib/indexed-db-adapter.js +14 -14
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +5 -5
- package/src/Card/card-manager.js +46 -42
- package/src/Card/models/card.js +61 -55
- package/src/Card/models/classic-card.js +1 -1
- package/src/Card/models/control-card.js +1 -1
- package/src/Card/models/image-only.js +1 -1
- package/src/Card/util/card-factory.js +20 -20
- package/src/ContentCards/content-cards-provider.js +140 -140
- 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 +3 -3
- package/src/Core/disable-sdk.js +2 -2
- package/src/Core/enable-sdk.js +2 -2
- package/src/Core/log-custom-event.js +14 -14
- package/src/Core/log-purchase.js +8 -8
- package/src/Core/open-session.js +4 -4
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag-factory.js +5 -5
- package/src/FeatureFlags/feature-flag.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +74 -74
- 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 +12 -12
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +29 -29
- package/src/Feed/get-cached-feed.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 +1 -1
- package/src/InAppMessage/in-app-message-manager.js +63 -63
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +10 -10
- package/src/InAppMessage/models/html-message.js +13 -13
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +59 -59
- package/src/InAppMessage/models/modal-message.js +9 -9
- package/src/InAppMessage/models/slide-up-message.js +11 -11
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +6 -6
- package/src/Push/utils/push-utils.js +1 -1
- package/src/User/user-manager.js +6 -6
- package/src/User/user.js +27 -27
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +7 -7
- package/src/common/feed-display.js +1 -1
- package/src/managers/auth-manager.js +9 -9
- package/src/managers/braze-instance.js +44 -44
- package/src/managers/network-manager.js +100 -100
- package/src/managers/server-config-manager.js +24 -24
- package/src/managers/session-manager.js +10 -10
- package/src/managers/storage-manager.js +20 -20
- package/src/managers/subscription-manager.js +2 -2
- package/src/models/backend-errors.js +4 -4
- package/src/models/braze-event.js +1 -1
- package/src/models/device.js +1 -1
- package/src/models/request-result.js +1 -1
- package/src/models/server-config.js +5 -5
- package/src/request-controller.js +121 -121
- package/src/triggers/models/filter.js +9 -9
- package/src/triggers/models/trigger-condition.js +26 -26
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +7 -7
- package/src/triggers/triggers-provider.js +27 -27
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +17 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { STORAGE_KEYS as o } from "./storage-manager.js";
|
|
2
2
|
import T from "./subscription-manager.js";
|
|
3
3
|
import Jt from "../models/server-config.js";
|
|
4
|
-
import
|
|
4
|
+
import t from "../common/event-logger.js";
|
|
5
5
|
import { EventTypes as i } from "../../shared-lib/index.js";
|
|
6
6
|
export default class Dt {
|
|
7
7
|
constructor(t) {
|
|
@@ -20,7 +20,7 @@ export default class Dt {
|
|
|
20
20
|
}
|
|
21
21
|
return this.rl;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
hi() {
|
|
24
24
|
return this.ll().hl;
|
|
25
25
|
}
|
|
26
26
|
al(t) {
|
|
@@ -42,26 +42,26 @@ export default class Dt {
|
|
|
42
42
|
let s = !1;
|
|
43
43
|
null != i.cl && this.Wn() !== i.cl && (s = !0);
|
|
44
44
|
let r = !1;
|
|
45
|
-
null != i.ml.enabled && this.
|
|
45
|
+
null != i.ml.enabled && this.ei() !== i.ml.enabled && (r = !0);
|
|
46
46
|
let n = !1;
|
|
47
|
-
null != i.
|
|
47
|
+
null != i.ai.enabled && this.mi() !== i.ai.enabled && (n = !0),
|
|
48
48
|
(this.rl = i),
|
|
49
|
-
this.u.
|
|
50
|
-
s && this.tl.
|
|
51
|
-
r && this.el.
|
|
52
|
-
n && this.il.
|
|
49
|
+
this.u.I(o.C.ul, i.Y()),
|
|
50
|
+
s && this.tl.Rt(),
|
|
51
|
+
r && this.el.Rt(),
|
|
52
|
+
n && this.il.Rt();
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
_n(t) {
|
|
57
|
-
const e = this.tl.
|
|
57
|
+
const e = this.tl.Nt(t);
|
|
58
58
|
return this.sl && this.tl.removeSubscription(this.sl), (this.sl = e), e;
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
return this.el.
|
|
60
|
+
Ms(t) {
|
|
61
|
+
return this.el.Nt(t);
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
return this.il.
|
|
63
|
+
bi(t) {
|
|
64
|
+
return this.il.Nt(t);
|
|
65
65
|
}
|
|
66
66
|
me(t) {
|
|
67
67
|
return -1 !== this.ll().gl.indexOf(t);
|
|
@@ -78,19 +78,19 @@ export default class Dt {
|
|
|
78
78
|
Wn() {
|
|
79
79
|
return this.ll().cl;
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
ei() {
|
|
82
82
|
return this.ll().ml.enabled || !1;
|
|
83
83
|
}
|
|
84
84
|
Cl() {
|
|
85
85
|
const t = this.ll().ol;
|
|
86
86
|
return !(!t || null == t.enabled) && t.enabled;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
Cu() {
|
|
89
89
|
if (!this.Cl()) return -1;
|
|
90
90
|
const t = this.ll().ol;
|
|
91
91
|
return null == t.capacity || t.capacity < 10 ? -1 : t.capacity;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
Su() {
|
|
94
94
|
if (!this.Cl()) return -1;
|
|
95
95
|
const t = this.ll().ol;
|
|
96
96
|
return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate;
|
|
@@ -99,22 +99,22 @@ export default class Dt {
|
|
|
99
99
|
const e = this.ll().ol.endpoint_overrides;
|
|
100
100
|
return null == e ? null : e[t];
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
Bu(t) {
|
|
103
103
|
const e = this.vl(t);
|
|
104
104
|
return null == e || isNaN(e.capacity) || e.capacity <= 0 ? -1 : e.capacity;
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
wu(t) {
|
|
107
107
|
const e = this.vl(t);
|
|
108
108
|
return null == e || isNaN(e.refill_rate) || e.refill_rate <= 0
|
|
109
109
|
? -1
|
|
110
110
|
: e.refill_rate;
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
return this.ll().
|
|
114
|
-
? (
|
|
115
|
-
: this.ll().
|
|
112
|
+
mi() {
|
|
113
|
+
return this.ll().ai.enabled && null == this.Di()
|
|
114
|
+
? (t.q(i.Ls, { e: "Missing feature flag refresh_rate_limit." }), !1)
|
|
115
|
+
: this.ll().ai.enabled || !1;
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
return this.ll().
|
|
117
|
+
Di() {
|
|
118
|
+
return this.ll().ai.refresh_rate_limit;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
export default class Mt {
|
|
11
11
|
constructor(s, t, i, e) {
|
|
12
12
|
(this.u = s),
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
13
|
+
(this.yt = t),
|
|
14
|
+
(this.qt = i),
|
|
15
15
|
(this.wl = e),
|
|
16
16
|
(this.u = s),
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
17
|
+
(this.yt = t),
|
|
18
|
+
(this.qt = i),
|
|
19
19
|
(this.Sl = 1e3),
|
|
20
20
|
(null == e || isNaN(e)) && (e = 1800),
|
|
21
21
|
e < this.Sl / 1e3 &&
|
|
@@ -30,21 +30,21 @@ export default class Mt {
|
|
|
30
30
|
(this.wl = e);
|
|
31
31
|
}
|
|
32
32
|
jl(s, t) {
|
|
33
|
-
return new ve(this.
|
|
33
|
+
return new ve(this.yt.getUserId(), i.xl, s, t.eu, { d: h(s - t.Dl) });
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
xi() {
|
|
36
36
|
const s = this.u.tu(o.iu.El);
|
|
37
37
|
return null == s ? null : s.eu;
|
|
38
38
|
}
|
|
39
39
|
Gl() {
|
|
40
40
|
const s = new Date().valueOf(),
|
|
41
|
-
t = this.
|
|
41
|
+
t = this.qt.dl(),
|
|
42
42
|
i = this.u.j(o.C.Nl);
|
|
43
43
|
if (null != i && null == t) return !1;
|
|
44
44
|
let e = !1;
|
|
45
45
|
return (
|
|
46
46
|
null == i ? (e = !0) : null != t && (e = s - i > 1e3 * t),
|
|
47
|
-
e && this.u.
|
|
47
|
+
e && this.u.I(o.C.Nl, s),
|
|
48
48
|
e
|
|
49
49
|
);
|
|
50
50
|
}
|
|
@@ -65,9 +65,9 @@ export default class Mt {
|
|
|
65
65
|
}
|
|
66
66
|
(n += ". Will expire " + t.valueOf()), r.info(n);
|
|
67
67
|
const l = new _t(p.W(), t);
|
|
68
|
-
this.u.kl(new ve(this.
|
|
68
|
+
this.u.kl(new ve(this.yt.getUserId(), i.ql, s, l.eu)),
|
|
69
69
|
this.u.uu(o.iu.El, l);
|
|
70
|
-
return null == this.u.j(o.C.Nl) && this.u.
|
|
70
|
+
return null == this.u.j(o.C.Nl) && this.u.I(o.C.Nl, s), l.eu;
|
|
71
71
|
}
|
|
72
72
|
if (null != e) return (e.Wl = s), (e.Hl = t), this.u.uu(o.iu.El, e), e.eu;
|
|
73
73
|
}
|
|
@@ -25,19 +25,19 @@ export const STORAGE_KEYS = {
|
|
|
25
25
|
Jh: "ab.storage.sdk_metadata",
|
|
26
26
|
Qh: "ab.storage.session_id_for_cached_metadata",
|
|
27
27
|
In: "ab.storage.pushToken",
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Ai: "ab.storage.newsFeed",
|
|
29
|
+
Bi: "ab.storage.lastNewsFeedRefresh",
|
|
30
30
|
J: "ab.storage.cardImpressions",
|
|
31
31
|
ul: "ab.storage.serverConfig",
|
|
32
32
|
rE: "ab.storage.triggers",
|
|
33
33
|
oE: "ab.storage.triggers.ts",
|
|
34
34
|
Nl: "ab.storage.messagingSessionStart",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
bs: "ab.storage.cc",
|
|
36
|
+
js: "ab.storage.ccLastFullSync",
|
|
37
|
+
Rs: "ab.storage.ccLastCardUpdated",
|
|
38
38
|
nE: "ab.storage.ccRateLimitCurrentTokenCount",
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
Ru: "ab.storage.globalRateLimitCurrentTokenCount",
|
|
40
|
+
bu: "ab.storage.dynamicRateLimitCurrentTokenCount",
|
|
41
41
|
v: "ab.storage.ccClicks",
|
|
42
42
|
H: "ab.storage.ccImpressions",
|
|
43
43
|
A: "ab.storage.ccDismissals",
|
|
@@ -45,16 +45,16 @@ export const STORAGE_KEYS = {
|
|
|
45
45
|
iE: "ab.storage.lastDisplayedTriggerTime",
|
|
46
46
|
EE: "ab.storage.triggerFireInstancesById",
|
|
47
47
|
wh: "ab.storage.signature",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
xs: "ab.storage.brazeSyncRetryCount",
|
|
49
|
+
Us: "ab.storage.sdkVersion",
|
|
50
|
+
vi: "ab.storage.ff",
|
|
51
|
+
wi: "ab.storage.ffImpressions",
|
|
52
|
+
zi: "ab.storage.ffLastRefreshAt",
|
|
53
|
+
Si: "ab.storage.ff.sessionId",
|
|
54
54
|
lE: "ab.storage.lastReqToEndpoint",
|
|
55
55
|
SE: "ab.storage.requestAttempts",
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
Xr: "ab.storage.deferredIam",
|
|
57
|
+
du: "ab.storage.lastSdkReq",
|
|
58
58
|
_E: "ab.storage.alias",
|
|
59
59
|
},
|
|
60
60
|
se: "ab.optOut",
|
|
@@ -138,11 +138,11 @@ export default class Q {
|
|
|
138
138
|
typeof t +
|
|
139
139
|
": " +
|
|
140
140
|
JSON.stringify(t)),
|
|
141
|
-
e.push(new ve(null, i.
|
|
141
|
+
e.push(new ve(null, i.Ls, new Date().valueOf(), null, { e: o }));
|
|
142
142
|
}
|
|
143
143
|
return e;
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
I(t, e) {
|
|
146
146
|
return (
|
|
147
147
|
!!J(
|
|
148
148
|
STORAGE_KEYS.C,
|
|
@@ -162,7 +162,7 @@ export default class Q {
|
|
|
162
162
|
) && this.TE.br(t)
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
ii(t) {
|
|
166
166
|
return (
|
|
167
167
|
!!J(
|
|
168
168
|
STORAGE_KEYS.C,
|
|
@@ -187,7 +187,7 @@ export default class Q {
|
|
|
187
187
|
gE(t) {
|
|
188
188
|
return t || STORAGE_KEYS.C.sE;
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
Pa(t) {
|
|
191
191
|
let e = this.TE.br(STORAGE_KEYS.C.eE);
|
|
192
192
|
null == e && (e = {});
|
|
193
193
|
const s = this.gE(t[User.Yn]),
|
|
@@ -226,7 +226,7 @@ export default class Q {
|
|
|
226
226
|
((e[s] = void 0),
|
|
227
227
|
this.TE.store(STORAGE_KEYS.C.eE, e),
|
|
228
228
|
(r[User.Yn] = t),
|
|
229
|
-
this.
|
|
229
|
+
this.Pa(r));
|
|
230
230
|
}
|
|
231
231
|
const s = this.tu(STORAGE_KEYS.iu.El);
|
|
232
232
|
let r = null;
|
|
@@ -3,7 +3,7 @@ export default class T {
|
|
|
3
3
|
constructor() {
|
|
4
4
|
this._e = {};
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
Nt(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
8
|
const i = p.W();
|
|
9
9
|
return (this._e[i] = t), i;
|
|
@@ -17,7 +17,7 @@ export default class T {
|
|
|
17
17
|
ic() {
|
|
18
18
|
return Object.keys(this._e).length;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
Rt(t) {
|
|
21
21
|
const i = [];
|
|
22
22
|
for (const s in this._e) {
|
|
23
23
|
const r = this._e[s];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Na: "invalid_api_key",
|
|
3
|
+
Xa: "blacklisted",
|
|
4
|
+
$a: "no_device_identifier",
|
|
5
|
+
Ba: "invalid_json_response",
|
|
6
6
|
Ra: "empty_response",
|
|
7
7
|
__: "sdk_auth_error",
|
|
8
8
|
};
|
package/src/models/device.js
CHANGED
|
@@ -21,7 +21,7 @@ export default class Jt {
|
|
|
21
21
|
(this.Rl = e),
|
|
22
22
|
(this.cl = r),
|
|
23
23
|
(this.ml = l),
|
|
24
|
-
(this.
|
|
24
|
+
(this.ai = a),
|
|
25
25
|
(this.ol = n),
|
|
26
26
|
(this.hl = t),
|
|
27
27
|
(this.gl = i),
|
|
@@ -30,12 +30,12 @@ export default class Jt {
|
|
|
30
30
|
(this.Rl = e),
|
|
31
31
|
(this.cl = r),
|
|
32
32
|
(this.ml = l),
|
|
33
|
-
(this.
|
|
33
|
+
(this.ai = a),
|
|
34
34
|
(this.ol = n);
|
|
35
35
|
}
|
|
36
36
|
Y() {
|
|
37
37
|
return {
|
|
38
|
-
s: "5.
|
|
38
|
+
s: "5.5.0",
|
|
39
39
|
l: this.hl,
|
|
40
40
|
e: this.gl,
|
|
41
41
|
a: this.fl,
|
|
@@ -43,14 +43,14 @@ export default class Jt {
|
|
|
43
43
|
m: this.Rl,
|
|
44
44
|
v: this.cl,
|
|
45
45
|
c: this.ml,
|
|
46
|
-
f: this.
|
|
46
|
+
f: this.ai,
|
|
47
47
|
grl: this.ol,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
static qn(t) {
|
|
51
51
|
let i = t.l;
|
|
52
52
|
return (
|
|
53
|
-
"5.
|
|
53
|
+
"5.5.0" !== t.s && (i = 0),
|
|
54
54
|
new Jt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f, t.grl)
|
|
55
55
|
);
|
|
56
56
|
}
|