@braze/web-sdk 5.6.1 → 5.7.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/README.md +1 -1
- package/index.d.ts +14 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +15 -15
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +14 -14
- package/src/Banner/banner-provider.js +53 -50
- package/src/Banner/banner.js +1 -1
- package/src/Banner/get-all-banners.js +2 -2
- package/src/Banner/get-banner.js +2 -2
- package/src/Banner/log-banner-click.js +1 -1
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +2 -2
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Card/card-manager.js +10 -10
- package/src/Card/models/captioned-image.js +1 -1
- package/src/Card/models/card.js +3 -3
- 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/ContentCards/content-cards-provider.js +139 -180
- 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 +10 -10
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/disable-sdk.js +3 -3
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/log-custom-event.js +3 -3
- package/src/Core/log-purchase.js +1 -1
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +4 -4
- package/src/FeatureFlags/feature-flag.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +81 -78
- 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 +34 -34
- 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/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +9 -9
- package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
- package/src/InAppMessage/display/modal-utils.js +5 -5
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +115 -91
- 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 +4 -4
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +5 -5
- package/src/InAppMessage/models/html-message.js +10 -10
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +37 -37
- package/src/InAppMessage/models/modal-message.js +5 -5
- package/src/InAppMessage/models/slide-up-message.js +7 -7
- 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 +14 -14
- 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.js +88 -88
- package/src/Push/utils/push-utils.js +12 -12
- package/src/User/user-manager.js +10 -10
- package/src/User/user.js +46 -34
- package/src/common/constants.js +1 -1
- package/src/common/event-logger.js +3 -3
- package/src/common/feed-display.js +10 -10
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +10 -10
- package/src/managers/braze-instance.js +110 -110
- package/src/managers/device-manager.js +17 -17
- package/src/managers/network-manager.js +180 -143
- package/src/managers/server-config-manager.js +65 -65
- package/src/managers/session-manager.js +22 -22
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +134 -134
- package/src/managers/subscription-manager.js +8 -8
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +8 -8
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +10 -10
- package/src/models/push-token.js +8 -8
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +158 -146
- package/src/triggers/models/custom-event-data.js +5 -5
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +16 -16
- package/src/triggers/models/in-app-message-click-data.js +2 -2
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +36 -36
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +37 -37
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/iam-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 +6 -6
- 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 +1 -0
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +22 -23
- package/src/util/request-header-utils.js +23 -20
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +14 -14
- package/src/util/window-utils.js +2 -2
|
@@ -1,80 +1,72 @@
|
|
|
1
|
-
import l
|
|
1
|
+
import l from "../util/net.js";
|
|
2
2
|
import s from "../common/base-provider.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import ContentCards from "./content-cards.js";
|
|
5
5
|
import { dateFromUnixTimestamp as O } from "../util/date-utils.js";
|
|
6
|
-
import { isURIJavascriptOrData as
|
|
6
|
+
import { isURIJavascriptOrData as X } from "../util/url-utils.js";
|
|
7
7
|
import {
|
|
8
|
-
newCardFromContentCardsJson as
|
|
9
|
-
newCardFromSerializedValue as
|
|
8
|
+
newCardFromContentCardsJson as Y,
|
|
9
|
+
newCardFromSerializedValue as Z,
|
|
10
10
|
} from "../Card/util/card-factory.js";
|
|
11
11
|
import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
12
12
|
import u from "../managers/subscription-manager.js";
|
|
13
|
-
import c from "../common/event-logger.js";
|
|
14
13
|
import h from "../util/request-header-utils.js";
|
|
15
14
|
import { randomInclusive as a } from "../util/math.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
logger as N,
|
|
19
|
-
IndexedDBAdapter as it,
|
|
20
|
-
EventTypes as d,
|
|
21
|
-
} from "../../shared-lib/index.js";
|
|
15
|
+
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
22
16
|
export default class Q extends s {
|
|
23
17
|
constructor(t, s, i, e, h) {
|
|
24
18
|
super(),
|
|
25
19
|
(this.As = t),
|
|
26
20
|
(this.C = s),
|
|
27
21
|
(this.B = i),
|
|
28
|
-
(this.
|
|
22
|
+
(this.Ls = e),
|
|
29
23
|
(this.S = h),
|
|
30
24
|
(this.As = t),
|
|
31
25
|
(this.C = s),
|
|
32
26
|
(this.B = i),
|
|
33
|
-
(this.
|
|
27
|
+
(this.Ls = e),
|
|
34
28
|
(this.S = h),
|
|
35
|
-
(this.
|
|
36
|
-
r.N(this.
|
|
29
|
+
(this.Js = new u()),
|
|
30
|
+
r.N(this.Js),
|
|
31
|
+
(this.Ms = 0),
|
|
37
32
|
(this.$s = 0),
|
|
38
|
-
(this.Ps = 0),
|
|
39
33
|
(this.cards = []),
|
|
40
|
-
this.
|
|
41
|
-
const n =
|
|
42
|
-
new
|
|
43
|
-
this.
|
|
34
|
+
this.Ps();
|
|
35
|
+
const n = tt._s.Xs;
|
|
36
|
+
new tt(n, N).Gs(n.Ks.Hs, (t) => {
|
|
37
|
+
this.Os(t);
|
|
44
38
|
}),
|
|
45
|
-
(this.
|
|
39
|
+
(this.Qs = null),
|
|
46
40
|
(this.k = null),
|
|
41
|
+
(this.Vs = null),
|
|
47
42
|
(this.Ws = null),
|
|
48
|
-
(this.Ys =
|
|
49
|
-
(this.Zs = null),
|
|
50
|
-
(this.fi = 10),
|
|
51
|
-
(this.di = 0);
|
|
43
|
+
(this.Ys = 10);
|
|
52
44
|
}
|
|
53
|
-
|
|
54
|
-
return this.
|
|
45
|
+
Zs() {
|
|
46
|
+
return this.Qs;
|
|
55
47
|
}
|
|
56
|
-
|
|
57
|
-
this.
|
|
48
|
+
fi(t) {
|
|
49
|
+
this.Qs = t;
|
|
58
50
|
}
|
|
59
|
-
|
|
51
|
+
Cs() {
|
|
60
52
|
return this.k;
|
|
61
53
|
}
|
|
62
|
-
|
|
54
|
+
Ts(t) {
|
|
63
55
|
this.k = t;
|
|
64
56
|
}
|
|
65
|
-
|
|
57
|
+
Ps() {
|
|
66
58
|
if (!this.C) return;
|
|
67
|
-
const s = this.C.
|
|
59
|
+
const s = this.C.vs(t.gs.di) || [],
|
|
68
60
|
i = [];
|
|
69
61
|
for (let t = 0; t < s.length; t++) {
|
|
70
|
-
const e =
|
|
62
|
+
const e = Z(s[t]);
|
|
71
63
|
null != e && i.push(e);
|
|
72
64
|
}
|
|
73
|
-
(this.cards = this.
|
|
74
|
-
(this
|
|
75
|
-
(this
|
|
65
|
+
(this.cards = this.pi(this.Ci(i, !1))),
|
|
66
|
+
(this.Ms = this.C.vs(t.gs.bi) || this.Ms),
|
|
67
|
+
(this.$s = this.C.vs(t.gs.vi) || this.$s);
|
|
76
68
|
}
|
|
77
|
-
|
|
69
|
+
wi(s, i = !1, e = 0, h = 0) {
|
|
78
70
|
let r;
|
|
79
71
|
if (i) {
|
|
80
72
|
r = [];
|
|
@@ -89,10 +81,10 @@ export default class Q extends s {
|
|
|
89
81
|
break;
|
|
90
82
|
}
|
|
91
83
|
if (i) {
|
|
92
|
-
const t =
|
|
84
|
+
const t = Y(e);
|
|
93
85
|
null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
|
|
94
86
|
} else if (null == h) {
|
|
95
|
-
const t =
|
|
87
|
+
const t = Y(e);
|
|
96
88
|
null != t && r.push(t);
|
|
97
89
|
} else {
|
|
98
90
|
if (!h.ni(e))
|
|
@@ -103,54 +95,28 @@ export default class Q extends s {
|
|
|
103
95
|
}
|
|
104
96
|
}
|
|
105
97
|
}
|
|
106
|
-
(this.cards = this.
|
|
107
|
-
this.
|
|
108
|
-
(this
|
|
109
|
-
(this
|
|
110
|
-
this.C && (this.C.
|
|
98
|
+
(this.cards = this.pi(this.Ci(r, i))),
|
|
99
|
+
this.gi(),
|
|
100
|
+
(this.Ms = e),
|
|
101
|
+
(this.$s = h),
|
|
102
|
+
this.C && (this.C.Bs(t.gs.bi, this.Ms), this.C.Bs(t.gs.vi, this.$s));
|
|
111
103
|
}
|
|
112
104
|
U(s) {
|
|
113
|
-
if (this.
|
|
114
|
-
this.C && this.C.
|
|
105
|
+
if (this.ji() && null != s && s.cards) {
|
|
106
|
+
this.C && this.C.Bs(t.gs.yi, r.Si());
|
|
115
107
|
const i = s.full_sync;
|
|
116
|
-
i || this.
|
|
117
|
-
this.
|
|
118
|
-
this.
|
|
108
|
+
i || this.Ps(),
|
|
109
|
+
this.wi(s.cards, i, s.last_full_sync_at, s.last_card_updated_at),
|
|
110
|
+
this.Js.X(this.Ri(!0));
|
|
119
111
|
}
|
|
120
112
|
}
|
|
121
|
-
|
|
122
|
-
this.
|
|
113
|
+
Ui(t) {
|
|
114
|
+
this.ki(), (this.Vs = t);
|
|
123
115
|
}
|
|
124
|
-
|
|
125
|
-
const h = () => {
|
|
126
|
-
this.zi(i, e, !0);
|
|
127
|
-
},
|
|
128
|
-
r = s ? X(s) : null;
|
|
129
|
-
let n;
|
|
130
|
-
if ((this.qi(), !r || !r["retry-after"])) return void this.Ai(0);
|
|
131
|
-
const o = r["retry-after"];
|
|
132
|
-
if (isNaN(o) && !isNaN(Date.parse(o)))
|
|
133
|
-
(n = Date.parse(o) - new Date().getTime()), n < 0 && h();
|
|
134
|
-
else {
|
|
135
|
-
if (isNaN(parseFloat(o.toString()))) {
|
|
136
|
-
const t =
|
|
137
|
-
"Received unexpected value for retry-after header in /sync response";
|
|
138
|
-
return c.ds(d.Li, { e: t + ": " + o }), void this.Ai(0);
|
|
139
|
-
}
|
|
140
|
-
n = 1e3 * parseFloat(o.toString());
|
|
141
|
-
}
|
|
142
|
-
this.Ws = window.setTimeout(() => {
|
|
143
|
-
h();
|
|
144
|
-
}, n);
|
|
145
|
-
let l = 0;
|
|
146
|
-
this.C && (l = this.C.ps(t.bs.Fi)),
|
|
147
|
-
(null == l || isNaN(parseInt(l.toString()))) && (l = 0),
|
|
148
|
-
this.Ai(parseInt(l.toString()) + 1);
|
|
149
|
-
}
|
|
150
|
-
Qs(t) {
|
|
116
|
+
Os(t) {
|
|
151
117
|
var s;
|
|
152
|
-
if (!this.
|
|
153
|
-
this.
|
|
118
|
+
if (!this.ji()) return;
|
|
119
|
+
this.Ps();
|
|
154
120
|
const i = this.cards.slice();
|
|
155
121
|
let e = null;
|
|
156
122
|
e = null === (s = this.As) || void 0 === s ? void 0 : s.getUserId();
|
|
@@ -164,7 +130,7 @@ export default class Q extends s {
|
|
|
164
130
|
break;
|
|
165
131
|
}
|
|
166
132
|
if (null == h) {
|
|
167
|
-
const t =
|
|
133
|
+
const t = Y(e);
|
|
168
134
|
null != t && i.push(t);
|
|
169
135
|
} else {
|
|
170
136
|
if (!h.ni(e))
|
|
@@ -175,16 +141,16 @@ export default class Q extends s {
|
|
|
175
141
|
}
|
|
176
142
|
}
|
|
177
143
|
}
|
|
178
|
-
(this.cards = this.
|
|
144
|
+
(this.cards = this.pi(this.Ci(i, !1))), this.gi(), this.Js.X(this.Ri(!0));
|
|
179
145
|
}
|
|
180
|
-
|
|
146
|
+
Ci(s, i) {
|
|
181
147
|
let e = {},
|
|
182
148
|
h = {},
|
|
183
149
|
r = {};
|
|
184
150
|
this.C &&
|
|
185
|
-
((e = this.C.
|
|
186
|
-
(h = this.C.
|
|
187
|
-
(r = this.C.
|
|
151
|
+
((e = this.C.vs(t.gs.ot) || {}),
|
|
152
|
+
(h = this.C.vs(t.gs.vt) || {}),
|
|
153
|
+
(r = this.C.vs(t.gs.gt) || {}));
|
|
188
154
|
const n = {},
|
|
189
155
|
o = {},
|
|
190
156
|
l = {};
|
|
@@ -198,19 +164,19 @@ export default class Q extends s {
|
|
|
198
164
|
return (
|
|
199
165
|
i &&
|
|
200
166
|
this.C &&
|
|
201
|
-
(this.C.
|
|
167
|
+
(this.C.Bs(t.gs.ot, n), this.C.Bs(t.gs.vt, o), this.C.Bs(t.gs.gt, l)),
|
|
202
168
|
s
|
|
203
169
|
);
|
|
204
170
|
}
|
|
205
|
-
|
|
171
|
+
pi(s) {
|
|
206
172
|
const i = [],
|
|
207
173
|
e = new Date();
|
|
208
174
|
let h = {};
|
|
209
|
-
this.C && (h = this.C.
|
|
175
|
+
this.C && (h = this.C.vs(t.gs.gt) || {});
|
|
210
176
|
let r = !1;
|
|
211
177
|
for (let t = 0; t < s.length; t++) {
|
|
212
178
|
const n = s[t].url;
|
|
213
|
-
if (!this.
|
|
179
|
+
if (!this.Ls && n && X(n)) {
|
|
214
180
|
N.error(
|
|
215
181
|
`Card with url ${n} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
|
|
216
182
|
);
|
|
@@ -225,92 +191,85 @@ export default class Q extends s {
|
|
|
225
191
|
i && (h[i] = !0), (r = !0);
|
|
226
192
|
}
|
|
227
193
|
}
|
|
228
|
-
return r && this.C && this.C.
|
|
194
|
+
return r && this.C && this.C.Bs(t.gs.gt, h), i;
|
|
229
195
|
}
|
|
230
|
-
|
|
196
|
+
gi() {
|
|
231
197
|
var s;
|
|
232
198
|
const i = [];
|
|
233
|
-
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].
|
|
234
|
-
null === (s = this.C) || void 0 === s || s.
|
|
235
|
-
}
|
|
236
|
-
qi() {
|
|
237
|
-
this.Ws && (clearTimeout(this.Ws), (this.Ws = null));
|
|
238
|
-
}
|
|
239
|
-
Ji() {
|
|
240
|
-
null != this.Ys && (clearTimeout(this.Ys), (this.Ys = null));
|
|
199
|
+
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bs());
|
|
200
|
+
null === (s = this.C) || void 0 === s || s.Bs(t.gs.di, i);
|
|
241
201
|
}
|
|
242
|
-
|
|
243
|
-
this.
|
|
244
|
-
(this.Ys = window.setTimeout(() => {
|
|
245
|
-
this.zi(s, i, !0);
|
|
246
|
-
}, t)),
|
|
247
|
-
(this.Zs = t);
|
|
202
|
+
ki() {
|
|
203
|
+
this.Vs && (clearTimeout(this.Vs), (this.Vs = null));
|
|
248
204
|
}
|
|
249
|
-
|
|
250
|
-
var
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
if (!
|
|
254
|
-
if ((
|
|
205
|
+
Di(s, i, e = !1) {
|
|
206
|
+
var n;
|
|
207
|
+
const o = this.S,
|
|
208
|
+
u = this.C;
|
|
209
|
+
if (!o || !u) return void ("function" == typeof i && i());
|
|
210
|
+
if ((e && (h.zi(u, h.O.Ai), this.ki()), !this.ji()))
|
|
255
211
|
return void (
|
|
256
|
-
null === (
|
|
257
|
-
void 0 ===
|
|
258
|
-
|
|
259
|
-
this.
|
|
212
|
+
null === (n = this.B) ||
|
|
213
|
+
void 0 === n ||
|
|
214
|
+
n.qi(() => {
|
|
215
|
+
this.Di(s, i, !0);
|
|
260
216
|
})
|
|
261
217
|
);
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
f,
|
|
218
|
+
const c = o.H({}, !0);
|
|
219
|
+
u.vs(t.gs.yi) !== r.Si() && this.xi(),
|
|
220
|
+
(c.last_full_sync_at = this.Ms),
|
|
221
|
+
(c.last_card_updated_at = this.$s);
|
|
222
|
+
const f = o.J(c, h.O.Ai, e);
|
|
223
|
+
let d = !1;
|
|
224
|
+
o.V(
|
|
225
|
+
c,
|
|
271
226
|
(t = -1) => {
|
|
272
227
|
if (this.C) {
|
|
273
228
|
const t = new Date().valueOf();
|
|
274
|
-
h.W(this.C, h.O.
|
|
229
|
+
h.W(this.C, h.O.Ai, t);
|
|
275
230
|
}
|
|
276
|
-
-1 !== t &&
|
|
231
|
+
-1 !== t && f.push(["X-Braze-Req-Tokens-Remaining", t.toString()]),
|
|
277
232
|
l.Y({
|
|
278
|
-
url: `${
|
|
279
|
-
data:
|
|
280
|
-
headers:
|
|
281
|
-
ss: (t
|
|
282
|
-
if (!
|
|
283
|
-
return (
|
|
284
|
-
|
|
285
|
-
this.xi(e, s, i),
|
|
286
|
-
this.U(t),
|
|
287
|
-
(m = !1),
|
|
288
|
-
h.ns(this.C, h.O.Pi, 1),
|
|
289
|
-
"function" == typeof s && s();
|
|
233
|
+
url: `${o.Z()}/content_cards/sync`,
|
|
234
|
+
data: c,
|
|
235
|
+
headers: f,
|
|
236
|
+
ss: (t) => {
|
|
237
|
+
if (!o.ts(c, t, f))
|
|
238
|
+
return (d = !0), void ("function" == typeof i && i());
|
|
239
|
+
o.es(), this.U(t), (d = !1), "function" == typeof s && s();
|
|
290
240
|
},
|
|
291
241
|
error: (t) => {
|
|
292
|
-
|
|
293
|
-
(
|
|
242
|
+
o.ns(t, "retrieving content cards"),
|
|
243
|
+
(d = !0),
|
|
294
244
|
"function" == typeof i && i();
|
|
295
245
|
},
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
let t = this.
|
|
300
|
-
(null == t || t < 1e3 * this.
|
|
301
|
-
|
|
302
|
-
(this.di = this.di + 1);
|
|
246
|
+
rs: (t, e) => {
|
|
247
|
+
let r;
|
|
248
|
+
if (d) {
|
|
249
|
+
let t = this.Ws;
|
|
250
|
+
(null == t || t < 1e3 * this.Ys) && (t = 1e3 * this.Ys),
|
|
251
|
+
(r = Math.min(3e5, a(1e3 * this.Ys, 3 * t)));
|
|
303
252
|
}
|
|
253
|
+
o.os(
|
|
254
|
+
e,
|
|
255
|
+
() => {
|
|
256
|
+
this.Di(s, i, !1);
|
|
257
|
+
},
|
|
258
|
+
h.O.Ai,
|
|
259
|
+
(t) => this.Ui(t),
|
|
260
|
+
() => this.ki(),
|
|
261
|
+
r,
|
|
262
|
+
);
|
|
304
263
|
},
|
|
305
264
|
});
|
|
306
265
|
},
|
|
307
|
-
h.O.
|
|
266
|
+
h.O.Ai,
|
|
308
267
|
i,
|
|
309
268
|
);
|
|
310
269
|
}
|
|
311
|
-
|
|
312
|
-
s || this.
|
|
313
|
-
const i = this.
|
|
270
|
+
Ri(s) {
|
|
271
|
+
s || this.Ps();
|
|
272
|
+
const i = this.pi(this.cards);
|
|
314
273
|
i.sort((t, s) =>
|
|
315
274
|
t.pinned && !s.pinned
|
|
316
275
|
? -1
|
|
@@ -322,50 +281,50 @@ export default class Q extends s {
|
|
|
322
281
|
? 1
|
|
323
282
|
: 0,
|
|
324
283
|
);
|
|
325
|
-
let e = Math.max(this
|
|
284
|
+
let e = Math.max(this.$s || 0, this.Ms || 0);
|
|
326
285
|
return (
|
|
327
286
|
0 === e && (e = void 0),
|
|
328
|
-
this.C && this.C.
|
|
287
|
+
this.C && this.C.vs(t.gs.vi) === this.$s && void 0 === e && (e = this.$s),
|
|
329
288
|
new ContentCards(i, O(e))
|
|
330
289
|
);
|
|
331
290
|
}
|
|
332
|
-
|
|
333
|
-
return this.
|
|
291
|
+
qs(t) {
|
|
292
|
+
return this.Js.Fs(t);
|
|
334
293
|
}
|
|
335
|
-
|
|
336
|
-
(this
|
|
337
|
-
(this
|
|
338
|
-
this.C && (this.C.
|
|
294
|
+
xi() {
|
|
295
|
+
(this.Ms = 0),
|
|
296
|
+
(this.$s = 0),
|
|
297
|
+
this.C && (this.C.Es(t.gs.bi), this.C.Es(t.gs.vi));
|
|
339
298
|
}
|
|
340
299
|
changeUser(s) {
|
|
341
300
|
s ||
|
|
342
301
|
((this.cards = []),
|
|
343
|
-
this.
|
|
302
|
+
this.Js.X(new ContentCards(this.cards.slice(), null)),
|
|
344
303
|
this.C &&
|
|
345
|
-
(this.C.
|
|
346
|
-
this.C.
|
|
347
|
-
this.C.
|
|
348
|
-
this.C.
|
|
349
|
-
this.
|
|
304
|
+
(this.C.Es(t.gs.di),
|
|
305
|
+
this.C.Es(t.gs.ot),
|
|
306
|
+
this.C.Es(t.gs.vt),
|
|
307
|
+
this.C.Es(t.gs.gt))),
|
|
308
|
+
this.xi();
|
|
350
309
|
}
|
|
351
310
|
clearData(s) {
|
|
352
|
-
(this
|
|
353
|
-
(this
|
|
311
|
+
(this.Ms = 0),
|
|
312
|
+
(this.$s = 0),
|
|
354
313
|
(this.cards = []),
|
|
355
|
-
this.
|
|
314
|
+
this.Js.X(new ContentCards(this.cards.slice(), null)),
|
|
356
315
|
s &&
|
|
357
316
|
this.C &&
|
|
358
|
-
(this.C.
|
|
359
|
-
this.C.
|
|
360
|
-
this.C.
|
|
361
|
-
this.C.
|
|
362
|
-
this.C.
|
|
363
|
-
this.C.
|
|
317
|
+
(this.C.Es(t.gs.di),
|
|
318
|
+
this.C.Es(t.gs.ot),
|
|
319
|
+
this.C.Es(t.gs.vt),
|
|
320
|
+
this.C.Es(t.gs.gt),
|
|
321
|
+
this.C.Es(t.gs.bi),
|
|
322
|
+
this.C.Es(t.gs.vi));
|
|
364
323
|
}
|
|
365
|
-
|
|
366
|
-
return !!this.B && (!!this.B.
|
|
324
|
+
ji() {
|
|
325
|
+
return !!this.B && (!!this.B.Fi() || (0 !== this.B.Us() && this.Li(), !1));
|
|
367
326
|
}
|
|
368
|
-
|
|
369
|
-
this.
|
|
327
|
+
Li() {
|
|
328
|
+
this.Js.X(new ContentCards([], new Date())), this.C && this.C.Es(t.gs.di);
|
|
370
329
|
}
|
|
371
330
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import W from "./content-cards-provider-factory.js";
|
|
3
|
-
export function subscribeToContentCardsUpdates(
|
|
3
|
+
export function subscribeToContentCardsUpdates(o) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
if (!
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
const r =
|
|
11
|
-
|
|
5
|
+
const t = W.m(),
|
|
6
|
+
n = t.qs(o);
|
|
7
|
+
if (!t.Cs()) {
|
|
8
|
+
const o = r.nn();
|
|
9
|
+
if (o) {
|
|
10
|
+
const r = o.rn(() => {
|
|
11
|
+
t.Di(void 0, void 0, !0);
|
|
12
12
|
});
|
|
13
|
-
r &&
|
|
13
|
+
r && t.Ts(r);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return n;
|
|
17
17
|
}
|
|
@@ -19,11 +19,11 @@ export function showContentCards(n, t) {
|
|
|
19
19
|
let e = !1;
|
|
20
20
|
null == n && ((n = document.body), (e = !0));
|
|
21
21
|
const o = r.sr(z.tn) || r.sr(z.en) || !1,
|
|
22
|
-
i = W.m().
|
|
22
|
+
i = W.m().Ri(!1);
|
|
23
23
|
"function" == typeof t && an(i, t(i.cards.slice()), i.lastUpdated, null, o);
|
|
24
24
|
const a = tn(i, o, e),
|
|
25
25
|
s = W.m(),
|
|
26
|
-
f = s.
|
|
26
|
+
f = s.Zs();
|
|
27
27
|
(null == i.lastUpdated ||
|
|
28
28
|
new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.ar) &&
|
|
29
29
|
(null == f || new Date().valueOf() - f > ContentCards.ar) &&
|
|
@@ -31,7 +31,7 @@ export function showContentCards(n, t) {
|
|
|
31
31
|
`Cached content cards were older than max TTL of ${ContentCards.ar} ms, requesting an update from the server.`,
|
|
32
32
|
),
|
|
33
33
|
on(i, a),
|
|
34
|
-
s.
|
|
34
|
+
s.fi(new Date().valueOf()));
|
|
35
35
|
const l = new Date().valueOf(),
|
|
36
36
|
c = subscribeToContentCardsUpdates(function (n) {
|
|
37
37
|
const e = a.querySelectorAll(".ab-refresh-button")[0];
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as N, IndexedDBAdapter as
|
|
2
|
+
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
3
3
|
import ne, { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
4
4
|
export function disableSDK() {
|
|
5
5
|
const e = r.nn();
|
|
@@ -7,8 +7,8 @@ export function disableSDK() {
|
|
|
7
7
|
const n = new ne.ne(null, !0),
|
|
8
8
|
s = "This-cookie-will-expire-in-" + n.se();
|
|
9
9
|
n.store(t.ae, s);
|
|
10
|
-
const a =
|
|
11
|
-
new
|
|
10
|
+
const a = tt._s.Xs;
|
|
11
|
+
new tt(a, N).setItem(a.Ks.ie, a.oe, !0),
|
|
12
12
|
N.info("disableSDK was called"),
|
|
13
13
|
r.destroy(!1),
|
|
14
14
|
r.re(!0);
|
package/src/Core/enable-sdk.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as N, IndexedDBAdapter as
|
|
2
|
+
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
3
3
|
import ne, { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
5
|
new ne.ne(null, !0).remove(t.ae);
|
|
6
|
-
const e =
|
|
7
|
-
new
|
|
6
|
+
const e = tt._s.Xs;
|
|
7
|
+
new tt(e, N).me(e.Ks.ie, e.oe),
|
|
8
8
|
N.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
10
|
r.re(!1);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
validateCustomProperties as rt,
|
|
8
8
|
validateCustomString as nt,
|
|
9
9
|
} from "../util/validation-utils.js";
|
|
10
|
-
import { LOG_CUSTOM_EVENT_STRING as
|
|
10
|
+
import { LOG_CUSTOM_EVENT_STRING as it } from "../common/constants.js";
|
|
11
11
|
export function logCustomEvent(t, e) {
|
|
12
12
|
if (!r.rr()) return !1;
|
|
13
13
|
if (null == t || t.length <= 0)
|
|
@@ -20,7 +20,7 @@ export function logCustomEvent(t, e) {
|
|
|
20
20
|
if (!nt(t, "log custom event", "the event name")) return !1;
|
|
21
21
|
const [o, n] = rt(
|
|
22
22
|
e,
|
|
23
|
-
|
|
23
|
+
it,
|
|
24
24
|
"eventProperties",
|
|
25
25
|
`log custom event "${t}"`,
|
|
26
26
|
"event",
|
|
@@ -29,7 +29,7 @@ export function logCustomEvent(t, e) {
|
|
|
29
29
|
const i = r.v();
|
|
30
30
|
if (i && i.ge(t))
|
|
31
31
|
return N.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1;
|
|
32
|
-
const s = c.
|
|
32
|
+
const s = c.cs(d.CustomEvent, { n: t, p: n });
|
|
33
33
|
if (s.ss) {
|
|
34
34
|
N.info(`Logged custom event "${t}".`);
|
|
35
35
|
for (const o of s.fe) ot.m().ue(et.ve, [t, e], o);
|
package/src/Core/log-purchase.js
CHANGED
|
@@ -230,7 +230,7 @@ export function logPurchase(e, o, i, n, t) {
|
|
|
230
230
|
const g = r.v();
|
|
231
231
|
if (g && g.Dr(e))
|
|
232
232
|
return N.info(`Purchase "${e}" is blocklisted, ignoring.`), !1;
|
|
233
|
-
const P = c.
|
|
233
|
+
const P = c.cs(d.Pr, { pid: e, c: i, p: s, q: D, pr: a });
|
|
234
234
|
if (P.ss) {
|
|
235
235
|
N.info(`Logged ${D} purchase${D > 1 ? "s" : ""} of "${e}" for ${i} ${s}.`);
|
|
236
236
|
for (const r of P.fe) ot.m().ue(et.Rr, [e, t], r);
|
package/src/Core/open-session.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as N, IndexedDBAdapter as
|
|
2
|
+
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
3
3
|
import et from "../triggers/models/trigger-events.js";
|
|
4
4
|
import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
|
|
5
5
|
export function openSession() {
|
|
@@ -7,9 +7,9 @@ export function openSession() {
|
|
|
7
7
|
const i = r.nn();
|
|
8
8
|
if (!i) return;
|
|
9
9
|
i.openSession();
|
|
10
|
-
const t =
|
|
11
|
-
o = new
|
|
12
|
-
o.jr(t.
|
|
10
|
+
const t = tt._s.Xs,
|
|
11
|
+
o = new tt(t, N);
|
|
12
|
+
o.jr(t.Ks.hr, (r, n) => {
|
|
13
13
|
const e = n.lastClick,
|
|
14
14
|
s = n.trackingString;
|
|
15
15
|
N.info(`Firing push click trigger from ${s} push click at ${e}`);
|
|
@@ -17,9 +17,9 @@ export function openSession() {
|
|
|
17
17
|
g = function () {
|
|
18
18
|
ot.m().ue(et.kr, [s], c);
|
|
19
19
|
};
|
|
20
|
-
i.vr(g, g), o.me(t.
|
|
20
|
+
i.vr(g, g), o.me(t.Ks.hr, r);
|
|
21
21
|
}),
|
|
22
|
-
o.
|
|
22
|
+
o.Gs(t.Ks.$r, function (r) {
|
|
23
23
|
i.wr(r);
|
|
24
24
|
});
|
|
25
25
|
}
|
package/src/Core/wipe-data.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import { keys as y } from "../util/code-utils.js";
|
|
3
|
-
import { logger as N, IndexedDBAdapter as
|
|
3
|
+
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
4
4
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as p } from "../common/constants.js";
|
|
5
5
|
export function wipeData() {
|
|
6
6
|
const o = r.j();
|
|
7
7
|
if (null == o) return void N.warn(p);
|
|
8
8
|
o.clearData();
|
|
9
|
-
const t = y(
|
|
9
|
+
const t = y(tt._s);
|
|
10
10
|
for (let o = 0; o < t.length; o++) {
|
|
11
11
|
const n = t[o],
|
|
12
|
-
r =
|
|
13
|
-
new
|
|
12
|
+
r = tt._s[n];
|
|
13
|
+
new tt(r, N).clearData();
|
|
14
14
|
}
|
|
15
15
|
if (r.rr()) for (const o of r.lr()) o.clearData(!0);
|
|
16
16
|
}
|