@braze/web-sdk 5.8.1 → 5.9.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 +14 -9
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +19 -19
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +3 -3
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +11 -11
- package/src/Banner/banner-provider.js +22 -19
- package/src/Banner/display/banner-to-html.js +32 -27
- package/src/Banner/get-all-banners.js +11 -5
- package/src/Banner/get-banner.js +6 -3
- 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 +5 -2
- package/src/Banner/subscribe-to-banners-updates.js +2 -2
- package/src/Banner/ui/insert-banner.js +2 -2
- package/src/Card/card-manager.js +9 -9
- package/src/Card/display/card-display.js +5 -5
- package/src/Card/log-card-click.js +2 -2
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-card-impressions.js +2 -2
- package/src/Card/models/captioned-image.js +17 -17
- package/src/Card/models/card.js +58 -58
- package/src/Card/models/classic-card.js +17 -17
- package/src/Card/models/control-card.js +8 -8
- package/src/Card/models/image-only.js +15 -15
- package/src/Card/util/card-factory.js +24 -24
- package/src/ContentCards/content-cards-provider.js +77 -75
- 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 +3 -3
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/change-user.js +1 -1
- package/src/Core/disable-sdk.js +4 -4
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/open-session.js +4 -4
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/wipe-data.js +7 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +3 -3
- package/src/FeatureFlags/feature-flags-provider.js +17 -11
- 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 +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +12 -12
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +8 -8
- package/src/InAppMessage/display/in-app-message-to-html.js +18 -18
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +70 -70
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- 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 +6 -6
- package/src/InAppMessage/models/html-message.js +7 -7
- package/src/InAppMessage/models/in-app-message-button.js +3 -3
- package/src/InAppMessage/models/in-app-message.js +36 -36
- package/src/InAppMessage/models/modal-message.js +6 -6
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- 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 +13 -13
- package/src/Push/push-manager.js +81 -81
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +10 -10
- package/src/User/user.js +15 -15
- package/src/common/constants.js +2 -0
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/auth-manager.js +30 -30
- package/src/managers/braze-instance.js +94 -93
- package/src/managers/device-manager.js +14 -14
- package/src/managers/network-manager.js +123 -117
- package/src/managers/server-config-manager.js +91 -79
- package/src/managers/session-manager.js +8 -8
- package/src/managers/storage-manager-factory.js +5 -5
- package/src/managers/storage-manager.js +48 -48
- package/src/managers/subscription-manager.js +4 -4
- package/src/models/backend-errors.js +4 -4
- package/src/models/braze-event.js +9 -9
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +4 -4
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +18 -18
- package/src/request-controller.js +86 -85
- 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 +6 -6
- 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 +33 -33
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +12 -12
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +17 -17
- 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 +2 -2
- package/src/util/dom-utils.js +3 -3
- package/src/util/html-display-utils.js +14 -14
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +2 -2
- package/src/util/request-header-utils.js +13 -13
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +2 -2
- package/src/util/window-utils.js +2 -2
|
@@ -1,136 +1,148 @@
|
|
|
1
1
|
import { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
2
|
import u from "./subscription-manager.js";
|
|
3
|
-
import
|
|
3
|
+
import Qt from "../models/server-config.js";
|
|
4
4
|
import c from "../common/event-logger.js";
|
|
5
5
|
import { EventTypes as d } from "../../shared-lib/index.js";
|
|
6
6
|
export default class Mt {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
(this.C = t),
|
|
9
9
|
(this.C = t),
|
|
10
|
-
(this.il = new u()),
|
|
11
10
|
(this.sl = new u()),
|
|
12
11
|
(this.rl = new u()),
|
|
12
|
+
(this.ul = new u()),
|
|
13
13
|
(this.al = new u()),
|
|
14
14
|
(this.hl = null),
|
|
15
|
-
(this.
|
|
15
|
+
(this.ol = null);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
if (null == this.
|
|
19
|
-
const t = this.C.ft(s.gt.
|
|
20
|
-
this.
|
|
17
|
+
cl() {
|
|
18
|
+
if (null == this.ol) {
|
|
19
|
+
const t = this.C.ft(s.gt.ml);
|
|
20
|
+
this.ol = null != t ? Qt.Rn(t) : new Qt();
|
|
21
21
|
}
|
|
22
|
-
return this.
|
|
22
|
+
return this.ol;
|
|
23
23
|
}
|
|
24
24
|
Et() {
|
|
25
|
-
return this.
|
|
25
|
+
return this.cl().dl;
|
|
26
26
|
}
|
|
27
27
|
gl(t) {
|
|
28
|
+
var i, e;
|
|
28
29
|
if (null != t && null != t.config) {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const t = (t) => (null == t ? this.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
t(
|
|
42
|
-
|
|
30
|
+
const n = t.config;
|
|
31
|
+
if (n.time > this.cl().dl) {
|
|
32
|
+
const t = (t) => (null == t ? this.cl().bl : t),
|
|
33
|
+
r = new Qt(
|
|
34
|
+
n.time,
|
|
35
|
+
n.events_blacklist,
|
|
36
|
+
n.attributes_blacklist,
|
|
37
|
+
n.purchases_blacklist,
|
|
38
|
+
n.messaging_session_timeout,
|
|
39
|
+
n.vapid_public_key,
|
|
40
|
+
n.content_cards,
|
|
41
|
+
n.feature_flags,
|
|
42
|
+
t(n.global_request_rate_limit),
|
|
43
|
+
n.banners,
|
|
43
44
|
);
|
|
44
|
-
let n = !1;
|
|
45
|
-
null != i.fl && this.Tn() !== i.fl && (n = !0);
|
|
46
|
-
let r = !1;
|
|
47
|
-
null != i.dl.enabled && this.Ri() !== i.dl.enabled && (r = !0);
|
|
48
45
|
let l = !1;
|
|
49
|
-
null !=
|
|
46
|
+
null != r.fl && this.In() !== r.fl && (l = !0);
|
|
47
|
+
let u = !1;
|
|
48
|
+
null != r.vl.enabled && this.yi() !== r.vl.enabled && (u = !0);
|
|
50
49
|
let a = !1;
|
|
51
|
-
null !=
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
this.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
null != r.De.enabled && this.ke() !== r.De.enabled && (a = !0);
|
|
51
|
+
let h = !1;
|
|
52
|
+
null !=
|
|
53
|
+
(null === (i = r.banners) || void 0 === i ? void 0 : i.enabled) &&
|
|
54
|
+
this.zt() !==
|
|
55
|
+
(null === (e = r.banners) || void 0 === e ? void 0 : e.enabled) &&
|
|
56
|
+
(h = !0),
|
|
57
|
+
(this.ol = r),
|
|
58
|
+
this.C.Bt(s.gt.ml, r.bt()),
|
|
59
|
+
l && this.sl.X(),
|
|
60
|
+
u && this.rl.X(),
|
|
61
|
+
a && this.ul.X(),
|
|
62
|
+
h && this.al.X();
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
return this.hl && this.
|
|
66
|
+
Vn(t) {
|
|
67
|
+
const i = this.sl.Dt(t);
|
|
68
|
+
return this.hl && this.sl.removeSubscription(this.hl), (this.hl = i), i;
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
return this.
|
|
70
|
+
gi(t) {
|
|
71
|
+
return this.rl.Dt(t);
|
|
69
72
|
}
|
|
70
73
|
Ke(t) {
|
|
71
|
-
return this.
|
|
74
|
+
return this.ul.Dt(t);
|
|
72
75
|
}
|
|
73
76
|
A(t) {
|
|
74
|
-
return this.al.
|
|
77
|
+
return this.al.Dt(t);
|
|
75
78
|
}
|
|
76
79
|
je(t) {
|
|
77
|
-
return -1 !== this.
|
|
80
|
+
return -1 !== this.cl().Rl.indexOf(t);
|
|
78
81
|
}
|
|
79
82
|
hu(t) {
|
|
80
|
-
return -1 !== this.
|
|
83
|
+
return -1 !== this.cl().Cl.indexOf(t);
|
|
81
84
|
}
|
|
82
85
|
Dr(t) {
|
|
83
|
-
return -1 !== this.
|
|
86
|
+
return -1 !== this.cl().El.indexOf(t);
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
return this.
|
|
88
|
+
wl() {
|
|
89
|
+
return this.cl().yl;
|
|
87
90
|
}
|
|
88
|
-
|
|
89
|
-
return this.
|
|
91
|
+
In() {
|
|
92
|
+
return this.cl().fl;
|
|
90
93
|
}
|
|
91
|
-
|
|
92
|
-
return this.
|
|
94
|
+
yi() {
|
|
95
|
+
return this.cl().vl.enabled || !1;
|
|
93
96
|
}
|
|
94
|
-
|
|
95
|
-
const t = this.
|
|
97
|
+
Ll() {
|
|
98
|
+
const t = this.cl().bl;
|
|
96
99
|
return !(!t || null == t.enabled) && t.enabled;
|
|
97
100
|
}
|
|
98
|
-
|
|
99
|
-
if (!this.
|
|
100
|
-
const t = this.
|
|
101
|
+
Zu() {
|
|
102
|
+
if (!this.Ll()) return -1;
|
|
103
|
+
const t = this.cl().bl;
|
|
101
104
|
return null == t.capacity || t.capacity < 10 ? -1 : t.capacity;
|
|
102
105
|
}
|
|
103
|
-
|
|
104
|
-
if (!this.
|
|
105
|
-
const t = this.
|
|
106
|
+
tl() {
|
|
107
|
+
if (!this.Ll()) return -1;
|
|
108
|
+
const t = this.cl().bl;
|
|
106
109
|
return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate;
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
return null ==
|
|
111
|
-
}
|
|
112
|
-
tl(t) {
|
|
113
|
-
const e = this.Ll(t);
|
|
114
|
-
return null == e || isNaN(e.capacity) || e.capacity <= 0 ? -1 : e.capacity;
|
|
111
|
+
Bl(t) {
|
|
112
|
+
const i = this.cl().bl.endpoint_overrides;
|
|
113
|
+
return null == i ? null : i[t];
|
|
115
114
|
}
|
|
116
115
|
el(t) {
|
|
117
|
-
const
|
|
118
|
-
return null ==
|
|
116
|
+
const i = this.Bl(t);
|
|
117
|
+
return null == i || isNaN(i.capacity) || i.capacity <= 0 ? -1 : i.capacity;
|
|
118
|
+
}
|
|
119
|
+
il(t) {
|
|
120
|
+
const i = this.Bl(t);
|
|
121
|
+
return null == i || isNaN(i.refill_rate) || i.refill_rate <= 0
|
|
119
122
|
? -1
|
|
120
|
-
:
|
|
123
|
+
: i.refill_rate;
|
|
121
124
|
}
|
|
122
|
-
|
|
123
|
-
return this.
|
|
124
|
-
? (c.ut(d.
|
|
125
|
-
: this.
|
|
125
|
+
ke() {
|
|
126
|
+
return this.cl().De.enabled && null == this.Oe()
|
|
127
|
+
? (c.ut(d.qu, { e: "Missing feature flag refresh_rate_limit." }), !1)
|
|
128
|
+
: this.cl().De.enabled || !1;
|
|
126
129
|
}
|
|
127
130
|
Oe() {
|
|
128
|
-
return this.
|
|
131
|
+
return this.cl().De.refresh_rate_limit;
|
|
129
132
|
}
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
zt() {
|
|
134
|
+
var t;
|
|
135
|
+
return (
|
|
136
|
+
(null === (t = this.cl().banners) || void 0 === t ? void 0 : t.enabled) ||
|
|
137
|
+
null
|
|
138
|
+
);
|
|
132
139
|
}
|
|
133
140
|
ne() {
|
|
134
|
-
|
|
141
|
+
var t;
|
|
142
|
+
return (
|
|
143
|
+
(null === (t = this.cl().banners) || void 0 === t
|
|
144
|
+
? void 0
|
|
145
|
+
: t.max_placements) || 0
|
|
146
|
+
);
|
|
135
147
|
}
|
|
136
148
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
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
|
-
import { convertMsToSeconds as
|
|
4
|
+
import { convertMsToSeconds as O } from "../util/date-utils.js";
|
|
5
5
|
import {
|
|
6
6
|
logger as N,
|
|
7
|
-
Guid as
|
|
7
|
+
Guid as K,
|
|
8
8
|
EventTypes as d,
|
|
9
9
|
} from "../../shared-lib/index.js";
|
|
10
10
|
export default class Wt {
|
|
@@ -30,7 +30,7 @@ export default class Wt {
|
|
|
30
30
|
(this.Sl = e);
|
|
31
31
|
}
|
|
32
32
|
xl(s, t) {
|
|
33
|
-
return new ve(this.Cs.getUserId(), d.Dl, s, t.eu, { d:
|
|
33
|
+
return new ve(this.Cs.getUserId(), d.Dl, s, t.eu, { d: O(s - t.Gl) });
|
|
34
34
|
}
|
|
35
35
|
St() {
|
|
36
36
|
const t = this.C.tu(s.iu.Nl);
|
|
@@ -38,7 +38,7 @@ export default class Wt {
|
|
|
38
38
|
}
|
|
39
39
|
zl() {
|
|
40
40
|
const t = new Date().valueOf(),
|
|
41
|
-
i = this.B.
|
|
41
|
+
i = this.B.wl();
|
|
42
42
|
if (null == i) return !1;
|
|
43
43
|
const e = this.C.ft(s.gt.Hl),
|
|
44
44
|
n = null == e || t - e > 1e3 * i;
|
|
@@ -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(
|
|
64
|
-
this.C.Al(new ve(this.Cs.getUserId(), d.
|
|
63
|
+
const o = new _t(K.ce(), i);
|
|
64
|
+
this.C.Al(new ve(this.Cs.getUserId(), d.Fl, t, o.eu)),
|
|
65
65
|
this.C.uu(s.iu.Nl, o);
|
|
66
66
|
return null == this.C.ft(s.gt.Hl) && this.C.Bt(s.gt.Hl, t), o.eu;
|
|
67
67
|
}
|
|
68
68
|
if (null != e) return (e.ql = t), (e.kl = i), this.C.uu(s.iu.Nl, e), e.eu;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
Il() {
|
|
71
71
|
const t = this.C.tu(s.iu.Nl);
|
|
72
72
|
null != t &&
|
|
73
|
-
(this.C.
|
|
73
|
+
(this.C.Jl(s.iu.Nl), this.C.Al(this.xl(new Date().valueOf(), t)));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
|
|
4
|
+
Ya: function (e, o = !1) {
|
|
5
5
|
let t = !1;
|
|
6
6
|
try {
|
|
7
7
|
if (localStorage && localStorage.getItem)
|
|
@@ -24,12 +24,12 @@ const Bt = {
|
|
|
24
24
|
} catch (e) {
|
|
25
25
|
N.info("Local Storage not supported!");
|
|
26
26
|
}
|
|
27
|
-
const r = Bt.
|
|
28
|
-
a = new ne.
|
|
27
|
+
const r = Bt.cc(),
|
|
28
|
+
a = new ne.lc(e, r && !o, t);
|
|
29
29
|
let n;
|
|
30
|
-
return (n = t ? new ne.
|
|
30
|
+
return (n = t ? new ne.gc(e) : new ne.uc()), new ne(a, n);
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
cc: function () {
|
|
33
33
|
return (
|
|
34
34
|
navigator.cookieEnabled ||
|
|
35
35
|
("cookie" in document &&
|
|
@@ -2,7 +2,7 @@ import ve from "../models/braze-event.js";
|
|
|
2
2
|
import _t from "../models/identifier.js";
|
|
3
3
|
import {
|
|
4
4
|
isArray as z,
|
|
5
|
-
keys as
|
|
5
|
+
keys as C,
|
|
6
6
|
validateValueIsFromEnum as ta,
|
|
7
7
|
values as Rt,
|
|
8
8
|
} from "../util/code-utils.js";
|
|
@@ -13,7 +13,7 @@ import { getErrorMessage as si } from "../util/error-utils.js";
|
|
|
13
13
|
export const STORAGE_KEYS = {
|
|
14
14
|
iu: {
|
|
15
15
|
su: "ab.storage.userId",
|
|
16
|
-
|
|
16
|
+
Na: "ab.storage.deviceId",
|
|
17
17
|
Nl: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
19
|
gt: {
|
|
@@ -21,42 +21,42 @@ export const STORAGE_KEYS = {
|
|
|
21
21
|
tE: "ab.storage.events",
|
|
22
22
|
eE: "ab.storage.attributes",
|
|
23
23
|
sE: "ab.storage.attributes.anonymous_user",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
oc: "ab.storage.device",
|
|
25
|
+
pu: "ab.storage.sdk_metadata",
|
|
26
|
+
Ru: "ab.storage.session_id_for_cached_metadata",
|
|
27
|
+
zn: "ab.storage.pushToken",
|
|
28
28
|
qi: "ab.storage.newsFeed",
|
|
29
29
|
zi: "ab.storage.lastNewsFeedRefresh",
|
|
30
30
|
Zt: "ab.storage.cardImpressions",
|
|
31
|
-
|
|
31
|
+
ml: "ab.storage.serverConfig",
|
|
32
32
|
rE: "ab.storage.triggers",
|
|
33
33
|
oE: "ab.storage.triggers.ts",
|
|
34
34
|
Hl: "ab.storage.messagingSessionStart",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
Hs: "ab.storage.cc",
|
|
36
|
+
Os: "ab.storage.ccLastFullSync",
|
|
37
|
+
Qs: "ab.storage.ccLastCardUpdated",
|
|
38
|
+
Hu: "ab.storage.globalRateLimitCurrentTokenCount",
|
|
39
|
+
_u: "ab.storage.dynamicRateLimitCurrentTokenCount",
|
|
40
40
|
Kt: "ab.storage.ccClicks",
|
|
41
41
|
Yt: "ab.storage.ccImpressions",
|
|
42
42
|
Vt: "ab.storage.ccDismissals",
|
|
43
43
|
nE: "ab.storage.lastDisplayedTriggerTimesById",
|
|
44
44
|
aE: "ab.storage.lastDisplayedTriggerTime",
|
|
45
45
|
iE: "ab.storage.triggerFireInstancesById",
|
|
46
|
-
|
|
46
|
+
qh: "ab.storage.signature",
|
|
47
47
|
EE: "ab.storage.brazeSyncRetryCount",
|
|
48
|
-
|
|
48
|
+
Zs: "ab.storage.sdkVersion",
|
|
49
49
|
Xe: "ab.storage.ff",
|
|
50
50
|
Ge: "ab.storage.ffImpressions",
|
|
51
51
|
Ze: "ab.storage.ffLastRefreshAt",
|
|
52
52
|
Ve: "ab.storage.ff.sessionId",
|
|
53
53
|
lE: "ab.storage.lastReqToEndpoint",
|
|
54
54
|
SE: "ab.storage.requestAttempts",
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
Kr: "ab.storage.deferredIam",
|
|
56
|
+
Ku: "ab.storage.lastSdkReq",
|
|
57
57
|
_E: "ab.storage.alias",
|
|
58
58
|
vt: "ab.storage.banners",
|
|
59
|
-
|
|
59
|
+
Nt: "ab.storage.banners.impressions",
|
|
60
60
|
yt: "ab.storage.banners.sessionId",
|
|
61
61
|
},
|
|
62
62
|
me: "ab.optOut",
|
|
@@ -65,8 +65,8 @@ export default class ne {
|
|
|
65
65
|
constructor(t, e) {
|
|
66
66
|
(this.uE = t), (this.cE = e), (this.uE = t), (this.cE = e);
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
const e =
|
|
68
|
+
Ha(t) {
|
|
69
|
+
const e = C(STORAGE_KEYS.iu),
|
|
70
70
|
s = new ne.se(t);
|
|
71
71
|
for (const t of e) s.remove(STORAGE_KEYS.iu[t]);
|
|
72
72
|
}
|
|
@@ -90,18 +90,18 @@ export default class ne {
|
|
|
90
90
|
return e;
|
|
91
91
|
})(e);
|
|
92
92
|
let r;
|
|
93
|
-
if (s) (r = _t.
|
|
93
|
+
if (s) (r = _t.Rn(s) || null), r && this.uu(t, r);
|
|
94
94
|
else {
|
|
95
95
|
const s = _t.hE(e);
|
|
96
|
-
(r = _t.
|
|
96
|
+
(r = _t.Rn(s) || null), s !== e && r && this.uu(t, r);
|
|
97
97
|
}
|
|
98
98
|
return r;
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
Jl(t) {
|
|
101
101
|
this.uE.remove(t);
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
const t =
|
|
103
|
+
Xa() {
|
|
104
|
+
const t = C(STORAGE_KEYS.iu);
|
|
105
105
|
let e;
|
|
106
106
|
for (const s of t)
|
|
107
107
|
(e = this.tu(STORAGE_KEYS.iu[s])),
|
|
@@ -127,7 +127,7 @@ export default class ne {
|
|
|
127
127
|
r = null;
|
|
128
128
|
if (z(t))
|
|
129
129
|
for (let s = 0; s < t.length; s++)
|
|
130
|
-
ve.RE(t[s]) ? e.push(ve.
|
|
130
|
+
ve.RE(t[s]) ? e.push(ve.Rn(t[s])) : (r = s);
|
|
131
131
|
else s = !0;
|
|
132
132
|
if (s || null != r) {
|
|
133
133
|
let o = "Stored events could not be deserialized as Events";
|
|
@@ -140,7 +140,7 @@ export default class ne {
|
|
|
140
140
|
typeof t +
|
|
141
141
|
": " +
|
|
142
142
|
JSON.stringify(t)),
|
|
143
|
-
e.push(new ve(null, d.
|
|
143
|
+
e.push(new ve(null, d.qu, new Date().valueOf(), null, { e: o }));
|
|
144
144
|
}
|
|
145
145
|
return e;
|
|
146
146
|
}
|
|
@@ -175,8 +175,8 @@ export default class ne {
|
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
clearData() {
|
|
178
|
-
const t =
|
|
179
|
-
e =
|
|
178
|
+
const t = C(STORAGE_KEYS.iu),
|
|
179
|
+
e = C(STORAGE_KEYS.gt);
|
|
180
180
|
for (let e = 0; e < t.length; e++) {
|
|
181
181
|
const s = t[e];
|
|
182
182
|
this.uE.remove(STORAGE_KEYS.iu[s]);
|
|
@@ -189,15 +189,15 @@ export default class ne {
|
|
|
189
189
|
gE(t) {
|
|
190
190
|
return t || STORAGE_KEYS.gt.sE;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
Cu(t) {
|
|
193
193
|
let e = this.cE.gr(STORAGE_KEYS.gt.eE);
|
|
194
194
|
null == e && (e = {});
|
|
195
|
-
const s = this.gE(t[User.
|
|
195
|
+
const s = this.gE(t[User.Xn]),
|
|
196
196
|
r = e[s];
|
|
197
197
|
for (const o in t)
|
|
198
|
-
o !== User.
|
|
198
|
+
o !== User.Xn &&
|
|
199
199
|
(null == e[s] || (r && null == r[o])) &&
|
|
200
|
-
this.mu(t[User.
|
|
200
|
+
this.mu(t[User.Xn], o, t[o]);
|
|
201
201
|
}
|
|
202
202
|
mu(t, e, s) {
|
|
203
203
|
let r = this.cE.gr(STORAGE_KEYS.gt.eE);
|
|
@@ -205,7 +205,7 @@ export default class ne {
|
|
|
205
205
|
const o = this.gE(t);
|
|
206
206
|
let n = r[o];
|
|
207
207
|
if (
|
|
208
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
208
|
+
(null == n && ((n = {}), null != t && (n[User.Xn] = t)), e === User.lu)
|
|
209
209
|
) {
|
|
210
210
|
null == n[e] && (n[e] = {});
|
|
211
211
|
for (const t in s) n[e][t] = s[t];
|
|
@@ -227,8 +227,8 @@ export default class ne {
|
|
|
227
227
|
null != r &&
|
|
228
228
|
((e[s] = void 0),
|
|
229
229
|
this.cE.store(STORAGE_KEYS.gt.eE, e),
|
|
230
|
-
(r[User.
|
|
231
|
-
this.
|
|
230
|
+
(r[User.Xn] = t),
|
|
231
|
+
this.Cu(r));
|
|
232
232
|
}
|
|
233
233
|
const s = this.tu(STORAGE_KEYS.iu.Nl);
|
|
234
234
|
let r = null;
|
|
@@ -244,12 +244,12 @@ export default class ne {
|
|
|
244
244
|
return this.cE.dE;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
(ne.
|
|
247
|
+
(ne.gc = class {
|
|
248
248
|
constructor(t) {
|
|
249
|
-
(this.
|
|
249
|
+
(this.an = t), (this.an = t), (this.dE = ro.fE() ? 3 : 10);
|
|
250
250
|
}
|
|
251
251
|
bE(t) {
|
|
252
|
-
return t + "." + this.
|
|
252
|
+
return t + "." + this.an;
|
|
253
253
|
}
|
|
254
254
|
store(t, e) {
|
|
255
255
|
const s = { v: e };
|
|
@@ -276,7 +276,7 @@ export default class ne {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}),
|
|
279
|
-
(ne.
|
|
279
|
+
(ne.uc = class {
|
|
280
280
|
constructor() {
|
|
281
281
|
(this.KE = {}), (this.mE = 5242880), (this.dE = 3);
|
|
282
282
|
}
|
|
@@ -320,15 +320,15 @@ export default class ne {
|
|
|
320
320
|
}),
|
|
321
321
|
(ne.se = class {
|
|
322
322
|
constructor(t, e) {
|
|
323
|
-
(this.
|
|
323
|
+
(this.an = t),
|
|
324
324
|
(this.NE = e),
|
|
325
|
-
(this.
|
|
325
|
+
(this.an = t),
|
|
326
326
|
(this.GE = this.DE()),
|
|
327
327
|
(this.CE = 576e3),
|
|
328
328
|
(this.NE = !!e);
|
|
329
329
|
}
|
|
330
330
|
bE(t) {
|
|
331
|
-
return null != this.
|
|
331
|
+
return null != this.an ? t + "." + this.an : t;
|
|
332
332
|
}
|
|
333
333
|
DE() {
|
|
334
334
|
let t = 0,
|
|
@@ -363,7 +363,7 @@ export default class ne {
|
|
|
363
363
|
}
|
|
364
364
|
if (o) {
|
|
365
365
|
const t = r.split("=")[0];
|
|
366
|
-
-1 === t.indexOf("." + this.
|
|
366
|
+
-1 === t.indexOf("." + this.an) && this.pE(t);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
}
|
|
@@ -419,13 +419,13 @@ export default class ne {
|
|
|
419
419
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
420
420
|
}
|
|
421
421
|
}),
|
|
422
|
-
(ne.
|
|
422
|
+
(ne.lc = class {
|
|
423
423
|
constructor(t, e, s) {
|
|
424
|
-
(this.
|
|
424
|
+
(this.an = t),
|
|
425
425
|
(this.vE = []),
|
|
426
426
|
e && this.vE.push(new ne.se(t)),
|
|
427
|
-
s && this.vE.push(new ne.
|
|
428
|
-
this.vE.push(new ne.
|
|
427
|
+
s && this.vE.push(new ne.gc(t)),
|
|
428
|
+
this.vE.push(new ne.uc());
|
|
429
429
|
}
|
|
430
430
|
store(t, e) {
|
|
431
431
|
let s = !0;
|
|
@@ -440,7 +440,7 @@ export default class ne {
|
|
|
440
440
|
return null;
|
|
441
441
|
}
|
|
442
442
|
remove(t) {
|
|
443
|
-
new ne.se(this.
|
|
443
|
+
new ne.se(this.an).remove(t);
|
|
444
444
|
for (let e = 0; e < this.vE.length; e++) this.vE[e].remove(t);
|
|
445
445
|
}
|
|
446
446
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Guid as
|
|
1
|
+
import { Guid as K } from "../../shared-lib/index.js";
|
|
2
2
|
export default class u {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.Mi = {};
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
Dt(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
|
-
const i =
|
|
8
|
+
const i = K.ce();
|
|
9
9
|
return (this.Mi[i] = t), i;
|
|
10
10
|
}
|
|
11
11
|
removeSubscription(t) {
|
|
@@ -14,7 +14,7 @@ export default class u {
|
|
|
14
14
|
removeAllSubscriptions() {
|
|
15
15
|
this.Mi = {};
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
hc() {
|
|
18
18
|
return Object.keys(this.Mi).length;
|
|
19
19
|
}
|
|
20
20
|
X(t) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Du: "invalid_api_key",
|
|
3
|
+
Tu: "blacklisted",
|
|
4
4
|
ku: "no_device_identifier",
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Au: "invalid_json_response",
|
|
6
|
+
bu: "empty_response",
|
|
7
7
|
__: "sdk_auth_error",
|
|
8
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { getAlias as
|
|
2
|
+
import { getAlias as Yt } from "../managers/utils.js";
|
|
3
3
|
import { isObject as yt } from "../util/code-utils.js";
|
|
4
4
|
import {
|
|
5
|
-
convertMsToSeconds as
|
|
6
|
-
timestampOrNow as
|
|
5
|
+
convertMsToSeconds as O,
|
|
6
|
+
timestampOrNow as Zt,
|
|
7
7
|
} from "../util/date-utils.js";
|
|
8
8
|
export default class ve {
|
|
9
9
|
constructor(t, s, i, r, e) {
|
|
@@ -14,22 +14,22 @@ export default class ve {
|
|
|
14
14
|
(this.data = e),
|
|
15
15
|
(this.userId = t),
|
|
16
16
|
(this.type = s),
|
|
17
|
-
(this.time =
|
|
17
|
+
(this.time = Zt(i)),
|
|
18
18
|
(this.sessionId = r),
|
|
19
19
|
(this.data = e);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
Nr() {
|
|
22
22
|
var t;
|
|
23
23
|
const s = {
|
|
24
24
|
name: this.type,
|
|
25
|
-
time:
|
|
25
|
+
time: O(this.time),
|
|
26
26
|
data: this.data || {},
|
|
27
27
|
session_id: this.sessionId,
|
|
28
28
|
};
|
|
29
29
|
null != this.userId && (s.user_id = this.userId);
|
|
30
|
-
const i = (null === (t = r.Sr()) || void 0 === t ? void 0 : t.
|
|
30
|
+
const i = (null === (t = r.Sr()) || void 0 === t ? void 0 : t.jh()) || !1;
|
|
31
31
|
if (!s.user_id && !i) {
|
|
32
|
-
const t =
|
|
32
|
+
const t = Yt(r.j());
|
|
33
33
|
t && (s.alias = t);
|
|
34
34
|
}
|
|
35
35
|
return s;
|
|
@@ -49,7 +49,7 @@ export default class ve {
|
|
|
49
49
|
static RE(t) {
|
|
50
50
|
return null != t && yt(t) && null != t.t && "" !== t.t;
|
|
51
51
|
}
|
|
52
|
-
static
|
|
52
|
+
static Rn(t) {
|
|
53
53
|
return new ve(t.u, t.t, t.ts, t.s, t.d);
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/models/device.js
CHANGED
|
@@ -2,11 +2,11 @@ export default class Gt {
|
|
|
2
2
|
constructor(s) {
|
|
3
3
|
(this.id = s), (this.id = s);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Nr() {
|
|
6
6
|
const s = {};
|
|
7
7
|
return (
|
|
8
8
|
null != this.browser && (s.browser = this.browser),
|
|
9
|
-
null != this.
|
|
9
|
+
null != this.tc && (s.browser_version = this.tc),
|
|
10
10
|
null != this.os && (s.os_version = this.os),
|
|
11
11
|
null != this.resolution && (s.resolution = this.resolution),
|
|
12
12
|
null != this.language && (s.locale = this.language),
|