@braze/web-sdk 6.3.1 → 6.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 +35 -3
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +23 -23
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +7 -7
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +22 -21
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/display/detect-banner-impressions.js +7 -7
- package/src/Banner/index.js +2 -0
- package/src/Banner/request-banners-refresh.js +6 -6
- package/src/Banner/ui/insert-banner.js +4 -4
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +4 -4
- package/src/Card/display/card-display.js +7 -7
- package/src/Card/log-card-dismissal.js +3 -3
- package/src/Card/log-content-card-click.js +3 -3
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/card.js +7 -7
- package/src/Card/util/card-factory.js +6 -6
- package/src/ContentCards/content-cards-provider-factory.js +14 -10
- package/src/ContentCards/content-cards-provider.js +28 -28
- package/src/ContentCards/content-cards.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 +3 -3
- package/src/ContentCards/ui/show-content-cards.js +8 -8
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +5 -5
- package/src/Core/disable-sdk.js +3 -3
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-user.js +1 -1
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +9 -9
- package/src/Core/log-purchase.js +7 -7
- package/src/Core/open-session.js +11 -11
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +5 -5
- package/src/DUST/dust-provider-factory.js +20 -0
- package/src/DUST/dust-provider.js +288 -0
- package/src/DUST/index.js +3 -0
- package/src/DUST/subscribe-to-dust.js +24 -0
- package/src/DUST/types.js +1 -0
- package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +38 -38
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +5 -5
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +5 -5
- 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 +80 -80
- package/src/InAppMessage/log-in-app-message-button-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +12 -12
- package/src/InAppMessage/models/html-message.js +14 -14
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +119 -121
- package/src/InAppMessage/models/modal-message.js +12 -12
- package/src/InAppMessage/models/slide-up-message.js +21 -21
- 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/remove-all-visible-in-app-messages.js +18 -0
- package/src/InAppMessage/ui/show-in-app-message.js +24 -24
- 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 +8 -8
- package/src/Push/push-manager.js +90 -90
- package/src/Push/utils/push-utils.js +17 -17
- package/src/User/user-manager.js +12 -12
- package/src/User/user.js +48 -48
- package/src/common/constants.js +1 -0
- package/src/common/content-cards-display.js +20 -20
- package/src/common/event-logger.js +4 -4
- package/src/common/properties-base.js +16 -16
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +141 -133
- package/src/managers/device-manager.js +18 -18
- package/src/managers/network-manager.js +139 -139
- package/src/managers/server-config-manager.js +99 -82
- package/src/managers/session-manager.js +32 -32
- package/src/managers/storage-manager-factory.js +8 -8
- package/src/managers/storage-manager.js +76 -74
- package/src/managers/subscription-manager.js +10 -10
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +9 -9
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +12 -12
- package/src/models/request-result.js +1 -1
- package/src/models/server-config.js +38 -34
- package/src/request-controller.js +136 -134
- 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 +8 -8
- package/src/triggers/models/filter.js +30 -30
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- 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 +1 -1
- package/src/triggers/models/trigger-condition.js +36 -36
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +15 -15
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +25 -25
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +3 -3
- package/src/util/braze-actions.js +3 -3
- package/src/util/browser-detector.js +13 -13
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +10 -10
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +22 -22
- package/src/util/user-agent-parser.js +14 -14
- package/src/util/validation-utils.js +9 -9
- package/src/util/window-utils.js +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isDate as Nt } from "../../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
|
-
convertMsToSeconds as
|
|
4
|
-
dateFromUnixTimestamp as
|
|
3
|
+
convertMsToSeconds as P,
|
|
4
|
+
dateFromUnixTimestamp as X,
|
|
5
5
|
secondsAgo as es,
|
|
6
6
|
secondsInTheFuture as hs,
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
8
|
-
export default class
|
|
8
|
+
export default class cr {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
10
|
(this.yE = t),
|
|
11
11
|
(this.HE = s),
|
|
@@ -15,48 +15,48 @@ export default class fr {
|
|
|
15
15
|
(this.HE = s),
|
|
16
16
|
(this.comparator = e),
|
|
17
17
|
(this.LE = i),
|
|
18
|
-
this.HE ===
|
|
19
|
-
this.comparator !==
|
|
20
|
-
this.comparator !==
|
|
21
|
-
this.comparator !==
|
|
22
|
-
this.comparator !==
|
|
23
|
-
(this.LE =
|
|
18
|
+
this.HE === cr.XE.QE &&
|
|
19
|
+
this.comparator !== cr.BE.wE &&
|
|
20
|
+
this.comparator !== cr.BE.jE &&
|
|
21
|
+
this.comparator !== cr.BE.zE &&
|
|
22
|
+
this.comparator !== cr.BE.FE &&
|
|
23
|
+
(this.LE = X(this.LE));
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
Bc(t) {
|
|
26
26
|
let s = null;
|
|
27
27
|
switch ((null != t && (s = t[this.yE]), this.comparator)) {
|
|
28
|
-
case
|
|
28
|
+
case cr.BE.kE:
|
|
29
29
|
return null != s && s.valueOf() === this.LE.valueOf();
|
|
30
|
-
case
|
|
30
|
+
case cr.BE.xE:
|
|
31
31
|
return null == s || s.valueOf() !== this.LE.valueOf();
|
|
32
|
-
case
|
|
32
|
+
case cr.BE.JE:
|
|
33
33
|
return null != s && typeof s == typeof this.LE && s > this.LE;
|
|
34
|
-
case
|
|
35
|
-
return this.HE ===
|
|
34
|
+
case cr.BE.wE:
|
|
35
|
+
return this.HE === cr.XE.QE
|
|
36
36
|
? null != s && Nt(s) && es(s) <= this.LE.valueOf()
|
|
37
37
|
: null != s && typeof s == typeof this.LE && s >= this.LE;
|
|
38
|
-
case
|
|
38
|
+
case cr.BE.VE:
|
|
39
39
|
return null != s && typeof s == typeof this.LE && s < this.LE;
|
|
40
|
-
case
|
|
41
|
-
return this.HE ===
|
|
40
|
+
case cr.BE.jE:
|
|
41
|
+
return this.HE === cr.XE.QE
|
|
42
42
|
? null != s && Nt(s) && es(s) >= this.LE.valueOf()
|
|
43
43
|
: null != s && typeof s == typeof this.LE && s <= this.LE;
|
|
44
|
-
case
|
|
44
|
+
case cr.BE.qE:
|
|
45
45
|
return (
|
|
46
46
|
null != s &&
|
|
47
47
|
"string" == typeof s &&
|
|
48
48
|
typeof s == typeof this.LE &&
|
|
49
49
|
null != s.match(this.LE)
|
|
50
50
|
);
|
|
51
|
-
case
|
|
51
|
+
case cr.BE.PE:
|
|
52
52
|
return null != s;
|
|
53
|
-
case
|
|
53
|
+
case cr.BE.WE:
|
|
54
54
|
return null == s;
|
|
55
|
-
case
|
|
55
|
+
case cr.BE.zE:
|
|
56
56
|
return null != s && Nt(s) && hs(s) < this.LE;
|
|
57
|
-
case
|
|
57
|
+
case cr.BE.FE:
|
|
58
58
|
return null != s && Nt(s) && hs(s) > this.LE;
|
|
59
|
-
case
|
|
59
|
+
case cr.BE.ZE:
|
|
60
60
|
return (
|
|
61
61
|
null == s ||
|
|
62
62
|
typeof s != typeof this.LE ||
|
|
@@ -67,7 +67,7 @@ export default class fr {
|
|
|
67
67
|
return !1;
|
|
68
68
|
}
|
|
69
69
|
static fromJson(t) {
|
|
70
|
-
return new
|
|
70
|
+
return new cr(
|
|
71
71
|
t.property_key,
|
|
72
72
|
t.property_type,
|
|
73
73
|
t.comparator,
|
|
@@ -77,16 +77,16 @@ export default class fr {
|
|
|
77
77
|
dt() {
|
|
78
78
|
let t = this.LE;
|
|
79
79
|
return (
|
|
80
|
-
Nt(this.LE) && (t =
|
|
80
|
+
Nt(this.LE) && (t = P(t.valueOf())),
|
|
81
81
|
{ k: this.yE, t: this.HE, c: this.comparator, v: t }
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
|
-
static
|
|
85
|
-
return new
|
|
84
|
+
static Vo(t) {
|
|
85
|
+
return new cr(t.k, t.t, t.c, t.v);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
(
|
|
89
|
-
(
|
|
88
|
+
(cr.XE = { $E: "boolean", tT: "number", sT: "string", QE: "date" }),
|
|
89
|
+
(cr.BE = {
|
|
90
90
|
kE: 1,
|
|
91
91
|
xE: 2,
|
|
92
92
|
JE: 3,
|
|
@@ -3,11 +3,11 @@ export default class us {
|
|
|
3
3
|
constructor(t, s) {
|
|
4
4
|
(this.productId = t), (this.tf = s), (this.productId = t), (this.tf = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
Bc(t) {
|
|
7
7
|
if (null == this.productId || null == this.tf) return !1;
|
|
8
8
|
const s = t[0],
|
|
9
9
|
i = t[1];
|
|
10
|
-
return s === this.productId && this.tf.
|
|
10
|
+
return s === this.productId && this.tf.Bc(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
13
|
return new us(
|
|
@@ -5,15 +5,15 @@ import ui from "./in-app-message-click-data.js";
|
|
|
5
5
|
import ns from "./purchase-data.js";
|
|
6
6
|
import us from "./purchase-property-data.js";
|
|
7
7
|
import ur from "./push-click-data.js";
|
|
8
|
-
import
|
|
8
|
+
import et from "./trigger-events.js";
|
|
9
9
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
10
10
|
import { getErrorMessage as si } from "../../util/error-utils.js";
|
|
11
11
|
export default class ri {
|
|
12
12
|
constructor(e, t) {
|
|
13
13
|
(this.type = e), (this.data = t), (this.type = e), (this.data = t);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
return ri.
|
|
15
|
+
_c(e, t) {
|
|
16
|
+
return ri.Ec[this.type] === e && (null == this.data || this.data.Bc(t));
|
|
17
17
|
}
|
|
18
18
|
static sf(e, t) {
|
|
19
19
|
let r = null;
|
|
@@ -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.gn.OPEN:
|
|
32
|
+
case ri.gn.qs:
|
|
33
33
|
break;
|
|
34
|
-
case ri.
|
|
34
|
+
case ri.gn.Rr:
|
|
35
35
|
r = ns.fromJson(e.data);
|
|
36
36
|
break;
|
|
37
|
-
case ri.
|
|
37
|
+
case ri.gn.Uc:
|
|
38
38
|
r = us.fromJson(e.data);
|
|
39
39
|
break;
|
|
40
|
-
case ri.
|
|
40
|
+
case ri.gn.wr:
|
|
41
41
|
r = ur.fromJson(e.data);
|
|
42
42
|
break;
|
|
43
|
-
case ri.
|
|
43
|
+
case ri.gn.pe:
|
|
44
44
|
r = rs.fromJson(e.data);
|
|
45
45
|
break;
|
|
46
|
-
case ri.
|
|
46
|
+
case ri.gn.Hc:
|
|
47
47
|
r = ls.fromJson(e.data);
|
|
48
48
|
break;
|
|
49
|
-
case ri.
|
|
49
|
+
case ri.gn.Bo:
|
|
50
50
|
r = ui.fromJson(e.data);
|
|
51
51
|
}
|
|
52
52
|
return new ri(t, r);
|
|
@@ -54,50 +54,50 @@ export default class ri {
|
|
|
54
54
|
dt() {
|
|
55
55
|
return { t: this.type, d: this.data ? this.data.dt() : null };
|
|
56
56
|
}
|
|
57
|
-
static
|
|
57
|
+
static Vo(e) {
|
|
58
58
|
let t,
|
|
59
59
|
r = null;
|
|
60
60
|
switch (e.t) {
|
|
61
|
-
case ri.
|
|
62
|
-
case ri.
|
|
61
|
+
case ri.gn.OPEN:
|
|
62
|
+
case ri.gn.qs:
|
|
63
63
|
break;
|
|
64
|
-
case ri.
|
|
64
|
+
case ri.gn.Rr:
|
|
65
65
|
r = new ns(e.d);
|
|
66
66
|
break;
|
|
67
|
-
case ri.
|
|
68
|
-
(t = e.d || {}), (r = new us(t.id, is.
|
|
67
|
+
case ri.gn.Uc:
|
|
68
|
+
(t = e.d || {}), (r = new us(t.id, is.Vo(t.pf || [])));
|
|
69
69
|
break;
|
|
70
|
-
case ri.
|
|
70
|
+
case ri.gn.wr:
|
|
71
71
|
r = new ur(e.d);
|
|
72
72
|
break;
|
|
73
|
-
case ri.
|
|
73
|
+
case ri.gn.pe:
|
|
74
74
|
r = new rs(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case ri.
|
|
77
|
-
(t = e.d || {}), (r = new ls(t.e, is.
|
|
76
|
+
case ri.gn.Hc:
|
|
77
|
+
(t = e.d || {}), (r = new ls(t.e, is.Vo(t.pf || [])));
|
|
78
78
|
break;
|
|
79
|
-
case ri.
|
|
79
|
+
case ri.gn.Bo:
|
|
80
80
|
r = new ui(e.d);
|
|
81
81
|
}
|
|
82
82
|
return new ri(e.t, r);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
(ri.
|
|
85
|
+
(ri.gn = {
|
|
86
86
|
OPEN: "open",
|
|
87
87
|
Rr: "purchase",
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
Uc: "purchase_property",
|
|
89
|
+
wr: "push_click",
|
|
90
90
|
pe: "custom_event",
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
Hc: "custom_event_property",
|
|
92
|
+
Bo: "iam_click",
|
|
93
93
|
qs: "test",
|
|
94
94
|
}),
|
|
95
|
-
(ri.
|
|
96
|
-
(ri.
|
|
97
|
-
(ri.
|
|
98
|
-
(ri.
|
|
99
|
-
(ri.
|
|
100
|
-
(ri.
|
|
101
|
-
(ri.
|
|
102
|
-
(ri.
|
|
103
|
-
(ri.
|
|
95
|
+
(ri.Ec = {}),
|
|
96
|
+
(ri.Ec[ri.gn.OPEN] = et.OPEN),
|
|
97
|
+
(ri.Ec[ri.gn.Rr] = et.Rr),
|
|
98
|
+
(ri.Ec[ri.gn.Uc] = et.Rr),
|
|
99
|
+
(ri.Ec[ri.gn.wr] = et.wr),
|
|
100
|
+
(ri.Ec[ri.gn.pe] = et.pe),
|
|
101
|
+
(ri.Ec[ri.gn.Hc] = et.pe),
|
|
102
|
+
(ri.Ec[ri.gn.Bo] = et.Bo),
|
|
103
|
+
(ri.Ec[ri.gn.qs] = et.qs);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
dateFromUnixTimestamp as
|
|
3
|
-
rehydrateDateAfterJsonization as
|
|
2
|
+
dateFromUnixTimestamp as X,
|
|
3
|
+
rehydrateDateAfterJsonization as Q,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
5
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
6
6
|
import ri from "./trigger-condition.js";
|
|
@@ -16,7 +16,7 @@ export default class pt {
|
|
|
16
16
|
(this.data = l),
|
|
17
17
|
(this.ed = o),
|
|
18
18
|
(this.rd = n),
|
|
19
|
-
(this.
|
|
19
|
+
(this.vn = a),
|
|
20
20
|
(this.hd = u),
|
|
21
21
|
(this.od = d),
|
|
22
22
|
(this.id = t),
|
|
@@ -29,7 +29,7 @@ export default class pt {
|
|
|
29
29
|
(this.type = h),
|
|
30
30
|
(this.ed = o || 0),
|
|
31
31
|
null == a && (a = 1e3 * (this.ed + 30)),
|
|
32
|
-
(this.
|
|
32
|
+
(this.vn = a),
|
|
33
33
|
(this.data = l),
|
|
34
34
|
null != n && (this.rd = n),
|
|
35
35
|
(this.hd = u),
|
|
@@ -49,11 +49,11 @@ export default class pt {
|
|
|
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.vn || i < this.vn;
|
|
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.vn}ms.`,
|
|
57
57
|
),
|
|
58
58
|
!s
|
|
59
59
|
);
|
|
@@ -63,8 +63,8 @@ export default class pt {
|
|
|
63
63
|
s = [];
|
|
64
64
|
for (let i = 0; i < t.trigger_condition.length; i++)
|
|
65
65
|
s.push(ri.fromJson(t.trigger_condition[i]));
|
|
66
|
-
const e =
|
|
67
|
-
r =
|
|
66
|
+
const e = X(t.start_time),
|
|
67
|
+
r = X(t.end_time),
|
|
68
68
|
h = t.priority,
|
|
69
69
|
l = t.type,
|
|
70
70
|
o = t.delay,
|
|
@@ -73,7 +73,7 @@ export default class pt {
|
|
|
73
73
|
u = t.data,
|
|
74
74
|
d = t.min_seconds_since_last_trigger;
|
|
75
75
|
return ta(
|
|
76
|
-
pt.
|
|
76
|
+
pt.gn,
|
|
77
77
|
l,
|
|
78
78
|
"Could not construct Trigger from server data",
|
|
79
79
|
"Trigger.Types",
|
|
@@ -94,20 +94,20 @@ export default class pt {
|
|
|
94
94
|
da: this.data,
|
|
95
95
|
d: this.ed,
|
|
96
96
|
r: this.rd,
|
|
97
|
-
tm: this.
|
|
97
|
+
tm: this.vn,
|
|
98
98
|
ss: this.hd,
|
|
99
99
|
ld: this.od,
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
static
|
|
102
|
+
static Vo(t) {
|
|
103
103
|
const i = [],
|
|
104
104
|
s = t.c || [];
|
|
105
|
-
for (let t = 0; t < s.length; t++) i.push(ri.
|
|
105
|
+
for (let t = 0; t < s.length; t++) i.push(ri.Vo(s[t]));
|
|
106
106
|
return new pt(
|
|
107
107
|
t.i,
|
|
108
108
|
i,
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
Q(t.s),
|
|
110
|
+
Q(t.e),
|
|
111
111
|
t.p,
|
|
112
112
|
t.t,
|
|
113
113
|
t.da,
|
|
@@ -119,4 +119,4 @@ export default class pt {
|
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
(pt.
|
|
122
|
+
(pt.gn = { fn: "inapp", md: "templated_iam" }), (pt.td = -1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import se from "../InAppMessage/in-app-message-manager-factory.js";
|
|
2
|
-
import r, { OPTIONS as
|
|
2
|
+
import r, { OPTIONS as q } from "../managers/braze-instance.js";
|
|
3
3
|
import gr from "./triggers-provider.js";
|
|
4
4
|
export const TriggersProviderFactory = {
|
|
5
5
|
i: !1,
|
|
@@ -11,10 +11,10 @@ export const TriggersProviderFactory = {
|
|
|
11
11
|
),
|
|
12
12
|
rg: () => {
|
|
13
13
|
if (!TriggersProviderFactory.provider) {
|
|
14
|
-
const i = r.ee(
|
|
14
|
+
const i = r.ee(q.Xh);
|
|
15
15
|
(TriggersProviderFactory.provider = new gr(
|
|
16
16
|
null != i ? i : 30,
|
|
17
|
-
se.ea().
|
|
17
|
+
se.ea().Nr(),
|
|
18
18
|
r.p(),
|
|
19
19
|
r.nn(),
|
|
20
20
|
se.ea(),
|
|
@@ -2,14 +2,14 @@ import t from "../common/base-provider.js";
|
|
|
2
2
|
import { newInAppMessageFromJson as ut } from "../InAppMessage/in-app-message-factory.js";
|
|
3
3
|
import ue from "../models/braze-event.js";
|
|
4
4
|
import {
|
|
5
|
-
isArray as
|
|
5
|
+
isArray as z,
|
|
6
6
|
isEqual as ii,
|
|
7
7
|
validateValueIsFromEnum as ta,
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
10
10
|
import wt from "../InAppMessage/models/templated-in-app-message.js";
|
|
11
11
|
import pt from "./models/trigger.js";
|
|
12
|
-
import
|
|
12
|
+
import et from "./models/trigger-events.js";
|
|
13
13
|
import { logger as E } from "../../shared-lib/index.js";
|
|
14
14
|
export default class gr extends t {
|
|
15
15
|
constructor(t, i, s, e, r) {
|
|
@@ -17,12 +17,12 @@ export default class gr extends t {
|
|
|
17
17
|
(this.tg = t),
|
|
18
18
|
(this.ws = i),
|
|
19
19
|
(this.j = s),
|
|
20
|
-
(this.
|
|
20
|
+
(this.au = e),
|
|
21
21
|
(this.ig = r),
|
|
22
22
|
(this.tg = t),
|
|
23
23
|
(this.ws = i),
|
|
24
24
|
(this.j = s),
|
|
25
|
-
(this.
|
|
25
|
+
(this.au = e),
|
|
26
26
|
(this.ig = r),
|
|
27
27
|
(this.sg = []),
|
|
28
28
|
(this.eg = []),
|
|
@@ -50,7 +50,7 @@ export default class gr extends t {
|
|
|
50
50
|
this.lg = this.j.lt(s.ct.nE) || 0;
|
|
51
51
|
const t = this.j.lt(s.ct.oE) || [],
|
|
52
52
|
i = [];
|
|
53
|
-
for (let s = 0; s < t.length; s++) i.push(pt.
|
|
53
|
+
for (let s = 0; s < t.length; s++) i.push(pt.Vo(t[s]));
|
|
54
54
|
(this.triggers = i), this.fg();
|
|
55
55
|
}
|
|
56
56
|
gg() {
|
|
@@ -70,19 +70,19 @@ export default class gr extends t {
|
|
|
70
70
|
h = [];
|
|
71
71
|
for (let r = 0; r < t.length; r++) {
|
|
72
72
|
const n = t[r],
|
|
73
|
-
o = s.ud(n.
|
|
73
|
+
o = s.ud(n.jn || 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 && ue.gE(n.dg) && (r = ue.
|
|
78
|
+
null != n.dg && ue.gE(n.dg) && (r = ue.Vo(n.dg));
|
|
79
79
|
const l = [];
|
|
80
|
-
if (n.pg &&
|
|
80
|
+
if (n.pg && z(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.jn || 0, t, r, l), o));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
this.ng[s.id].length > h.length &&
|
|
@@ -109,7 +109,7 @@ export default class gr extends t {
|
|
|
109
109
|
N(t) {
|
|
110
110
|
let i = !1;
|
|
111
111
|
if (null != t && t.triggers) {
|
|
112
|
-
this.ig.
|
|
112
|
+
this.ig.kn(), this.fg();
|
|
113
113
|
const e = {},
|
|
114
114
|
r = {};
|
|
115
115
|
this.triggers = [];
|
|
@@ -121,7 +121,7 @@ export default class gr extends t {
|
|
|
121
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
123
|
for (let t = 0; t < h.sd.length; t++)
|
|
124
|
-
if (h.sd[t].
|
|
124
|
+
if (h.sd[t]._c(et.qs, null)) {
|
|
125
125
|
i = !0;
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
@@ -134,8 +134,8 @@ export default class gr extends t {
|
|
|
134
134
|
this.mg(),
|
|
135
135
|
i &&
|
|
136
136
|
(E.info("Trigger with test condition found, firing test."),
|
|
137
|
-
this.ve(
|
|
138
|
-
this.ve(
|
|
137
|
+
this.ve(et.qs)),
|
|
138
|
+
this.ve(et.OPEN);
|
|
139
139
|
const h = this.sg;
|
|
140
140
|
let n;
|
|
141
141
|
this.sg = [];
|
|
@@ -148,12 +148,12 @@ export default class gr extends t {
|
|
|
148
148
|
this.fg();
|
|
149
149
|
const r = new Date().valueOf();
|
|
150
150
|
t.dd(i) ||
|
|
151
|
-
(!1 === navigator.onLine && t.type === pt.
|
|
151
|
+
(!1 === navigator.onLine && t.type === pt.gn.fn && 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.nd(r) && this.wg(t, r, s)
|
|
156
|
-
? 0 === this.ws.
|
|
156
|
+
? 0 === this.ws.he()
|
|
157
157
|
? E.info(
|
|
158
158
|
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
|
|
159
159
|
)
|
|
@@ -185,35 +185,35 @@ export default class gr extends t {
|
|
|
185
185
|
};
|
|
186
186
|
let o, l, a;
|
|
187
187
|
switch (t.type) {
|
|
188
|
-
case pt.
|
|
188
|
+
case pt.gn.fn:
|
|
189
189
|
if (((o = ut(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.Yr(o)), l)) {
|
|
196
196
|
E.error(l), n();
|
|
197
197
|
break;
|
|
198
198
|
}
|
|
199
199
|
h(o);
|
|
200
200
|
break;
|
|
201
|
-
case pt.
|
|
202
|
-
if (((a = wt.fromJson(t.data, h, n, i, t.
|
|
201
|
+
case pt.gn.md:
|
|
202
|
+
if (((a = wt.fromJson(t.data, h, n, i, t.vn || 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.un(a, s, e);
|
|
209
209
|
break;
|
|
210
210
|
default:
|
|
211
211
|
E.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
ve(t, i = null, s) {
|
|
215
|
-
if (!ta(
|
|
216
|
-
if (this.
|
|
215
|
+
if (!ta(et, t, "Cannot fire trigger action.", "TriggerEvents")) return;
|
|
216
|
+
if (this.au && this.au.Mc())
|
|
217
217
|
return (
|
|
218
218
|
E.info(
|
|
219
219
|
"Trigger sync is currently in progress, awaiting sync completion before firing trigger event.",
|
|
@@ -236,7 +236,7 @@ export default class gr extends t {
|
|
|
236
236
|
) {
|
|
237
237
|
let s = !1;
|
|
238
238
|
for (let e = 0; e < r.sd.length; e++)
|
|
239
|
-
if (r.sd[e].
|
|
239
|
+
if (r.sd[e]._c(t, i)) {
|
|
240
240
|
s = !0;
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
@@ -283,7 +283,7 @@ export default class gr extends t {
|
|
|
283
283
|
}
|
|
284
284
|
wg(t, i, s) {
|
|
285
285
|
if (null == this.hg) return !0;
|
|
286
|
-
if (s ===
|
|
286
|
+
if (s === et.qs)
|
|
287
287
|
return (
|
|
288
288
|
E.info(
|
|
289
289
|
"Ignoring minimum interval between trigger because it is a test type.",
|
|
@@ -297,7 +297,7 @@ export default class gr 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.jn = i), (n.ug = e), null != r && (o = r.dt()), (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),
|
package/src/ui/js/attach-css.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as q } 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.4.0".replace(/\./g, "-")}`;
|
|
5
5
|
if (!c) return;
|
|
6
6
|
const s = c.ownerDocument || document;
|
|
7
7
|
if (null == s.getElementById(e)) {
|
|
8
8
|
const n = s.createElement("style");
|
|
9
9
|
(n.innerHTML = o || ""), (n.id = e);
|
|
10
|
-
const t = r.ee(
|
|
10
|
+
const t = r.ee(q.er);
|
|
11
11
|
null != t && n.setAttribute("nonce", t), c.appendChild(n);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as q } from "../../managers/braze-instance.js";
|
|
2
2
|
export function loadFontAwesome() {
|
|
3
|
-
if (r.ee(
|
|
3
|
+
if (r.ee(q.Na)) return;
|
|
4
4
|
const e = "https://use.fontawesome.com/7f85a56ba4.css";
|
|
5
5
|
if (
|
|
6
6
|
!(null !== document.querySelector('link[rel=stylesheet][href="' + e + '"]'))
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { isArray as
|
|
1
|
+
import { isArray as z } from "./code-utils.js";
|
|
2
2
|
export default class ge {
|
|
3
3
|
constructor() {}
|
|
4
4
|
ef() {}
|
|
5
5
|
ff() {}
|
|
6
|
-
|
|
6
|
+
rc(t) {}
|
|
7
7
|
static nf(t, e) {
|
|
8
8
|
if (t && e)
|
|
9
|
-
if (((t = t.toLowerCase()),
|
|
9
|
+
if (((t = t.toLowerCase()), z(e.cf))) {
|
|
10
10
|
for (let r = 0; r < e.cf.length; r++)
|
|
11
11
|
if (-1 !== t.indexOf(e.cf[r].toLowerCase())) return e.identity;
|
|
12
12
|
} else if (-1 !== t.indexOf(e.cf.toLowerCase())) return e.identity;
|
|
@@ -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
|
+
Zr: "unknownBrazeAction",
|
|
29
|
+
Zc: "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.Zr
|
|
33
33
|
? `${o} contains an unknown braze action type and will not be displayed.`
|
|
34
34
|
: "";
|
|
35
35
|
export function getDecodedBrazeAction(t) {
|