@braze/web-sdk 5.8.0 → 5.8.1
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 +1 -1
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +22 -22
- package/shared-lib/guid.js +1 -1
- package/shared-lib/indexed-db-adapter.js +18 -18
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +16 -16
- package/src/Banner/banner-provider.js +79 -79
- package/src/Banner/banner.js +9 -9
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/get-all-banners.js +2 -2
- package/src/Banner/get-banner.js +2 -2
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +1 -1
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +8 -8
- package/src/Card/log-card-click.js +1 -1
- package/src/Card/log-card-dismissal.js +1 -1
- package/src/Card/log-card-impressions.js +1 -1
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +92 -92
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +19 -19
- package/src/Card/util/card-factory.js +39 -39
- package/src/ContentCards/content-cards-provider.js +142 -142
- 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 +6 -6
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +5 -5
- package/src/Core/log-purchase.js +4 -4
- package/src/Core/open-session.js +5 -5
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +15 -15
- package/src/FeatureFlags/feature-flags-provider.js +61 -61
- 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/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +41 -41
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +89 -89
- package/src/InAppMessage/log-in-app-message-button-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +8 -8
- package/src/InAppMessage/models/in-app-message.js +80 -80
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +29 -29
- 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 +12 -12
- package/src/Push/push-manager-factory.js +1 -1
- package/src/Push/push-manager.js +94 -94
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +17 -17
- package/src/User/user.js +38 -38
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +5 -5
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +125 -125
- package/src/managers/device-manager.js +24 -24
- package/src/managers/network-manager.js +149 -149
- package/src/managers/server-config-manager.js +84 -84
- package/src/managers/session-manager.js +27 -27
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +83 -83
- package/src/managers/subscription-manager.js +10 -10
- package/src/managers/utils.js +4 -4
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +148 -148
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +4 -4
- package/src/triggers/models/filter.js +2 -2
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +32 -32
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +72 -72
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +4 -4
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +6 -6
- package/src/util/request-header-utils.js +21 -21
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/window-utils.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STORAGE_KEYS as
|
|
1
|
+
import { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
2
|
import u from "./subscription-manager.js";
|
|
3
3
|
import Jt from "../models/server-config.js";
|
|
4
4
|
import c from "../common/event-logger.js";
|
|
@@ -7,130 +7,130 @@ export default class Mt {
|
|
|
7
7
|
constructor(t) {
|
|
8
8
|
(this.C = t),
|
|
9
9
|
(this.C = t),
|
|
10
|
+
(this.il = new u()),
|
|
11
|
+
(this.sl = new u()),
|
|
12
|
+
(this.rl = new u()),
|
|
10
13
|
(this.al = new u()),
|
|
11
|
-
(this.hl =
|
|
12
|
-
(this.ul =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (null == this.ml) {
|
|
19
|
-
const e = this.C.vs(t.gs.bl);
|
|
20
|
-
this.ml = null != e ? Jt.Bn(e) : new Jt();
|
|
14
|
+
(this.hl = null),
|
|
15
|
+
(this.ul = null);
|
|
16
|
+
}
|
|
17
|
+
ol() {
|
|
18
|
+
if (null == this.ul) {
|
|
19
|
+
const t = this.C.ft(s.gt.cl);
|
|
20
|
+
this.ul = null != t ? Jt.En(t) : new Jt();
|
|
21
21
|
}
|
|
22
|
-
return this.
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return this.
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (null !=
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
e
|
|
42
|
-
|
|
22
|
+
return this.ul;
|
|
23
|
+
}
|
|
24
|
+
Et() {
|
|
25
|
+
return this.ol().ml;
|
|
26
|
+
}
|
|
27
|
+
gl(t) {
|
|
28
|
+
if (null != t && null != t.config) {
|
|
29
|
+
const e = t.config;
|
|
30
|
+
if (e.time > this.ol().ml) {
|
|
31
|
+
const t = (t) => (null == t ? this.ol().bl : t),
|
|
32
|
+
i = new Jt(
|
|
33
|
+
e.time,
|
|
34
|
+
e.events_blacklist,
|
|
35
|
+
e.attributes_blacklist,
|
|
36
|
+
e.purchases_blacklist,
|
|
37
|
+
e.messaging_session_timeout,
|
|
38
|
+
e.vapid_public_key,
|
|
39
|
+
e.content_cards,
|
|
40
|
+
e.feature_flags,
|
|
41
|
+
t(e.global_request_rate_limit),
|
|
42
|
+
e.banners,
|
|
43
43
|
);
|
|
44
44
|
let n = !1;
|
|
45
|
-
null !=
|
|
45
|
+
null != i.fl && this.Tn() !== i.fl && (n = !0);
|
|
46
46
|
let r = !1;
|
|
47
|
-
null !=
|
|
47
|
+
null != i.dl.enabled && this.Ri() !== i.dl.enabled && (r = !0);
|
|
48
48
|
let l = !1;
|
|
49
|
-
null !=
|
|
49
|
+
null != i.De.enabled && this.Be() !== i.De.enabled && (l = !0);
|
|
50
50
|
let a = !1;
|
|
51
|
-
null !=
|
|
52
|
-
this.
|
|
51
|
+
null != i.banners.enabled &&
|
|
52
|
+
this.Dt() !== i.banners.enabled &&
|
|
53
53
|
(a = !0),
|
|
54
|
-
(this.
|
|
55
|
-
this.C.
|
|
56
|
-
n && this.
|
|
57
|
-
r && this.
|
|
58
|
-
l && this.
|
|
59
|
-
a && this.
|
|
54
|
+
(this.ul = i),
|
|
55
|
+
this.C.Bt(s.gt.cl, i.bt()),
|
|
56
|
+
n && this.il.X(),
|
|
57
|
+
r && this.sl.X(),
|
|
58
|
+
l && this.rl.X(),
|
|
59
|
+
a && this.al.X();
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
const e = this.
|
|
65
|
-
return this.
|
|
63
|
+
In(t) {
|
|
64
|
+
const e = this.il.Ft(t);
|
|
65
|
+
return this.hl && this.il.removeSubscription(this.hl), (this.hl = e), e;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
return this.
|
|
67
|
+
ji(t) {
|
|
68
|
+
return this.sl.Ft(t);
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
return this.
|
|
70
|
+
Ke(t) {
|
|
71
|
+
return this.rl.Ft(t);
|
|
72
72
|
}
|
|
73
73
|
A(t) {
|
|
74
|
-
return this.
|
|
74
|
+
return this.al.Ft(t);
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
return -1 !== this.
|
|
76
|
+
je(t) {
|
|
77
|
+
return -1 !== this.ol().Rl.indexOf(t);
|
|
78
78
|
}
|
|
79
79
|
hu(t) {
|
|
80
|
-
return -1 !== this.
|
|
80
|
+
return -1 !== this.ol().Cl.indexOf(t);
|
|
81
81
|
}
|
|
82
82
|
Dr(t) {
|
|
83
|
-
return -1 !== this.
|
|
83
|
+
return -1 !== this.ol().El.indexOf(t);
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
return this.
|
|
85
|
+
vl() {
|
|
86
|
+
return this.ol().wl;
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
return this.
|
|
88
|
+
Tn() {
|
|
89
|
+
return this.ol().fl;
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
return this.
|
|
91
|
+
Ri() {
|
|
92
|
+
return this.ol().dl.enabled || !1;
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
const t = this.
|
|
94
|
+
yl() {
|
|
95
|
+
const t = this.ol().bl;
|
|
96
96
|
return !(!t || null == t.enabled) && t.enabled;
|
|
97
97
|
}
|
|
98
|
-
|
|
99
|
-
if (!this.
|
|
100
|
-
const t = this.
|
|
98
|
+
Vu() {
|
|
99
|
+
if (!this.yl()) return -1;
|
|
100
|
+
const t = this.ol().bl;
|
|
101
101
|
return null == t.capacity || t.capacity < 10 ? -1 : t.capacity;
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
if (!this.
|
|
105
|
-
const t = this.
|
|
103
|
+
Zu() {
|
|
104
|
+
if (!this.yl()) return -1;
|
|
105
|
+
const t = this.ol().bl;
|
|
106
106
|
return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate;
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
const e = this.
|
|
108
|
+
Ll(t) {
|
|
109
|
+
const e = this.ol().bl.endpoint_overrides;
|
|
110
110
|
return null == e ? null : e[t];
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
const e = this.
|
|
112
|
+
tl(t) {
|
|
113
|
+
const e = this.Ll(t);
|
|
114
114
|
return null == e || isNaN(e.capacity) || e.capacity <= 0 ? -1 : e.capacity;
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
const e = this.
|
|
116
|
+
el(t) {
|
|
117
|
+
const e = this.Ll(t);
|
|
118
118
|
return null == e || isNaN(e.refill_rate) || e.refill_rate <= 0
|
|
119
119
|
? -1
|
|
120
120
|
: e.refill_rate;
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
return this.
|
|
124
|
-
? (c.
|
|
125
|
-
: this.
|
|
122
|
+
Be() {
|
|
123
|
+
return this.ol().De.enabled && null == this.Oe()
|
|
124
|
+
? (c.ut(d.bu, { e: "Missing feature flag refresh_rate_limit." }), !1)
|
|
125
|
+
: this.ol().De.enabled || !1;
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
return this.
|
|
127
|
+
Oe() {
|
|
128
|
+
return this.ol().De.refresh_rate_limit;
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
return this.
|
|
130
|
+
Dt() {
|
|
131
|
+
return this.ol().banners.enabled || !1;
|
|
132
132
|
}
|
|
133
133
|
ne() {
|
|
134
|
-
return this.
|
|
134
|
+
return this.ol().banners.max_placements || 0;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STORAGE_KEYS as
|
|
1
|
+
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
2
2
|
import ve from "../models/braze-event.js";
|
|
3
3
|
import _t from "../models/identifier.js";
|
|
4
4
|
import { convertMsToSeconds as L } from "../util/date-utils.js";
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
export default class Wt {
|
|
11
11
|
constructor(s, t, i, e) {
|
|
12
12
|
(this.C = s),
|
|
13
|
-
(this.
|
|
13
|
+
(this.Cs = t),
|
|
14
14
|
(this.B = i),
|
|
15
15
|
(this.Sl = e),
|
|
16
16
|
(this.C = s),
|
|
17
|
-
(this.
|
|
17
|
+
(this.Cs = t),
|
|
18
18
|
(this.B = i),
|
|
19
19
|
(this.jl = 1e3),
|
|
20
20
|
(null == e || isNaN(e)) && (e = 1800),
|
|
@@ -30,29 +30,29 @@ export default class Wt {
|
|
|
30
30
|
(this.Sl = e);
|
|
31
31
|
}
|
|
32
32
|
xl(s, t) {
|
|
33
|
-
return new ve(this.
|
|
33
|
+
return new ve(this.Cs.getUserId(), d.Dl, s, t.eu, { d: L(s - t.Gl) });
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
return null ==
|
|
35
|
+
St() {
|
|
36
|
+
const t = this.C.tu(s.iu.Nl);
|
|
37
|
+
return null == t ? null : t.eu;
|
|
38
38
|
}
|
|
39
39
|
zl() {
|
|
40
|
-
const
|
|
41
|
-
i = this.B.
|
|
40
|
+
const t = new Date().valueOf(),
|
|
41
|
+
i = this.B.vl();
|
|
42
42
|
if (null == i) return !1;
|
|
43
|
-
const e = this.C.
|
|
44
|
-
n = null == e ||
|
|
45
|
-
return n && this.C.
|
|
43
|
+
const e = this.C.ft(s.gt.Hl),
|
|
44
|
+
n = null == e || t - e > 1e3 * i;
|
|
45
|
+
return n && this.C.Bt(s.gt.Hl, t), n;
|
|
46
46
|
}
|
|
47
47
|
Wl(s, t) {
|
|
48
48
|
return null == t || null == t.kl || (!(s - t.Gl < this.jl) && t.kl < s);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
i =
|
|
53
|
-
e = this.C.tu(
|
|
54
|
-
if (this.Wl(
|
|
55
|
-
let n = "Generating session start event with time " +
|
|
50
|
+
Qo() {
|
|
51
|
+
const t = new Date().valueOf(),
|
|
52
|
+
i = t + 1e3 * this.Sl,
|
|
53
|
+
e = this.C.tu(s.iu.Nl);
|
|
54
|
+
if (this.Wl(t, e)) {
|
|
55
|
+
let n = "Generating session start event with time " + t;
|
|
56
56
|
if (null != e) {
|
|
57
57
|
let s = e.ql;
|
|
58
58
|
s - e.Gl < this.jl && (s = e.Gl + this.jl),
|
|
@@ -60,16 +60,16 @@ export default class Wt {
|
|
|
60
60
|
(n += " (old session ended " + s + ")");
|
|
61
61
|
}
|
|
62
62
|
(n += ". Will expire " + i.valueOf()), N.info(n);
|
|
63
|
-
const o = new _t(G.
|
|
64
|
-
this.C.Al(new ve(this.
|
|
65
|
-
this.C.uu(
|
|
66
|
-
return null == this.C.
|
|
63
|
+
const o = new _t(G.ce(), i);
|
|
64
|
+
this.C.Al(new ve(this.Cs.getUserId(), d.Bl, t, o.eu)),
|
|
65
|
+
this.C.uu(s.iu.Nl, o);
|
|
66
|
+
return null == this.C.ft(s.gt.Hl) && this.C.Bt(s.gt.Hl, t), o.eu;
|
|
67
67
|
}
|
|
68
|
-
if (null != e) return (e.ql =
|
|
68
|
+
if (null != e) return (e.ql = t), (e.kl = i), this.C.uu(s.iu.Nl, e), e.eu;
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
null !=
|
|
73
|
-
(this.C.
|
|
70
|
+
Fl() {
|
|
71
|
+
const t = this.C.tu(s.iu.Nl);
|
|
72
|
+
null != t &&
|
|
73
|
+
(this.C.Il(s.iu.Nl), this.C.Al(this.xl(new Date().valueOf(), t)));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import ne, { STORAGE_KEYS as
|
|
1
|
+
import ne, { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
2
|
import { logger as N } from "../../shared-lib/index.js";
|
|
3
3
|
const Bt = {
|
|
4
|
-
|
|
5
|
-
let
|
|
4
|
+
Ja: function (e, o = !1) {
|
|
5
|
+
let t = !1;
|
|
6
6
|
try {
|
|
7
7
|
if (localStorage && localStorage.getItem)
|
|
8
8
|
try {
|
|
9
|
-
localStorage.setItem(
|
|
10
|
-
localStorage.getItem(
|
|
11
|
-
(localStorage.removeItem(
|
|
9
|
+
localStorage.setItem(s.gt.ac, "true"),
|
|
10
|
+
localStorage.getItem(s.gt.ac) &&
|
|
11
|
+
(localStorage.removeItem(s.gt.ac), (t = !0));
|
|
12
12
|
} catch (e) {
|
|
13
13
|
if (
|
|
14
14
|
!(
|
|
@@ -19,17 +19,17 @@ const Bt = {
|
|
|
19
19
|
)
|
|
20
20
|
)
|
|
21
21
|
throw e;
|
|
22
|
-
|
|
22
|
+
t = !0;
|
|
23
23
|
}
|
|
24
24
|
} catch (e) {
|
|
25
25
|
N.info("Local Storage not supported!");
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
let
|
|
30
|
-
return (
|
|
27
|
+
const r = Bt.nc(),
|
|
28
|
+
a = new ne.cc(e, r && !o, t);
|
|
29
|
+
let n;
|
|
30
|
+
return (n = t ? new ne.lc(e) : new ne.gc()), new ne(a, n);
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
nc: function () {
|
|
33
33
|
return (
|
|
34
34
|
navigator.cookieEnabled ||
|
|
35
35
|
("cookie" in document &&
|