@braze/web-sdk 4.6.3 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +13 -8
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +2 -2
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +18 -17
- package/shared-lib/indexed-db-adapter.js +2 -2
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +15 -15
- package/src/Core/handle-braze-action.js +40 -34
- package/src/Core/log-custom-event.js +2 -7
- package/src/Core/log-purchase.js +3 -3
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag.js +33 -16
- package/src/FeatureFlags/feature-flags-provider.js +86 -75
- package/src/FeatureFlags/get-all-feature-flags.js +5 -5
- package/src/FeatureFlags/get-feature-flag.js +6 -6
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/types.js +1 -0
- package/src/Feed/feed-provider.js +17 -17
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +135 -120
- package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
- package/src/InAppMessage/display/modal-utils.js +6 -6
- package/src/InAppMessage/in-app-message-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager.js +65 -65
- package/src/InAppMessage/log-in-app-message-button-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +1 -1
- 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 +80 -80
- package/src/InAppMessage/models/modal-message.js +2 -2
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- package/src/InAppMessage/models/templated-in-app-message.js +4 -4
- 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.js +216 -209
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +11 -8
- package/src/User/user.js +52 -41
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/auth-manager.js +24 -24
- package/src/managers/braze-instance.js +120 -120
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +63 -54
- package/src/managers/server-config-manager.js +20 -20
- package/src/managers/session-manager.js +29 -29
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +104 -104
- package/src/managers/subscription-manager.js +6 -6
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +15 -15
- package/src/request-controller.js +92 -88
- package/src/triggers/models/custom-event-data.js +4 -4
- 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 +63 -63
- package/src/triggers/models/in-app-message-click-data.js +5 -5
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +9 -9
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +48 -48
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +29 -29
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +87 -89
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +4 -4
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +8 -8
- package/src/util/browser-detector.js +8 -8
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/code-utils.js +10 -3
- package/src/util/component-utils.js +1 -1
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +9 -9
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/user-agent-parser.js +4 -4
- package/src/util/validation-utils.js +155 -74
- package/src/util/window-utils.js +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import Gt from "./filter-set.js";
|
|
2
|
+
export default class ts {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.productId = t), (this.
|
|
4
|
+
(this.productId = t), (this.Gl = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.productId || null == this.
|
|
6
|
+
Jl(t) {
|
|
7
|
+
if (null == this.productId || null == this.Gl) return !1;
|
|
8
8
|
const s = t[0],
|
|
9
9
|
i = t[1];
|
|
10
|
-
return s === this.productId && this.
|
|
10
|
+
return s === this.productId && this.Gl.Jl(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
|
-
return new
|
|
13
|
+
return new ts(
|
|
14
14
|
t ? t.product_id : null,
|
|
15
|
-
t ?
|
|
15
|
+
t ? Gt.fromJson(t.property_filters) : null
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
ss() {
|
|
19
|
-
return { id: this.productId, pf: this.
|
|
19
|
+
return { id: this.productId, pf: this.Gl.ss() };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import Yt from "./trigger-condition.js";
|
|
2
|
+
export default class lr {
|
|
3
3
|
constructor(t) {
|
|
4
4
|
this.fu = t;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
return null == this.fu ||
|
|
6
|
+
Jl(t) {
|
|
7
|
+
return null == this.fu || Yt.gu(t[0], this.fu);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t) {
|
|
10
|
-
return new
|
|
10
|
+
return new lr(t ? t.campaign_id : null);
|
|
11
11
|
}
|
|
12
12
|
ss() {
|
|
13
13
|
return this.fu;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import xt from "./custom-event-data.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import Ht from "./custom-event-property-data.js";
|
|
3
|
+
import Gt from "./filter-set.js";
|
|
4
|
+
import Zt from "./in-app-message-click-data.js";
|
|
5
|
+
import $t from "./purchase-data.js";
|
|
6
|
+
import ts from "./purchase-property-data.js";
|
|
7
|
+
import lr from "./push-click-data.js";
|
|
8
8
|
import V from "./trigger-events.js";
|
|
9
9
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
10
|
-
export default class
|
|
10
|
+
export default class Yt {
|
|
11
11
|
constructor(e, t) {
|
|
12
12
|
(this.type = e), (this.data = t);
|
|
13
13
|
}
|
|
14
14
|
ec(e, t) {
|
|
15
|
-
return
|
|
15
|
+
return Yt.tc[this.type] === e && (null == this.data || this.data.Jl(t));
|
|
16
16
|
}
|
|
17
17
|
static gu(e, t) {
|
|
18
18
|
let a = null;
|
|
@@ -29,81 +29,81 @@ export default class Kt {
|
|
|
29
29
|
const t = e.type;
|
|
30
30
|
let r;
|
|
31
31
|
switch (t) {
|
|
32
|
-
case
|
|
32
|
+
case Yt.rc.OPEN:
|
|
33
33
|
r = null;
|
|
34
34
|
break;
|
|
35
|
-
case
|
|
36
|
-
r =
|
|
35
|
+
case Yt.rc.Rr:
|
|
36
|
+
r = $t.fromJson(e.data);
|
|
37
37
|
break;
|
|
38
|
-
case
|
|
39
|
-
r =
|
|
38
|
+
case Yt.rc.ac:
|
|
39
|
+
r = ts.fromJson(e.data);
|
|
40
40
|
break;
|
|
41
|
-
case
|
|
42
|
-
r =
|
|
41
|
+
case Yt.rc.vr:
|
|
42
|
+
r = lr.fromJson(e.data);
|
|
43
43
|
break;
|
|
44
|
-
case
|
|
44
|
+
case Yt.rc.be:
|
|
45
45
|
r = xt.fromJson(e.data);
|
|
46
46
|
break;
|
|
47
|
-
case
|
|
48
|
-
r =
|
|
47
|
+
case Yt.rc.sc:
|
|
48
|
+
r = Ht.fromJson(e.data);
|
|
49
49
|
break;
|
|
50
|
-
case
|
|
51
|
-
r =
|
|
50
|
+
case Yt.rc.Mr:
|
|
51
|
+
r = Zt.fromJson(e.data);
|
|
52
52
|
break;
|
|
53
|
-
case
|
|
53
|
+
case Yt.rc.ks:
|
|
54
54
|
r = null;
|
|
55
55
|
}
|
|
56
|
-
return new
|
|
56
|
+
return new Yt(t, r);
|
|
57
57
|
}
|
|
58
58
|
ss() {
|
|
59
59
|
return { t: this.type, d: this.data ? this.data.ss() : null };
|
|
60
60
|
}
|
|
61
|
-
static
|
|
61
|
+
static Pn(e) {
|
|
62
62
|
let t, r;
|
|
63
63
|
switch (e.t) {
|
|
64
|
-
case
|
|
64
|
+
case Yt.rc.OPEN:
|
|
65
65
|
t = null;
|
|
66
66
|
break;
|
|
67
|
-
case
|
|
68
|
-
t = new
|
|
67
|
+
case Yt.rc.Rr:
|
|
68
|
+
t = new $t(e.d);
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
71
|
-
(r = e.d || {}), (t = new
|
|
70
|
+
case Yt.rc.ac:
|
|
71
|
+
(r = e.d || {}), (t = new ts(r.id, Gt.Pn(r.pf || [])));
|
|
72
72
|
break;
|
|
73
|
-
case
|
|
74
|
-
t = new
|
|
73
|
+
case Yt.rc.vr:
|
|
74
|
+
t = new lr(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
76
|
+
case Yt.rc.be:
|
|
77
77
|
t = new xt(e.d);
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
80
|
-
(r = e.d || {}), (t = new
|
|
79
|
+
case Yt.rc.sc:
|
|
80
|
+
(r = e.d || {}), (t = new Ht(r.e, Gt.Pn(r.pf || [])));
|
|
81
81
|
break;
|
|
82
|
-
case
|
|
83
|
-
t = new
|
|
82
|
+
case Yt.rc.Mr:
|
|
83
|
+
t = new Zt(e.d);
|
|
84
84
|
break;
|
|
85
|
-
case
|
|
85
|
+
case Yt.rc.ks:
|
|
86
86
|
t = null;
|
|
87
87
|
}
|
|
88
|
-
return new
|
|
88
|
+
return new Yt(e.t, t);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
(
|
|
91
|
+
(Yt.rc = {
|
|
92
92
|
OPEN: "open",
|
|
93
93
|
Rr: "purchase",
|
|
94
94
|
ac: "purchase_property",
|
|
95
95
|
vr: "push_click",
|
|
96
96
|
be: "custom_event",
|
|
97
97
|
sc: "custom_event_property",
|
|
98
|
-
|
|
98
|
+
Mr: "iam_click",
|
|
99
99
|
ks: "test"
|
|
100
100
|
}),
|
|
101
|
-
(
|
|
102
|
-
(
|
|
103
|
-
(
|
|
104
|
-
(
|
|
105
|
-
(
|
|
106
|
-
(
|
|
107
|
-
(
|
|
108
|
-
(
|
|
109
|
-
(
|
|
101
|
+
(Yt.tc = {}),
|
|
102
|
+
(Yt.tc[Yt.rc.OPEN] = V.OPEN),
|
|
103
|
+
(Yt.tc[Yt.rc.Rr] = V.Rr),
|
|
104
|
+
(Yt.tc[Yt.rc.ac] = V.Rr),
|
|
105
|
+
(Yt.tc[Yt.rc.vr] = V.vr),
|
|
106
|
+
(Yt.tc[Yt.rc.be] = V.be),
|
|
107
|
+
(Yt.tc[Yt.rc.sc] = V.be),
|
|
108
|
+
(Yt.tc[Yt.rc.Mr] = V.Mr),
|
|
109
|
+
(Yt.tc[Yt.rc.ks] = V.ks);
|
|
@@ -3,46 +3,46 @@ import {
|
|
|
3
3
|
rehydrateDateAfterJsonization as w
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
5
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
6
|
-
import
|
|
6
|
+
import Yt from "./trigger-condition.js";
|
|
7
7
|
import { validateValueIsFromEnum as F } from "../../util/code-utils.js";
|
|
8
8
|
export default class pt {
|
|
9
9
|
constructor(t, i, s, e, r, l, o, n, h, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
|
-
(this
|
|
11
|
+
(this.pu = i || []),
|
|
12
12
|
void 0 === s && (s = null),
|
|
13
13
|
(this.startTime = s),
|
|
14
14
|
void 0 === e && (e = null),
|
|
15
15
|
(this.endTime = e),
|
|
16
16
|
(this.priority = r || 0),
|
|
17
17
|
(this.type = l),
|
|
18
|
-
(this.
|
|
19
|
-
null == a && (a = 1e3 * (this.
|
|
20
|
-
(this.
|
|
18
|
+
(this.Du = n || 0),
|
|
19
|
+
null == a && (a = 1e3 * (this.Du + 30)),
|
|
20
|
+
(this.Vi = a),
|
|
21
21
|
(this.data = o),
|
|
22
|
-
null == h && (h = pt.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
22
|
+
null == h && (h = pt.Pu),
|
|
23
|
+
(this.yu = h),
|
|
24
|
+
(this.ju = u),
|
|
25
|
+
(this.wu = d || null);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
Nu(t) {
|
|
28
28
|
return (
|
|
29
|
-
null == this.
|
|
29
|
+
null == this.wu || (this.yu !== pt.Pu && t - this.wu >= 1e3 * this.yu)
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
this.
|
|
32
|
+
vu(t) {
|
|
33
|
+
this.wu = t;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
const i = t + 1e3 * this.
|
|
35
|
+
zu(t) {
|
|
36
|
+
const i = t + 1e3 * this.Du;
|
|
37
37
|
return Math.max(i - new Date().valueOf(), 0);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
Iu(t) {
|
|
40
40
|
const i = new Date().valueOf() - t,
|
|
41
|
-
s = null == t || isNaN(i) || null == this.
|
|
41
|
+
s = null == t || isNaN(i) || null == this.Vi || i < this.Vi;
|
|
42
42
|
return (
|
|
43
43
|
s ||
|
|
44
44
|
r.D.info(
|
|
45
|
-
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.
|
|
45
|
+
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.Vi}ms.`
|
|
46
46
|
),
|
|
47
47
|
!s
|
|
48
48
|
);
|
|
@@ -51,7 +51,7 @@ export default class pt {
|
|
|
51
51
|
const i = t.id,
|
|
52
52
|
s = [];
|
|
53
53
|
for (let i = 0; i < t.trigger_condition.length; i++)
|
|
54
|
-
s.push(
|
|
54
|
+
s.push(Yt.fromJson(t.trigger_condition[i]));
|
|
55
55
|
const e = h(t.start_time),
|
|
56
56
|
r = h(t.end_time),
|
|
57
57
|
l = t.priority,
|
|
@@ -62,7 +62,7 @@ export default class pt {
|
|
|
62
62
|
d = t.data,
|
|
63
63
|
m = t.min_seconds_since_last_trigger;
|
|
64
64
|
return F(
|
|
65
|
-
pt.
|
|
65
|
+
pt.Ki,
|
|
66
66
|
o,
|
|
67
67
|
"Could not construct Trigger from server data",
|
|
68
68
|
"Trigger.Types"
|
|
@@ -72,7 +72,7 @@ export default class pt {
|
|
|
72
72
|
}
|
|
73
73
|
ss() {
|
|
74
74
|
const t = [];
|
|
75
|
-
for (let i = 0; i < this
|
|
75
|
+
for (let i = 0; i < this.pu.length; i++) t.push(this.pu[i].ss());
|
|
76
76
|
return {
|
|
77
77
|
i: this.id,
|
|
78
78
|
c: t,
|
|
@@ -81,16 +81,16 @@ export default class pt {
|
|
|
81
81
|
p: this.priority,
|
|
82
82
|
t: this.type,
|
|
83
83
|
da: this.data,
|
|
84
|
-
d: this.
|
|
85
|
-
r: this.
|
|
86
|
-
tm: this.
|
|
87
|
-
ss: this.
|
|
88
|
-
ld: this.
|
|
84
|
+
d: this.Du,
|
|
85
|
+
r: this.yu,
|
|
86
|
+
tm: this.Vi,
|
|
87
|
+
ss: this.ju,
|
|
88
|
+
ld: this.wu
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
static
|
|
91
|
+
static Pn(t) {
|
|
92
92
|
const i = [];
|
|
93
|
-
for (let s = 0; s < t.c.length; s++) i.push(
|
|
93
|
+
for (let s = 0; s < t.c.length; s++) i.push(Yt.Pn(t.c[s]));
|
|
94
94
|
return new pt(
|
|
95
95
|
t.i,
|
|
96
96
|
i,
|
|
@@ -107,4 +107,4 @@ export default class pt {
|
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
(pt.
|
|
110
|
+
(pt.Pu = -1), (pt.Ki = { Ji: "inapp", $u: "templated_iam" });
|
|
@@ -7,10 +7,10 @@ export const TriggersProviderFactory = {
|
|
|
7
7
|
er: () => (TriggersProviderFactory.init(), TriggersProviderFactory.provider),
|
|
8
8
|
rg: () => {
|
|
9
9
|
if (!TriggersProviderFactory.provider) {
|
|
10
|
-
const r = e.nn(T.
|
|
10
|
+
const r = e.nn(T._o);
|
|
11
11
|
(TriggersProviderFactory.provider = new gr(
|
|
12
12
|
null != r ? r : 30,
|
|
13
|
-
pe.m().
|
|
13
|
+
pe.m().Qe(),
|
|
14
14
|
e.l(),
|
|
15
15
|
e.mr(),
|
|
16
16
|
pe.m()
|