@braze/web-sdk 4.7.2 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +27 -24
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +5 -5
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +24 -24
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +17 -17
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +18 -18
- package/src/Card/card-manager-factory.js +2 -2
- package/src/Card/card-manager.js +47 -41
- package/src/Card/display/card-display.js +70 -67
- package/src/Card/log-card-click.js +1 -1
- package/src/Card/log-card-dismissal.js +1 -1
- package/src/Card/log-card-impressions.js +3 -3
- package/src/Card/models/banner.js +3 -2
- package/src/Card/models/captioned-image.js +6 -5
- package/src/Card/models/card.js +107 -87
- package/src/Card/models/classic-card.js +5 -5
- package/src/Card/models/control-card.js +5 -21
- package/src/Card/types.js +1 -0
- package/src/Card/util/card-factory.js +32 -32
- package/src/ContentCards/content-cards-provider-factory.js +3 -3
- package/src/ContentCards/content-cards-provider.js +283 -175
- package/src/ContentCards/content-cards.js +2 -2
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/log-content-cards-displayed.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +9 -6
- package/src/ContentCards/types.js +1 -0
- package/src/ContentCards/ui/hide-content-cards.js +2 -2
- package/src/ContentCards/ui/show-content-cards.js +35 -33
- package/src/Core/add-sdk-metadata.js +17 -18
- package/src/Core/change-user.js +12 -14
- package/src/Core/destroy.js +1 -1
- package/src/Core/disable-sdk.js +7 -6
- package/src/Core/enable-sdk.js +4 -4
- package/src/Core/get-device-id.js +7 -6
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +57 -40
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +22 -15
- package/src/Core/log-purchase.js +33 -33
- package/src/Core/open-session.js +17 -15
- package/src/Core/request-immediate-data-flush.js +4 -2
- package/src/Core/set-logger.js +1 -1
- package/src/Core/set-sdk-authentication-signature.js +5 -6
- package/src/Core/subscribe-to-sdk-authentication-failures.js +3 -1
- package/src/Core/toggle-logging.js +1 -1
- package/src/Core/types.js +1 -0
- package/src/Core/wipe-data.js +11 -10
- package/src/FeatureFlags/feature-flag-factory.js +6 -6
- package/src/FeatureFlags/feature-flag.js +17 -17
- package/src/FeatureFlags/feature-flags-provider-factory.js +2 -2
- package/src/FeatureFlags/feature-flags-provider.js +67 -65
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -1
- package/src/Feed/feed-provider-factory.js +8 -8
- package/src/Feed/feed-provider.js +57 -46
- package/src/Feed/feed.js +1 -1
- package/src/Feed/get-cached-feed.js +2 -2
- package/src/Feed/log-feed-displayed.js +3 -1
- package/src/Feed/request-feed-refresh.js +2 -2
- package/src/Feed/subscribe-to-feed-updates.js +2 -2
- package/src/Feed/types.js +1 -0
- package/src/Feed/ui/hide-feed.js +2 -2
- package/src/Feed/ui/show-feed.js +40 -36
- package/src/InAppMessage/display/html-message-to-html.js +125 -119
- package/src/InAppMessage/display/in-app-message-to-html.js +72 -69
- package/src/InAppMessage/display/modal-utils.js +18 -13
- package/src/InAppMessage/in-app-message-factory.js +9 -8
- package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +122 -108
- package/src/InAppMessage/log-in-app-message-button-click.js +10 -10
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +10 -10
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -1
- package/src/InAppMessage/models/full-screen-message.js +35 -37
- package/src/InAppMessage/models/html-message.js +34 -33
- package/src/InAppMessage/models/in-app-message-button.js +23 -16
- package/src/InAppMessage/models/in-app-message.js +147 -105
- package/src/InAppMessage/models/modal-message.js +34 -36
- package/src/InAppMessage/models/slide-up-message.js +25 -27
- package/src/InAppMessage/models/templated-in-app-message.js +12 -7
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/types.js +1 -0
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
- package/src/InAppMessage/ui/show-in-app-message.js +95 -89
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -0
- 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 +20 -20
- package/src/Push/push-manager.js +192 -174
- package/src/Push/request-push-permission.js +4 -3
- package/src/Push/types.js +1 -0
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +10 -10
- package/src/User/types.js +1 -0
- package/src/User/user-manager.js +24 -24
- package/src/User/user.js +117 -105
- package/src/common/base-feed.js +7 -7
- package/src/common/base-provider.js +2 -2
- package/src/common/constants.js +6 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +18 -18
- package/src/common/types.js +1 -0
- package/src/l10n/l10n-manager-factory.js +5 -5
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +202 -202
- package/src/managers/device-manager.js +23 -23
- package/src/managers/network-manager.js +96 -82
- package/src/managers/server-config-manager.js +60 -42
- package/src/managers/session-manager.js +41 -41
- package/src/managers/storage-manager-factory.js +15 -15
- package/src/managers/storage-manager.js +163 -160
- package/src/managers/subscription-manager.js +11 -11
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +7 -7
- package/src/models/push-token.js +7 -7
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +20 -20
- package/src/request-controller.js +176 -174
- package/src/triggers/models/custom-event-data.js +6 -6
- 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 +64 -64
- package/src/triggers/models/in-app-message-click-data.js +12 -12
- 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 +52 -52
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +8 -8
- package/src/triggers/triggers-provider.js +165 -162
- package/src/types.js +1 -0
- 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 +1 -1
- package/src/util/braze-actions.js +20 -20
- package/src/util/browser-detector.js +22 -22
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/code-utils.js +1 -1
- package/src/util/color-utils.js +2 -2
- package/src/util/component-utils.js +2 -2
- package/src/util/deprecation-utils.js +1 -1
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +2 -2
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +11 -11
- package/src/util/request-header-utils.js +23 -0
- package/src/util/string-utils.js +1 -1
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +44 -44
- package/src/util/window-utils.js +3 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Zt from "./filter.js";
|
|
2
2
|
import { isArray as p } from "../../util/code-utils.js";
|
|
3
|
-
export default class
|
|
3
|
+
export default class Qt {
|
|
4
4
|
constructor(t) {
|
|
5
5
|
this.filters = t;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
Bl(t) {
|
|
8
8
|
let r = !0;
|
|
9
9
|
for (let e = 0; e < this.filters.length; e++) {
|
|
10
10
|
const o = this.filters[e];
|
|
11
11
|
let s = !1;
|
|
12
12
|
for (let r = 0; r < o.length; r++)
|
|
13
|
-
if (o[r].
|
|
13
|
+
if (o[r].Bl(t)) {
|
|
14
14
|
s = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -27,10 +27,10 @@ export default class Gt {
|
|
|
27
27
|
for (let e = 0; e < t.length; e++) {
|
|
28
28
|
const o = [],
|
|
29
29
|
s = t[e];
|
|
30
|
-
for (let t = 0; t < s.length; t++) o.push(
|
|
30
|
+
for (let t = 0; t < s.length; t++) o.push(Zt.fromJson(s[t]));
|
|
31
31
|
r.push(o);
|
|
32
32
|
}
|
|
33
|
-
return new
|
|
33
|
+
return new Qt(r);
|
|
34
34
|
}
|
|
35
35
|
ss() {
|
|
36
36
|
const t = [];
|
|
@@ -42,14 +42,14 @@ export default class Gt {
|
|
|
42
42
|
}
|
|
43
43
|
return t;
|
|
44
44
|
}
|
|
45
|
-
static
|
|
45
|
+
static Tn(t) {
|
|
46
46
|
const r = [];
|
|
47
47
|
for (let e = 0; e < t.length; e++) {
|
|
48
48
|
const o = [],
|
|
49
49
|
s = t[e];
|
|
50
|
-
for (let t = 0; t < s.length; t++) o.push(
|
|
50
|
+
for (let t = 0; t < s.length; t++) o.push(Zt.Tn(s[t]));
|
|
51
51
|
r.push(o);
|
|
52
52
|
}
|
|
53
|
-
return new
|
|
53
|
+
return new Qt(r);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
import { isDate as Nt } from "../../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
|
-
convertMsToSeconds as
|
|
4
|
-
dateFromUnixTimestamp as
|
|
5
|
-
secondsAgo as
|
|
6
|
-
secondsInTheFuture as
|
|
3
|
+
convertMsToSeconds as h,
|
|
4
|
+
dateFromUnixTimestamp as l,
|
|
5
|
+
secondsAgo as ts,
|
|
6
|
+
secondsInTheFuture as es
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
8
|
-
export default class
|
|
8
|
+
export default class Zt {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.El = t),
|
|
11
|
+
(this.Hl = s),
|
|
12
12
|
(this.comparator = e),
|
|
13
|
-
(this.
|
|
14
|
-
this.
|
|
15
|
-
this.comparator !==
|
|
16
|
-
this.comparator !==
|
|
17
|
-
this.comparator !==
|
|
18
|
-
this.comparator !==
|
|
19
|
-
(this.
|
|
13
|
+
(this.Il = i),
|
|
14
|
+
this.Hl === Zt.Ql.Ul &&
|
|
15
|
+
this.comparator !== Zt.Gl.Xl &&
|
|
16
|
+
this.comparator !== Zt.Gl.Vl &&
|
|
17
|
+
this.comparator !== Zt.Gl.Kl &&
|
|
18
|
+
this.comparator !== Zt.Gl.Wl &&
|
|
19
|
+
(this.Il = l(this.Il));
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
Bl(t) {
|
|
22
22
|
let s = null;
|
|
23
|
-
switch ((null != t && (s = t[this.
|
|
24
|
-
case
|
|
25
|
-
return null != s && s.valueOf() === this.
|
|
26
|
-
case
|
|
27
|
-
return null == s || s.valueOf() !== this.
|
|
28
|
-
case
|
|
29
|
-
return typeof s == typeof this.
|
|
30
|
-
case
|
|
31
|
-
return this.
|
|
32
|
-
? null != s && Nt(s) &&
|
|
33
|
-
: typeof s == typeof this.
|
|
34
|
-
case
|
|
35
|
-
return typeof s == typeof this.
|
|
36
|
-
case
|
|
37
|
-
return this.
|
|
38
|
-
? null != s && Nt(s) &&
|
|
39
|
-
: typeof s == typeof this.
|
|
40
|
-
case
|
|
23
|
+
switch ((null != t && (s = t[this.El]), this.comparator)) {
|
|
24
|
+
case Zt.Gl.Yl:
|
|
25
|
+
return null != s && s.valueOf() === this.Il.valueOf();
|
|
26
|
+
case Zt.Gl.Zl:
|
|
27
|
+
return null == s || s.valueOf() !== this.Il.valueOf();
|
|
28
|
+
case Zt.Gl.Zh:
|
|
29
|
+
return typeof s == typeof this.Il && s > this.Il;
|
|
30
|
+
case Zt.Gl.Xl:
|
|
31
|
+
return this.Hl === Zt.Ql.Ul
|
|
32
|
+
? null != s && Nt(s) && ts(s) <= this.Il
|
|
33
|
+
: typeof s == typeof this.Il && s >= this.Il;
|
|
34
|
+
case Zt.Gl.$h:
|
|
35
|
+
return typeof s == typeof this.Il && s < this.Il;
|
|
36
|
+
case Zt.Gl.Vl:
|
|
37
|
+
return this.Hl === Zt.Ql.Ul
|
|
38
|
+
? null != s && Nt(s) && ts(s) >= this.Il
|
|
39
|
+
: typeof s == typeof this.Il && s <= this.Il;
|
|
40
|
+
case Zt.Gl.Eu:
|
|
41
41
|
return (
|
|
42
42
|
null != s &&
|
|
43
43
|
"string" == typeof s &&
|
|
44
|
-
typeof s == typeof this.
|
|
45
|
-
null != s.match(this.
|
|
44
|
+
typeof s == typeof this.Il &&
|
|
45
|
+
null != s.match(this.Il)
|
|
46
46
|
);
|
|
47
|
-
case
|
|
47
|
+
case Zt.Gl.Tu:
|
|
48
48
|
return null != s;
|
|
49
|
-
case
|
|
49
|
+
case Zt.Gl._u:
|
|
50
50
|
return null == s;
|
|
51
|
-
case
|
|
52
|
-
return null != s && Nt(s) &&
|
|
53
|
-
case
|
|
54
|
-
return null != s && Nt(s) &&
|
|
55
|
-
case
|
|
51
|
+
case Zt.Gl.Kl:
|
|
52
|
+
return null != s && Nt(s) && es(s) < this.Il;
|
|
53
|
+
case Zt.Gl.Wl:
|
|
54
|
+
return null != s && Nt(s) && es(s) > this.Il;
|
|
55
|
+
case Zt.Gl.yu:
|
|
56
56
|
return (
|
|
57
57
|
null == s ||
|
|
58
|
-
typeof s != typeof this.
|
|
58
|
+
typeof s != typeof this.Il ||
|
|
59
59
|
"string" != typeof s ||
|
|
60
|
-
null == s.match(this.
|
|
60
|
+
null == s.match(this.Il)
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
static fromJson(t) {
|
|
66
|
-
return new
|
|
66
|
+
return new Zt(
|
|
67
67
|
t.property_key,
|
|
68
68
|
t.property_type,
|
|
69
69
|
t.comparator,
|
|
@@ -71,28 +71,28 @@ export default class Vt {
|
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
ss() {
|
|
74
|
-
let t = this.
|
|
74
|
+
let t = this.Il;
|
|
75
75
|
return (
|
|
76
|
-
Nt(this.
|
|
77
|
-
{ k: this.
|
|
76
|
+
Nt(this.Il) && (t = h(t.valueOf())),
|
|
77
|
+
{ k: this.El, t: this.Hl, c: this.comparator, v: t }
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
|
-
static
|
|
81
|
-
return new
|
|
80
|
+
static Tn(t) {
|
|
81
|
+
return new Zt(t.k, t.t, t.c, t.v);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
(Zt.Gl = {
|
|
85
|
+
Yl: 1,
|
|
86
|
+
Zl: 2,
|
|
87
|
+
Zh: 3,
|
|
88
|
+
Xl: 4,
|
|
89
|
+
$h: 5,
|
|
90
|
+
Vl: 6,
|
|
91
|
+
Eu: 10,
|
|
92
|
+
Tu: 11,
|
|
93
|
+
_u: 12,
|
|
94
|
+
Kl: 15,
|
|
95
|
+
Wl: 16,
|
|
96
|
+
yu: 17
|
|
97
97
|
}),
|
|
98
|
-
(
|
|
98
|
+
(Zt.Ql = { Nu: "boolean", Mu: "number", Ru: "string", Ul: "date" });
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import ri from "./trigger-condition.js";
|
|
2
|
+
export default class si {
|
|
3
3
|
constructor(t, i) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.ju = t), (this.ku = i);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
8
|
-
const i =
|
|
6
|
+
Bl(t) {
|
|
7
|
+
if (null == this.ju) return !1;
|
|
8
|
+
const i = ri.wu(t[0], this.ju);
|
|
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.ku || 0 === this.ku.length;
|
|
11
|
+
if (null != this.ku)
|
|
12
|
+
for (let i = 0; i < this.ku.length; i++)
|
|
13
|
+
if (this.ku[i] === t[1]) {
|
|
14
14
|
r = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
17
17
|
return i && r;
|
|
18
18
|
}
|
|
19
19
|
static fromJson(t) {
|
|
20
|
-
return new
|
|
20
|
+
return new si(t ? t.id : null, t ? t.buttons : null);
|
|
21
21
|
}
|
|
22
22
|
ss() {
|
|
23
|
-
return this.
|
|
23
|
+
return this.ju;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class sr {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
this.productId = t;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Bl(t) {
|
|
6
6
|
return null == this.productId || t[0] === this.productId;
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
|
-
return new
|
|
9
|
+
return new sr(t ? t.product_id : null);
|
|
10
10
|
}
|
|
11
11
|
ss() {
|
|
12
12
|
return this.productId;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import Qt from "./filter-set.js";
|
|
2
|
+
export default class is {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.productId = t), (this.
|
|
4
|
+
(this.productId = t), (this.Jl = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.productId || null == this.
|
|
6
|
+
Bl(t) {
|
|
7
|
+
if (null == this.productId || null == this.Jl) 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.Jl.Bl(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
|
-
return new
|
|
13
|
+
return new is(
|
|
14
14
|
t ? t.product_id : null,
|
|
15
|
-
t ?
|
|
15
|
+
t ? Qt.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.Jl.ss() };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ri from "./trigger-condition.js";
|
|
2
2
|
export default class lr {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
this.
|
|
4
|
+
this.ju = t;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
return null == this.
|
|
6
|
+
Bl(t) {
|
|
7
|
+
return null == this.ju || ri.wu(t[0], this.ju);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t) {
|
|
10
10
|
return new lr(t ? t.campaign_id : null);
|
|
11
11
|
}
|
|
12
12
|
ss() {
|
|
13
|
-
return this.
|
|
13
|
+
return this.ju;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import Gt from "./custom-event-data.js";
|
|
2
|
+
import Yt from "./custom-event-property-data.js";
|
|
3
|
+
import Qt from "./filter-set.js";
|
|
4
|
+
import si from "./in-app-message-click-data.js";
|
|
5
|
+
import sr from "./purchase-data.js";
|
|
6
|
+
import is from "./purchase-property-data.js";
|
|
7
7
|
import lr from "./push-click-data.js";
|
|
8
|
-
import
|
|
8
|
+
import tt from "./trigger-events.js";
|
|
9
9
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
10
|
-
export default class
|
|
10
|
+
export default class ri {
|
|
11
11
|
constructor(e, t) {
|
|
12
12
|
(this.type = e), (this.data = t);
|
|
13
13
|
}
|
|
14
14
|
ec(e, t) {
|
|
15
|
-
return
|
|
15
|
+
return ri.tc[this.type] === e && (null == this.data || this.data.Bl(t));
|
|
16
16
|
}
|
|
17
|
-
static
|
|
17
|
+
static wu(e, t) {
|
|
18
18
|
let a = null;
|
|
19
19
|
try {
|
|
20
20
|
a = window.atob(e);
|
|
21
21
|
} catch (t) {
|
|
22
22
|
return (
|
|
23
|
-
r.
|
|
23
|
+
r.j.info("Failed to unencode analytics id " + e + ": " + t.message), !1
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
return t === a.split("_")[0];
|
|
@@ -29,81 +29,81 @@ export default class Yt {
|
|
|
29
29
|
const t = e.type;
|
|
30
30
|
let r;
|
|
31
31
|
switch (t) {
|
|
32
|
-
case
|
|
32
|
+
case ri.rc.OPEN:
|
|
33
33
|
r = null;
|
|
34
34
|
break;
|
|
35
|
-
case
|
|
36
|
-
r =
|
|
35
|
+
case ri.rc.Rr:
|
|
36
|
+
r = sr.fromJson(e.data);
|
|
37
37
|
break;
|
|
38
|
-
case
|
|
39
|
-
r =
|
|
38
|
+
case ri.rc.ac:
|
|
39
|
+
r = is.fromJson(e.data);
|
|
40
40
|
break;
|
|
41
|
-
case
|
|
41
|
+
case ri.rc.zr:
|
|
42
42
|
r = lr.fromJson(e.data);
|
|
43
43
|
break;
|
|
44
|
-
case
|
|
45
|
-
r =
|
|
44
|
+
case ri.rc.be:
|
|
45
|
+
r = Gt.fromJson(e.data);
|
|
46
46
|
break;
|
|
47
|
-
case
|
|
48
|
-
r =
|
|
47
|
+
case ri.rc.sc:
|
|
48
|
+
r = Yt.fromJson(e.data);
|
|
49
49
|
break;
|
|
50
|
-
case
|
|
51
|
-
r =
|
|
50
|
+
case ri.rc.Kr:
|
|
51
|
+
r = si.fromJson(e.data);
|
|
52
52
|
break;
|
|
53
|
-
case
|
|
53
|
+
case ri.rc.ks:
|
|
54
54
|
r = null;
|
|
55
55
|
}
|
|
56
|
-
return new
|
|
56
|
+
return new ri(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 Tn(e) {
|
|
62
62
|
let t, r;
|
|
63
63
|
switch (e.t) {
|
|
64
|
-
case
|
|
64
|
+
case ri.rc.OPEN:
|
|
65
65
|
t = null;
|
|
66
66
|
break;
|
|
67
|
-
case
|
|
68
|
-
t = new
|
|
67
|
+
case ri.rc.Rr:
|
|
68
|
+
t = new sr(e.d);
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
71
|
-
(r = e.d || {}), (t = new
|
|
70
|
+
case ri.rc.ac:
|
|
71
|
+
(r = e.d || {}), (t = new is(r.id, Qt.Tn(r.pf || [])));
|
|
72
72
|
break;
|
|
73
|
-
case
|
|
73
|
+
case ri.rc.zr:
|
|
74
74
|
t = new lr(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
77
|
-
t = new
|
|
76
|
+
case ri.rc.be:
|
|
77
|
+
t = new Gt(e.d);
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
80
|
-
(r = e.d || {}), (t = new
|
|
79
|
+
case ri.rc.sc:
|
|
80
|
+
(r = e.d || {}), (t = new Yt(r.e, Qt.Tn(r.pf || [])));
|
|
81
81
|
break;
|
|
82
|
-
case
|
|
83
|
-
t = new
|
|
82
|
+
case ri.rc.Kr:
|
|
83
|
+
t = new si(e.d);
|
|
84
84
|
break;
|
|
85
|
-
case
|
|
85
|
+
case ri.rc.ks:
|
|
86
86
|
t = null;
|
|
87
87
|
}
|
|
88
|
-
return new
|
|
88
|
+
return new ri(e.t, t);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
(
|
|
91
|
+
(ri.rc = {
|
|
92
92
|
OPEN: "open",
|
|
93
93
|
Rr: "purchase",
|
|
94
94
|
ac: "purchase_property",
|
|
95
|
-
|
|
95
|
+
zr: "push_click",
|
|
96
96
|
be: "custom_event",
|
|
97
97
|
sc: "custom_event_property",
|
|
98
|
-
|
|
98
|
+
Kr: "iam_click",
|
|
99
99
|
ks: "test"
|
|
100
100
|
}),
|
|
101
|
-
(
|
|
102
|
-
(
|
|
103
|
-
(
|
|
104
|
-
(
|
|
105
|
-
(
|
|
106
|
-
(
|
|
107
|
-
(
|
|
108
|
-
(
|
|
109
|
-
(
|
|
101
|
+
(ri.tc = {}),
|
|
102
|
+
(ri.tc[ri.rc.OPEN] = tt.OPEN),
|
|
103
|
+
(ri.tc[ri.rc.Rr] = tt.Rr),
|
|
104
|
+
(ri.tc[ri.rc.ac] = tt.Rr),
|
|
105
|
+
(ri.tc[ri.rc.zr] = tt.zr),
|
|
106
|
+
(ri.tc[ri.rc.be] = tt.be),
|
|
107
|
+
(ri.tc[ri.rc.sc] = tt.be),
|
|
108
|
+
(ri.tc[ri.rc.Kr] = tt.Kr),
|
|
109
|
+
(ri.tc[ri.rc.ks] = tt.ks);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
dateFromUnixTimestamp as
|
|
2
|
+
dateFromUnixTimestamp as l,
|
|
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
|
|
7
|
-
import { validateValueIsFromEnum as
|
|
8
|
-
export default class
|
|
6
|
+
import ri from "./trigger-condition.js";
|
|
7
|
+
import { validateValueIsFromEnum as H } from "../../util/code-utils.js";
|
|
8
|
+
export default class mt {
|
|
9
9
|
constructor(t, i, s, e, r, l, o, n, h, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
11
|
(this.Du = i || []),
|
|
@@ -17,32 +17,32 @@ export default class pt {
|
|
|
17
17
|
(this.type = l),
|
|
18
18
|
(this.Pu = n || 0),
|
|
19
19
|
null == a && (a = 1e3 * (this.Pu + 30)),
|
|
20
|
-
(this.
|
|
20
|
+
(this.Jr = a),
|
|
21
21
|
(this.data = o),
|
|
22
|
-
null == h && (h =
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this
|
|
22
|
+
null == h && (h = mt.vu),
|
|
23
|
+
(this.zu = h),
|
|
24
|
+
(this.Iu = u),
|
|
25
|
+
(this.$u = d || null);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
xu(t) {
|
|
28
28
|
return (
|
|
29
|
-
null == this
|
|
29
|
+
null == this.$u || (this.zu !== mt.vu && t - this.$u >= 1e3 * this.zu)
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
this
|
|
32
|
+
Bu(t) {
|
|
33
|
+
this.$u = t;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
Cu(t) {
|
|
36
36
|
const i = t + 1e3 * this.Pu;
|
|
37
37
|
return Math.max(i - new Date().valueOf(), 0);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
Hu(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.Jr || i < this.Jr;
|
|
42
42
|
return (
|
|
43
43
|
s ||
|
|
44
|
-
r.
|
|
45
|
-
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.
|
|
44
|
+
r.j.info(
|
|
45
|
+
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.Jr}ms.`
|
|
46
46
|
),
|
|
47
47
|
!s
|
|
48
48
|
);
|
|
@@ -51,23 +51,23 @@ 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(
|
|
55
|
-
const e =
|
|
56
|
-
r =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
s.push(ri.fromJson(t.trigger_condition[i]));
|
|
55
|
+
const e = l(t.start_time),
|
|
56
|
+
r = l(t.end_time),
|
|
57
|
+
o = t.priority,
|
|
58
|
+
n = t.type,
|
|
59
|
+
h = t.delay,
|
|
60
60
|
a = t.re_eligibility,
|
|
61
61
|
u = t.timeout,
|
|
62
62
|
d = t.data,
|
|
63
63
|
m = t.min_seconds_since_last_trigger;
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
return H(
|
|
65
|
+
mt._r,
|
|
66
|
+
n,
|
|
67
67
|
"Could not construct Trigger from server data",
|
|
68
68
|
"Trigger.Types"
|
|
69
69
|
)
|
|
70
|
-
? new
|
|
70
|
+
? new mt(i, s, e, r, o, n, d, h, a, u, m)
|
|
71
71
|
: null;
|
|
72
72
|
}
|
|
73
73
|
ss() {
|
|
@@ -82,16 +82,16 @@ export default class pt {
|
|
|
82
82
|
t: this.type,
|
|
83
83
|
da: this.data,
|
|
84
84
|
d: this.Pu,
|
|
85
|
-
r: this.
|
|
86
|
-
tm: this.
|
|
87
|
-
ss: this.
|
|
88
|
-
ld: this
|
|
85
|
+
r: this.zu,
|
|
86
|
+
tm: this.Jr,
|
|
87
|
+
ss: this.Iu,
|
|
88
|
+
ld: this.$u
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
static
|
|
91
|
+
static Tn(t) {
|
|
92
92
|
const i = [];
|
|
93
|
-
for (let s = 0; s < t.c.length; s++) i.push(
|
|
94
|
-
return new
|
|
93
|
+
for (let s = 0; s < t.c.length; s++) i.push(ri.Tn(t.c[s]));
|
|
94
|
+
return new mt(
|
|
95
95
|
t.i,
|
|
96
96
|
i,
|
|
97
97
|
w(t.s),
|
|
@@ -107,4 +107,4 @@ export default class pt {
|
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
(
|
|
110
|
+
(mt.vu = -1), (mt._r = { Mr: "inapp", Ju: "templated_iam" });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import e, { OPTIONS as
|
|
1
|
+
import ea from "../InAppMessage/in-app-message-manager-factory.js";
|
|
2
|
+
import e, { OPTIONS as L } from "../managers/braze-instance.js";
|
|
3
3
|
import gr from "./triggers-provider.js";
|
|
4
4
|
export const TriggersProviderFactory = {
|
|
5
5
|
t: !1,
|
|
@@ -7,21 +7,21 @@ export const TriggersProviderFactory = {
|
|
|
7
7
|
er: () => (TriggersProviderFactory.init(), TriggersProviderFactory.provider),
|
|
8
8
|
rg: () => {
|
|
9
9
|
if (!TriggersProviderFactory.provider) {
|
|
10
|
-
const r = e.nn(
|
|
10
|
+
const r = e.nn(L.No);
|
|
11
11
|
(TriggersProviderFactory.provider = new gr(
|
|
12
12
|
null != r ? r : 30,
|
|
13
|
-
|
|
13
|
+
ea.m().Ue(),
|
|
14
14
|
e.l(),
|
|
15
|
-
e.
|
|
16
|
-
|
|
15
|
+
e.cr(),
|
|
16
|
+
ea.m()
|
|
17
17
|
)),
|
|
18
|
-
e.
|
|
18
|
+
e.dr(TriggersProviderFactory.provider);
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
init: () => {
|
|
22
22
|
TriggersProviderFactory.t ||
|
|
23
23
|
(TriggersProviderFactory.rg(),
|
|
24
|
-
e.
|
|
24
|
+
e.g(TriggersProviderFactory),
|
|
25
25
|
(TriggersProviderFactory.t = !0));
|
|
26
26
|
},
|
|
27
27
|
destroy: () => {
|