@braze/web-sdk 5.3.1 → 5.4.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 +20 -4
- package/package.json +1 -1
- package/shared-lib/event-types.js +10 -10
- package/shared-lib/indexed-db-adapter.js +1 -1
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +9 -8
- package/src/Card/display/card-display.js +59 -58
- package/src/Core/index.js +1 -0
- package/src/Core/is-initialized.js +4 -0
- package/src/InAppMessage/display/html-message-display-utils.js +172 -0
- package/src/InAppMessage/display/html-message-to-html.js +54 -219
- package/src/InAppMessage/display/in-app-message-to-html.js +78 -76
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +56 -56
- 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 +2 -2
- package/src/InAppMessage/models/html-message.js +2 -2
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +26 -26
- package/src/InAppMessage/models/modal-message.js +2 -2
- package/src/InAppMessage/models/slide-up-message.js +4 -4
- 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 +47 -45
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -18
- 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 +2 -1
- package/src/Push/push-manager.js +80 -92
- package/src/Push/utils/push-utils.js +12 -12
- package/src/User/user-manager.js +3 -3
- package/src/User/user.js +19 -19
- package/src/common/event-logger.js +4 -4
- package/src/common/feed-display.js +25 -24
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +15 -5
- package/src/managers/auth-manager.js +1 -1
- package/src/managers/braze-instance.js +54 -52
- package/src/managers/device-manager.js +19 -19
- package/src/managers/network-manager.js +100 -100
- package/src/managers/server-config-manager.js +7 -7
- package/src/managers/session-manager.js +4 -4
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +18 -18
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +10 -10
- package/src/models/device.js +3 -3
- package/src/models/server-config.js +7 -7
- package/src/request-controller.js +77 -77
- package/src/triggers/models/custom-event-data.js +2 -2
- package/src/triggers/models/custom-event-property-data.js +4 -4
- package/src/triggers/models/filter-set.js +3 -3
- package/src/triggers/models/filter.js +9 -9
- package/src/triggers/models/in-app-message-click-data.js +8 -8
- 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 +3 -3
- package/src/triggers/models/trigger-condition.js +39 -39
- package/src/triggers/models/trigger.js +12 -12
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +15 -15
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +21 -21
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/component-utils.js +15 -14
- package/src/util/date-utils.js +2 -2
- package/src/util/dom-utils.js +3 -3
- package/src/util/net.js +2 -2
- package/src/util/request-header-utils.js +8 -8
- package/src/util/user-agent-parser.js +3 -3
- package/src/util/validation-utils.js +17 -17
- package/src/util/window-utils.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isDate as
|
|
1
|
+
import { isDate as Nt } from "../../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
3
|
convertMsToSeconds as h,
|
|
4
4
|
dateFromUnixTimestamp as l,
|
|
@@ -33,13 +33,13 @@ export default class lr {
|
|
|
33
33
|
return null != s && typeof s == typeof this.Ll && s > this.Ll;
|
|
34
34
|
case lr.Ql.Ul:
|
|
35
35
|
return this._l === lr.Ol.Il
|
|
36
|
-
? null != s &&
|
|
36
|
+
? null != s && Nt(s) && es(s) <= this.Ll.valueOf()
|
|
37
37
|
: null != s && typeof s == typeof this.Ll && s >= this.Ll;
|
|
38
38
|
case lr.Ql.$l:
|
|
39
39
|
return null != s && typeof s == typeof this.Ll && s < this.Ll;
|
|
40
40
|
case lr.Ql.Xl:
|
|
41
41
|
return this._l === lr.Ol.Il
|
|
42
|
-
? null != s &&
|
|
42
|
+
? null != s && Nt(s) && es(s) >= this.Ll.valueOf()
|
|
43
43
|
: null != s && typeof s == typeof this.Ll && s <= this.Ll;
|
|
44
44
|
case lr.Ql.Hu:
|
|
45
45
|
return (
|
|
@@ -53,10 +53,10 @@ export default class lr {
|
|
|
53
53
|
case lr.Ql.Xu:
|
|
54
54
|
return null == s;
|
|
55
55
|
case lr.Ql.Fl:
|
|
56
|
-
return null != s &&
|
|
56
|
+
return null != s && Nt(s) && ls(s) < this.Ll;
|
|
57
57
|
case lr.Ql.Kl:
|
|
58
|
-
return null != s &&
|
|
59
|
-
case lr.Ql.
|
|
58
|
+
return null != s && Nt(s) && ls(s) > this.Ll;
|
|
59
|
+
case lr.Ql.Vu:
|
|
60
60
|
return (
|
|
61
61
|
null == s ||
|
|
62
62
|
typeof s != typeof this.Ll ||
|
|
@@ -77,7 +77,7 @@ export default class lr {
|
|
|
77
77
|
Y() {
|
|
78
78
|
let t = this.Ll;
|
|
79
79
|
return (
|
|
80
|
-
|
|
80
|
+
Nt(this.Ll) && (t = h(t.valueOf())),
|
|
81
81
|
{ k: this.Tl, t: this._l, c: this.comparator, v: t }
|
|
82
82
|
);
|
|
83
83
|
}
|
|
@@ -85,7 +85,7 @@ export default class lr {
|
|
|
85
85
|
return new lr(t.k, t.t, t.c, t.v);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
(lr.Ol = {
|
|
88
|
+
(lr.Ol = { Yu: "boolean", Zu: "number", yE: "string", Il: "date" }),
|
|
89
89
|
(lr.Ql = {
|
|
90
90
|
Pl: 1,
|
|
91
91
|
Yl: 2,
|
|
@@ -98,5 +98,5 @@ export default class lr {
|
|
|
98
98
|
Xu: 12,
|
|
99
99
|
Fl: 15,
|
|
100
100
|
Kl: 16,
|
|
101
|
-
|
|
101
|
+
Vu: 17,
|
|
102
102
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import ri from "./trigger-condition.js";
|
|
2
2
|
export default class ni {
|
|
3
3
|
constructor(t, i) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.tf = t), (this.if = i), (this.tf = t), (this.if = i);
|
|
5
5
|
}
|
|
6
6
|
Jl(t) {
|
|
7
|
-
if (null == this.
|
|
8
|
-
const i = ri.
|
|
7
|
+
if (null == this.tf) return !1;
|
|
8
|
+
const i = ri.rf(t[0], this.tf);
|
|
9
9
|
if (!i) return !1;
|
|
10
|
-
let r = null == this.
|
|
11
|
-
if (null != this.
|
|
12
|
-
for (let i = 0; i < this.
|
|
13
|
-
if (this.
|
|
10
|
+
let r = null == this.if || 0 === this.if.length;
|
|
11
|
+
if (null != this.if)
|
|
12
|
+
for (let i = 0; i < this.if.length; i++)
|
|
13
|
+
if (this.if[i] === t[1]) {
|
|
14
14
|
r = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -20,6 +20,6 @@ export default class ni {
|
|
|
20
20
|
return new ni(t ? t.id : null, t ? t.buttons : null);
|
|
21
21
|
}
|
|
22
22
|
Y() {
|
|
23
|
-
return this.
|
|
23
|
+
return this.tf;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class ns {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
(this.productId = t), (this.productId = t);
|
|
4
4
|
}
|
|
@@ -6,7 +6,7 @@ export default class rs {
|
|
|
6
6
|
return null == this.productId || t[0] === this.productId;
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
|
-
return new
|
|
9
|
+
return new ns(t ? t.product_id : null);
|
|
10
10
|
}
|
|
11
11
|
Y() {
|
|
12
12
|
return this.productId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import is from "./filter-set.js";
|
|
2
|
+
export default class hs {
|
|
3
3
|
constructor(t, s) {
|
|
4
4
|
(this.productId = t), (this.Ml = s), (this.productId = t), (this.Ml = s);
|
|
5
5
|
}
|
|
@@ -10,9 +10,9 @@ export default class ns {
|
|
|
10
10
|
return s === this.productId && this.Ml.Jl(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
|
-
return new
|
|
13
|
+
return new hs(
|
|
14
14
|
t ? t.product_id : null,
|
|
15
|
-
t ?
|
|
15
|
+
t ? is.fromJson(t.property_filters) : null,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
Y() {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import ri from "./trigger-condition.js";
|
|
2
2
|
export default class ur {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.tf = t), (this.tf = t);
|
|
5
5
|
}
|
|
6
6
|
Jl(t) {
|
|
7
|
-
return null == this.
|
|
7
|
+
return null == this.tf || ri.rf(t[0], this.tf);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t) {
|
|
10
10
|
return new ur(t ? t.campaign_id : null);
|
|
11
11
|
}
|
|
12
12
|
Y() {
|
|
13
|
-
return this.
|
|
13
|
+
return this.tf;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import ts from "./custom-event-data.js";
|
|
2
|
+
import rs from "./custom-event-property-data.js";
|
|
3
|
+
import is from "./filter-set.js";
|
|
4
4
|
import ni from "./in-app-message-click-data.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import ns from "./purchase-data.js";
|
|
6
|
+
import hs from "./purchase-property-data.js";
|
|
7
7
|
import ur from "./push-click-data.js";
|
|
8
8
|
import tt from "./trigger-events.js";
|
|
9
9
|
import { logger as r } from "../../../shared-lib/index.js";
|
|
@@ -15,7 +15,7 @@ export default class ri {
|
|
|
15
15
|
sc(e, t) {
|
|
16
16
|
return ri.cc[this.type] === e && (null == this.data || this.data.Jl(t));
|
|
17
17
|
}
|
|
18
|
-
static
|
|
18
|
+
static rf(e, t) {
|
|
19
19
|
let s = null;
|
|
20
20
|
try {
|
|
21
21
|
s = window.atob(e);
|
|
@@ -28,25 +28,25 @@ export default class ri {
|
|
|
28
28
|
const t = e.type;
|
|
29
29
|
let r = null;
|
|
30
30
|
switch (t) {
|
|
31
|
-
case ri.
|
|
32
|
-
case ri.
|
|
31
|
+
case ri.Br.OPEN:
|
|
32
|
+
case ri.Br.kt:
|
|
33
33
|
break;
|
|
34
|
-
case ri.
|
|
35
|
-
r = rs.fromJson(e.data);
|
|
36
|
-
break;
|
|
37
|
-
case ri._r.nc:
|
|
34
|
+
case ri.Br.Rr:
|
|
38
35
|
r = ns.fromJson(e.data);
|
|
39
36
|
break;
|
|
40
|
-
case ri.
|
|
37
|
+
case ri.Br.nc:
|
|
38
|
+
r = hs.fromJson(e.data);
|
|
39
|
+
break;
|
|
40
|
+
case ri.Br.vr:
|
|
41
41
|
r = ur.fromJson(e.data);
|
|
42
42
|
break;
|
|
43
|
-
case ri.
|
|
44
|
-
r =
|
|
43
|
+
case ri.Br.ue:
|
|
44
|
+
r = ts.fromJson(e.data);
|
|
45
45
|
break;
|
|
46
|
-
case ri.
|
|
47
|
-
r =
|
|
46
|
+
case ri.Br.lc:
|
|
47
|
+
r = rs.fromJson(e.data);
|
|
48
48
|
break;
|
|
49
|
-
case ri.
|
|
49
|
+
case ri.Br.Qr:
|
|
50
50
|
r = ni.fromJson(e.data);
|
|
51
51
|
}
|
|
52
52
|
return new ri(t, r);
|
|
@@ -58,31 +58,31 @@ export default class ri {
|
|
|
58
58
|
let t,
|
|
59
59
|
r = null;
|
|
60
60
|
switch (e.t) {
|
|
61
|
-
case ri.
|
|
62
|
-
case ri.
|
|
61
|
+
case ri.Br.OPEN:
|
|
62
|
+
case ri.Br.kt:
|
|
63
63
|
break;
|
|
64
|
-
case ri.
|
|
65
|
-
r = new
|
|
64
|
+
case ri.Br.Rr:
|
|
65
|
+
r = new ns(e.d);
|
|
66
66
|
break;
|
|
67
|
-
case ri.
|
|
68
|
-
(t = e.d || {}), (r = new
|
|
67
|
+
case ri.Br.nc:
|
|
68
|
+
(t = e.d || {}), (r = new hs(t.id, is.qn(t.pf || [])));
|
|
69
69
|
break;
|
|
70
|
-
case ri.
|
|
70
|
+
case ri.Br.vr:
|
|
71
71
|
r = new ur(e.d);
|
|
72
72
|
break;
|
|
73
|
-
case ri.
|
|
74
|
-
r = new
|
|
73
|
+
case ri.Br.ue:
|
|
74
|
+
r = new ts(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case ri.
|
|
77
|
-
(t = e.d || {}), (r = new
|
|
76
|
+
case ri.Br.lc:
|
|
77
|
+
(t = e.d || {}), (r = new rs(t.e, is.qn(t.pf || [])));
|
|
78
78
|
break;
|
|
79
|
-
case ri.
|
|
79
|
+
case ri.Br.Qr:
|
|
80
80
|
r = new ni(e.d);
|
|
81
81
|
}
|
|
82
82
|
return new ri(e.t, r);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
(ri.
|
|
85
|
+
(ri.Br = {
|
|
86
86
|
OPEN: "open",
|
|
87
87
|
Rr: "purchase",
|
|
88
88
|
nc: "purchase_property",
|
|
@@ -93,11 +93,11 @@ export default class ri {
|
|
|
93
93
|
kt: "test",
|
|
94
94
|
}),
|
|
95
95
|
(ri.cc = {}),
|
|
96
|
-
(ri.cc[ri.
|
|
97
|
-
(ri.cc[ri.
|
|
98
|
-
(ri.cc[ri.
|
|
99
|
-
(ri.cc[ri.
|
|
100
|
-
(ri.cc[ri.
|
|
101
|
-
(ri.cc[ri.
|
|
102
|
-
(ri.cc[ri.
|
|
103
|
-
(ri.cc[ri.
|
|
96
|
+
(ri.cc[ri.Br.OPEN] = tt.OPEN),
|
|
97
|
+
(ri.cc[ri.Br.Rr] = tt.Rr),
|
|
98
|
+
(ri.cc[ri.Br.nc] = tt.Rr),
|
|
99
|
+
(ri.cc[ri.Br.vr] = tt.vr),
|
|
100
|
+
(ri.cc[ri.Br.ue] = tt.ue),
|
|
101
|
+
(ri.cc[ri.Br.lc] = tt.ue),
|
|
102
|
+
(ri.cc[ri.Br.Qr] = tt.Qr),
|
|
103
|
+
(ri.cc[ri.Br.kt] = tt.kt);
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
import { logger as r } from "../../../shared-lib/index.js";
|
|
6
6
|
import ri from "./trigger-condition.js";
|
|
7
7
|
import { validateValueIsFromEnum as J } 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 gt {
|
|
9
|
+
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = gt.td, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
11
|
(this.sd = i),
|
|
12
12
|
(this.startTime = s),
|
|
@@ -16,7 +16,7 @@ export default class mt {
|
|
|
16
16
|
(this.data = l),
|
|
17
17
|
(this.ed = o),
|
|
18
18
|
(this.rd = n),
|
|
19
|
-
(this.
|
|
19
|
+
(this.Gr = a),
|
|
20
20
|
(this.hd = u),
|
|
21
21
|
(this.od = d),
|
|
22
22
|
(this.id = t),
|
|
@@ -29,7 +29,7 @@ export default class mt {
|
|
|
29
29
|
(this.type = h),
|
|
30
30
|
(this.ed = o || 0),
|
|
31
31
|
null == a && (a = 1e3 * (this.ed + 30)),
|
|
32
|
-
(this.
|
|
32
|
+
(this.Gr = a),
|
|
33
33
|
(this.data = l),
|
|
34
34
|
null != n && (this.rd = n),
|
|
35
35
|
(this.hd = u),
|
|
@@ -37,7 +37,7 @@ export default class mt {
|
|
|
37
37
|
}
|
|
38
38
|
nd(t) {
|
|
39
39
|
return (
|
|
40
|
-
null == this.od || (this.rd !==
|
|
40
|
+
null == this.od || (this.rd !== gt.td && t - this.od >= 1e3 * this.rd)
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
ad(t) {
|
|
@@ -49,11 +49,11 @@ export default class mt {
|
|
|
49
49
|
}
|
|
50
50
|
dd(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.Gr || i < this.Gr;
|
|
53
53
|
return (
|
|
54
54
|
s ||
|
|
55
55
|
r.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.Gr}ms.`,
|
|
57
57
|
),
|
|
58
58
|
!s
|
|
59
59
|
);
|
|
@@ -73,12 +73,12 @@ export default class mt {
|
|
|
73
73
|
d = t.data,
|
|
74
74
|
m = t.min_seconds_since_last_trigger;
|
|
75
75
|
return J(
|
|
76
|
-
|
|
76
|
+
gt.Br,
|
|
77
77
|
o,
|
|
78
78
|
"Could not construct Trigger from server data",
|
|
79
79
|
"Trigger.Types",
|
|
80
80
|
)
|
|
81
|
-
? new
|
|
81
|
+
? new gt(i, s, e, r, h, o, d, n, a, u, m)
|
|
82
82
|
: null;
|
|
83
83
|
}
|
|
84
84
|
Y() {
|
|
@@ -94,7 +94,7 @@ export default class mt {
|
|
|
94
94
|
da: this.data,
|
|
95
95
|
d: this.ed,
|
|
96
96
|
r: this.rd,
|
|
97
|
-
tm: this.
|
|
97
|
+
tm: this.Gr,
|
|
98
98
|
ss: this.hd,
|
|
99
99
|
ld: this.od,
|
|
100
100
|
};
|
|
@@ -103,7 +103,7 @@ export default class mt {
|
|
|
103
103
|
const i = [],
|
|
104
104
|
s = t.c || [];
|
|
105
105
|
for (let t = 0; t < s.length; t++) i.push(ri.qn(s[t]));
|
|
106
|
-
return new
|
|
106
|
+
return new gt(
|
|
107
107
|
t.i,
|
|
108
108
|
i,
|
|
109
109
|
w(t.s),
|
|
@@ -119,4 +119,4 @@ export default class mt {
|
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
(
|
|
122
|
+
(gt.Br = { Tr: "inapp", md: "templated_iam" }), (gt.td = -1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import y from "../common/base-provider.js";
|
|
2
2
|
import { newInAppMessageFromJson as pt } from "../InAppMessage/in-app-message-factory.js";
|
|
3
|
-
import
|
|
3
|
+
import ve from "../models/braze-event.js";
|
|
4
4
|
import {
|
|
5
5
|
isArray as j,
|
|
6
6
|
isEqual as ii,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
10
10
|
import wt from "../InAppMessage/models/templated-in-app-message.js";
|
|
11
|
-
import
|
|
11
|
+
import gt from "./models/trigger.js";
|
|
12
12
|
import tt from "./models/trigger-events.js";
|
|
13
13
|
import { logger as r } from "../../shared-lib/index.js";
|
|
14
14
|
export default class gr extends y {
|
|
@@ -50,7 +50,7 @@ export default class gr extends y {
|
|
|
50
50
|
this.lg = this.u.j(o.C.oE) || 0;
|
|
51
51
|
const t = this.u.j(o.C.rE) || [],
|
|
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(gt.qn(t[s]));
|
|
54
54
|
(this.triggers = i), this.fg();
|
|
55
55
|
}
|
|
56
56
|
gg() {
|
|
@@ -70,19 +70,19 @@ export default class gr extends y {
|
|
|
70
70
|
h = [];
|
|
71
71
|
for (let e = 0; e < t.length; e++) {
|
|
72
72
|
const n = t[e],
|
|
73
|
-
o = r.ud(n.
|
|
73
|
+
o = r.ud(n.Er || 0);
|
|
74
74
|
if (o > 0) {
|
|
75
75
|
let t, e;
|
|
76
76
|
h.push(n),
|
|
77
77
|
null != n.ug && (t = n.ug),
|
|
78
|
-
null != n.dg &&
|
|
78
|
+
null != n.dg && ve.RE(n.dg) && (e = ve.qn(n.dg));
|
|
79
79
|
const l = [];
|
|
80
80
|
if (n.pg && j(n.pg))
|
|
81
81
|
for (let t = 0; t < n.pg.length; t++) {
|
|
82
82
|
const i = s[n.pg[t]];
|
|
83
83
|
null != i && l.push(i);
|
|
84
84
|
}
|
|
85
|
-
this.eg.push(window.setTimeout(i(r, n.
|
|
85
|
+
this.eg.push(window.setTimeout(i(r, n.Er || 0, t, e, l), o));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
this.ng[r.id].length > h.length &&
|
|
@@ -113,7 +113,7 @@ export default class gr extends y {
|
|
|
113
113
|
e = {};
|
|
114
114
|
this.triggers = [];
|
|
115
115
|
for (let r = 0; r < t.triggers.length; r++) {
|
|
116
|
-
const h =
|
|
116
|
+
const h = gt.fromJson(t.triggers[r]);
|
|
117
117
|
if (h) {
|
|
118
118
|
h.id &&
|
|
119
119
|
null != this.og[h.id] &&
|
|
@@ -146,7 +146,7 @@ export default class gr extends y {
|
|
|
146
146
|
this.fg();
|
|
147
147
|
const h = new Date().valueOf();
|
|
148
148
|
t.dd(i) ||
|
|
149
|
-
(!1 === navigator.onLine && t.type ===
|
|
149
|
+
(!1 === navigator.onLine && t.type === gt.Br.Tr && e.imageUrl
|
|
150
150
|
? r.info(
|
|
151
151
|
`Not showing ${t.type} trigger action ${t.id} due to offline state.`,
|
|
152
152
|
)
|
|
@@ -183,27 +183,27 @@ export default class gr extends y {
|
|
|
183
183
|
};
|
|
184
184
|
let l, a, g;
|
|
185
185
|
switch (t.type) {
|
|
186
|
-
case
|
|
186
|
+
case gt.Br.Tr:
|
|
187
187
|
if (((l = pt(t.data)), null == l)) {
|
|
188
188
|
r.error(
|
|
189
189
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
190
190
|
);
|
|
191
191
|
break;
|
|
192
192
|
}
|
|
193
|
-
if (((a = this.ig.
|
|
193
|
+
if (((a = this.ig.Ki(l)), a)) {
|
|
194
194
|
r.error(a), o();
|
|
195
195
|
break;
|
|
196
196
|
}
|
|
197
197
|
n(l);
|
|
198
198
|
break;
|
|
199
|
-
case
|
|
200
|
-
if (((g = wt.fromJson(t.data, n, o, i, t.
|
|
199
|
+
case gt.Br.md:
|
|
200
|
+
if (((g = wt.fromJson(t.data, n, o, i, t.Gr || 0)), null == g)) {
|
|
201
201
|
r.error(
|
|
202
202
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
203
203
|
);
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
|
-
this.ig.
|
|
206
|
+
this.ig.Wi(g, s, e);
|
|
207
207
|
break;
|
|
208
208
|
default:
|
|
209
209
|
r.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
|
|
@@ -211,7 +211,7 @@ export default class gr extends y {
|
|
|
211
211
|
}
|
|
212
212
|
fe(t, i = null, s) {
|
|
213
213
|
if (!J(tt, t, "Cannot fire trigger action.", "TriggerEvents")) return;
|
|
214
|
-
if (this.zi && this.zi.
|
|
214
|
+
if (this.zi && this.zi.zu())
|
|
215
215
|
return (
|
|
216
216
|
r.info(
|
|
217
217
|
"Trigger sync is currently in progress, awaiting sync completion before firing trigger event.",
|
|
@@ -295,7 +295,7 @@ export default class gr extends y {
|
|
|
295
295
|
this.fg(), t.id && (this.ng[t.id] = this.ng[t.id] || []);
|
|
296
296
|
const h = {};
|
|
297
297
|
let n;
|
|
298
|
-
(h.
|
|
298
|
+
(h.Er = i), (h.ug = s), null != e && (n = e.Y()), (h.dg = n);
|
|
299
299
|
const l = [];
|
|
300
300
|
for (const t of r) t.id && l.push(t.id);
|
|
301
301
|
(h.pg = l),
|
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-${"5.
|
|
4
|
+
s = `ab-${t}-css-definitions-${"5.4.0".replace(/\./g, "-")}`;
|
|
5
5
|
if (!c) return;
|
|
6
6
|
const a = c.ownerDocument || document;
|
|
7
7
|
if (null == a.getElementById(s)) {
|
package/src/ui/js/feed-css.js
CHANGED
|
@@ -4,7 +4,7 @@ export function attachFeedCSS(t) {
|
|
|
4
4
|
Ce(
|
|
5
5
|
t,
|
|
6
6
|
"feed",
|
|
7
|
-
"body>.ab-feed{position:fixed;top:0;right:0;bottom:0;width:421px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}body>.ab-feed .ab-feed-body{position:absolute;top:0;left:0;right:0;border:none;border-left:1px solid #d0d0d0;padding-top:70px;min-height:100%}body>.ab-feed .ab-initial-spinner{float:none}body>.ab-feed .ab-no-cards-message{position:absolute;width:100%;margin-left:-20px;top:40%}.ab-feed{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0 1px 7px 1px rgba(66,82,113,.15);-moz-box-shadow:0 1px 7px 1px rgba(66,82,113,.15);box-shadow:0 1px 7px 1px rgba(66,82,113,.15);width:402px;background-color:#eee;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;font-size:13px;line-height:130%;letter-spacing:normal;overflow-y:auto;overflow-x:visible;z-index:9011;-webkit-overflow-scrolling:touch}.ab-feed :focus,.ab-feed:focus{outline:0}.ab-feed .ab-feed-body{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid #d0d0d0;border-top:none;padding:20px 20px 0 20px}.ab-feed.ab-effect-slide{-webkit-transform:translateX(450px);-moz-transform:translateX(450px);-ms-transform:translateX(450px);transform:translateX(450px);-webkit-transition:transform .5s ease-in-out;-moz-transition:transform .5s ease-in-out;-o-transition:transform .5s ease-in-out;transition:transform .5s ease-in-out}.ab-feed.ab-effect-slide.ab-show{-webkit-transform:translateX(0);-moz-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.ab-feed.ab-effect-slide.ab-hide{-webkit-transform:translateX(450px);-moz-transform:translateX(450px);-ms-transform:translateX(450px);transform:translateX(450px)}.ab-feed .ab-card{position:relative;-webkit-box-shadow:0 2px 3px 0 rgba(178,178,178,.5);-moz-box-shadow:0 2px 3px 0 rgba(178,178,178,.5);box-shadow:0 2px 3px 0 rgba(178,178,178,.5);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;width:100%;border:1px solid #d0d0d0;margin-bottom:20px;overflow:hidden;background-color:#fff;-webkit-transition:height .4s ease-in-out,margin .4s ease-in-out;-moz-transition:height .4s ease-in-out,margin .4s ease-in-out;-o-transition:height .4s ease-in-out,margin .4s ease-in-out;transition:height .4s ease-in-out,margin .4s ease-in-out}.ab-feed .ab-card .ab-pinned-indicator{position:absolute;right:0;top:0;margin-right:-1px;width:0;height:0;border-style:solid;border-width:0 24px 24px 0;border-color:transparent #1676d0 transparent transparent}.ab-feed .ab-card .ab-pinned-indicator .fa-star{position:absolute;right:-21px;top:2px;font-size:9px;color:#fff}.ab-feed .ab-card.ab-effect-card.ab-hide{-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out}.ab-feed .ab-card.ab-effect-card.ab-hide.ab-swiped-left{-webkit-transform:translateX(-450px);-moz-transform:translateX(-450px);-ms-transform:translateX(-450px);transform:translateX(-450px)}.ab-feed .ab-card.ab-effect-card.ab-hide.ab-swiped-right{-webkit-transform:translateX(450px);-moz-transform:translateX(450px);-ms-transform:translateX(450px);transform:translateX(450px)}.ab-feed .ab-card.ab-effect-card.ab-hide:not(.ab-swiped-left):not(.ab-swiped-right){opacity:0}.ab-feed .ab-card .ab-close-button{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-color:transparent;background-size:15px;border:none;width:15px;min-width:15px;height:15px;cursor:pointer;display:block;font-size:15px;line-height:0;padding-top:15px;padding-right:15px;padding-left:15px;padding-bottom:15px;position:absolute;
|
|
7
|
+
"body>.ab-feed{position:fixed;top:0;right:0;bottom:0;width:421px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}body>.ab-feed .ab-feed-body{position:absolute;top:0;left:0;right:0;border:none;border-left:1px solid #d0d0d0;padding-top:70px;min-height:100%}body>.ab-feed .ab-initial-spinner{float:none}body>.ab-feed .ab-no-cards-message{position:absolute;width:100%;margin-left:-20px;top:40%}.ab-feed{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0 1px 7px 1px rgba(66,82,113,.15);-moz-box-shadow:0 1px 7px 1px rgba(66,82,113,.15);box-shadow:0 1px 7px 1px rgba(66,82,113,.15);width:402px;background-color:#eee;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;font-size:13px;line-height:130%;letter-spacing:normal;overflow-y:auto;overflow-x:visible;z-index:9011;-webkit-overflow-scrolling:touch}.ab-feed :focus,.ab-feed:focus{outline:0}.ab-feed .ab-feed-body{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid #d0d0d0;border-top:none;padding:20px 20px 0 20px}.ab-feed.ab-effect-slide{-webkit-transform:translateX(450px);-moz-transform:translateX(450px);-ms-transform:translateX(450px);transform:translateX(450px);-webkit-transition:transform .5s ease-in-out;-moz-transition:transform .5s ease-in-out;-o-transition:transform .5s ease-in-out;transition:transform .5s ease-in-out}.ab-feed.ab-effect-slide.ab-show{-webkit-transform:translateX(0);-moz-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.ab-feed.ab-effect-slide.ab-hide{-webkit-transform:translateX(450px);-moz-transform:translateX(450px);-ms-transform:translateX(450px);transform:translateX(450px)}.ab-feed .ab-card{position:relative;-webkit-box-shadow:0 2px 3px 0 rgba(178,178,178,.5);-moz-box-shadow:0 2px 3px 0 rgba(178,178,178,.5);box-shadow:0 2px 3px 0 rgba(178,178,178,.5);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;width:100%;border:1px solid #d0d0d0;margin-bottom:20px;overflow:hidden;background-color:#fff;-webkit-transition:height .4s ease-in-out,margin .4s ease-in-out;-moz-transition:height .4s ease-in-out,margin .4s ease-in-out;-o-transition:height .4s ease-in-out,margin .4s ease-in-out;transition:height .4s ease-in-out,margin .4s ease-in-out}.ab-feed .ab-card .ab-pinned-indicator{position:absolute;right:0;top:0;margin-right:-1px;width:0;height:0;border-style:solid;border-width:0 24px 24px 0;border-color:transparent #1676d0 transparent transparent}.ab-feed .ab-card .ab-pinned-indicator .fa-star{position:absolute;right:-21px;top:2px;font-size:9px;color:#fff}.ab-feed .ab-card.ab-effect-card.ab-hide{-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out}.ab-feed .ab-card.ab-effect-card.ab-hide.ab-swiped-left{-webkit-transform:translateX(-450px);-moz-transform:translateX(-450px);-ms-transform:translateX(-450px);transform:translateX(-450px)}.ab-feed .ab-card.ab-effect-card.ab-hide.ab-swiped-right{-webkit-transform:translateX(450px);-moz-transform:translateX(450px);-ms-transform:translateX(450px);transform:translateX(450px)}.ab-feed .ab-card.ab-effect-card.ab-hide:not(.ab-swiped-left):not(.ab-swiped-right){opacity:0}.ab-feed .ab-card .ab-close-button{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-color:transparent;background-size:15px;border:none;width:15px;min-width:15px;height:15px;cursor:pointer;display:block;font-size:15px;line-height:0;padding-top:15px;padding-right:15px;padding-left:15px;padding-bottom:15px;position:absolute;top:0;z-index:9021;opacity:0;-webkit-transition:.5s;-moz-transition:.5s;-o-transition:.5s;transition:.5s}.ab-feed .ab-card .ab-close-button[dir=rtl]{left:0}.ab-feed .ab-card .ab-close-button[dir=ltr]{right:0}.ab-feed .ab-card .ab-close-button svg{-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease;fill:#9b9b9b;height:auto;width:100%}.ab-feed .ab-card .ab-close-button svg.ab-chevron{display:none}.ab-feed .ab-card .ab-close-button:active{background-color:transparent}.ab-feed .ab-card .ab-close-button:focus{background-color:transparent}.ab-feed .ab-card .ab-close-button:hover{background-color:transparent}.ab-feed .ab-card .ab-close-button:hover svg{fill-opacity:.8}.ab-feed .ab-card .ab-close-button:hover{opacity:1}.ab-feed .ab-card .ab-close-button:focus{opacity:1}.ab-feed .ab-card a{float:none;color:inherit;text-decoration:none}.ab-feed .ab-card a:hover{text-decoration:underline}.ab-feed .ab-card .ab-image-area{float:none;display:inline-block;vertical-align:top;line-height:0;overflow:hidden;width:100%;-webkit-box-sizing:initial;-moz-box-sizing:initial;box-sizing:initial}.ab-feed .ab-card .ab-image-area img{float:none;height:auto;width:100%}.ab-feed .ab-card.ab-image-only .ab-card-body{display:none}.ab-feed .ab-card .ab-card-body{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:inline-block;width:100%;position:relative}.ab-feed .ab-card .ab-unread-indicator{position:absolute;bottom:0;margin-right:-1px;width:100%;height:5px;background-color:#1676d0}.ab-feed .ab-card .ab-unread-indicator.read{background-color:transparent}.ab-feed .ab-card .ab-title{float:none;letter-spacing:0;margin:0;font-weight:700;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;display:block;overflow:hidden;word-wrap:break-word;text-overflow:ellipsis;font-size:18px;line-height:130%;padding:20px 25px 0 25px}.ab-feed .ab-card .ab-description{float:none;color:#545454;padding:15px 25px 20px 25px;word-wrap:break-word;white-space:pre-wrap}.ab-feed .ab-card .ab-description.ab-no-title{padding-top:20px}.ab-feed .ab-card .ab-url-area{float:none;color:#1676d0;margin-top:12px;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif}.ab-feed .ab-card.ab-classic-card .ab-card-body{min-height:40px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.ab-feed .ab-card.ab-classic-card.with-image .ab-card-body{min-height:100px}.ab-feed .ab-card.ab-classic-card.with-image .ab-card-body[dir=ltr]{padding-left:72px}.ab-feed .ab-card.ab-classic-card.with-image .ab-card-body[dir=rtl]{padding-right:72px}.ab-feed .ab-card.ab-classic-card.with-image .ab-image-area{width:60px;height:60px;padding:20px 0 25px 25px;position:absolute}.ab-feed .ab-card.ab-classic-card.with-image .ab-image-area[dir=rtl]{padding:20px 25px 25px 0}.ab-feed .ab-card.ab-classic-card.with-image .ab-image-area img{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;max-width:100%;max-height:100%;width:auto;height:auto}.ab-feed .ab-card.ab-classic-card.with-image .ab-title{background-color:transparent;font-size:16px}.ab-feed .ab-card.ab-classic-card.with-image .ab-description{padding-top:10px}.ab-feed .ab-card.ab-control-card{height:0;width:0;margin:0;border:0}.ab-feed .ab-feed-buttons-wrapper{float:none;position:relative;background-color:#282828;height:50px;-webkit-box-shadow:0 2px 3px 0 rgba(178,178,178,.5);-moz-box-shadow:0 2px 3px 0 rgba(178,178,178,.5);box-shadow:0 2px 3px 0 rgba(178,178,178,.5);z-index:1}.ab-feed .ab-feed-buttons-wrapper .ab-close-button,.ab-feed .ab-feed-buttons-wrapper .ab-refresh-button{float:none;cursor:pointer;color:#fff;font-size:18px;padding:16px;-webkit-transition:.2s;-moz-transition:.2s;-o-transition:.2s;transition:.2s}.ab-feed .ab-feed-buttons-wrapper .ab-close-button:hover,.ab-feed .ab-feed-buttons-wrapper .ab-refresh-button:hover{font-size:22px}.ab-feed .ab-feed-buttons-wrapper .ab-close-button{float:right}.ab-feed .ab-feed-buttons-wrapper .ab-close-button:hover{padding-top:12px;padding-right:14px}.ab-feed .ab-feed-buttons-wrapper .ab-refresh-button{padding-left:17px}.ab-feed .ab-feed-buttons-wrapper .ab-refresh-button:hover{padding-top:13px;padding-left:14px}.ab-feed .ab-no-cards-message{text-align:center;margin-bottom:20px}@media (max-width:600px){body>.ab-feed{width:100%}}",
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
export function setupFeedUI() {
|