@braze/web-sdk 4.7.2 → 4.8.1
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 +32 -26
- 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 +25 -25
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +74 -74
- 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 +48 -42
- 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 +36 -34
- 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 +8 -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 +41 -37
- 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 +130 -110
- 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 +193 -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 +95 -85
- package/src/common/types.js +1 -0
- package/src/l10n/l10n-manager-factory.js +10 -10
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +37 -34
- package/src/managers/braze-instance.js +209 -193
- package/src/managers/device-manager.js +43 -38
- package/src/managers/network-manager.js +119 -96
- package/src/managers/server-config-manager.js +68 -48
- package/src/managers/session-manager.js +52 -45
- package/src/managers/storage-manager-factory.js +29 -22
- package/src/managers/storage-manager.js +288 -273
- package/src/managers/subscription-manager.js +9 -6
- package/src/managers/types.js +1 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +14 -8
- package/src/models/device.js +10 -18
- package/src/models/identifier.js +10 -11
- package/src/models/push-token.js +17 -12
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +36 -20
- package/src/models/types.js +1 -0
- 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 +7 -7
- package/src/triggers/models/trigger-condition.js +57 -57
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +42 -42
- package/src/triggers/triggers-provider-factory.js +8 -8
- package/src/triggers/triggers-provider.js +173 -170
- 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 +2 -2
- package/src/util/braze-actions.js +20 -20
- package/src/util/browser-detector.js +22 -22
- package/src/util/client-hints-parser.js +7 -7
- 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 +3 -3
- package/src/util/dom-utils.js +7 -7
- package/src/util/error-utils.js +2 -0
- 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 +21 -21
- package/src/util/validation-utils.js +44 -44
- package/src/util/window-utils.js +3 -3
|
@@ -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 sr {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.Eu = t),
|
|
11
|
+
(this.Tu = 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.Au = i),
|
|
14
|
+
this.Tu === sr.yu._u &&
|
|
15
|
+
this.comparator !== sr.Nu.Su &&
|
|
16
|
+
this.comparator !== sr.Nu.Mu &&
|
|
17
|
+
this.comparator !== sr.Nu.Ru &&
|
|
18
|
+
this.comparator !== sr.Nu.Hu &&
|
|
19
|
+
(this.Au = l(this.Au));
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
xu(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.Eu]), this.comparator)) {
|
|
24
|
+
case sr.Nu.Lu:
|
|
25
|
+
return null != s && s.valueOf() === this.Au.valueOf();
|
|
26
|
+
case sr.Nu.Iu:
|
|
27
|
+
return null == s || s.valueOf() !== this.Au.valueOf();
|
|
28
|
+
case sr.Nu.Ou:
|
|
29
|
+
return typeof s == typeof this.Au && s > this.Au;
|
|
30
|
+
case sr.Nu.Su:
|
|
31
|
+
return this.Tu === sr.yu._u
|
|
32
|
+
? null != s && Nt(s) && ts(s) <= this.Au
|
|
33
|
+
: typeof s == typeof this.Au && s >= this.Au;
|
|
34
|
+
case sr.Nu.Uu:
|
|
35
|
+
return typeof s == typeof this.Au && s < this.Au;
|
|
36
|
+
case sr.Nu.Mu:
|
|
37
|
+
return this.Tu === sr.yu._u
|
|
38
|
+
? null != s && Nt(s) && ts(s) >= this.Au
|
|
39
|
+
: typeof s == typeof this.Au && s <= this.Au;
|
|
40
|
+
case sr.Nu.Du:
|
|
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.Au &&
|
|
45
|
+
null != s.match(this.Au)
|
|
46
46
|
);
|
|
47
|
-
case
|
|
47
|
+
case sr.Nu.Qu:
|
|
48
48
|
return null != s;
|
|
49
|
-
case
|
|
49
|
+
case sr.Nu.Xu:
|
|
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 sr.Nu.Ru:
|
|
52
|
+
return null != s && Nt(s) && es(s) < this.Au;
|
|
53
|
+
case sr.Nu.Hu:
|
|
54
|
+
return null != s && Nt(s) && es(s) > this.Au;
|
|
55
|
+
case sr.Nu.Bu:
|
|
56
56
|
return (
|
|
57
57
|
null == s ||
|
|
58
|
-
typeof s != typeof this.
|
|
58
|
+
typeof s != typeof this.Au ||
|
|
59
59
|
"string" != typeof s ||
|
|
60
|
-
null == s.match(this.
|
|
60
|
+
null == s.match(this.Au)
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
static fromJson(t) {
|
|
66
|
-
return new
|
|
66
|
+
return new sr(
|
|
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.Au;
|
|
75
75
|
return (
|
|
76
|
-
Nt(this.
|
|
77
|
-
{ k: this.
|
|
76
|
+
Nt(this.Au) && (t = h(t.valueOf())),
|
|
77
|
+
{ k: this.Eu, t: this.Tu, c: this.comparator, v: t }
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
|
-
static
|
|
81
|
-
return new
|
|
80
|
+
static zn(t) {
|
|
81
|
+
return new sr(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
|
+
(sr.Nu = {
|
|
85
|
+
Lu: 1,
|
|
86
|
+
Iu: 2,
|
|
87
|
+
Ou: 3,
|
|
88
|
+
Su: 4,
|
|
89
|
+
Uu: 5,
|
|
90
|
+
Mu: 6,
|
|
91
|
+
Du: 10,
|
|
92
|
+
Qu: 11,
|
|
93
|
+
Xu: 12,
|
|
94
|
+
Ru: 15,
|
|
95
|
+
Hu: 16,
|
|
96
|
+
Bu: 17
|
|
97
97
|
}),
|
|
98
|
-
(
|
|
98
|
+
(sr.yu = { Gu: "boolean", bu: "number", zu: "string", _u: "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.ku = t), (this.Ju = i);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
8
|
-
const i =
|
|
6
|
+
xu(t) {
|
|
7
|
+
if (null == this.ku) return !1;
|
|
8
|
+
const i = ri.qu(t[0], this.ku);
|
|
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.Ju || 0 === this.Ju.length;
|
|
11
|
+
if (null != this.Ju)
|
|
12
|
+
for (let i = 0; i < this.Ju.length; i++)
|
|
13
|
+
if (this.Ju[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.ku;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class lr {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
this.productId = t;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
xu(t) {
|
|
6
6
|
return null == this.productId || t[0] === this.productId;
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
|
-
return new
|
|
9
|
+
return new lr(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 Yt from "./filter-set.js";
|
|
2
|
+
export default class is {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.productId = t), (this.
|
|
4
|
+
(this.productId = t), (this.ju = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.productId || null == this.
|
|
6
|
+
xu(t) {
|
|
7
|
+
if (null == this.productId || null == this.ju) 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.ju.xu(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 ? 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.ju.ss() };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import ri from "./trigger-condition.js";
|
|
2
|
+
export default class ur {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
this.
|
|
4
|
+
this.ku = t;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
return null == this.
|
|
6
|
+
xu(t) {
|
|
7
|
+
return null == this.ku || ri.qu(t[0], this.ku);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t) {
|
|
10
|
-
return new
|
|
10
|
+
return new ur(t ? t.campaign_id : null);
|
|
11
11
|
}
|
|
12
12
|
ss() {
|
|
13
|
-
return this.
|
|
13
|
+
return this.ku;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import Qt from "./custom-event-data.js";
|
|
2
|
+
import Zt from "./custom-event-property-data.js";
|
|
3
|
+
import Yt from "./filter-set.js";
|
|
4
|
+
import si from "./in-app-message-click-data.js";
|
|
5
|
+
import lr from "./purchase-data.js";
|
|
6
|
+
import is from "./purchase-property-data.js";
|
|
7
|
+
import ur from "./push-click-data.js";
|
|
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.rc[this.type] === e && (null == this.data || this.data.xu(t));
|
|
16
16
|
}
|
|
17
|
-
static
|
|
17
|
+
static qu(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.ac.OPEN:
|
|
33
33
|
r = null;
|
|
34
34
|
break;
|
|
35
|
-
case
|
|
36
|
-
r = $t.fromJson(e.data);
|
|
37
|
-
break;
|
|
38
|
-
case Yt.rc.ac:
|
|
39
|
-
r = ts.fromJson(e.data);
|
|
40
|
-
break;
|
|
41
|
-
case Yt.rc.vr:
|
|
35
|
+
case ri.ac.Rr:
|
|
42
36
|
r = lr.fromJson(e.data);
|
|
43
37
|
break;
|
|
44
|
-
case
|
|
45
|
-
r =
|
|
38
|
+
case ri.ac.sc:
|
|
39
|
+
r = is.fromJson(e.data);
|
|
40
|
+
break;
|
|
41
|
+
case ri.ac.zr:
|
|
42
|
+
r = ur.fromJson(e.data);
|
|
46
43
|
break;
|
|
47
|
-
case
|
|
48
|
-
r =
|
|
44
|
+
case ri.ac.be:
|
|
45
|
+
r = Qt.fromJson(e.data);
|
|
49
46
|
break;
|
|
50
|
-
case
|
|
47
|
+
case ri.ac.cc:
|
|
51
48
|
r = Zt.fromJson(e.data);
|
|
52
49
|
break;
|
|
53
|
-
case
|
|
50
|
+
case ri.ac.Lr:
|
|
51
|
+
r = si.fromJson(e.data);
|
|
52
|
+
break;
|
|
53
|
+
case ri.ac.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 zn(e) {
|
|
62
62
|
let t, r;
|
|
63
63
|
switch (e.t) {
|
|
64
|
-
case
|
|
64
|
+
case ri.ac.OPEN:
|
|
65
65
|
t = null;
|
|
66
66
|
break;
|
|
67
|
-
case
|
|
68
|
-
t = new
|
|
67
|
+
case ri.ac.Rr:
|
|
68
|
+
t = new lr(e.d);
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
71
|
-
(r = e.d || {}), (t = new
|
|
70
|
+
case ri.ac.sc:
|
|
71
|
+
(r = e.d || {}), (t = new is(r.id, Yt.zn(r.pf || [])));
|
|
72
72
|
break;
|
|
73
|
-
case
|
|
74
|
-
t = new
|
|
73
|
+
case ri.ac.zr:
|
|
74
|
+
t = new ur(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
77
|
-
t = new
|
|
76
|
+
case ri.ac.be:
|
|
77
|
+
t = new Qt(e.d);
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
80
|
-
(r = e.d || {}), (t = new
|
|
79
|
+
case ri.ac.cc:
|
|
80
|
+
(r = e.d || {}), (t = new Zt(r.e, Yt.zn(r.pf || [])));
|
|
81
81
|
break;
|
|
82
|
-
case
|
|
83
|
-
t = new
|
|
82
|
+
case ri.ac.Lr:
|
|
83
|
+
t = new si(e.d);
|
|
84
84
|
break;
|
|
85
|
-
case
|
|
85
|
+
case ri.ac.ks:
|
|
86
86
|
t = null;
|
|
87
87
|
}
|
|
88
|
-
return new
|
|
88
|
+
return new ri(e.t, t);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
(
|
|
91
|
+
(ri.ac = {
|
|
92
92
|
OPEN: "open",
|
|
93
93
|
Rr: "purchase",
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
sc: "purchase_property",
|
|
95
|
+
zr: "push_click",
|
|
96
96
|
be: "custom_event",
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
cc: "custom_event_property",
|
|
98
|
+
Lr: "iam_click",
|
|
99
99
|
ks: "test"
|
|
100
100
|
}),
|
|
101
|
-
(
|
|
102
|
-
(
|
|
103
|
-
(
|
|
104
|
-
(
|
|
105
|
-
(
|
|
106
|
-
(
|
|
107
|
-
(
|
|
108
|
-
(
|
|
109
|
-
(
|
|
101
|
+
(ri.rc = {}),
|
|
102
|
+
(ri.rc[ri.ac.OPEN] = tt.OPEN),
|
|
103
|
+
(ri.rc[ri.ac.Rr] = tt.Rr),
|
|
104
|
+
(ri.rc[ri.ac.sc] = tt.Rr),
|
|
105
|
+
(ri.rc[ri.ac.zr] = tt.zr),
|
|
106
|
+
(ri.rc[ri.ac.be] = tt.be),
|
|
107
|
+
(ri.rc[ri.ac.cc] = tt.be),
|
|
108
|
+
(ri.rc[ri.ac.Lr] = tt.Lr),
|
|
109
|
+
(ri.rc[ri.ac.ks] = tt.ks);
|
|
@@ -1,48 +1,48 @@
|
|
|
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
|
-
(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.vu = n || 0),
|
|
19
|
+
null == a && (a = 1e3 * (this.vu + 30)),
|
|
20
|
+
(this.Kr = a),
|
|
21
21
|
(this.data = o),
|
|
22
|
-
null == h && (h =
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
22
|
+
null == h && (h = mt.$u),
|
|
23
|
+
(this.Cu = h),
|
|
24
|
+
(this.Fu = u),
|
|
25
|
+
(this.Vu = d || null);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
Ku(t) {
|
|
28
28
|
return (
|
|
29
|
-
null == this.
|
|
29
|
+
null == this.Vu || (this.Cu !== mt.$u && t - this.Vu >= 1e3 * this.Cu)
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
this.
|
|
32
|
+
Wu(t) {
|
|
33
|
+
this.Vu = t;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
const i = t + 1e3 * this.
|
|
35
|
+
Yu(t) {
|
|
36
|
+
const i = t + 1e3 * this.vu;
|
|
37
37
|
return Math.max(i - new Date().valueOf(), 0);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
Zu(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.Kr || i < this.Kr;
|
|
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.Kr}ms.`
|
|
46
46
|
),
|
|
47
47
|
!s
|
|
48
48
|
);
|
|
@@ -51,28 +51,28 @@ 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.Gr,
|
|
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() {
|
|
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,17 +81,17 @@ 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.vu,
|
|
85
|
+
r: this.Cu,
|
|
86
|
+
tm: this.Kr,
|
|
87
|
+
ss: this.Fu,
|
|
88
|
+
ld: this.Vu
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
static
|
|
91
|
+
static zn(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.zn(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.$u = -1), (mt.Gr = { _r: "inapp", td: "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: () => {
|