@braze/web-sdk 5.0.0 → 5.1.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/README.md +1 -1
- package/index.d.ts +12 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +29 -29
- package/shared-lib/guid.js +3 -3
- package/shared-lib/index.js +6 -0
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +21 -21
- package/src/Card/card-manager.js +43 -45
- package/src/Card/display/card-display.js +60 -60
- package/src/Card/log-card-click.js +4 -4
- package/src/Card/log-card-dismissal.js +2 -3
- package/src/Card/log-card-impressions.js +7 -7
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +73 -73
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +19 -19
- package/src/Card/util/card-factory.js +68 -68
- package/src/ContentCards/content-cards-provider-factory.js +3 -3
- package/src/ContentCards/content-cards-provider.js +255 -245
- package/src/ContentCards/content-cards.js +2 -2
- 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 +6 -6
- package/src/ContentCards/ui/hide-content-cards.js +1 -1
- package/src/ContentCards/ui/show-content-cards.js +24 -24
- package/src/ContentCards/ui/toggle-content-cards.js +1 -1
- package/src/Core/add-sdk-metadata.js +21 -19
- package/src/Core/change-user.js +10 -10
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +11 -11
- package/src/Core/enable-sdk.js +7 -7
- package/src/Core/get-device-id.js +6 -6
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +41 -41
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +15 -15
- package/src/Core/log-purchase.js +31 -37
- package/src/Core/open-session.js +12 -12
- package/src/Core/remove-all-subscriptions.js +1 -1
- package/src/Core/remove-subscription.js +1 -1
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -4
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +12 -12
- package/src/FeatureFlags/feature-flag.js +10 -10
- package/src/FeatureFlags/feature-flags-provider-factory.js +3 -2
- package/src/FeatureFlags/feature-flags-provider.js +108 -80
- package/src/FeatureFlags/get-all-feature-flags.js +5 -5
- package/src/FeatureFlags/get-feature-flag.js +6 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +15 -13
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +7 -4
- package/src/Feed/feed-provider-factory.js +2 -2
- package/src/Feed/feed-provider.js +44 -44
- package/src/Feed/feed.js +1 -1
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +4 -4
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/hide-feed.js +1 -1
- package/src/Feed/ui/show-feed.js +28 -28
- package/src/Feed/ui/toggle-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +5 -5
- package/src/InAppMessage/display/html-message-to-html.js +54 -54
- package/src/InAppMessage/display/in-app-message-to-html.js +79 -79
- package/src/InAppMessage/display/modal-utils.js +8 -8
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +49 -49
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +143 -138
- package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-impression.js +6 -6
- package/src/InAppMessage/models/full-screen-message.js +33 -33
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +6 -6
- package/src/InAppMessage/models/in-app-message.js +99 -99
- package/src/InAppMessage/models/modal-message.js +32 -32
- package/src/InAppMessage/models/slide-up-message.js +28 -28
- 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 +4 -4
- package/src/InAppMessage/ui/show-in-app-message.js +81 -81
- package/src/Push/is-push-blocked.js +1 -1
- package/src/Push/is-push-permission-granted.js +1 -1
- package/src/Push/is-push-supported.js +1 -1
- package/src/Push/push-manager-factory.js +5 -5
- package/src/Push/push-manager.js +176 -173
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +29 -29
- package/src/User/user.js +72 -74
- package/src/common/base-feed.js +7 -7
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/event-logger.js +21 -18
- package/src/common/feed-display.js +44 -44
- package/src/l10n/l10n-manager-factory.js +3 -3
- package/src/l10n/l10n-manager.js +7 -7
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +188 -189
- package/src/managers/device-manager.js +28 -28
- package/src/managers/network-manager.js +189 -138
- package/src/managers/server-config-manager.js +69 -53
- package/src/managers/session-manager.js +34 -30
- package/src/managers/storage-manager-factory.js +16 -16
- package/src/managers/storage-manager.js +210 -188
- package/src/managers/subscription-manager.js +12 -12
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +3 -3
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +34 -14
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +32 -23
- package/src/request-controller.js +187 -180
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +10 -10
- package/src/triggers/models/filter-set.js +13 -13
- package/src/triggers/models/filter.js +45 -45
- package/src/triggers/models/in-app-message-click-data.js +12 -12
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +7 -7
- package/src/triggers/models/trigger-condition.js +57 -59
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +38 -38
- package/src/triggers/triggers-provider-factory.js +4 -4
- package/src/triggers/triggers-provider.js +127 -130
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +3 -3
- package/src/util/braze-actions.js +35 -35
- package/src/util/browser-detector.js +21 -21
- package/src/util/client-hints-parser.js +8 -8
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +1 -1
- package/src/util/deprecation-utils.js +4 -4
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +18 -18
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +18 -18
- package/src/util/request-header-utils.js +39 -37
- package/src/util/string-utils.js +10 -10
- package/src/util/user-agent-parser.js +18 -18
- package/src/util/validation-utils.js +37 -39
- package/src/util/window-utils.js +3 -3
- package/shared-lib/braze-shared-lib.js +0 -8
|
@@ -2,10 +2,10 @@ import { isDate as yt } from "../../util/code-utils.js";
|
|
|
2
2
|
import {
|
|
3
3
|
convertMsToSeconds as h,
|
|
4
4
|
dateFromUnixTimestamp as l,
|
|
5
|
-
secondsAgo as
|
|
6
|
-
secondsInTheFuture as
|
|
5
|
+
secondsAgo as es,
|
|
6
|
+
secondsInTheFuture as ls,
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
8
|
-
export default class
|
|
8
|
+
export default class lr {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
10
|
(this.Tl = t),
|
|
11
11
|
(this.Al = s),
|
|
@@ -15,48 +15,48 @@ export default class Zt {
|
|
|
15
15
|
(this.Al = s),
|
|
16
16
|
(this.comparator = e),
|
|
17
17
|
(this._l = i),
|
|
18
|
-
this.Al ===
|
|
19
|
-
this.comparator !==
|
|
20
|
-
this.comparator !==
|
|
21
|
-
this.comparator !==
|
|
22
|
-
this.comparator !==
|
|
18
|
+
this.Al === lr.Il.Ll &&
|
|
19
|
+
this.comparator !== lr.Ul.Ol &&
|
|
20
|
+
this.comparator !== lr.Ul.Ql &&
|
|
21
|
+
this.comparator !== lr.Ul.Xl &&
|
|
22
|
+
this.comparator !== lr.Ul.Fl &&
|
|
23
23
|
(this._l = l(this._l));
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
Jl(t) {
|
|
26
26
|
let s = null;
|
|
27
27
|
switch ((null != t && (s = t[this.Tl]), this.comparator)) {
|
|
28
|
-
case
|
|
28
|
+
case lr.Ul.Kl:
|
|
29
29
|
return null != s && s.valueOf() === this._l.valueOf();
|
|
30
|
-
case
|
|
30
|
+
case lr.Ul.Pl:
|
|
31
31
|
return null == s || s.valueOf() !== this._l.valueOf();
|
|
32
|
-
case
|
|
32
|
+
case lr.Ul.Yl:
|
|
33
33
|
return null != s && typeof s == typeof this._l && s > this._l;
|
|
34
|
-
case
|
|
35
|
-
return this.Al ===
|
|
36
|
-
? null != s && yt(s) &&
|
|
34
|
+
case lr.Ul.Ol:
|
|
35
|
+
return this.Al === lr.Il.Ll
|
|
36
|
+
? null != s && yt(s) && es(s) <= this._l.valueOf()
|
|
37
37
|
: null != s && typeof s == typeof this._l && s >= this._l;
|
|
38
|
-
case
|
|
38
|
+
case lr.Ul.Zl:
|
|
39
39
|
return null != s && typeof s == typeof this._l && s < this._l;
|
|
40
|
-
case
|
|
41
|
-
return this.Al ===
|
|
42
|
-
? null != s && yt(s) &&
|
|
40
|
+
case lr.Ul.Ql:
|
|
41
|
+
return this.Al === lr.Il.Ll
|
|
42
|
+
? null != s && yt(s) && es(s) >= this._l.valueOf()
|
|
43
43
|
: null != s && typeof s == typeof this._l && s <= this._l;
|
|
44
|
-
case
|
|
44
|
+
case lr.Ul.$l:
|
|
45
45
|
return (
|
|
46
46
|
null != s &&
|
|
47
47
|
"string" == typeof s &&
|
|
48
48
|
typeof s == typeof this._l &&
|
|
49
49
|
null != s.match(this._l)
|
|
50
50
|
);
|
|
51
|
-
case
|
|
51
|
+
case lr.Ul.Eu:
|
|
52
52
|
return null != s;
|
|
53
|
-
case
|
|
53
|
+
case lr.Ul.Hu:
|
|
54
54
|
return null == s;
|
|
55
|
-
case
|
|
56
|
-
return null != s && yt(s) &&
|
|
57
|
-
case
|
|
58
|
-
return null != s && yt(s) &&
|
|
59
|
-
case
|
|
55
|
+
case lr.Ul.Xl:
|
|
56
|
+
return null != s && yt(s) && ls(s) < this._l;
|
|
57
|
+
case lr.Ul.Fl:
|
|
58
|
+
return null != s && yt(s) && ls(s) > this._l;
|
|
59
|
+
case lr.Ul.Qu:
|
|
60
60
|
return (
|
|
61
61
|
null == s ||
|
|
62
62
|
typeof s != typeof this._l ||
|
|
@@ -67,36 +67,36 @@ export default class Zt {
|
|
|
67
67
|
return !1;
|
|
68
68
|
}
|
|
69
69
|
static fromJson(t) {
|
|
70
|
-
return new
|
|
70
|
+
return new lr(
|
|
71
71
|
t.property_key,
|
|
72
72
|
t.property_type,
|
|
73
73
|
t.comparator,
|
|
74
74
|
t.property_value,
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
Y() {
|
|
78
78
|
let t = this._l;
|
|
79
79
|
return (
|
|
80
80
|
yt(this._l) && (t = h(t.valueOf())),
|
|
81
81
|
{ k: this.Tl, t: this.Al, c: this.comparator, v: t }
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
|
-
static
|
|
85
|
-
return new
|
|
84
|
+
static En(t) {
|
|
85
|
+
return new lr(t.k, t.t, t.c, t.v);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
(
|
|
89
|
-
(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
(lr.Il = { Xu: "boolean", Bu: "number", Gu: "string", Ll: "date" }),
|
|
89
|
+
(lr.Ul = {
|
|
90
|
+
Kl: 1,
|
|
91
|
+
Pl: 2,
|
|
92
|
+
Yl: 3,
|
|
93
|
+
Ol: 4,
|
|
94
|
+
Zl: 5,
|
|
95
|
+
Ql: 6,
|
|
96
|
+
$l: 10,
|
|
97
|
+
Eu: 11,
|
|
98
|
+
Hu: 12,
|
|
99
|
+
Xl: 15,
|
|
100
|
+
Fl: 16,
|
|
101
|
+
Qu: 17,
|
|
102
102
|
});
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import ri from "./trigger-condition.js";
|
|
2
|
-
export default class
|
|
2
|
+
export default class ni {
|
|
3
3
|
constructor(t, i) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.zu = t), (this.Ju = i), (this.zu = t), (this.Ju = i);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
8
|
-
const i = ri.
|
|
6
|
+
Jl(t) {
|
|
7
|
+
if (null == this.zu) return !1;
|
|
8
|
+
const i = ri.Ku(t[0], this.zu);
|
|
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 ni(t ? t.id : null, t ? t.buttons : null);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
return this.
|
|
22
|
+
Y() {
|
|
23
|
+
return this.zu;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -2,13 +2,13 @@ export default class rs {
|
|
|
2
2
|
constructor(t) {
|
|
3
3
|
(this.productId = t), (this.productId = t);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Jl(t) {
|
|
6
6
|
return null == this.productId || t[0] === this.productId;
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
9
|
return new rs(t ? t.product_id : null);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
Y() {
|
|
12
12
|
return this.productId;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import ts from "./filter-set.js";
|
|
2
|
+
export default class ns {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.productId = t), (this.
|
|
4
|
+
(this.productId = t), (this.Ml = s), (this.productId = t), (this.Ml = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.productId || null == this.
|
|
6
|
+
Jl(t) {
|
|
7
|
+
if (null == this.productId || null == this.Ml) return !1;
|
|
8
8
|
const s = t[0],
|
|
9
9
|
i = t[1];
|
|
10
|
-
return s === this.productId && this.Jl
|
|
10
|
+
return s === this.productId && this.Ml.Jl(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
|
-
return new
|
|
13
|
+
return new ns(
|
|
14
14
|
t ? t.product_id : null,
|
|
15
|
-
t ?
|
|
15
|
+
t ? ts.fromJson(t.property_filters) : null,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return { id: this.productId, pf: this.
|
|
18
|
+
Y() {
|
|
19
|
+
return { id: this.productId, pf: this.Ml ? this.Ml.Y() : 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 ur {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.zu = t), (this.zu = t);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
return null == this.
|
|
6
|
+
Jl(t) {
|
|
7
|
+
return null == this.zu || ri.Ku(t[0], this.zu);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t) {
|
|
10
|
-
return new
|
|
10
|
+
return new ur(t ? t.campaign_id : null);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
return this.
|
|
12
|
+
Y() {
|
|
13
|
+
return this.zu;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import Zt from "./custom-event-data.js";
|
|
2
|
+
import is from "./custom-event-property-data.js";
|
|
3
|
+
import ts from "./filter-set.js";
|
|
4
|
+
import ni from "./in-app-message-click-data.js";
|
|
5
5
|
import rs from "./purchase-data.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import ns from "./purchase-property-data.js";
|
|
7
|
+
import ur from "./push-click-data.js";
|
|
8
8
|
import tt from "./trigger-events.js";
|
|
9
|
-
import r from "../../../shared-lib/
|
|
10
|
-
import { getErrorMessage as
|
|
9
|
+
import { logger as r } from "../../../shared-lib/index.js";
|
|
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
|
+
sc(e, t) {
|
|
16
|
+
return ri.cc[this.type] === e && (null == this.data || this.data.Jl(t));
|
|
17
17
|
}
|
|
18
|
-
static
|
|
18
|
+
static Ku(e, t) {
|
|
19
19
|
let s = null;
|
|
20
20
|
try {
|
|
21
21
|
s = window.atob(e);
|
|
22
22
|
} catch (t) {
|
|
23
|
-
return (
|
|
24
|
-
r.j.info("Failed to unencode analytics id " + e + ": " + ei(t)), !1
|
|
25
|
-
);
|
|
23
|
+
return r.info("Failed to unencode analytics id " + e + ": " + si(t)), !1;
|
|
26
24
|
}
|
|
27
25
|
return t === s.split("_")[0];
|
|
28
26
|
}
|
|
@@ -30,76 +28,76 @@ export default class ri {
|
|
|
30
28
|
const t = e.type;
|
|
31
29
|
let r = null;
|
|
32
30
|
switch (t) {
|
|
33
|
-
case ri.
|
|
34
|
-
case ri.
|
|
31
|
+
case ri.Kr.OPEN:
|
|
32
|
+
case ri.Kr.kt:
|
|
35
33
|
break;
|
|
36
|
-
case ri.
|
|
34
|
+
case ri.Kr.Rr:
|
|
37
35
|
r = rs.fromJson(e.data);
|
|
38
36
|
break;
|
|
39
|
-
case ri.
|
|
40
|
-
r =
|
|
37
|
+
case ri.Kr.nc:
|
|
38
|
+
r = ns.fromJson(e.data);
|
|
41
39
|
break;
|
|
42
|
-
case ri.
|
|
43
|
-
r =
|
|
40
|
+
case ri.Kr.vr:
|
|
41
|
+
r = ur.fromJson(e.data);
|
|
44
42
|
break;
|
|
45
|
-
case ri.
|
|
46
|
-
r =
|
|
43
|
+
case ri.Kr.ue:
|
|
44
|
+
r = Zt.fromJson(e.data);
|
|
47
45
|
break;
|
|
48
|
-
case ri.
|
|
49
|
-
r =
|
|
46
|
+
case ri.Kr.lc:
|
|
47
|
+
r = is.fromJson(e.data);
|
|
50
48
|
break;
|
|
51
|
-
case ri.
|
|
52
|
-
r =
|
|
49
|
+
case ri.Kr.mo:
|
|
50
|
+
r = ni.fromJson(e.data);
|
|
53
51
|
}
|
|
54
52
|
return new ri(t, r);
|
|
55
53
|
}
|
|
56
|
-
|
|
57
|
-
return { t: this.type, d: this.data ? this.data.
|
|
54
|
+
Y() {
|
|
55
|
+
return { t: this.type, d: this.data ? this.data.Y() : null };
|
|
58
56
|
}
|
|
59
|
-
static
|
|
57
|
+
static En(e) {
|
|
60
58
|
let t,
|
|
61
59
|
r = null;
|
|
62
60
|
switch (e.t) {
|
|
63
|
-
case ri.
|
|
64
|
-
case ri.
|
|
61
|
+
case ri.Kr.OPEN:
|
|
62
|
+
case ri.Kr.kt:
|
|
65
63
|
break;
|
|
66
|
-
case ri.
|
|
64
|
+
case ri.Kr.Rr:
|
|
67
65
|
r = new rs(e.d);
|
|
68
66
|
break;
|
|
69
|
-
case ri.
|
|
70
|
-
(t = e.d || {}), (r = new
|
|
67
|
+
case ri.Kr.nc:
|
|
68
|
+
(t = e.d || {}), (r = new ns(t.id, ts.En(t.pf || [])));
|
|
71
69
|
break;
|
|
72
|
-
case ri.
|
|
73
|
-
r = new
|
|
70
|
+
case ri.Kr.vr:
|
|
71
|
+
r = new ur(e.d);
|
|
74
72
|
break;
|
|
75
|
-
case ri.
|
|
76
|
-
r = new
|
|
73
|
+
case ri.Kr.ue:
|
|
74
|
+
r = new Zt(e.d);
|
|
77
75
|
break;
|
|
78
|
-
case ri.
|
|
79
|
-
(t = e.d || {}), (r = new
|
|
76
|
+
case ri.Kr.lc:
|
|
77
|
+
(t = e.d || {}), (r = new is(t.e, ts.En(t.pf || [])));
|
|
80
78
|
break;
|
|
81
|
-
case ri.
|
|
82
|
-
r = new
|
|
79
|
+
case ri.Kr.mo:
|
|
80
|
+
r = new ni(e.d);
|
|
83
81
|
}
|
|
84
82
|
return new ri(e.t, r);
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
|
-
(ri.
|
|
85
|
+
(ri.Kr = {
|
|
88
86
|
OPEN: "open",
|
|
89
87
|
Rr: "purchase",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
nc: "purchase_property",
|
|
89
|
+
vr: "push_click",
|
|
90
|
+
ue: "custom_event",
|
|
91
|
+
lc: "custom_event_property",
|
|
92
|
+
mo: "iam_click",
|
|
93
|
+
kt: "test",
|
|
96
94
|
}),
|
|
97
|
-
(ri.
|
|
98
|
-
(ri.
|
|
99
|
-
(ri.
|
|
100
|
-
(ri.
|
|
101
|
-
(ri.
|
|
102
|
-
(ri.
|
|
103
|
-
(ri.
|
|
104
|
-
(ri.
|
|
105
|
-
(ri.
|
|
95
|
+
(ri.cc = {}),
|
|
96
|
+
(ri.cc[ri.Kr.OPEN] = tt.OPEN),
|
|
97
|
+
(ri.cc[ri.Kr.Rr] = tt.Rr),
|
|
98
|
+
(ri.cc[ri.Kr.nc] = tt.Rr),
|
|
99
|
+
(ri.cc[ri.Kr.vr] = tt.vr),
|
|
100
|
+
(ri.cc[ri.Kr.ue] = tt.ue),
|
|
101
|
+
(ri.cc[ri.Kr.lc] = tt.ue),
|
|
102
|
+
(ri.cc[ri.Kr.mo] = tt.mo),
|
|
103
|
+
(ri.cc[ri.Kr.kt] = tt.kt);
|
|
@@ -2,58 +2,58 @@ import {
|
|
|
2
2
|
dateFromUnixTimestamp as l,
|
|
3
3
|
rehydrateDateAfterJsonization as w,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
|
-
import r from "../../../shared-lib/
|
|
5
|
+
import { logger as r } from "../../../shared-lib/index.js";
|
|
6
6
|
import ri from "./trigger-condition.js";
|
|
7
|
-
import { validateValueIsFromEnum as
|
|
7
|
+
import { validateValueIsFromEnum as J } from "../../util/code-utils.js";
|
|
8
8
|
export default class pt {
|
|
9
|
-
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = pt.
|
|
9
|
+
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = pt.Vu, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
|
-
(this.
|
|
11
|
+
(this.Wu = i),
|
|
12
12
|
(this.startTime = s),
|
|
13
13
|
(this.endTime = e),
|
|
14
14
|
(this.priority = r),
|
|
15
15
|
(this.type = h),
|
|
16
16
|
(this.data = l),
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
17
|
+
(this.Yu = o),
|
|
18
|
+
(this.Zu = n),
|
|
19
|
+
(this.Vr = a),
|
|
20
|
+
(this.td = u),
|
|
21
|
+
(this.sd = d),
|
|
22
22
|
(this.id = t),
|
|
23
|
-
(this.
|
|
23
|
+
(this.Wu = i || []),
|
|
24
24
|
void 0 === s && (s = null),
|
|
25
25
|
(this.startTime = s),
|
|
26
26
|
void 0 === e && (e = null),
|
|
27
27
|
(this.endTime = e),
|
|
28
28
|
(this.priority = r || 0),
|
|
29
29
|
(this.type = h),
|
|
30
|
-
(this.
|
|
31
|
-
null == a && (a = 1e3 * (this.
|
|
32
|
-
(this.
|
|
30
|
+
(this.Yu = o || 0),
|
|
31
|
+
null == a && (a = 1e3 * (this.Yu + 30)),
|
|
32
|
+
(this.Vr = a),
|
|
33
33
|
(this.data = l),
|
|
34
|
-
null != n && (this.
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
34
|
+
null != n && (this.Zu = n),
|
|
35
|
+
(this.td = u),
|
|
36
|
+
(this.sd = d || null);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
ed(t) {
|
|
39
39
|
return (
|
|
40
|
-
null == this.
|
|
40
|
+
null == this.sd || (this.Zu !== pt.Vu && t - this.sd >= 1e3 * this.Zu)
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
this.
|
|
43
|
+
rd(t) {
|
|
44
|
+
this.sd = t;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
const i = t + 1e3 * this.
|
|
46
|
+
hd(t) {
|
|
47
|
+
const i = t + 1e3 * this.Yu;
|
|
48
48
|
return Math.max(i - new Date().valueOf(), 0);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
od(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.Vr || i < this.Vr;
|
|
53
53
|
return (
|
|
54
54
|
s ||
|
|
55
|
-
r.
|
|
56
|
-
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.
|
|
55
|
+
r.info(
|
|
56
|
+
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.Vr}ms.`,
|
|
57
57
|
),
|
|
58
58
|
!s
|
|
59
59
|
);
|
|
@@ -72,8 +72,8 @@ export default class pt {
|
|
|
72
72
|
u = t.timeout,
|
|
73
73
|
d = t.data,
|
|
74
74
|
m = t.min_seconds_since_last_trigger;
|
|
75
|
-
return
|
|
76
|
-
pt.
|
|
75
|
+
return J(
|
|
76
|
+
pt.Kr,
|
|
77
77
|
o,
|
|
78
78
|
"Could not construct Trigger from server data",
|
|
79
79
|
"Trigger.Types",
|
|
@@ -81,9 +81,9 @@ export default class pt {
|
|
|
81
81
|
? new pt(i, s, e, r, h, o, d, n, a, u, m)
|
|
82
82
|
: null;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
Y() {
|
|
85
85
|
const t = [];
|
|
86
|
-
for (let i = 0; i < this.
|
|
86
|
+
for (let i = 0; i < this.Wu.length; i++) t.push(this.Wu[i].Y());
|
|
87
87
|
return {
|
|
88
88
|
i: this.id,
|
|
89
89
|
c: t,
|
|
@@ -92,17 +92,17 @@ export default class pt {
|
|
|
92
92
|
p: this.priority,
|
|
93
93
|
t: this.type,
|
|
94
94
|
da: this.data,
|
|
95
|
-
d: this.
|
|
96
|
-
r: this.
|
|
97
|
-
tm: this.
|
|
98
|
-
ss: this.
|
|
99
|
-
ld: this.
|
|
95
|
+
d: this.Yu,
|
|
96
|
+
r: this.Zu,
|
|
97
|
+
tm: this.Vr,
|
|
98
|
+
ss: this.td,
|
|
99
|
+
ld: this.sd,
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
static
|
|
102
|
+
static En(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.En(s[t]));
|
|
106
106
|
return new pt(
|
|
107
107
|
t.i,
|
|
108
108
|
i,
|
|
@@ -119,4 +119,4 @@ export default class pt {
|
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
(pt.
|
|
122
|
+
(pt.Kr = { Jr: "inapp", nd: "templated_iam" }), (pt.Vu = -1);
|
|
@@ -4,22 +4,22 @@ import gr from "./triggers-provider.js";
|
|
|
4
4
|
export const TriggersProviderFactory = {
|
|
5
5
|
t: !1,
|
|
6
6
|
provider: null,
|
|
7
|
-
|
|
7
|
+
rr: () => (
|
|
8
8
|
TriggersProviderFactory.o(),
|
|
9
9
|
TriggersProviderFactory.provider || TriggersProviderFactory.rg(),
|
|
10
10
|
TriggersProviderFactory.provider
|
|
11
11
|
),
|
|
12
12
|
rg: () => {
|
|
13
13
|
if (!TriggersProviderFactory.provider) {
|
|
14
|
-
const r = e.nn(L.
|
|
14
|
+
const r = e.nn(L.Po);
|
|
15
15
|
(TriggersProviderFactory.provider = new gr(
|
|
16
16
|
null != r ? r : 30,
|
|
17
|
-
se.m().
|
|
17
|
+
se.m().He(),
|
|
18
18
|
e.l(),
|
|
19
19
|
e.cr(),
|
|
20
20
|
se.m(),
|
|
21
21
|
)),
|
|
22
|
-
e.
|
|
22
|
+
e.ar(TriggersProviderFactory.provider);
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
o: () => {
|