@braze/web-sdk 6.11.0 → 6.12.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 +36 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +4 -4
- package/shared-lib/indexed-db-adapter.js +51 -51
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +9 -9
- package/src/DUST/dust-config-store.js +89 -0
- package/src/DUST/dust-connection-core.js +7 -21
- package/src/DUST/dust-message-dedup.js +33 -0
- package/src/DUST/dust-provider.js +367 -397
- package/src/DUST/dust-tab-identity.js +30 -0
- package/src/DUST/index.js +7 -9
- package/src/DUST/subscribe-to-dust.js +5 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +5 -5
- package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
- package/src/FeatureFlags/feature-flags-provider.js +74 -74
- 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 +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +42 -42
- package/src/InAppMessage/display/modal-utils.js +14 -14
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +73 -73
- 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 +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +9 -9
- package/src/InAppMessage/models/html-message.js +4 -4
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +52 -52
- package/src/InAppMessage/models/modal-message.js +7 -7
- package/src/InAppMessage/models/slide-up-message.js +11 -11
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/show-in-app-message.js +36 -36
- 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-factory.js +6 -6
- package/src/Push/push-manager.js +14 -14
- package/src/Push/unregister-push-token-on-server.js +3 -3
- package/src/Push/utils/push-utils.js +10 -10
- package/src/User/user.js +19 -19
- package/src/common/content-cards-display.js +21 -21
- package/src/common/event-logger.js +2 -2
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +5 -5
- package/src/managers/auth-manager.js +1 -1
- package/src/managers/braze-instance.js +41 -41
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +108 -108
- package/src/managers/server-config-manager.js +83 -83
- package/src/managers/session-manager.js +6 -6
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +127 -125
- 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 +7 -7
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +39 -39
- package/src/triggers/models/filter.js +58 -58
- package/src/triggers/models/in-app-message-click-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger.js +37 -37
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +50 -50
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +2 -2
- package/src/util/browser-detector.js +15 -15
- package/src/util/client-hints-parser.js +5 -5
- package/src/util/component-utils.js +4 -4
- package/src/util/dom-utils.js +5 -5
- package/src/util/ecommerce-event-validation.js +77 -48
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +20 -20
- package/src/util/string-utils.js +5 -0
- package/src/util/user-agent-parser.js +18 -18
- package/src/util/validation-utils.js +4 -4
- package/src/util/window-utils.js +2 -2
- package/src/DUST/dust-shared-worker-code.js +0 -2
- package/src/DUST/dust-shared-worker-impl.js +0 -234
- package/src/DUST/dust-worker-bridge.js +0 -151
|
@@ -3,57 +3,57 @@ import {
|
|
|
3
3
|
rehydrateDateAfterJsonization as ee,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
5
|
import { logger as b } from "../../../shared-lib/index.js";
|
|
6
|
-
import
|
|
6
|
+
import ji from "./trigger-condition.js";
|
|
7
7
|
import { validateValueIsFromEnum as ta } from "../../util/code-utils.js";
|
|
8
|
-
export default class
|
|
9
|
-
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n =
|
|
8
|
+
export default class vt {
|
|
9
|
+
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = vt.Td, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
|
-
(this.
|
|
11
|
+
(this.Dd = i),
|
|
12
12
|
(this.startTime = s),
|
|
13
13
|
(this.endTime = e),
|
|
14
14
|
(this.priority = r),
|
|
15
15
|
(this.type = h),
|
|
16
16
|
(this.data = l),
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
17
|
+
(this.Pd = o),
|
|
18
|
+
(this.yd = n),
|
|
19
|
+
(this.ia = a),
|
|
20
|
+
(this.jd = u),
|
|
21
|
+
(this.Nd = d),
|
|
22
22
|
(this.id = t),
|
|
23
|
-
(this.
|
|
23
|
+
(this.Dd = i || []),
|
|
24
24
|
void 0 === s && (s = null),
|
|
25
25
|
(this.startTime = s),
|
|
26
26
|
void 0 === e && (e = null),
|
|
27
27
|
(this.endTime = e),
|
|
28
28
|
(this.priority = r || 0),
|
|
29
29
|
(this.type = h),
|
|
30
|
-
(this.
|
|
31
|
-
null == a && (a = 1e3 * (this.
|
|
32
|
-
(this.
|
|
30
|
+
(this.Pd = o || 0),
|
|
31
|
+
null == a && (a = 1e3 * (this.Pd + 30)),
|
|
32
|
+
(this.ia = a),
|
|
33
33
|
(this.data = l),
|
|
34
|
-
null != n && (this.
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
34
|
+
null != n && (this.yd = n),
|
|
35
|
+
(this.jd = u),
|
|
36
|
+
(this.Nd = d || null);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
_d(t) {
|
|
39
39
|
return (
|
|
40
|
-
null == this.
|
|
40
|
+
null == this.Nd || (this.yd !== vt.Td && t - this.Nd >= 1e3 * this.yd)
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
this.
|
|
43
|
+
Ad(t) {
|
|
44
|
+
this.Nd = t;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
const i = t + 1e3 * this.
|
|
46
|
+
Id(t) {
|
|
47
|
+
const i = t + 1e3 * this.Pd;
|
|
48
48
|
return Math.max(i - new Date().valueOf(), 0);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
$d(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.ia || i < this.ia;
|
|
53
53
|
return (
|
|
54
54
|
s ||
|
|
55
55
|
b.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.ia}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(ji.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,17 +73,17 @@ export default class gt {
|
|
|
73
73
|
u = t.data,
|
|
74
74
|
d = t.min_seconds_since_last_trigger;
|
|
75
75
|
return ta(
|
|
76
|
-
|
|
76
|
+
vt.Yo,
|
|
77
77
|
l,
|
|
78
78
|
"Could not construct Trigger from server data",
|
|
79
79
|
"Trigger.Types",
|
|
80
80
|
)
|
|
81
|
-
? new
|
|
81
|
+
? new vt(i, s, e, r, h, l, u, o, n, a, d)
|
|
82
82
|
: null;
|
|
83
83
|
}
|
|
84
84
|
qt() {
|
|
85
85
|
const t = [];
|
|
86
|
-
for (let i = 0; i < this.
|
|
86
|
+
for (let i = 0; i < this.Dd.length; i++) t.push(this.Dd[i].qt());
|
|
87
87
|
return {
|
|
88
88
|
i: this.id,
|
|
89
89
|
c: t,
|
|
@@ -92,18 +92,18 @@ export default class gt {
|
|
|
92
92
|
p: this.priority,
|
|
93
93
|
t: this.type,
|
|
94
94
|
da: this.data,
|
|
95
|
-
d: this.
|
|
96
|
-
r: this.
|
|
97
|
-
tm: this.
|
|
98
|
-
ss: this.
|
|
99
|
-
ld: this.
|
|
95
|
+
d: this.Pd,
|
|
96
|
+
r: this.yd,
|
|
97
|
+
tm: this.ia,
|
|
98
|
+
ss: this.jd,
|
|
99
|
+
ld: this.Nd,
|
|
100
100
|
};
|
|
101
101
|
}
|
|
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(
|
|
106
|
-
return new
|
|
105
|
+
for (let t = 0; t < s.length; t++) i.push(ji._u(s[t]));
|
|
106
|
+
return new vt(
|
|
107
107
|
t.i,
|
|
108
108
|
i,
|
|
109
109
|
ee(t.s),
|
|
@@ -119,4 +119,4 @@ export default class gt {
|
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
(
|
|
122
|
+
(vt.Yo = { Wo: "inapp", xd: "templated_iam" }), (vt.Td = -1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import se from "../InAppMessage/in-app-message-manager-factory.js";
|
|
2
2
|
import r, { OPTIONS as U } from "../managers/braze-instance.js";
|
|
3
3
|
import vr from "./triggers-provider.js";
|
|
4
4
|
export const TriggersProviderFactory = {
|
|
@@ -14,10 +14,10 @@ export const TriggersProviderFactory = {
|
|
|
14
14
|
const i = r.er(U.Dh);
|
|
15
15
|
(TriggersProviderFactory.provider = new vr(
|
|
16
16
|
null != i ? i : 30,
|
|
17
|
-
|
|
17
|
+
se.ra().Pn(),
|
|
18
18
|
r.p(),
|
|
19
19
|
r.nn(),
|
|
20
|
-
|
|
20
|
+
se.ra(),
|
|
21
21
|
)),
|
|
22
22
|
r.v(TriggersProviderFactory.provider);
|
|
23
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import t from "../common/base-provider.js";
|
|
2
|
-
import { newInAppMessageFromJson as
|
|
3
|
-
import
|
|
2
|
+
import { newInAppMessageFromJson as yt } from "../InAppMessage/in-app-message-factory.js";
|
|
3
|
+
import ve from "../models/braze-event.js";
|
|
4
4
|
import {
|
|
5
5
|
isArray as g,
|
|
6
6
|
isEqual as hi,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
10
10
|
import Jt from "../InAppMessage/models/templated-in-app-message.js";
|
|
11
|
-
import
|
|
11
|
+
import vt from "./models/trigger.js";
|
|
12
12
|
import ot from "./models/trigger-events.js";
|
|
13
13
|
import { logger as b } from "../../shared-lib/index.js";
|
|
14
14
|
export default class vr extends t {
|
|
@@ -36,21 +36,21 @@ export default class vr extends t {
|
|
|
36
36
|
}
|
|
37
37
|
fg() {
|
|
38
38
|
if (this.j) {
|
|
39
|
-
(this.hg = this.j.St(s.It
|
|
40
|
-
(this.ng = this.j.St(s.It.
|
|
41
|
-
(this.og = this.j.St(s.It.
|
|
39
|
+
(this.hg = this.j.St(s.It.iS) || this.hg),
|
|
40
|
+
(this.ng = this.j.St(s.It.SS) || this.ng),
|
|
41
|
+
(this.og = this.j.St(s.It.aS) || this.og);
|
|
42
42
|
for (let t = 0; t < this.triggers.length; t++) {
|
|
43
43
|
const i = this.triggers[t];
|
|
44
|
-
i.id && null != this.og[i.id] && i
|
|
44
|
+
i.id && null != this.og[i.id] && i.Ad(this.og[i.id]);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
ag() {
|
|
49
49
|
if (!this.j) return;
|
|
50
|
-
this.lg = this.j.St(s.It.
|
|
51
|
-
const t = this.j.St(s.It.
|
|
50
|
+
this.lg = this.j.St(s.It.nS) || 0;
|
|
51
|
+
const t = this.j.St(s.It.oS) || [],
|
|
52
52
|
i = [];
|
|
53
|
-
for (let s = 0; s < t.length; s++) i.push(
|
|
53
|
+
for (let s = 0; s < t.length; s++) i.push(vt._u(t[s]));
|
|
54
54
|
(this.triggers = i), this.fg();
|
|
55
55
|
}
|
|
56
56
|
gg() {
|
|
@@ -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.
|
|
73
|
+
o = s.Id(n.ta || 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 &&
|
|
78
|
+
null != n.dg && ve.RS(n.dg) && (r = ve._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.ta || 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.j && this.j.Pt(s.It.
|
|
94
|
+
r && this.j && this.j.Pt(s.It.SS, this.ng);
|
|
95
95
|
}
|
|
96
96
|
mg() {
|
|
97
97
|
if (!this.j) return;
|
|
@@ -99,38 +99,38 @@ 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.j.Pt(s.It.
|
|
103
|
-
this.j.Pt(s.It.
|
|
102
|
+
this.j.Pt(s.It.oS, t),
|
|
103
|
+
this.j.Pt(s.It.nS, this.lg);
|
|
104
104
|
}
|
|
105
105
|
bg() {
|
|
106
106
|
if (!this.j) return;
|
|
107
|
-
(this.j.St(s.It.
|
|
107
|
+
(this.j.St(s.It.nS) || 0) > this.lg ? this.ag() : this.fg();
|
|
108
108
|
}
|
|
109
109
|
q(t) {
|
|
110
110
|
let i = !1;
|
|
111
111
|
if (null != t && t.triggers) {
|
|
112
|
-
this.ig.
|
|
112
|
+
this.ig.ma(), this.fg();
|
|
113
113
|
const e = {},
|
|
114
114
|
r = {};
|
|
115
115
|
this.triggers = [];
|
|
116
116
|
for (let s = 0; s < t.triggers.length; s++) {
|
|
117
|
-
const h =
|
|
117
|
+
const h = vt.fromJson(t.triggers[s]);
|
|
118
118
|
if (h) {
|
|
119
119
|
h.id &&
|
|
120
120
|
null != this.og[h.id] &&
|
|
121
|
-
(h
|
|
121
|
+
(h.Ad(this.og[h.id]), (e[h.id] = this.og[h.id])),
|
|
122
122
|
h.id && null != this.ng[h.id] && (r[h.id] = this.ng[h.id]);
|
|
123
|
-
for (let t = 0; t < h.
|
|
124
|
-
if (h.
|
|
123
|
+
for (let t = 0; t < h.Dd.length; t++)
|
|
124
|
+
if (h.Dd[t]._c(ot.Os, null)) {
|
|
125
125
|
i = !0;
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
this.triggers.push(h);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
hi(this.og, e) || ((this.og = e), this.j && this.j.Pt(s.It.
|
|
131
|
+
hi(this.og, e) || ((this.og = e), this.j && this.j.Pt(s.It.aS, this.og)),
|
|
132
132
|
hi(this.ng, r) ||
|
|
133
|
-
((this.ng = r), this.j && this.j.Pt(s.It.
|
|
133
|
+
((this.ng = r), this.j && this.j.Pt(s.It.SS, this.ng)),
|
|
134
134
|
this.mg(),
|
|
135
135
|
i &&
|
|
136
136
|
(b.info("Trigger with test condition found, firing test."),
|
|
@@ -147,13 +147,13 @@ export default class vr extends t {
|
|
|
147
147
|
const h = (e) => {
|
|
148
148
|
this.fg();
|
|
149
149
|
const r = new Date().valueOf();
|
|
150
|
-
t
|
|
151
|
-
(!1 === navigator.onLine && t.type ===
|
|
150
|
+
t.$d(i) ||
|
|
151
|
+
(!1 === navigator.onLine && t.type === vt.Yo.Wo && e.imageUrl
|
|
152
152
|
? b.info(
|
|
153
153
|
`Not showing ${t.type} trigger action ${t.id} due to offline state.`,
|
|
154
154
|
)
|
|
155
|
-
: t.
|
|
156
|
-
? 0 === this.Rs.
|
|
155
|
+
: t._d(r) && this.wg(t, r, s)
|
|
156
|
+
? 0 === this.Rs.an()
|
|
157
157
|
? b.info(
|
|
158
158
|
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
|
|
159
159
|
)
|
|
@@ -166,14 +166,14 @@ export default class vr extends t {
|
|
|
166
166
|
this.fg();
|
|
167
167
|
const h = r.pop();
|
|
168
168
|
if (null != h)
|
|
169
|
-
if ((this.Tg(h, i, s, e, r), h
|
|
169
|
+
if ((this.Tg(h, i, s, e, r), h.$d(i))) {
|
|
170
170
|
let t = `Server aborted in-app message display, but the timeout on fallback trigger ${h.id} has already elapsed.`;
|
|
171
171
|
r.length > 0 && (t += " Continuing to fall back."), b.info(t), n();
|
|
172
172
|
} else {
|
|
173
173
|
b.info(
|
|
174
174
|
`Server aborted in-app message display. Falling back to lower priority ${h.type} trigger action ${t.id}.`,
|
|
175
175
|
);
|
|
176
|
-
const n = 1e3 * h.
|
|
176
|
+
const n = 1e3 * h.Pd - (new Date().valueOf() - i);
|
|
177
177
|
n > 0
|
|
178
178
|
? this.eg.push(
|
|
179
179
|
window.setTimeout(() => {
|
|
@@ -185,8 +185,8 @@ export default class vr extends t {
|
|
|
185
185
|
};
|
|
186
186
|
let o, l, a;
|
|
187
187
|
switch (t.type) {
|
|
188
|
-
case
|
|
189
|
-
if (((o =
|
|
188
|
+
case vt.Yo.Wo:
|
|
189
|
+
if (((o = yt(t.data)), null == o)) {
|
|
190
190
|
b.error(
|
|
191
191
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
192
192
|
);
|
|
@@ -198,14 +198,14 @@ export default class vr extends t {
|
|
|
198
198
|
}
|
|
199
199
|
h(o);
|
|
200
200
|
break;
|
|
201
|
-
case
|
|
202
|
-
if (((a = Jt.fromJson(t.data, h, n, i, t.
|
|
201
|
+
case vt.Yo.xd:
|
|
202
|
+
if (((a = Jt.fromJson(t.data, h, n, i, t.ia || 0)), null == a)) {
|
|
203
203
|
b.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.Po(a, s, e);
|
|
209
209
|
break;
|
|
210
210
|
default:
|
|
211
211
|
b.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
|
|
@@ -228,15 +228,15 @@ export default class vr extends t {
|
|
|
228
228
|
const o = [];
|
|
229
229
|
for (let s = 0; s < this.triggers.length; s++) {
|
|
230
230
|
const r = this.triggers[s],
|
|
231
|
-
l = e + 1e3 * r.
|
|
231
|
+
l = e + 1e3 * r.Pd;
|
|
232
232
|
if (
|
|
233
|
-
r.
|
|
233
|
+
r._d(l) &&
|
|
234
234
|
(null == r.startTime || r.startTime.valueOf() <= e) &&
|
|
235
235
|
(null == r.endTime || r.endTime.valueOf() >= e)
|
|
236
236
|
) {
|
|
237
237
|
let s = !1;
|
|
238
|
-
for (let e = 0; e < r.
|
|
239
|
-
if (r.
|
|
238
|
+
for (let e = 0; e < r.Dd.length; e++)
|
|
239
|
+
if (r.Dd[e]._c(t, i)) {
|
|
240
240
|
s = !0;
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
@@ -260,24 +260,24 @@ export default class vr extends t {
|
|
|
260
260
|
`Firing ${l.type} trigger action ${l.id} from trigger event ${t}.`,
|
|
261
261
|
),
|
|
262
262
|
this.Tg(l, e, t, s, o),
|
|
263
|
-
0 === l.
|
|
263
|
+
0 === l.Pd
|
|
264
264
|
? this.cg(l, e, t, s, o)
|
|
265
265
|
: this.eg.push(
|
|
266
266
|
window.setTimeout(() => {
|
|
267
267
|
this.cg(l, e, t, s, o);
|
|
268
|
-
}, 1e3 * l.
|
|
268
|
+
}, 1e3 * l.Pd),
|
|
269
269
|
));
|
|
270
270
|
}
|
|
271
271
|
changeUser(t = !1) {
|
|
272
|
-
if (((this.triggers = []), this.j && this.j.Vt(s.It.
|
|
272
|
+
if (((this.triggers = []), this.j && this.j.Vt(s.It.oS), !t)) {
|
|
273
273
|
(this.sg = []),
|
|
274
274
|
(this.hg = null),
|
|
275
275
|
(this.og = {}),
|
|
276
276
|
(this.ng = {}),
|
|
277
|
-
this.ig && this.ig.
|
|
277
|
+
this.ig && this.ig.oa();
|
|
278
278
|
for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
|
|
279
279
|
(this.eg = []),
|
|
280
|
-
this.j && (this.j.Vt(s.It
|
|
280
|
+
this.j && (this.j.Vt(s.It.iS), this.j.Vt(s.It.aS), this.j.Vt(s.It.SS));
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
clearData() {
|
|
@@ -285,7 +285,7 @@ export default class vr extends t {
|
|
|
285
285
|
(this.hg = null),
|
|
286
286
|
(this.og = {}),
|
|
287
287
|
(this.ng = {}),
|
|
288
|
-
this.ig && this.ig.
|
|
288
|
+
this.ig && this.ig.oa();
|
|
289
289
|
for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
|
|
290
290
|
this.eg = [];
|
|
291
291
|
}
|
|
@@ -298,25 +298,25 @@ export default class vr extends t {
|
|
|
298
298
|
),
|
|
299
299
|
!0
|
|
300
300
|
);
|
|
301
|
-
let e = t.
|
|
301
|
+
let e = t.jd;
|
|
302
302
|
return null == e && (e = this.tg), i - this.hg >= 1e3 * e;
|
|
303
303
|
}
|
|
304
304
|
Tg(t, i, e, r, h) {
|
|
305
305
|
this.fg(), t.id && (this.ng[t.id] = this.ng[t.id] || []);
|
|
306
306
|
const n = {};
|
|
307
307
|
let o;
|
|
308
|
-
(n.
|
|
308
|
+
(n.ta = i), (n.ug = e), null != r && (o = r.qt()), (n.dg = o);
|
|
309
309
|
const l = [];
|
|
310
310
|
for (const t of h) t.id && l.push(t.id);
|
|
311
311
|
(n.pg = l),
|
|
312
312
|
t.id && this.ng[t.id].push(n),
|
|
313
|
-
this.j && this.j.Pt(s.It.
|
|
313
|
+
this.j && this.j.Pt(s.It.SS, this.ng);
|
|
314
314
|
}
|
|
315
315
|
yg(t, i) {
|
|
316
316
|
this.fg(),
|
|
317
|
-
t
|
|
317
|
+
t.Ad(i),
|
|
318
318
|
(this.hg = i),
|
|
319
319
|
t.id && (this.og[t.id] = i),
|
|
320
|
-
this.j && (this.j.Pt(s.It
|
|
320
|
+
this.j && (this.j.Pt(s.It.iS, i), this.j.Pt(s.It.aS, this.og));
|
|
321
321
|
}
|
|
322
322
|
}
|
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.12.0".replace(/\./g, "-")}`;
|
|
5
5
|
if (!c) return;
|
|
6
6
|
const s = c.ownerDocument || document;
|
|
7
7
|
if (null == s.getElementById(e)) {
|
package/src/ui/js/feed-css.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attachCSS as Sn } from "./attach-css.js";
|
|
2
|
-
import { loadFontAwesome as
|
|
2
|
+
import { loadFontAwesome as Se } from "./load-font-awesome.js";
|
|
3
3
|
export function attachFeedCSS(t) {
|
|
4
4
|
Sn(
|
|
5
5
|
t,
|
|
@@ -8,5 +8,5 @@ export function attachFeedCSS(t) {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
export function setupFeedUI() {
|
|
11
|
-
attachFeedCSS(),
|
|
11
|
+
attachFeedCSS(), Se();
|
|
12
12
|
}
|
package/src/ui/js/iam-css.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attachCSS as Sn } from "./attach-css.js";
|
|
2
|
-
import { loadFontAwesome as
|
|
2
|
+
import { loadFontAwesome as Se } from "./load-font-awesome.js";
|
|
3
3
|
export function attachInAppMessageCSS(t) {
|
|
4
4
|
Sn(
|
|
5
5
|
t,
|
|
@@ -8,5 +8,5 @@ export function attachInAppMessageCSS(t) {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
export function setupInAppMessageUI() {
|
|
11
|
-
attachInAppMessageCSS(),
|
|
11
|
+
attachInAppMessageCSS(), Se();
|
|
12
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger as b } from "../../shared-lib/index.js";
|
|
2
|
-
import { getErrorMessage as
|
|
2
|
+
import { getErrorMessage as ci } 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,
|
|
@@ -46,7 +46,7 @@ export function getDecodedBrazeAction(t) {
|
|
|
46
46
|
? JSON.parse(e)
|
|
47
47
|
: void b.error(`Failed to decode base64 encoded brazeAction: ${n}`);
|
|
48
48
|
} catch (o) {
|
|
49
|
-
return void b.error(`Failed to process brazeAction URL ${t} : ${
|
|
49
|
+
return void b.error(`Failed to process brazeAction URL ${t} : ${ci(o)}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function po(t, o) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import Si from "./client-hints-parser.js";
|
|
2
|
-
import
|
|
3
|
-
import { Browsers as
|
|
4
|
-
class
|
|
2
|
+
import yi from "./user-agent-parser.js";
|
|
3
|
+
import { Browsers as xi, OperatingSystems as so } from "./device-constants.js";
|
|
4
|
+
class Bi {
|
|
5
5
|
constructor() {
|
|
6
6
|
let t;
|
|
7
7
|
(t =
|
|
8
|
-
navigator.userAgent.toLowerCase().includes(
|
|
8
|
+
navigator.userAgent.toLowerCase().includes(xi.Sg.toLowerCase()) ||
|
|
9
9
|
!navigator.userAgentData
|
|
10
|
-
?
|
|
10
|
+
? yi
|
|
11
11
|
: Si),
|
|
12
12
|
(this.vg = new t()),
|
|
13
13
|
(this.userAgent = navigator.userAgent),
|
|
14
14
|
(this.browser = this.vg.ef()),
|
|
15
15
|
(this.version = this.vg.ff()),
|
|
16
16
|
(this.OS = null),
|
|
17
|
-
this.
|
|
17
|
+
this.Fa().then((t) => (this.OS = t));
|
|
18
18
|
const i = navigator;
|
|
19
19
|
(this.language = (
|
|
20
20
|
i.userLanguage ||
|
|
@@ -23,18 +23,18 @@ class xi {
|
|
|
23
23
|
i.systemLanguage ||
|
|
24
24
|
""
|
|
25
25
|
).toLowerCase()),
|
|
26
|
-
(this.il =
|
|
26
|
+
(this.il = Bi.xg(this.userAgent));
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
return this.browser ===
|
|
28
|
+
mS() {
|
|
29
|
+
return this.browser === xi.Bg;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
qa() {
|
|
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.
|
|
37
|
+
: this.vg.Fa(Bi.Og).then((t) => ((this.OS = t), t));
|
|
38
38
|
}
|
|
39
39
|
static xg(t) {
|
|
40
40
|
t = t.toLowerCase();
|
|
@@ -63,7 +63,7 @@ class xi {
|
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
Bi.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 @@ xi.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 Bi();
|
|
95
|
+
export { ro as default, Bi as BrowserDetector };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Browsers as
|
|
3
|
-
export default class Si extends
|
|
1
|
+
import Oe from "./base-device-parser.js";
|
|
2
|
+
import { Browsers as xi } from "./device-constants.js";
|
|
3
|
+
export default class Si extends Oe {
|
|
4
4
|
constructor() {
|
|
5
5
|
if (
|
|
6
6
|
(super(),
|
|
@@ -21,7 +21,7 @@ export default class Si extends Ve {
|
|
|
21
21
|
ff() {
|
|
22
22
|
return this.version;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
Fa(t) {
|
|
25
25
|
if (this.OS) return Promise.resolve(this.OS);
|
|
26
26
|
const s = (s) => {
|
|
27
27
|
for (let r = 0; r < t.length; r++) {
|
|
@@ -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.Vc(
|
|
44
|
+
const s = this.Vc(xi),
|
|
45
45
|
i = r.brand.match(s);
|
|
46
46
|
if (i && i.length > 0) {
|
|
47
47
|
(t.browser = i[0]), (t.version = r.version);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { addPassiveEventListener as F, buildSvg as
|
|
2
|
-
import { KeyCodes as
|
|
1
|
+
import { addPassiveEventListener as F, buildSvg as oe } from "./dom-utils.js";
|
|
2
|
+
import { KeyCodes as le } from "./key-codes.js";
|
|
3
3
|
export function createCloseButton(t, o, e, r = "ltr") {
|
|
4
4
|
const n = document.createElement("button");
|
|
5
5
|
n.setAttribute("aria-label", t),
|
|
@@ -7,7 +7,7 @@ export function createCloseButton(t, o, e, r = "ltr") {
|
|
|
7
7
|
(n.dir = r),
|
|
8
8
|
F(n, "touchstart"),
|
|
9
9
|
(n.className = "ab-close-button");
|
|
10
|
-
const l =
|
|
10
|
+
const l = oe(
|
|
11
11
|
"0 0 15 15",
|
|
12
12
|
"M15 1.5L13.5 0l-6 6-6-6L0 1.5l6 6-6 6L1.5 15l6-6 6 6 1.5-1.5-6-6 6-6z",
|
|
13
13
|
o,
|
|
@@ -16,7 +16,7 @@ export function createCloseButton(t, o, e, r = "ltr") {
|
|
|
16
16
|
n.appendChild(l),
|
|
17
17
|
l.setAttribute("aria-hidden", "true"),
|
|
18
18
|
n.addEventListener("keydown", (t) => {
|
|
19
|
-
(t.keyCode !==
|
|
19
|
+
(t.keyCode !== le.To && t.keyCode !== le.Lo) ||
|
|
20
20
|
(e(), t.stopPropagation());
|
|
21
21
|
}),
|
|
22
22
|
(n.onclick = (t) => {
|