@braze/web-sdk 4.8.2 → 4.9.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 +121 -6
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +7 -7
- package/shared-lib/encoding-utils.js +4 -4
- package/shared-lib/event-types.js +22 -21
- package/shared-lib/guid.js +7 -7
- package/shared-lib/indexed-db-adapter.js +172 -135
- package/shared-lib/logger.js +26 -26
- package/shared-lib/supported-options.js +15 -15
- package/shared-lib/types.js +1 -0
- package/src/Card/card-manager-factory.js +1 -1
- package/src/Card/card-manager.js +2 -2
- package/src/Card/display/card-display.js +5 -4
- package/src/Card/models/banner.js +10 -10
- package/src/Card/models/captioned-image.js +7 -7
- package/src/Card/models/card.js +37 -36
- package/src/Card/models/classic-card.js +7 -7
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +32 -0
- package/src/Card/models/index.js +1 -0
- package/src/Card/util/card-factory.js +16 -16
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +102 -102
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
- package/src/ContentCards/ui/show-content-cards.js +15 -12
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/braze-sdk-metadata.js +1 -1
- package/src/Core/change-user.js +1 -1
- package/src/Core/device-properties.js +1 -1
- package/src/Core/disable-sdk.js +10 -7
- package/src/Core/enable-sdk.js +5 -2
- package/src/Core/get-device-id.js +3 -3
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +4 -4
- package/src/Core/log-purchase.js +9 -9
- package/src/Core/open-session.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +5 -3
- package/src/FeatureFlags/feature-flag.js +17 -14
- package/src/FeatureFlags/feature-flags-provider-factory.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +56 -43
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/index.js +1 -0
- package/src/FeatureFlags/log-feature-flag-impression.js +23 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +20 -20
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +13 -10
- package/src/InAppMessage/defer-in-app-message.js +13 -0
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +47 -47
- package/src/InAppMessage/display/in-app-message-to-html.js +92 -91
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +5 -0
- package/src/InAppMessage/in-app-message-factory.js +77 -57
- package/src/InAppMessage/in-app-message-manager-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +121 -82
- package/src/InAppMessage/index.js +2 -0
- package/src/InAppMessage/log-in-app-message-button-click.js +17 -9
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +65 -29
- package/src/InAppMessage/models/html-message.js +32 -13
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +203 -134
- package/src/InAppMessage/models/modal-message.js +64 -29
- package/src/InAppMessage/models/slide-up-message.js +52 -24
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +49 -47
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
- 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 +19 -19
- package/src/Push/push-manager.js +131 -131
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +12 -10
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +57 -57
- package/src/common/base-feed.js +1 -1
- package/src/common/constants.js +1 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +34 -34
- package/src/common/translations.js +33 -33
- package/src/l10n/l10n-manager-factory.js +8 -8
- package/src/l10n/l10n-manager.js +6 -2
- package/src/l10n/types.js +1 -0
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +125 -125
- package/src/managers/device-manager.js +20 -20
- package/src/managers/network-manager.js +100 -98
- package/src/managers/server-config-manager.js +23 -23
- package/src/managers/session-manager.js +5 -5
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +132 -129
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +6 -6
- package/src/models/braze-event.js +11 -11
- package/src/models/braze-sdk-metadata.js +1 -1
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +5 -5
- package/src/models/server-config.js +7 -7
- package/src/request-controller.js +191 -178
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +7 -7
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +64 -60
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +55 -59
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +47 -35
- package/src/triggers/triggers-provider-factory.js +10 -6
- package/src/triggers/triggers-provider.js +203 -185
- package/src/triggers/types.js +1 -0
- package/src/ui/js/attach-css.js +5 -4
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +5 -5
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +35 -30
- package/src/util/browser-detector.js +30 -31
- package/src/util/client-hints-parser.js +30 -24
- package/src/util/code-utils.js +22 -21
- package/src/util/color-utils.js +19 -13
- package/src/util/component-utils.js +4 -4
- package/src/util/date-utils.js +4 -3
- package/src/util/device-constants.js +10 -10
- package/src/util/dom-utils.js +32 -28
- package/src/util/error-utils.js +1 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +53 -57
- package/src/util/request-header-utils.js +34 -11
- package/src/util/string-utils.js +14 -14
- package/src/util/types.js +1 -0
- package/src/util/url-utils.js +1 -4
- package/src/util/user-agent-parser.js +39 -39
- package/src/util/validation-utils.js +32 -32
- package/src/util/window-utils.js +11 -12
|
@@ -3,61 +3,65 @@ import {
|
|
|
3
3
|
convertMsToSeconds as h,
|
|
4
4
|
dateFromUnixTimestamp as l,
|
|
5
5
|
secondsAgo as ts,
|
|
6
|
-
secondsInTheFuture as es
|
|
6
|
+
secondsInTheFuture as es,
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
8
8
|
export default class sr {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.Tl = t),
|
|
11
|
+
(this.Al = s),
|
|
12
12
|
(this.comparator = e),
|
|
13
|
-
(this.
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
(this._l = i),
|
|
14
|
+
(this.Tl = t),
|
|
15
|
+
(this.Al = s),
|
|
16
|
+
(this.comparator = e),
|
|
17
|
+
(this._l = i),
|
|
18
|
+
this.Al === sr.Rl.Ml &&
|
|
19
|
+
this.comparator !== sr.Il.Ll &&
|
|
20
|
+
this.comparator !== sr.Il.Ol &&
|
|
21
|
+
this.comparator !== sr.Il.Ul &&
|
|
22
|
+
this.comparator !== sr.Il.Ql &&
|
|
23
|
+
(this._l = l(this._l));
|
|
20
24
|
}
|
|
21
|
-
|
|
25
|
+
Bl(t) {
|
|
22
26
|
let s = null;
|
|
23
|
-
switch ((null != t && (s = t[this.
|
|
24
|
-
case sr.
|
|
25
|
-
return null != s && s.valueOf() === this.
|
|
26
|
-
case sr.
|
|
27
|
-
return null == s || s.valueOf() !== this.
|
|
28
|
-
case sr.
|
|
29
|
-
return typeof s == typeof this.
|
|
30
|
-
case sr.
|
|
31
|
-
return this.
|
|
32
|
-
? null != s && Nt(s) && ts(s) <= this.
|
|
33
|
-
: typeof s == typeof this.
|
|
34
|
-
case sr.
|
|
35
|
-
return typeof s == typeof this.
|
|
36
|
-
case sr.
|
|
37
|
-
return this.
|
|
38
|
-
? null != s && Nt(s) && ts(s) >= this.
|
|
39
|
-
: typeof s == typeof this.
|
|
40
|
-
case sr.
|
|
27
|
+
switch ((null != t && (s = t[this.Tl]), this.comparator)) {
|
|
28
|
+
case sr.Il.Xl:
|
|
29
|
+
return null != s && s.valueOf() === this._l.valueOf();
|
|
30
|
+
case sr.Il.Fl:
|
|
31
|
+
return null == s || s.valueOf() !== this._l.valueOf();
|
|
32
|
+
case sr.Il.Kl:
|
|
33
|
+
return null != s && typeof s == typeof this._l && s > this._l;
|
|
34
|
+
case sr.Il.Ll:
|
|
35
|
+
return this.Al === sr.Rl.Ml
|
|
36
|
+
? null != s && Nt(s) && ts(s) <= this._l.valueOf()
|
|
37
|
+
: null != s && typeof s == typeof this._l && s >= this._l;
|
|
38
|
+
case sr.Il.Pl:
|
|
39
|
+
return null != s && typeof s == typeof this._l && s < this._l;
|
|
40
|
+
case sr.Il.Ol:
|
|
41
|
+
return this.Al === sr.Rl.Ml
|
|
42
|
+
? null != s && Nt(s) && ts(s) >= this._l.valueOf()
|
|
43
|
+
: null != s && typeof s == typeof this._l && s <= this._l;
|
|
44
|
+
case sr.Il.Yl:
|
|
41
45
|
return (
|
|
42
46
|
null != s &&
|
|
43
47
|
"string" == typeof s &&
|
|
44
|
-
typeof s == typeof this.
|
|
45
|
-
null != s.match(this.
|
|
48
|
+
typeof s == typeof this._l &&
|
|
49
|
+
null != s.match(this._l)
|
|
46
50
|
);
|
|
47
|
-
case sr.
|
|
51
|
+
case sr.Il.Zl:
|
|
48
52
|
return null != s;
|
|
49
|
-
case sr.
|
|
53
|
+
case sr.Il.$l:
|
|
50
54
|
return null == s;
|
|
51
|
-
case sr.
|
|
52
|
-
return null != s && Nt(s) && es(s) < this.
|
|
53
|
-
case sr.
|
|
54
|
-
return null != s && Nt(s) && es(s) > this.
|
|
55
|
-
case sr.
|
|
55
|
+
case sr.Il.Ul:
|
|
56
|
+
return null != s && Nt(s) && es(s) < this._l;
|
|
57
|
+
case sr.Il.Ql:
|
|
58
|
+
return null != s && Nt(s) && es(s) > this._l;
|
|
59
|
+
case sr.Il.Eu:
|
|
56
60
|
return (
|
|
57
61
|
null == s ||
|
|
58
|
-
typeof s != typeof this.
|
|
62
|
+
typeof s != typeof this._l ||
|
|
59
63
|
"string" != typeof s ||
|
|
60
|
-
null == s.match(this.
|
|
64
|
+
null == s.match(this._l)
|
|
61
65
|
);
|
|
62
66
|
}
|
|
63
67
|
return !1;
|
|
@@ -67,32 +71,32 @@ export default class sr {
|
|
|
67
71
|
t.property_key,
|
|
68
72
|
t.property_type,
|
|
69
73
|
t.comparator,
|
|
70
|
-
t.property_value
|
|
74
|
+
t.property_value,
|
|
71
75
|
);
|
|
72
76
|
}
|
|
73
77
|
ss() {
|
|
74
|
-
let t = this.
|
|
78
|
+
let t = this._l;
|
|
75
79
|
return (
|
|
76
|
-
Nt(this.
|
|
77
|
-
{ k: this.
|
|
80
|
+
Nt(this._l) && (t = h(t.valueOf())),
|
|
81
|
+
{ k: this.Tl, t: this.Al, c: this.comparator, v: t }
|
|
78
82
|
);
|
|
79
83
|
}
|
|
80
|
-
static
|
|
84
|
+
static Yn(t) {
|
|
81
85
|
return new sr(t.k, t.t, t.c, t.v);
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
|
-
(sr.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
(sr.Rl = { Tu: "boolean", _u: "number", Nu: "string", Ml: "date" }),
|
|
89
|
+
(sr.Il = {
|
|
90
|
+
Xl: 1,
|
|
91
|
+
Fl: 2,
|
|
92
|
+
Kl: 3,
|
|
93
|
+
Ll: 4,
|
|
94
|
+
Pl: 5,
|
|
95
|
+
Ol: 6,
|
|
96
|
+
Yl: 10,
|
|
97
|
+
Zl: 11,
|
|
98
|
+
$l: 12,
|
|
99
|
+
Ul: 15,
|
|
100
|
+
Ql: 16,
|
|
101
|
+
Eu: 17,
|
|
102
|
+
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import ri from "./trigger-condition.js";
|
|
2
2
|
export default class si {
|
|
3
3
|
constructor(t, i) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.xu = t), (this.zu = i), (this.xu = t), (this.zu = i);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
8
|
-
const i = ri.
|
|
6
|
+
Bl(t) {
|
|
7
|
+
if (null == this.xu) return !1;
|
|
8
|
+
const i = ri.Bu(t[0], this.xu);
|
|
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.zu || 0 === this.zu.length;
|
|
11
|
+
if (null != this.zu)
|
|
12
|
+
for (let i = 0; i < this.zu.length; i++)
|
|
13
|
+
if (this.zu[i] === t[1]) {
|
|
14
14
|
r = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -20,6 +20,6 @@ export default class si {
|
|
|
20
20
|
return new si(t ? t.id : null, t ? t.buttons : null);
|
|
21
21
|
}
|
|
22
22
|
ss() {
|
|
23
|
-
return this.
|
|
23
|
+
return this.xu;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class rs {
|
|
2
2
|
constructor(t) {
|
|
3
|
-
this.productId = t;
|
|
3
|
+
(this.productId = t), (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 rs(t ? t.product_id : null);
|
|
10
10
|
}
|
|
11
11
|
ss() {
|
|
12
12
|
return this.productId;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import Yt from "./filter-set.js";
|
|
2
2
|
export default class is {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.productId = t), (this.
|
|
4
|
+
(this.productId = t), (this.Jl = s), (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
13
|
return new is(
|
|
14
14
|
t ? t.product_id : null,
|
|
15
|
-
t ? Yt.fromJson(t.property_filters) : null
|
|
15
|
+
t ? Yt.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 ? this.Jl.ss() : null };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import ri from "./trigger-condition.js";
|
|
2
|
-
export default class
|
|
2
|
+
export default class lr {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
this.
|
|
4
|
+
(this.xu = t), (this.xu = t);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
return null == this.
|
|
6
|
+
Bl(t) {
|
|
7
|
+
return null == this.xu || ri.Bu(t[0], this.xu);
|
|
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
|
-
return this.
|
|
13
|
+
return this.xu;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -2,108 +2,104 @@ import Qt from "./custom-event-data.js";
|
|
|
2
2
|
import Zt from "./custom-event-property-data.js";
|
|
3
3
|
import Yt from "./filter-set.js";
|
|
4
4
|
import si from "./in-app-message-click-data.js";
|
|
5
|
-
import
|
|
5
|
+
import rs from "./purchase-data.js";
|
|
6
6
|
import is from "./purchase-property-data.js";
|
|
7
|
-
import
|
|
7
|
+
import lr from "./push-click-data.js";
|
|
8
8
|
import tt from "./trigger-events.js";
|
|
9
9
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
10
|
+
import { getErrorMessage as ei } from "../../util/error-utils.js";
|
|
10
11
|
export default class ri {
|
|
11
12
|
constructor(e, t) {
|
|
12
|
-
(this.type = e), (this.data = t);
|
|
13
|
+
(this.type = e), (this.data = t), (this.type = e), (this.data = t);
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
return ri.
|
|
15
|
+
sc(e, t) {
|
|
16
|
+
return ri.cc[this.type] === e && (null == this.data || this.data.Bl(t));
|
|
16
17
|
}
|
|
17
|
-
static
|
|
18
|
-
let
|
|
18
|
+
static Bu(e, t) {
|
|
19
|
+
let s = null;
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
+
s = window.atob(e);
|
|
21
22
|
} catch (t) {
|
|
22
23
|
return (
|
|
23
|
-
r.j.info("Failed to unencode analytics id " + e + ": " + t
|
|
24
|
+
r.j.info("Failed to unencode analytics id " + e + ": " + ei(t)), !1
|
|
24
25
|
);
|
|
25
26
|
}
|
|
26
|
-
return t ===
|
|
27
|
+
return t === s.split("_")[0];
|
|
27
28
|
}
|
|
28
29
|
static fromJson(e) {
|
|
29
30
|
const t = e.type;
|
|
30
|
-
let r;
|
|
31
|
+
let r = null;
|
|
31
32
|
switch (t) {
|
|
32
|
-
case ri.
|
|
33
|
-
|
|
33
|
+
case ri.Wr.OPEN:
|
|
34
|
+
case ri.Wr.zs:
|
|
34
35
|
break;
|
|
35
|
-
case ri.
|
|
36
|
-
r =
|
|
36
|
+
case ri.Wr.Rr:
|
|
37
|
+
r = rs.fromJson(e.data);
|
|
37
38
|
break;
|
|
38
|
-
case ri.
|
|
39
|
+
case ri.Wr.nc:
|
|
39
40
|
r = is.fromJson(e.data);
|
|
40
41
|
break;
|
|
41
|
-
case ri.
|
|
42
|
-
r =
|
|
42
|
+
case ri.Wr.zr:
|
|
43
|
+
r = lr.fromJson(e.data);
|
|
43
44
|
break;
|
|
44
|
-
case ri.
|
|
45
|
+
case ri.Wr.$e:
|
|
45
46
|
r = Qt.fromJson(e.data);
|
|
46
47
|
break;
|
|
47
|
-
case ri.
|
|
48
|
+
case ri.Wr.lc:
|
|
48
49
|
r = Zt.fromJson(e.data);
|
|
49
50
|
break;
|
|
50
|
-
case ri.
|
|
51
|
+
case ri.Wr.ro:
|
|
51
52
|
r = si.fromJson(e.data);
|
|
52
|
-
break;
|
|
53
|
-
case ri.ac.ks:
|
|
54
|
-
r = null;
|
|
55
53
|
}
|
|
56
54
|
return new ri(t, r);
|
|
57
55
|
}
|
|
58
56
|
ss() {
|
|
59
57
|
return { t: this.type, d: this.data ? this.data.ss() : null };
|
|
60
58
|
}
|
|
61
|
-
static
|
|
62
|
-
let t,
|
|
59
|
+
static Yn(e) {
|
|
60
|
+
let t,
|
|
61
|
+
r = null;
|
|
63
62
|
switch (e.t) {
|
|
64
|
-
case ri.
|
|
65
|
-
|
|
66
|
-
break;
|
|
67
|
-
case ri.ac.Rr:
|
|
68
|
-
t = new lr(e.d);
|
|
63
|
+
case ri.Wr.OPEN:
|
|
64
|
+
case ri.Wr.zs:
|
|
69
65
|
break;
|
|
70
|
-
case ri.
|
|
71
|
-
|
|
66
|
+
case ri.Wr.Rr:
|
|
67
|
+
r = new rs(e.d);
|
|
72
68
|
break;
|
|
73
|
-
case ri.
|
|
74
|
-
t = new
|
|
69
|
+
case ri.Wr.nc:
|
|
70
|
+
(t = e.d || {}), (r = new is(t.id, Yt.Yn(t.pf || [])));
|
|
75
71
|
break;
|
|
76
|
-
case ri.
|
|
77
|
-
|
|
72
|
+
case ri.Wr.zr:
|
|
73
|
+
r = new lr(e.d);
|
|
78
74
|
break;
|
|
79
|
-
case ri.
|
|
80
|
-
|
|
75
|
+
case ri.Wr.$e:
|
|
76
|
+
r = new Qt(e.d);
|
|
81
77
|
break;
|
|
82
|
-
case ri.
|
|
83
|
-
t = new
|
|
78
|
+
case ri.Wr.lc:
|
|
79
|
+
(t = e.d || {}), (r = new Zt(t.e, Yt.Yn(t.pf || [])));
|
|
84
80
|
break;
|
|
85
|
-
case ri.
|
|
86
|
-
|
|
81
|
+
case ri.Wr.ro:
|
|
82
|
+
r = new si(e.d);
|
|
87
83
|
}
|
|
88
|
-
return new ri(e.t,
|
|
84
|
+
return new ri(e.t, r);
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
|
-
(ri.
|
|
87
|
+
(ri.Wr = {
|
|
92
88
|
OPEN: "open",
|
|
93
89
|
Rr: "purchase",
|
|
94
|
-
|
|
90
|
+
nc: "purchase_property",
|
|
95
91
|
zr: "push_click",
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
$e: "custom_event",
|
|
93
|
+
lc: "custom_event_property",
|
|
94
|
+
ro: "iam_click",
|
|
95
|
+
zs: "test",
|
|
100
96
|
}),
|
|
101
|
-
(ri.
|
|
102
|
-
(ri.
|
|
103
|
-
(ri.
|
|
104
|
-
(ri.
|
|
105
|
-
(ri.
|
|
106
|
-
(ri.
|
|
107
|
-
(ri.
|
|
108
|
-
(ri.
|
|
109
|
-
(ri.
|
|
97
|
+
(ri.cc = {}),
|
|
98
|
+
(ri.cc[ri.Wr.OPEN] = tt.OPEN),
|
|
99
|
+
(ri.cc[ri.Wr.Rr] = tt.Rr),
|
|
100
|
+
(ri.cc[ri.Wr.nc] = tt.Rr),
|
|
101
|
+
(ri.cc[ri.Wr.zr] = tt.zr),
|
|
102
|
+
(ri.cc[ri.Wr.$e] = tt.$e),
|
|
103
|
+
(ri.cc[ri.Wr.lc] = tt.$e),
|
|
104
|
+
(ri.cc[ri.Wr.ro] = tt.ro),
|
|
105
|
+
(ri.cc[ri.Wr.zs] = tt.zs);
|
|
@@ -1,48 +1,59 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dateFromUnixTimestamp as l,
|
|
3
|
-
rehydrateDateAfterJsonization as w
|
|
3
|
+
rehydrateDateAfterJsonization as w,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
5
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
6
6
|
import ri from "./trigger-condition.js";
|
|
7
7
|
import { validateValueIsFromEnum as H } from "../../util/code-utils.js";
|
|
8
8
|
export default class mt {
|
|
9
|
-
constructor(t, i, s, e, r, l, o, n
|
|
9
|
+
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = mt.Du, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
|
+
(this.Pu = i),
|
|
12
|
+
(this.startTime = s),
|
|
13
|
+
(this.endTime = e),
|
|
14
|
+
(this.priority = r),
|
|
15
|
+
(this.type = h),
|
|
16
|
+
(this.data = l),
|
|
17
|
+
(this.Iu = o),
|
|
18
|
+
(this.Mu = n),
|
|
19
|
+
(this.sn = a),
|
|
20
|
+
(this.Fu = u),
|
|
21
|
+
(this.Hu = d),
|
|
22
|
+
(this.id = t),
|
|
11
23
|
(this.Pu = i || []),
|
|
12
24
|
void 0 === s && (s = null),
|
|
13
25
|
(this.startTime = s),
|
|
14
26
|
void 0 === e && (e = null),
|
|
15
27
|
(this.endTime = e),
|
|
16
28
|
(this.priority = r || 0),
|
|
17
|
-
(this.type =
|
|
18
|
-
(this.
|
|
19
|
-
null == a && (a = 1e3 * (this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.data =
|
|
22
|
-
null
|
|
23
|
-
(this.Cu = h),
|
|
29
|
+
(this.type = h),
|
|
30
|
+
(this.Iu = o || 0),
|
|
31
|
+
null == a && (a = 1e3 * (this.Iu + 30)),
|
|
32
|
+
(this.sn = a),
|
|
33
|
+
(this.data = l),
|
|
34
|
+
null != n && (this.Mu = n),
|
|
24
35
|
(this.Fu = u),
|
|
25
|
-
(this.
|
|
36
|
+
(this.Hu = d || null);
|
|
26
37
|
}
|
|
27
|
-
|
|
38
|
+
Ju(t) {
|
|
28
39
|
return (
|
|
29
|
-
null == this.
|
|
40
|
+
null == this.Hu || (this.Mu !== mt.Du && t - this.Hu >= 1e3 * this.Mu)
|
|
30
41
|
);
|
|
31
42
|
}
|
|
32
|
-
|
|
33
|
-
this.
|
|
43
|
+
Lu(t) {
|
|
44
|
+
this.Hu = t;
|
|
34
45
|
}
|
|
35
|
-
|
|
36
|
-
const i = t + 1e3 * this.
|
|
46
|
+
Ru(t) {
|
|
47
|
+
const i = t + 1e3 * this.Iu;
|
|
37
48
|
return Math.max(i - new Date().valueOf(), 0);
|
|
38
49
|
}
|
|
39
|
-
|
|
50
|
+
Vu(t) {
|
|
40
51
|
const i = new Date().valueOf() - t,
|
|
41
|
-
s = null == t || isNaN(i) || null == this.
|
|
52
|
+
s = null == t || isNaN(i) || null == this.sn || i < this.sn;
|
|
42
53
|
return (
|
|
43
54
|
s ||
|
|
44
55
|
r.j.info(
|
|
45
|
-
`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.sn}ms.`,
|
|
46
57
|
),
|
|
47
58
|
!s
|
|
48
59
|
);
|
|
@@ -54,20 +65,20 @@ export default class mt {
|
|
|
54
65
|
s.push(ri.fromJson(t.trigger_condition[i]));
|
|
55
66
|
const e = l(t.start_time),
|
|
56
67
|
r = l(t.end_time),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
68
|
+
h = t.priority,
|
|
69
|
+
o = t.type,
|
|
70
|
+
n = t.delay,
|
|
60
71
|
a = t.re_eligibility,
|
|
61
72
|
u = t.timeout,
|
|
62
73
|
d = t.data,
|
|
63
74
|
m = t.min_seconds_since_last_trigger;
|
|
64
75
|
return H(
|
|
65
|
-
mt.
|
|
66
|
-
|
|
76
|
+
mt.Wr,
|
|
77
|
+
o,
|
|
67
78
|
"Could not construct Trigger from server data",
|
|
68
|
-
"Trigger.Types"
|
|
79
|
+
"Trigger.Types",
|
|
69
80
|
)
|
|
70
|
-
? new mt(i, s, e, r,
|
|
81
|
+
? new mt(i, s, e, r, h, o, d, n, a, u, m)
|
|
71
82
|
: null;
|
|
72
83
|
}
|
|
73
84
|
ss() {
|
|
@@ -81,16 +92,17 @@ export default class mt {
|
|
|
81
92
|
p: this.priority,
|
|
82
93
|
t: this.type,
|
|
83
94
|
da: this.data,
|
|
84
|
-
d: this.
|
|
85
|
-
r: this.
|
|
86
|
-
tm: this.
|
|
95
|
+
d: this.Iu,
|
|
96
|
+
r: this.Mu,
|
|
97
|
+
tm: this.sn,
|
|
87
98
|
ss: this.Fu,
|
|
88
|
-
ld: this.
|
|
99
|
+
ld: this.Hu,
|
|
89
100
|
};
|
|
90
101
|
}
|
|
91
|
-
static
|
|
92
|
-
const i = []
|
|
93
|
-
|
|
102
|
+
static Yn(t) {
|
|
103
|
+
const i = [],
|
|
104
|
+
s = t.c || [];
|
|
105
|
+
for (let t = 0; t < s.length; t++) i.push(ri.Yn(s[t]));
|
|
94
106
|
return new mt(
|
|
95
107
|
t.i,
|
|
96
108
|
i,
|
|
@@ -103,8 +115,8 @@ export default class mt {
|
|
|
103
115
|
t.r,
|
|
104
116
|
t.tm,
|
|
105
117
|
t.ss,
|
|
106
|
-
t.ld
|
|
118
|
+
t.ld,
|
|
107
119
|
);
|
|
108
120
|
}
|
|
109
121
|
}
|
|
110
|
-
(mt
|
|
122
|
+
(mt.Wr = { Vr: "inapp", Gu: "templated_iam" }), (mt.Du = -1);
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import se from "../InAppMessage/in-app-message-manager-factory.js";
|
|
2
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,
|
|
6
6
|
provider: null,
|
|
7
|
-
er: () => (
|
|
7
|
+
er: () => (
|
|
8
|
+
TriggersProviderFactory.o(),
|
|
9
|
+
TriggersProviderFactory.provider || TriggersProviderFactory.rg(),
|
|
10
|
+
TriggersProviderFactory.provider
|
|
11
|
+
),
|
|
8
12
|
rg: () => {
|
|
9
13
|
if (!TriggersProviderFactory.provider) {
|
|
10
14
|
const r = e.nn(L.No);
|
|
11
15
|
(TriggersProviderFactory.provider = new gr(
|
|
12
16
|
null != r ? r : 30,
|
|
13
|
-
|
|
17
|
+
se.m().Ze(),
|
|
14
18
|
e.l(),
|
|
15
19
|
e.cr(),
|
|
16
|
-
|
|
20
|
+
se.m(),
|
|
17
21
|
)),
|
|
18
22
|
e.dr(TriggersProviderFactory.provider);
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
|
-
|
|
25
|
+
o: () => {
|
|
22
26
|
TriggersProviderFactory.t ||
|
|
23
27
|
(TriggersProviderFactory.rg(),
|
|
24
28
|
e.g(TriggersProviderFactory),
|
|
@@ -26,5 +30,5 @@ export const TriggersProviderFactory = {
|
|
|
26
30
|
},
|
|
27
31
|
destroy: () => {
|
|
28
32
|
(TriggersProviderFactory.provider = null), (TriggersProviderFactory.t = !1);
|
|
29
|
-
}
|
|
33
|
+
},
|
|
30
34
|
};
|