@braze/web-sdk 4.8.0 → 4.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 +6 -3
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +11 -11
- package/shared-lib/indexed-db-adapter.js +67 -67
- package/shared-lib/logger.js +7 -7
- package/src/Card/card-manager.js +1 -1
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/Core/disable-sdk.js +5 -4
- package/src/Core/enable-sdk.js +1 -1
- package/src/Core/is-disabled.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +12 -12
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +40 -34
- 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 +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +13 -13
- package/src/InAppMessage/models/slide-up-message.js +2 -2
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +2 -2
- package/src/Push/push-manager.js +82 -81
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +5 -5
- package/src/common/feed-display.js +82 -72
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/managers/auth-manager.js +18 -15
- package/src/managers/braze-instance.js +125 -109
- package/src/managers/device-manager.js +40 -35
- package/src/managers/network-manager.js +90 -81
- package/src/managers/server-config-manager.js +36 -34
- package/src/managers/session-manager.js +44 -37
- package/src/managers/storage-manager-factory.js +23 -16
- package/src/managers/storage-manager.js +251 -239
- package/src/managers/subscription-manager.js +10 -7
- package/src/managers/types.js +1 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +10 -4
- package/src/models/device.js +10 -18
- package/src/models/identifier.js +10 -11
- package/src/models/push-token.js +14 -9
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +32 -16
- package/src/models/types.js +1 -0
- package/src/request-controller.js +109 -109
- package/src/triggers/models/custom-event-data.js +6 -6
- package/src/triggers/models/custom-event-property-data.js +9 -9
- package/src/triggers/models/filter-set.js +9 -9
- package/src/triggers/models/filter.js +60 -60
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +7 -7
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +46 -46
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +27 -27
- package/src/triggers/triggers-provider.js +126 -126
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +18 -18
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/device-constants.js +6 -6
- package/src/util/dom-utils.js +5 -5
- package/src/util/error-utils.js +2 -0
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +9 -9
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/window-utils.js +1 -1
|
@@ -17,224 +17,224 @@ export default class gr extends y {
|
|
|
17
17
|
super(),
|
|
18
18
|
(this.tg = t),
|
|
19
19
|
(this.ig = i),
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this.eg = []),
|
|
20
|
+
(this.yh = s),
|
|
21
|
+
(this.sg = e),
|
|
22
|
+
(this.eg = r),
|
|
24
23
|
(this.hg = []),
|
|
25
|
-
(this.og =
|
|
26
|
-
(this.ng =
|
|
24
|
+
(this.og = []),
|
|
25
|
+
(this.ng = null),
|
|
27
26
|
(this.lg = {}),
|
|
28
|
-
this.ag
|
|
29
|
-
this.gg()
|
|
27
|
+
(this.ag = {}),
|
|
28
|
+
this.gg(),
|
|
29
|
+
this.fg();
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
35
|
-
for (let t = 0; t < this.
|
|
36
|
-
const i = this.
|
|
37
|
-
null != this.
|
|
31
|
+
cg() {
|
|
32
|
+
(this.ng = this.yh.v(i.k.Ma) || this.ng),
|
|
33
|
+
(this.lg = this.yh.v(i.k.ya) || this.lg),
|
|
34
|
+
(this.ag = this.yh.v(i.k.Ga) || this.ag);
|
|
35
|
+
for (let t = 0; t < this.ug.length; t++) {
|
|
36
|
+
const i = this.ug[t];
|
|
37
|
+
null != this.ag[i.id] && i.Wu(this.ag[i.id]);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
const t = this.
|
|
40
|
+
gg() {
|
|
41
|
+
this.dg = this.yh.v(i.k.Ca) || 0;
|
|
42
|
+
const t = this.yh.v(i.k.Na) || [],
|
|
43
43
|
s = [];
|
|
44
|
-
for (let i = 0; i < t.length; i++) s.push(mt.
|
|
45
|
-
(this.
|
|
44
|
+
for (let i = 0; i < t.length; i++) s.push(mt.zn(t[i]));
|
|
45
|
+
(this.ug = s), this.cg();
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
fg() {
|
|
48
48
|
const t = this,
|
|
49
49
|
s = function(i, s, e, r, h) {
|
|
50
50
|
return function() {
|
|
51
|
-
t.
|
|
51
|
+
t.mg(i, s, e, r, h);
|
|
52
52
|
};
|
|
53
53
|
},
|
|
54
54
|
e = {};
|
|
55
|
-
for (let t = 0; t < this.
|
|
55
|
+
for (let t = 0; t < this.ug.length; t++) e[this.ug[t].id] = this.ug[t];
|
|
56
56
|
let r = !1;
|
|
57
|
-
for (let t = 0; t < this.
|
|
58
|
-
const i = this.
|
|
59
|
-
if (null != this.
|
|
60
|
-
const t = this.
|
|
57
|
+
for (let t = 0; t < this.ug.length; t++) {
|
|
58
|
+
const i = this.ug[t];
|
|
59
|
+
if (null != this.lg[i.id]) {
|
|
60
|
+
const t = this.lg[i.id],
|
|
61
61
|
h = [];
|
|
62
62
|
for (let r = 0; r < t.length; r++) {
|
|
63
63
|
const o = t[r],
|
|
64
|
-
n = i.
|
|
64
|
+
n = i.Yu(o.Jr);
|
|
65
65
|
if (n > 0) {
|
|
66
66
|
let t, r;
|
|
67
67
|
h.push(o),
|
|
68
|
-
null != o.
|
|
69
|
-
null != o.
|
|
68
|
+
null != o.pg && (t = o.pg),
|
|
69
|
+
null != o.bg && ue.Qa(o.bg) && (r = ue.zn(o.bg));
|
|
70
70
|
const l = [];
|
|
71
|
-
if (p(o.
|
|
72
|
-
for (let t = 0; t < o.
|
|
73
|
-
const i = e[o.
|
|
71
|
+
if (p(o.Tg))
|
|
72
|
+
for (let t = 0; t < o.Tg.length; t++) {
|
|
73
|
+
const i = e[o.Tg[t]];
|
|
74
74
|
null != i && l.push(i);
|
|
75
75
|
}
|
|
76
|
-
this.
|
|
76
|
+
this.og.push(setTimeout(s(i, o.Jr, t, r, l), n));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
this.
|
|
80
|
-
((this.
|
|
79
|
+
this.lg[i.id].length > h.length &&
|
|
80
|
+
((this.lg[i.id] = h),
|
|
81
81
|
(r = !0),
|
|
82
|
-
0 === this.
|
|
82
|
+
0 === this.lg[i.id].length && delete this.lg[i.id]);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
r && this.
|
|
85
|
+
r && this.yh.D(i.k.ya, this.lg);
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
yg() {
|
|
88
88
|
const t = [];
|
|
89
|
-
for (let i = 0; i < this.
|
|
90
|
-
(this.
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
89
|
+
for (let i = 0; i < this.ug.length; i++) t.push(this.ug[i].ss());
|
|
90
|
+
(this.dg = new Date().valueOf()),
|
|
91
|
+
this.yh.D(i.k.Na, t),
|
|
92
|
+
this.yh.D(i.k.Ca, this.dg);
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
(this.
|
|
94
|
+
vg() {
|
|
95
|
+
(this.yh.v(i.k.Ca) || 0) > this.dg ? this.gg() : this.cg();
|
|
96
96
|
}
|
|
97
97
|
Ts(t) {
|
|
98
98
|
let s = !1;
|
|
99
99
|
if (null != t && t.triggers) {
|
|
100
|
-
this.
|
|
100
|
+
this.cg();
|
|
101
101
|
const e = {},
|
|
102
102
|
h = {};
|
|
103
|
-
this.
|
|
103
|
+
this.ug = [];
|
|
104
104
|
for (let i = 0; i < t.triggers.length; i++) {
|
|
105
105
|
const r = mt.fromJson(t.triggers[i]);
|
|
106
|
-
null != this.
|
|
107
|
-
(r.
|
|
108
|
-
null != this.
|
|
109
|
-
for (let t = 0; t < r.
|
|
110
|
-
if (r.
|
|
106
|
+
null != this.ag[r.id] &&
|
|
107
|
+
(r.Wu(this.ag[r.id]), (e[r.id] = this.ag[r.id])),
|
|
108
|
+
null != this.lg[r.id] && (h[r.id] = this.lg[r.id]);
|
|
109
|
+
for (let t = 0; t < r.Pu.length; t++)
|
|
110
|
+
if (r.Pu[t].ec(tt.ks, null)) {
|
|
111
111
|
s = !0;
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
|
-
null != r && this.
|
|
114
|
+
null != r && this.ug.push(r);
|
|
115
115
|
}
|
|
116
|
-
ii(this.
|
|
117
|
-
ii(this.
|
|
118
|
-
this.
|
|
116
|
+
ii(this.ag, e) || ((this.ag = e), this.yh.D(i.k.Ga, this.ag)),
|
|
117
|
+
ii(this.lg, h) || ((this.lg = h), this.yh.D(i.k.ya, this.lg)),
|
|
118
|
+
this.yg(),
|
|
119
119
|
s &&
|
|
120
120
|
(r.j.info("Trigger with test condition found, firing test."),
|
|
121
121
|
this.je(tt.ks)),
|
|
122
122
|
this.je(tt.OPEN);
|
|
123
|
-
const o = this.
|
|
124
|
-
this.
|
|
123
|
+
const o = this.hg;
|
|
124
|
+
this.hg = [];
|
|
125
125
|
for (let t = 0; t < o.length; t++) this.je.apply(this, o[t]);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
mg(t, i, s, e, h) {
|
|
129
129
|
const o = e => {
|
|
130
|
-
this.
|
|
130
|
+
this.cg();
|
|
131
131
|
const h = new Date().valueOf();
|
|
132
|
-
if (!t.
|
|
133
|
-
return !1 === navigator.onLine && t.type === mt._r
|
|
132
|
+
if (!t.Zu(i))
|
|
133
|
+
return !1 === navigator.onLine && t.type === mt.Gr._r && e.imageUrl
|
|
134
134
|
? (r.j.info(
|
|
135
135
|
`Not showing ${t.type} trigger action ${t.id} due to offline state.`
|
|
136
136
|
),
|
|
137
|
-
void this.
|
|
138
|
-
: void (t.
|
|
139
|
-
? 0 === this.ig.
|
|
137
|
+
void this.eg.Ye(t.id, InAppMessage.Me.Dh))
|
|
138
|
+
: void (t.Ku(h) && this.wg(t, h, s)
|
|
139
|
+
? 0 === this.ig.tc()
|
|
140
140
|
? r.j.info(
|
|
141
141
|
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`
|
|
142
142
|
)
|
|
143
|
-
: (this.ig.Et([e]), this
|
|
143
|
+
: (this.ig.Et([e]), this.$g(t, h))
|
|
144
144
|
: r.j.info(
|
|
145
145
|
`Not displaying trigger ${t.id} because display time fell outside of the acceptable time window.`
|
|
146
146
|
));
|
|
147
|
-
t.type === mt.
|
|
148
|
-
? this.
|
|
149
|
-
: this.
|
|
147
|
+
t.type === mt.Gr.td
|
|
148
|
+
? this.eg.Ye(t.id, InAppMessage.Me.Zi)
|
|
149
|
+
: this.eg.Ye(t.id, InAppMessage.Me.Mh);
|
|
150
150
|
},
|
|
151
151
|
n = () => {
|
|
152
|
-
this.
|
|
152
|
+
this.cg();
|
|
153
153
|
const o = h.pop();
|
|
154
154
|
if (null != o)
|
|
155
|
-
if ((this
|
|
155
|
+
if ((this.jg(o, i, s, e, h), o.Zu(i))) {
|
|
156
156
|
let t = `Server aborted in-app message display, but the timeout on fallback trigger ${o.id} has already elapsed.`;
|
|
157
157
|
h.length > 0 && (t += " Continuing to fall back."),
|
|
158
158
|
r.j.info(t),
|
|
159
|
-
this.
|
|
159
|
+
this.eg.Ye(o.id, InAppMessage.Me.Mh),
|
|
160
160
|
n();
|
|
161
161
|
} else {
|
|
162
162
|
r.j.info(
|
|
163
163
|
`Server aborted in-app message display. Falling back to lower priority ${o.type} trigger action ${t.id}.`
|
|
164
164
|
);
|
|
165
|
-
const n = 1e3 * o.
|
|
165
|
+
const n = 1e3 * o.vu - (new Date().valueOf() - i);
|
|
166
166
|
n > 0
|
|
167
|
-
? this.
|
|
167
|
+
? this.og.push(
|
|
168
168
|
setTimeout(() => {
|
|
169
|
-
this.
|
|
169
|
+
this.mg(o, i, s, e, h);
|
|
170
170
|
}, n)
|
|
171
171
|
)
|
|
172
|
-
: this.
|
|
172
|
+
: this.mg(o, i, s, e, h);
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
175
|
let l, a, g;
|
|
176
176
|
switch (t.type) {
|
|
177
|
-
case mt._r
|
|
177
|
+
case mt.Gr._r:
|
|
178
178
|
if (((l = pt(t.data)), null == l)) {
|
|
179
179
|
r.j.error(
|
|
180
180
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`
|
|
181
181
|
),
|
|
182
|
-
this.
|
|
182
|
+
this.eg.Ye(t.id, InAppMessage.Me.Or);
|
|
183
183
|
break;
|
|
184
184
|
}
|
|
185
|
-
if (((a = this.
|
|
185
|
+
if (((a = this.eg.Ji(l)), a)) {
|
|
186
186
|
r.j.error(a), n();
|
|
187
187
|
break;
|
|
188
188
|
}
|
|
189
189
|
o(l);
|
|
190
190
|
break;
|
|
191
|
-
case mt.
|
|
192
|
-
if (((g = wt.fromJson(t.data, o, n, i, t.
|
|
191
|
+
case mt.Gr.td:
|
|
192
|
+
if (((g = wt.fromJson(t.data, o, n, i, t.Kr)), null == g)) {
|
|
193
193
|
r.j.error(
|
|
194
194
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`
|
|
195
195
|
),
|
|
196
|
-
this.
|
|
196
|
+
this.eg.Ye(t.id, InAppMessage.Me.Or);
|
|
197
197
|
break;
|
|
198
198
|
}
|
|
199
|
-
this.
|
|
199
|
+
this.eg.Vi(g, s, e);
|
|
200
200
|
break;
|
|
201
201
|
default:
|
|
202
202
|
r.j.error(
|
|
203
203
|
`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`
|
|
204
204
|
),
|
|
205
|
-
this.
|
|
205
|
+
this.eg.Ye(t.id, InAppMessage.Me.Or);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
je(t, i, s) {
|
|
209
209
|
if (!H(tt, t, "Cannot fire trigger action.", "TriggerEvents")) return;
|
|
210
|
-
if (this.
|
|
210
|
+
if (this.sg.Vh())
|
|
211
211
|
return (
|
|
212
212
|
r.j.info(
|
|
213
213
|
"Trigger sync is currently in progress, awaiting sync completion before firing trigger event."
|
|
214
214
|
),
|
|
215
|
-
void this.
|
|
215
|
+
void this.hg.push(arguments)
|
|
216
216
|
);
|
|
217
|
-
this.
|
|
217
|
+
this.vg();
|
|
218
218
|
const e = new Date().valueOf(),
|
|
219
|
-
h = e - this.
|
|
219
|
+
h = e - this.ng;
|
|
220
220
|
let o = !0,
|
|
221
221
|
n = !0;
|
|
222
222
|
const l = [];
|
|
223
|
-
for (let s = 0; s < this.
|
|
224
|
-
const r = this.
|
|
225
|
-
h = e + 1e3 * r.
|
|
223
|
+
for (let s = 0; s < this.ug.length; s++) {
|
|
224
|
+
const r = this.ug[s],
|
|
225
|
+
h = e + 1e3 * r.vu;
|
|
226
226
|
if (
|
|
227
|
-
r.
|
|
227
|
+
r.Ku(h) &&
|
|
228
228
|
(null == r.startTime || r.startTime <= e) &&
|
|
229
229
|
(null == r.endTime || r.endTime >= e)
|
|
230
230
|
) {
|
|
231
231
|
let s = !1;
|
|
232
|
-
for (let e = 0; e < r.
|
|
233
|
-
if (r.
|
|
232
|
+
for (let e = 0; e < r.Pu.length; e++)
|
|
233
|
+
if (r.Pu[e].ec(t, i)) {
|
|
234
234
|
s = !0;
|
|
235
235
|
break;
|
|
236
236
|
}
|
|
237
|
-
s && ((o = !1), this.
|
|
237
|
+
s && ((o = !1), this.wg(r, h, t) && ((n = !1), l.push(r)));
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
if (o)
|
|
@@ -252,32 +252,32 @@ export default class gr extends y {
|
|
|
252
252
|
(r.j.info(
|
|
253
253
|
`Firing ${a.type} trigger action ${a.id} from trigger event ${t}.`
|
|
254
254
|
),
|
|
255
|
-
this
|
|
256
|
-
0 === a.
|
|
257
|
-
? this.
|
|
258
|
-
: this.
|
|
255
|
+
this.jg(a, e, t, s, l),
|
|
256
|
+
0 === a.vu
|
|
257
|
+
? this.mg(a, e, t, s, l)
|
|
258
|
+
: this.og.push(
|
|
259
259
|
setTimeout(() => {
|
|
260
|
-
this.
|
|
261
|
-
}, 1e3 * a.
|
|
260
|
+
this.mg(a, e, t, s, l);
|
|
261
|
+
}, 1e3 * a.vu)
|
|
262
262
|
));
|
|
263
263
|
}
|
|
264
264
|
changeUser(t) {
|
|
265
|
-
if (((this.
|
|
266
|
-
(this.
|
|
267
|
-
for (let t = 0; t < this.
|
|
268
|
-
(this.
|
|
269
|
-
this.
|
|
270
|
-
this.
|
|
271
|
-
this.
|
|
265
|
+
if (((this.ug = []), this.yh.ri(i.k.Na), !t)) {
|
|
266
|
+
(this.hg = []), (this.ng = null), (this.ag = {}), (this.lg = {});
|
|
267
|
+
for (let t = 0; t < this.og.length; t++) clearTimeout(this.og[t]);
|
|
268
|
+
(this.og = []),
|
|
269
|
+
this.yh.ri(i.k.Ma),
|
|
270
|
+
this.yh.ri(i.k.Ga),
|
|
271
|
+
this.yh.ri(i.k.ya);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
clearData() {
|
|
275
|
-
(this.
|
|
276
|
-
for (let t = 0; t < this.
|
|
277
|
-
this.
|
|
275
|
+
(this.ug = []), (this.ng = null), (this.ag = {}), (this.lg = {});
|
|
276
|
+
for (let t = 0; t < this.og.length; t++) clearTimeout(this.og[t]);
|
|
277
|
+
this.og = [];
|
|
278
278
|
}
|
|
279
|
-
|
|
280
|
-
if (null == this.
|
|
279
|
+
wg(t, i, s) {
|
|
280
|
+
if (null == this.ng) return !0;
|
|
281
281
|
if (s === tt.ks)
|
|
282
282
|
return (
|
|
283
283
|
r.j.info(
|
|
@@ -285,24 +285,24 @@ export default class gr extends y {
|
|
|
285
285
|
),
|
|
286
286
|
!0
|
|
287
287
|
);
|
|
288
|
-
let e = t.
|
|
289
|
-
return null == e && (e = this.tg), i - this.
|
|
288
|
+
let e = t.Fu;
|
|
289
|
+
return null == e && (e = this.tg), i - this.ng >= 1e3 * e;
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
this.
|
|
291
|
+
jg(t, s, e, r, h) {
|
|
292
|
+
this.cg(), (this.lg[t.id] = this.lg[t.id] || []);
|
|
293
293
|
const o = {};
|
|
294
294
|
let n;
|
|
295
|
-
(o.
|
|
295
|
+
(o.Jr = s), (o.pg = e), null != r && (n = r.ss()), (o.bg = n);
|
|
296
296
|
const l = [];
|
|
297
297
|
for (let t = 0; t < h.length; t++) l.push(h[t].id);
|
|
298
|
-
(o.
|
|
298
|
+
(o.Tg = l), this.lg[t.id].push(o), this.yh.D(i.k.ya, this.lg);
|
|
299
299
|
}
|
|
300
|
-
|
|
301
|
-
this.
|
|
302
|
-
t.
|
|
303
|
-
(this.
|
|
304
|
-
this.
|
|
305
|
-
(this.
|
|
306
|
-
this.
|
|
300
|
+
$g(t, s) {
|
|
301
|
+
this.cg(),
|
|
302
|
+
t.Wu(s),
|
|
303
|
+
(this.ng = s),
|
|
304
|
+
this.yh.D(i.k.Ma, s),
|
|
305
|
+
(this.ag[t.id] = s),
|
|
306
|
+
this.yh.D(i.k.Ga, this.ag);
|
|
307
307
|
}
|
|
308
308
|
}
|
package/src/ui/js/attach-css.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e, { OPTIONS as L } from "../../managers/braze-instance.js";
|
|
2
2
|
export function attachCSS(n, t, o) {
|
|
3
3
|
const c = n || document.querySelector("head"),
|
|
4
|
-
s = `ab-${t}-css-definitions-${"4.8.
|
|
4
|
+
s = `ab-${t}-css-definitions-${"4.8.1".replace(/\./g, "-")}`,
|
|
5
5
|
a = c.ownerDocument || document;
|
|
6
6
|
if (null == a.getElementById(s)) {
|
|
7
7
|
const n = a.createElement("style");
|
|
@@ -24,14 +24,14 @@ export const BRAZE_ACTIONS = {
|
|
|
24
24
|
properties: { type: "type", ce: "steps", me: "args" }
|
|
25
25
|
};
|
|
26
26
|
export const INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES = {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
Ki: "unknownBrazeAction",
|
|
28
|
+
Qi: "noPushPrompt"
|
|
29
29
|
};
|
|
30
30
|
export const ineligibleBrazeActionURLErrorMessage = (t, o) => {
|
|
31
31
|
switch (t) {
|
|
32
|
-
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.
|
|
32
|
+
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Ki:
|
|
33
33
|
return `${o} contains an unknown braze action type and will not be displayed.`;
|
|
34
|
-
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.
|
|
34
|
+
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Qi:
|
|
35
35
|
return `${o} contains a push prompt braze action, but is not eligible for a push prompt. Ignoring.`;
|
|
36
36
|
default:
|
|
37
37
|
return "";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import ni from "./client-hints-parser.js";
|
|
2
|
-
import
|
|
3
|
-
import { Browsers as
|
|
4
|
-
class
|
|
2
|
+
import ai from "./user-agent-parser.js";
|
|
3
|
+
import { Browsers as gi, OperatingSystems as W } from "./device-constants.js";
|
|
4
|
+
class oi {
|
|
5
5
|
constructor() {
|
|
6
|
-
const t = navigator.userAgentData ? ni :
|
|
6
|
+
const t = navigator.userAgentData ? ni : ai;
|
|
7
7
|
(this.Sg = new t()),
|
|
8
8
|
(this.userAgent = navigator.userAgent),
|
|
9
9
|
(this.browser = this.Sg.tf()),
|
|
10
10
|
(this.version = this.Sg.ef()),
|
|
11
|
-
this.
|
|
11
|
+
this.Zo().then(t => (this.OS = t)),
|
|
12
12
|
(this.language = (
|
|
13
13
|
navigator.userLanguage ||
|
|
14
14
|
navigator.language ||
|
|
@@ -16,21 +16,21 @@ class gi {
|
|
|
16
16
|
navigator.systemLanguage ||
|
|
17
17
|
""
|
|
18
18
|
).toLowerCase()),
|
|
19
|
-
(this
|
|
19
|
+
(this.Ho = oi.Bg(this.userAgent));
|
|
20
20
|
}
|
|
21
21
|
Og() {
|
|
22
|
-
return this.browser !==
|
|
22
|
+
return this.browser !== gi.Pg || this.version > 8;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
return this.browser ===
|
|
24
|
+
$a() {
|
|
25
|
+
return this.browser === gi.kg;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
ca() {
|
|
28
28
|
return this.OS || null;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
Zo() {
|
|
31
31
|
return this.OS
|
|
32
32
|
? Promise.resolve(this.OS)
|
|
33
|
-
: this.Sg.
|
|
33
|
+
: this.Sg.Zo(oi.xg).then(t => ((this.OS = t), t));
|
|
34
34
|
}
|
|
35
35
|
static Bg(t) {
|
|
36
36
|
t = t.toLowerCase();
|
|
@@ -56,9 +56,9 @@ class gi {
|
|
|
56
56
|
return !1;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
oi.xg = [
|
|
60
60
|
{ string: navigator.platform, if: "Win", identity: W.Dg },
|
|
61
|
-
{ string: navigator.platform, if: "Mac", identity: W.
|
|
61
|
+
{ string: navigator.platform, if: "Mac", identity: W.Fg },
|
|
62
62
|
{ string: navigator.platform, if: "BlackBerry", identity: "BlackBerry" },
|
|
63
63
|
{ string: navigator.platform, if: "FreeBSD", identity: "FreeBSD" },
|
|
64
64
|
{ string: navigator.platform, if: "OpenBSD", identity: "OpenBSD" },
|
|
@@ -76,10 +76,10 @@ gi.xg = [
|
|
|
76
76
|
{
|
|
77
77
|
string: navigator.platform,
|
|
78
78
|
if: ["Linux armv7l", "Android"],
|
|
79
|
-
identity: W.
|
|
79
|
+
identity: W.Lg
|
|
80
80
|
},
|
|
81
|
-
{ string: navigator.userAgent, if: ["Android"], identity: W.
|
|
81
|
+
{ string: navigator.userAgent, if: ["Android"], identity: W.Lg },
|
|
82
82
|
{ string: navigator.platform, if: "Linux", identity: "Linux" }
|
|
83
83
|
];
|
|
84
|
-
const V = new
|
|
85
|
-
export { V as default,
|
|
84
|
+
const V = new oi();
|
|
85
|
+
export { V as default, oi as BrowserDetector };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Browsers as
|
|
3
|
-
export default class ni extends
|
|
1
|
+
import ge from "./base-device-parser.js";
|
|
2
|
+
import { Browsers as gi } from "./device-constants.js";
|
|
3
|
+
export default class ni extends ge {
|
|
4
4
|
constructor() {
|
|
5
5
|
if (
|
|
6
6
|
(super(),
|
|
@@ -18,7 +18,7 @@ export default class ni extends Oe {
|
|
|
18
18
|
ef() {
|
|
19
19
|
return this.version;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
Zo(t) {
|
|
22
22
|
if (this.OS) return Promise.resolve(this.OS);
|
|
23
23
|
const r = r => {
|
|
24
24
|
for (let s = 0; s < t.length; s++) {
|
|
@@ -38,7 +38,7 @@ export default class ni extends Oe {
|
|
|
38
38
|
r = this.userAgentData.brands;
|
|
39
39
|
if (r && r.length)
|
|
40
40
|
for (const s of r) {
|
|
41
|
-
const r = this.oc(
|
|
41
|
+
const r = this.oc(gi),
|
|
42
42
|
e = s.brand.match(r);
|
|
43
43
|
if (e && e.length > 0) {
|
|
44
44
|
(t.browser = e[0]), (t.version = s.version);
|
|
@@ -49,7 +49,7 @@ export default class ni extends Oe {
|
|
|
49
49
|
}
|
|
50
50
|
oc(t) {
|
|
51
51
|
const r = [];
|
|
52
|
-
for (const s in t) t[s] !==
|
|
52
|
+
for (const s in t) t[s] !== gi.Pg && r.push(t[s]);
|
|
53
53
|
return new RegExp("(" + r.join("|") + ")", "i");
|
|
54
54
|
}
|
|
55
55
|
nc() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export const Browsers = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
rE: "Chrome",
|
|
3
|
+
eE: "Edge",
|
|
4
4
|
Pg: "Internet Explorer",
|
|
5
|
-
|
|
5
|
+
EE: "Opera",
|
|
6
6
|
kg: "Safari",
|
|
7
|
-
|
|
7
|
+
oE: "Firefox"
|
|
8
8
|
};
|
|
9
9
|
export const OperatingSystems = {
|
|
10
|
-
|
|
10
|
+
Lg: "Android",
|
|
11
11
|
fe: "iOS",
|
|
12
|
-
|
|
12
|
+
Fg: "Mac",
|
|
13
13
|
Dg: "Windows"
|
|
14
14
|
};
|
package/src/util/dom-utils.js
CHANGED
|
@@ -16,22 +16,22 @@ export function _isInView(t, n, e, s) {
|
|
|
16
16
|
!s)
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
export const DOMUtils = {
|
|
19
|
+
export const DOMUtils = { lc: null, eo: _isInView };
|
|
20
20
|
export const DIRECTIONS = { Je: "up", Ke: "down", W: "left", X: "right" };
|
|
21
21
|
export function supportsPassive() {
|
|
22
|
-
if (null == DOMUtils.
|
|
23
|
-
DOMUtils.
|
|
22
|
+
if (null == DOMUtils.lc) {
|
|
23
|
+
DOMUtils.lc = !1;
|
|
24
24
|
try {
|
|
25
25
|
const t = Object.defineProperty({}, "passive", {
|
|
26
26
|
get: () => {
|
|
27
|
-
DOMUtils.
|
|
27
|
+
DOMUtils.lc = !0;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
window.addEventListener("testPassive", null, t),
|
|
31
31
|
window.removeEventListener("testPassive", null, t);
|
|
32
32
|
} catch (t) {}
|
|
33
33
|
}
|
|
34
|
-
return DOMUtils.
|
|
34
|
+
return DOMUtils.lc;
|
|
35
35
|
}
|
|
36
36
|
export function addPassiveEventListener(t, n, e = () => {}) {
|
|
37
37
|
t.addEventListener(n, e, !!supportsPassive() && { passive: !0 });
|
package/src/util/net.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
2
2
|
const T = {
|
|
3
|
-
Qs: {
|
|
4
|
-
|
|
5
|
-
if (e) return e.v(i.k.
|
|
3
|
+
Qs: { Sa: "d", Os: "cc", xi: "ff", Yi: "t" },
|
|
4
|
+
eT: e => {
|
|
5
|
+
if (e) return e.v(i.k.Ua);
|
|
6
6
|
},
|
|
7
|
-
|
|
8
|
-
e && e.D(i.k.
|
|
7
|
+
tT: (e, t) => {
|
|
8
|
+
e && e.D(i.k.Ua, t);
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
Xa: (e, t) => {
|
|
11
11
|
if (!e || !t) return -1;
|
|
12
|
-
const r = T.
|
|
12
|
+
const r = T.eT(e);
|
|
13
13
|
if (null == r) return -1;
|
|
14
14
|
const s = r[t];
|
|
15
15
|
return null == s || isNaN(s) ? -1 : s;
|
|
16
16
|
},
|
|
17
17
|
Xs: (e, t, r) => {
|
|
18
18
|
if (!e || !t) return;
|
|
19
|
-
let s = T.
|
|
20
|
-
null == s && (s = {}), (s[t] = r), T.
|
|
19
|
+
let s = T.eT(e);
|
|
20
|
+
null == s && (s = {}), (s[t] = r), T.tT(e, s);
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
export default T;
|