@braze/web-sdk 6.7.0 → 6.8.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 +74 -27
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +2 -2
- package/shared-lib/event-types.js +13 -13
- package/shared-lib/indexed-db-adapter.js +3 -3
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +8 -8
- package/src/Banner/log-banner-impressions.js +20 -11
- package/src/ContentCards/content-cards-provider-factory.js +13 -11
- package/src/ContentCards/content-cards-provider.js +4 -4
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/change-user.js +2 -2
- package/src/Core/index.js +1 -0
- package/src/Core/log-ecommerce-event.js +29 -0
- package/src/Core/log-purchase.js +17 -192
- package/src/Core/open-session.js +6 -6
- package/src/Core/set-sdk-authentication-signature.js +1 -1
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/DUST/dust-connection-core.js +1 -0
- package/src/DUST/dust-provider-factory.js +10 -10
- package/src/DUST/dust-provider.js +181 -158
- package/src/DUST/dust-shared-worker-code.js +1 -1
- package/src/DUST/dust-shared-worker-impl.js +93 -100
- package/src/DUST/dust-worker-bridge.js +27 -27
- package/src/DUST/subscribe-to-dust.js +7 -7
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
- package/src/InAppMessage/display/modal-utils.js +2 -2
- package/src/InAppMessage/in-app-message-manager.js +64 -64
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +7 -7
- package/src/InAppMessage/models/html-message.js +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +22 -22
- package/src/InAppMessage/models/modal-message.js +5 -5
- package/src/InAppMessage/models/slide-up-message.js +6 -6
- 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 +20 -20
- package/src/Push/push-manager-factory.js +2 -2
- package/src/Push/push-manager.js +8 -8
- package/src/Push/utils/push-utils.js +6 -6
- package/src/User/user-manager.js +5 -5
- package/src/User/user.js +8 -8
- package/src/common/constants.js +1 -0
- package/src/common/content-cards-display.js +2 -2
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/braze-instance.js +21 -21
- package/src/managers/device-manager.js +6 -6
- package/src/managers/network-manager.js +93 -92
- package/src/managers/server-config-manager.js +68 -68
- package/src/managers/session-manager.js +2 -2
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +120 -120
- package/src/managers/subscription-manager.js +1 -1
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +3 -3
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +5 -5
- package/src/models/server-config.js +27 -27
- package/src/request-controller.js +99 -99
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +1 -1
- package/src/triggers/models/in-app-message-click-data.js +5 -5
- 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 +5 -5
- package/src/triggers/models/trigger-condition.js +42 -42
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +10 -10
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +30 -30
- package/src/types.js +5 -1
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +13 -13
- package/src/util/client-hints-parser.js +2 -2
- package/src/util/dom-utils.js +2 -2
- package/src/util/ecommerce-event-validation.js +326 -0
- package/src/util/iso-4217-currency-codes.js +176 -0
- package/src/util/net.js +3 -3
- package/src/util/request-header-utils.js +18 -18
- package/src/util/user-agent-parser.js +14 -14
- package/src/util/validation-utils.js +2 -2
- package/src/util/window-utils.js +2 -2
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import es from "./custom-event-data.js";
|
|
2
2
|
import ns from "./custom-event-property-data.js";
|
|
3
3
|
import ls from "./filter-set.js";
|
|
4
|
-
import
|
|
4
|
+
import bi from "./in-app-message-click-data.js";
|
|
5
5
|
import os from "./purchase-data.js";
|
|
6
6
|
import fs from "./purchase-property-data.js";
|
|
7
|
-
import
|
|
7
|
+
import jr from "./push-click-data.js";
|
|
8
8
|
import ot from "./trigger-events.js";
|
|
9
9
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
10
|
-
import { getErrorMessage as
|
|
11
|
-
export default class
|
|
10
|
+
import { getErrorMessage as hi } from "../../util/error-utils.js";
|
|
11
|
+
export default class pi {
|
|
12
12
|
constructor(e, t) {
|
|
13
13
|
(this.type = e), (this.data = t), (this.type = e), (this.data = t);
|
|
14
14
|
}
|
|
15
15
|
Vc(e, t) {
|
|
16
|
-
return
|
|
16
|
+
return pi.Yc[this.type] === e && (null == this.data || this.data.Qc(t));
|
|
17
17
|
}
|
|
18
18
|
static sf(e, t) {
|
|
19
19
|
let r = null;
|
|
20
20
|
try {
|
|
21
21
|
r = window.atob(e);
|
|
22
22
|
} catch (t) {
|
|
23
|
-
return E.info("Failed to unencode analytics id " + e + ": " +
|
|
23
|
+
return E.info("Failed to unencode analytics id " + e + ": " + hi(t)), !1;
|
|
24
24
|
}
|
|
25
25
|
return t === r.split("_")[0];
|
|
26
26
|
}
|
|
@@ -28,28 +28,28 @@ export default class gi {
|
|
|
28
28
|
const t = e.type;
|
|
29
29
|
let r = null;
|
|
30
30
|
switch (t) {
|
|
31
|
-
case
|
|
32
|
-
case
|
|
31
|
+
case pi.ma.OPEN:
|
|
32
|
+
case pi.ma.Ls:
|
|
33
33
|
break;
|
|
34
|
-
case
|
|
34
|
+
case pi.ma.qr:
|
|
35
35
|
r = os.fromJson(e.data);
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
37
|
+
case pi.ma.Zc:
|
|
38
38
|
r = fs.fromJson(e.data);
|
|
39
39
|
break;
|
|
40
|
-
case
|
|
41
|
-
r =
|
|
40
|
+
case pi.ma.Sr:
|
|
41
|
+
r = jr.fromJson(e.data);
|
|
42
42
|
break;
|
|
43
|
-
case
|
|
43
|
+
case pi.ma.he:
|
|
44
44
|
r = es.fromJson(e.data);
|
|
45
45
|
break;
|
|
46
|
-
case
|
|
46
|
+
case pi.ma.km:
|
|
47
47
|
r = ns.fromJson(e.data);
|
|
48
48
|
break;
|
|
49
|
-
case
|
|
50
|
-
r =
|
|
49
|
+
case pi.ma.rm:
|
|
50
|
+
r = bi.fromJson(e.data);
|
|
51
51
|
}
|
|
52
|
-
return new
|
|
52
|
+
return new pi(t, r);
|
|
53
53
|
}
|
|
54
54
|
qt() {
|
|
55
55
|
return { t: this.type, d: this.data ? this.data.qt() : null };
|
|
@@ -58,46 +58,46 @@ export default class gi {
|
|
|
58
58
|
let t,
|
|
59
59
|
r = null;
|
|
60
60
|
switch (e.t) {
|
|
61
|
-
case
|
|
62
|
-
case
|
|
61
|
+
case pi.ma.OPEN:
|
|
62
|
+
case pi.ma.Ls:
|
|
63
63
|
break;
|
|
64
|
-
case
|
|
64
|
+
case pi.ma.qr:
|
|
65
65
|
r = new os(e.d);
|
|
66
66
|
break;
|
|
67
|
-
case
|
|
67
|
+
case pi.ma.Zc:
|
|
68
68
|
(t = e.d || {}), (r = new fs(t.id, ls._u(t.pf || [])));
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
71
|
-
r = new
|
|
70
|
+
case pi.ma.Sr:
|
|
71
|
+
r = new jr(e.d);
|
|
72
72
|
break;
|
|
73
|
-
case
|
|
73
|
+
case pi.ma.he:
|
|
74
74
|
r = new es(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
76
|
+
case pi.ma.km:
|
|
77
77
|
(t = e.d || {}), (r = new ns(t.e, ls._u(t.pf || [])));
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
80
|
-
r = new
|
|
79
|
+
case pi.ma.rm:
|
|
80
|
+
r = new bi(e.d);
|
|
81
81
|
}
|
|
82
|
-
return new
|
|
82
|
+
return new pi(e.t, r);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
(
|
|
85
|
+
(pi.ma = {
|
|
86
86
|
OPEN: "open",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
qr: "purchase",
|
|
88
|
+
Zc: "purchase_property",
|
|
89
|
+
Sr: "push_click",
|
|
90
90
|
he: "custom_event",
|
|
91
|
-
|
|
91
|
+
km: "custom_event_property",
|
|
92
92
|
rm: "iam_click",
|
|
93
93
|
Ls: "test",
|
|
94
94
|
}),
|
|
95
|
-
(
|
|
96
|
-
(
|
|
97
|
-
(
|
|
98
|
-
(
|
|
99
|
-
(
|
|
100
|
-
(
|
|
101
|
-
(
|
|
102
|
-
(
|
|
103
|
-
(
|
|
95
|
+
(pi.Yc = {}),
|
|
96
|
+
(pi.Yc[pi.ma.OPEN] = ot.OPEN),
|
|
97
|
+
(pi.Yc[pi.ma.qr] = ot.qr),
|
|
98
|
+
(pi.Yc[pi.ma.Zc] = ot.qr),
|
|
99
|
+
(pi.Yc[pi.ma.Sr] = ot.Sr),
|
|
100
|
+
(pi.Yc[pi.ma.he] = ot.he),
|
|
101
|
+
(pi.Yc[pi.ma.km] = ot.he),
|
|
102
|
+
(pi.Yc[pi.ma.rm] = ot.rm),
|
|
103
|
+
(pi.Yc[pi.ma.Ls] = ot.Ls);
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
rehydrateDateAfterJsonization as ee,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
5
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
6
|
-
import
|
|
6
|
+
import pi from "./trigger-condition.js";
|
|
7
7
|
import { validateValueIsFromEnum as ta } from "../../util/code-utils.js";
|
|
8
8
|
export default class gt {
|
|
9
9
|
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = gt.sd, a, u, d) {
|
|
@@ -16,7 +16,7 @@ export default class gt {
|
|
|
16
16
|
(this.data = l),
|
|
17
17
|
(this.hd = o),
|
|
18
18
|
(this.nd = n),
|
|
19
|
-
(this.
|
|
19
|
+
(this.ha = a),
|
|
20
20
|
(this.ad = u),
|
|
21
21
|
(this.ud = d),
|
|
22
22
|
(this.id = t),
|
|
@@ -29,7 +29,7 @@ export default class gt {
|
|
|
29
29
|
(this.type = h),
|
|
30
30
|
(this.hd = o || 0),
|
|
31
31
|
null == a && (a = 1e3 * (this.hd + 30)),
|
|
32
|
-
(this.
|
|
32
|
+
(this.ha = a),
|
|
33
33
|
(this.data = l),
|
|
34
34
|
null != n && (this.nd = n),
|
|
35
35
|
(this.ad = u),
|
|
@@ -49,11 +49,11 @@ export default class gt {
|
|
|
49
49
|
}
|
|
50
50
|
fd(t) {
|
|
51
51
|
const i = new Date().valueOf() - t,
|
|
52
|
-
s = null == t || isNaN(i) || null == this.
|
|
52
|
+
s = null == t || isNaN(i) || null == this.ha || i < this.ha;
|
|
53
53
|
return (
|
|
54
54
|
s ||
|
|
55
55
|
E.info(
|
|
56
|
-
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.
|
|
56
|
+
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.ha}ms.`,
|
|
57
57
|
),
|
|
58
58
|
!s
|
|
59
59
|
);
|
|
@@ -62,7 +62,7 @@ export default class gt {
|
|
|
62
62
|
const i = t.id,
|
|
63
63
|
s = [];
|
|
64
64
|
for (let i = 0; i < t.trigger_condition.length; i++)
|
|
65
|
-
s.push(
|
|
65
|
+
s.push(pi.fromJson(t.trigger_condition[i]));
|
|
66
66
|
const e = Y(t.start_time),
|
|
67
67
|
r = Y(t.end_time),
|
|
68
68
|
h = t.priority,
|
|
@@ -73,7 +73,7 @@ export default class gt {
|
|
|
73
73
|
u = t.data,
|
|
74
74
|
d = t.min_seconds_since_last_trigger;
|
|
75
75
|
return ta(
|
|
76
|
-
gt.
|
|
76
|
+
gt.ma,
|
|
77
77
|
l,
|
|
78
78
|
"Could not construct Trigger from server data",
|
|
79
79
|
"Trigger.Types",
|
|
@@ -94,7 +94,7 @@ export default class gt {
|
|
|
94
94
|
da: this.data,
|
|
95
95
|
d: this.hd,
|
|
96
96
|
r: this.nd,
|
|
97
|
-
tm: this.
|
|
97
|
+
tm: this.ha,
|
|
98
98
|
ss: this.ad,
|
|
99
99
|
ld: this.ud,
|
|
100
100
|
};
|
|
@@ -102,7 +102,7 @@ export default class gt {
|
|
|
102
102
|
static _u(t) {
|
|
103
103
|
const i = [],
|
|
104
104
|
s = t.c || [];
|
|
105
|
-
for (let t = 0; t < s.length; t++) i.push(
|
|
105
|
+
for (let t = 0; t < s.length; t++) i.push(pi._u(s[t]));
|
|
106
106
|
return new gt(
|
|
107
107
|
t.i,
|
|
108
108
|
i,
|
|
@@ -119,4 +119,4 @@ export default class gt {
|
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
(gt.
|
|
122
|
+
(gt.ma = { ua: "inapp", pd: "templated_iam" }), (gt.sd = -1);
|
|
@@ -3,7 +3,7 @@ import { newInAppMessageFromJson as pt } from "../InAppMessage/in-app-message-fa
|
|
|
3
3
|
import Ie from "../models/braze-event.js";
|
|
4
4
|
import {
|
|
5
5
|
isArray as g,
|
|
6
|
-
isEqual as
|
|
6
|
+
isEqual as oi,
|
|
7
7
|
validateValueIsFromEnum as ta,
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
@@ -36,9 +36,9 @@ export default class vr extends t {
|
|
|
36
36
|
}
|
|
37
37
|
fg() {
|
|
38
38
|
if (this.C) {
|
|
39
|
-
(this.hg = this.C.Rt(s.Tt.
|
|
40
|
-
(this.ng = this.C.Rt(s.Tt.
|
|
41
|
-
(this.og = this.C.Rt(s.Tt.
|
|
39
|
+
(this.hg = this.C.Rt(s.Tt.nS) || this.hg),
|
|
40
|
+
(this.ng = this.C.Rt(s.Tt.aS) || this.ng),
|
|
41
|
+
(this.og = this.C.Rt(s.Tt.oS) || this.og);
|
|
42
42
|
for (let t = 0; t < this.triggers.length; t++) {
|
|
43
43
|
const i = this.triggers[t];
|
|
44
44
|
i.id && null != this.og[i.id] && i.md(this.og[i.id]);
|
|
@@ -47,8 +47,8 @@ export default class vr extends t {
|
|
|
47
47
|
}
|
|
48
48
|
ag() {
|
|
49
49
|
if (!this.C) return;
|
|
50
|
-
this.lg = this.C.Rt(s.Tt.
|
|
51
|
-
const t = this.C.Rt(s.Tt.
|
|
50
|
+
this.lg = this.C.Rt(s.Tt.rS) || 0;
|
|
51
|
+
const t = this.C.Rt(s.Tt.sS) || [],
|
|
52
52
|
i = [];
|
|
53
53
|
for (let s = 0; s < t.length; s++) i.push(gt._u(t[s]));
|
|
54
54
|
(this.triggers = i), this.fg();
|
|
@@ -70,19 +70,19 @@ export default class vr extends t {
|
|
|
70
70
|
h = [];
|
|
71
71
|
for (let r = 0; r < t.length; r++) {
|
|
72
72
|
const n = t[r],
|
|
73
|
-
o = s.gd(n.
|
|
73
|
+
o = s.gd(n.pa || 0);
|
|
74
74
|
if (o > 0) {
|
|
75
75
|
let t, r;
|
|
76
76
|
h.push(n),
|
|
77
77
|
null != n.ug && (t = n.ug),
|
|
78
|
-
null != n.dg && Ie.
|
|
78
|
+
null != n.dg && Ie.AS(n.dg) && (r = Ie._u(n.dg));
|
|
79
79
|
const l = [];
|
|
80
80
|
if (n.pg && g(n.pg))
|
|
81
81
|
for (let t = 0; t < n.pg.length; t++) {
|
|
82
82
|
const i = e[n.pg[t]];
|
|
83
83
|
null != i && l.push(i);
|
|
84
84
|
}
|
|
85
|
-
this.eg.push(window.setTimeout(i(s, n.
|
|
85
|
+
this.eg.push(window.setTimeout(i(s, n.pa || 0, t, r, l), o));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
this.ng[s.id].length > h.length &&
|
|
@@ -91,7 +91,7 @@ export default class vr extends t {
|
|
|
91
91
|
0 === this.ng[s.id].length && delete this.ng[s.id]);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
r && this.C && this.C.It(s.Tt.
|
|
94
|
+
r && this.C && this.C.It(s.Tt.aS, this.ng);
|
|
95
95
|
}
|
|
96
96
|
mg() {
|
|
97
97
|
if (!this.C) return;
|
|
@@ -99,17 +99,17 @@ export default class vr extends t {
|
|
|
99
99
|
for (let i = 0; i < this.triggers.length; i++)
|
|
100
100
|
t.push(this.triggers[i].qt());
|
|
101
101
|
(this.lg = new Date().valueOf()),
|
|
102
|
-
this.C.It(s.Tt.
|
|
103
|
-
this.C.It(s.Tt.
|
|
102
|
+
this.C.It(s.Tt.sS, t),
|
|
103
|
+
this.C.It(s.Tt.rS, this.lg);
|
|
104
104
|
}
|
|
105
105
|
bg() {
|
|
106
106
|
if (!this.C) return;
|
|
107
|
-
(this.C.Rt(s.Tt.
|
|
107
|
+
(this.C.Rt(s.Tt.rS) || 0) > this.lg ? this.ag() : this.fg();
|
|
108
108
|
}
|
|
109
109
|
I(t) {
|
|
110
110
|
let i = !1;
|
|
111
111
|
if (null != t && t.triggers) {
|
|
112
|
-
this.ig.
|
|
112
|
+
this.ig.da(), this.fg();
|
|
113
113
|
const e = {},
|
|
114
114
|
r = {};
|
|
115
115
|
this.triggers = [];
|
|
@@ -128,9 +128,9 @@ export default class vr extends t {
|
|
|
128
128
|
this.triggers.push(h);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
((this.ng = r), this.C && this.C.It(s.Tt.
|
|
131
|
+
oi(this.og, e) || ((this.og = e), this.C && this.C.It(s.Tt.oS, this.og)),
|
|
132
|
+
oi(this.ng, r) ||
|
|
133
|
+
((this.ng = r), this.C && this.C.It(s.Tt.aS, this.ng)),
|
|
134
134
|
this.mg(),
|
|
135
135
|
i &&
|
|
136
136
|
(E.info("Trigger with test condition found, firing test."),
|
|
@@ -148,12 +148,12 @@ export default class vr extends t {
|
|
|
148
148
|
this.fg();
|
|
149
149
|
const r = new Date().valueOf();
|
|
150
150
|
t.fd(i) ||
|
|
151
|
-
(!1 === navigator.onLine && t.type === gt.
|
|
151
|
+
(!1 === navigator.onLine && t.type === gt.ma.ua && e.imageUrl
|
|
152
152
|
? E.info(
|
|
153
153
|
`Not showing ${t.type} trigger action ${t.id} due to offline state.`,
|
|
154
154
|
)
|
|
155
155
|
: t.dd(r) && this.wg(t, r, s)
|
|
156
|
-
? 0 === this.Rs.
|
|
156
|
+
? 0 === this.Rs.Ke()
|
|
157
157
|
? E.info(
|
|
158
158
|
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
|
|
159
159
|
)
|
|
@@ -185,27 +185,27 @@ export default class vr extends t {
|
|
|
185
185
|
};
|
|
186
186
|
let o, l, a;
|
|
187
187
|
switch (t.type) {
|
|
188
|
-
case gt.
|
|
188
|
+
case gt.ma.ua:
|
|
189
189
|
if (((o = pt(t.data)), null == o)) {
|
|
190
190
|
E.error(
|
|
191
191
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
192
192
|
);
|
|
193
193
|
break;
|
|
194
194
|
}
|
|
195
|
-
if (((l = this.ig.
|
|
195
|
+
if (((l = this.ig.Vn(o)), l)) {
|
|
196
196
|
E.error(l), n();
|
|
197
197
|
break;
|
|
198
198
|
}
|
|
199
199
|
h(o);
|
|
200
200
|
break;
|
|
201
|
-
case gt.
|
|
202
|
-
if (((a = Jt.fromJson(t.data, h, n, i, t.
|
|
201
|
+
case gt.ma.pd:
|
|
202
|
+
if (((a = Jt.fromJson(t.data, h, n, i, t.ha || 0)), null == a)) {
|
|
203
203
|
E.error(
|
|
204
204
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
205
205
|
);
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
|
-
this.ig.
|
|
208
|
+
this.ig.Zo(a, s, e);
|
|
209
209
|
break;
|
|
210
210
|
default:
|
|
211
211
|
E.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
|
|
@@ -213,7 +213,7 @@ export default class vr extends t {
|
|
|
213
213
|
}
|
|
214
214
|
Ee(t, i = null, s) {
|
|
215
215
|
if (!ta(ot, t, "Cannot fire trigger action.", "TriggerEvents")) return;
|
|
216
|
-
if (this.Ru && this.Ru.
|
|
216
|
+
if (this.Ru && this.Ru.Pc())
|
|
217
217
|
return (
|
|
218
218
|
E.info(
|
|
219
219
|
"Trigger sync is currently in progress, awaiting sync completion before firing trigger event.",
|
|
@@ -269,11 +269,11 @@ export default class vr extends t {
|
|
|
269
269
|
));
|
|
270
270
|
}
|
|
271
271
|
changeUser(t = !1) {
|
|
272
|
-
if (((this.triggers = []), this.C && this.C.Qt(s.Tt.
|
|
272
|
+
if (((this.triggers = []), this.C && this.C.Qt(s.Tt.sS), !t)) {
|
|
273
273
|
(this.sg = []), (this.hg = null), (this.og = {}), (this.ng = {});
|
|
274
274
|
for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
|
|
275
275
|
(this.eg = []),
|
|
276
|
-
this.C && (this.C.Qt(s.Tt.
|
|
276
|
+
this.C && (this.C.Qt(s.Tt.nS), this.C.Qt(s.Tt.oS), this.C.Qt(s.Tt.aS));
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
clearData() {
|
|
@@ -297,18 +297,18 @@ export default class vr extends t {
|
|
|
297
297
|
this.fg(), t.id && (this.ng[t.id] = this.ng[t.id] || []);
|
|
298
298
|
const n = {};
|
|
299
299
|
let o;
|
|
300
|
-
(n.
|
|
300
|
+
(n.pa = i), (n.ug = e), null != r && (o = r.qt()), (n.dg = o);
|
|
301
301
|
const l = [];
|
|
302
302
|
for (const t of h) t.id && l.push(t.id);
|
|
303
303
|
(n.pg = l),
|
|
304
304
|
t.id && this.ng[t.id].push(n),
|
|
305
|
-
this.C && this.C.It(s.Tt.
|
|
305
|
+
this.C && this.C.It(s.Tt.aS, this.ng);
|
|
306
306
|
}
|
|
307
307
|
yg(t, i) {
|
|
308
308
|
this.fg(),
|
|
309
309
|
t.md(i),
|
|
310
310
|
(this.hg = i),
|
|
311
311
|
t.id && (this.og[t.id] = i),
|
|
312
|
-
this.C && (this.C.It(s.Tt.
|
|
312
|
+
this.C && (this.C.It(s.Tt.nS, i), this.C.It(s.Tt.oS, this.og));
|
|
313
313
|
}
|
|
314
314
|
}
|
package/src/types.js
CHANGED
package/src/ui/js/attach-css.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import r, { OPTIONS as U } from "../../managers/braze-instance.js";
|
|
2
2
|
export function attachCSS(n, t, o) {
|
|
3
3
|
const c = n || document.querySelector("head"),
|
|
4
|
-
e = `ab-${t}-css-definitions-${"6.
|
|
4
|
+
e = `ab-${t}-css-definitions-${"6.8.0".replace(/\./g, "-")}`;
|
|
5
5
|
if (!c) return;
|
|
6
6
|
const s = c.ownerDocument || document;
|
|
7
7
|
if (null == s.getElementById(e)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger as E } from "../../shared-lib/index.js";
|
|
2
|
-
import { getErrorMessage as
|
|
2
|
+
import { getErrorMessage as hi } from "./error-utils.js";
|
|
3
3
|
import { decodeBrazeActions as uo } from "./string-utils.js";
|
|
4
4
|
import {
|
|
5
5
|
BRAZE_ACTION_URI_REGEX as to,
|
|
@@ -25,11 +25,11 @@ export const BRAZE_ACTIONS = {
|
|
|
25
25
|
properties: { type: "type", eo: "steps", so: "args" },
|
|
26
26
|
};
|
|
27
27
|
export const INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES = {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Wn: "unknownBrazeAction",
|
|
29
|
+
cp: "noPushPrompt",
|
|
30
30
|
};
|
|
31
31
|
export const ineligibleBrazeActionURLErrorMessage = (t, o) =>
|
|
32
|
-
t === INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.
|
|
32
|
+
t === INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Wn
|
|
33
33
|
? `${o} contains an unknown braze action type and will not be displayed.`
|
|
34
34
|
: "";
|
|
35
35
|
export function getDecodedBrazeAction(t) {
|
|
@@ -46,7 +46,7 @@ export function getDecodedBrazeAction(t) {
|
|
|
46
46
|
? JSON.parse(e)
|
|
47
47
|
: void E.error(`Failed to decode base64 encoded brazeAction: ${n}`);
|
|
48
48
|
} catch (o) {
|
|
49
|
-
return void E.error(`Failed to process brazeAction URL ${t} : ${
|
|
49
|
+
return void E.error(`Failed to process brazeAction URL ${t} : ${hi(o)}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function po(t, o) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import Si from "./client-hints-parser.js";
|
|
2
|
-
import
|
|
3
|
-
import { Browsers as
|
|
4
|
-
class
|
|
2
|
+
import vi from "./user-agent-parser.js";
|
|
3
|
+
import { Browsers as yi, OperatingSystems as so } from "./device-constants.js";
|
|
4
|
+
class xi {
|
|
5
5
|
constructor() {
|
|
6
6
|
let t;
|
|
7
7
|
(t =
|
|
8
|
-
navigator.userAgent.toLowerCase().includes(
|
|
8
|
+
navigator.userAgent.toLowerCase().includes(yi.Sg.toLowerCase()) ||
|
|
9
9
|
!navigator.userAgentData
|
|
10
|
-
?
|
|
10
|
+
? vi
|
|
11
11
|
: Si),
|
|
12
12
|
(this.vg = new t()),
|
|
13
13
|
(this.userAgent = navigator.userAgent),
|
|
@@ -23,18 +23,18 @@ class yi {
|
|
|
23
23
|
i.systemLanguage ||
|
|
24
24
|
""
|
|
25
25
|
).toLowerCase()),
|
|
26
|
-
(this.il =
|
|
26
|
+
(this.il = xi.xg(this.userAgent));
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
return this.browser ===
|
|
28
|
+
bS() {
|
|
29
|
+
return this.browser === yi.Bg;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
Ha() {
|
|
32
32
|
return this.OS || null;
|
|
33
33
|
}
|
|
34
34
|
Fa() {
|
|
35
35
|
return this.OS
|
|
36
36
|
? Promise.resolve(this.OS)
|
|
37
|
-
: this.vg.Fa(
|
|
37
|
+
: this.vg.Fa(xi.Og).then((t) => ((this.OS = t), t));
|
|
38
38
|
}
|
|
39
39
|
static xg(t) {
|
|
40
40
|
t = t.toLowerCase();
|
|
@@ -63,7 +63,7 @@ class yi {
|
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
xi.Og = [
|
|
67
67
|
{ string: navigator.platform, cf: "Win", identity: so.kg },
|
|
68
68
|
{ string: navigator.platform, cf: "Mac", identity: so.Pg },
|
|
69
69
|
{ string: navigator.platform, cf: "BlackBerry", identity: "BlackBerry" },
|
|
@@ -91,5 +91,5 @@ yi.Og = [
|
|
|
91
91
|
{ string: navigator.userAgent, cf: ["Android"], identity: so.Dg },
|
|
92
92
|
{ string: navigator.platform, cf: "Linux", identity: "Linux" },
|
|
93
93
|
];
|
|
94
|
-
const ro = new
|
|
95
|
-
export { ro as default,
|
|
94
|
+
const ro = new xi();
|
|
95
|
+
export { ro as default, xi as BrowserDetector };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Ve from "./base-device-parser.js";
|
|
2
|
-
import { Browsers as
|
|
2
|
+
import { Browsers as yi } from "./device-constants.js";
|
|
3
3
|
export default class Si extends Ve {
|
|
4
4
|
constructor() {
|
|
5
5
|
if (
|
|
@@ -41,7 +41,7 @@ export default class Si extends Ve {
|
|
|
41
41
|
s = this.userAgentData.brands;
|
|
42
42
|
if (s && s.length)
|
|
43
43
|
for (const r of s) {
|
|
44
|
-
const s = this.uf(
|
|
44
|
+
const s = this.uf(yi),
|
|
45
45
|
i = r.brand.match(s);
|
|
46
46
|
if (i && i.length > 0) {
|
|
47
47
|
(t.browser = i[0]), (t.version = r.version);
|
package/src/util/dom-utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger as E } from "../../shared-lib/index.js";
|
|
2
|
-
import { getErrorMessage as
|
|
2
|
+
import { getErrorMessage as hi } from "./error-utils.js";
|
|
3
3
|
export function _isInView(t, n = !1, e = !1, s = !1) {
|
|
4
4
|
if (null == t) return !1;
|
|
5
5
|
(n = n || !1), (e = e || !1);
|
|
@@ -32,7 +32,7 @@ export function supportsPassive() {
|
|
|
32
32
|
window.addEventListener("testPassive", () => {}, t),
|
|
33
33
|
window.removeEventListener("testPassive", () => {}, t);
|
|
34
34
|
} catch (t) {
|
|
35
|
-
E.error(
|
|
35
|
+
E.error(hi(t));
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
return DOMUtils.lp;
|