@braze/web-sdk 5.5.0 → 5.6.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 +109 -7
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +33 -31
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +20 -20
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +24 -24
- package/src/Banner/banner-factory.js +14 -0
- package/src/Banner/banner-provider-factory.js +19 -0
- package/src/Banner/banner-provider.js +198 -0
- package/src/Banner/banner.js +30 -0
- package/src/Banner/display/banner-to-html.js +57 -0
- package/src/Banner/display/destroy-banner-html.js +7 -0
- package/src/Banner/display/detect-banner-impressions.js +28 -0
- package/src/Banner/get-all-banners.js +13 -0
- package/src/Banner/get-banner.js +19 -0
- package/src/Banner/index.js +7 -0
- package/src/Banner/log-banner-click.js +22 -0
- package/src/Banner/log-banner-impressions.js +31 -0
- package/src/Banner/request-banners-refresh.js +35 -0
- package/src/Banner/subscribe-to-banners-updates.js +23 -0
- package/src/Banner/types.js +1 -0
- package/src/Banner/ui/insert-banner.js +24 -0
- package/src/Card/card-manager-factory.js +10 -10
- package/src/Card/card-manager.js +54 -52
- package/src/Card/display/card-display.js +77 -91
- package/src/Card/log-card-click.js +6 -6
- package/src/Card/log-card-dismissal.js +6 -5
- package/src/Card/log-card-impressions.js +11 -11
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +99 -99
- 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 +58 -58
- package/src/ContentCards/content-cards-provider-factory.js +14 -14
- package/src/ContentCards/content-cards-provider.js +261 -263
- package/src/ContentCards/content-cards.js +5 -5
- package/src/ContentCards/get-cached-content-cards.js +3 -3
- package/src/ContentCards/request-content-cards-refresh.js +4 -4
- package/src/ContentCards/subscribe-to-content-cards-updates.js +13 -13
- package/src/ContentCards/ui/hide-content-cards.js +7 -7
- package/src/ContentCards/ui/show-content-cards.js +52 -52
- package/src/ContentCards/ui/toggle-content-cards.js +4 -4
- package/src/Core/add-sdk-metadata.js +9 -9
- package/src/Core/change-user.js +14 -14
- package/src/Core/destroy.js +3 -3
- package/src/Core/disable-sdk.js +13 -13
- package/src/Core/enable-sdk.js +9 -9
- package/src/Core/get-device-id.js +10 -10
- package/src/Core/get-user.js +2 -2
- package/src/Core/handle-braze-action.js +53 -53
- package/src/Core/initialize.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +2 -2
- package/src/Core/log-custom-event.js +27 -27
- package/src/Core/log-purchase.js +38 -38
- package/src/Core/open-session.js +18 -18
- package/src/Core/remove-all-subscriptions.js +2 -2
- package/src/Core/remove-subscription.js +3 -3
- package/src/Core/request-immediate-data-flush.js +5 -5
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +6 -6
- package/src/Core/subscribe-to-sdk-authentication-failures.js +5 -5
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +13 -13
- package/src/FeatureFlags/feature-flag.js +10 -10
- package/src/FeatureFlags/feature-flags-provider-factory.js +13 -14
- package/src/FeatureFlags/feature-flags-provider.js +118 -116
- package/src/FeatureFlags/get-all-feature-flags.js +10 -10
- package/src/FeatureFlags/get-feature-flag.js +9 -9
- package/src/FeatureFlags/log-feature-flag-impression.js +18 -18
- package/src/FeatureFlags/refresh-feature-flags.js +6 -6
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +9 -9
- package/src/Feed/feed-provider-factory.js +12 -12
- package/src/Feed/feed-provider.js +59 -59
- package/src/Feed/feed.js +4 -4
- package/src/Feed/get-cached-feed.js +3 -3
- package/src/Feed/log-feed-displayed.js +5 -5
- package/src/Feed/request-feed-refresh.js +3 -3
- package/src/Feed/subscribe-to-feed-updates.js +4 -4
- package/src/Feed/ui/hide-feed.js +5 -5
- package/src/Feed/ui/show-feed.js +53 -53
- package/src/Feed/ui/toggle-feed.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +9 -9
- package/src/InAppMessage/display/html-message-display-utils.js +18 -164
- package/src/InAppMessage/display/html-message-to-html.js +55 -62
- package/src/InAppMessage/display/in-app-message-to-html.js +74 -74
- package/src/InAppMessage/display/modal-utils.js +17 -17
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +61 -61
- package/src/InAppMessage/in-app-message-manager-factory.js +9 -9
- package/src/InAppMessage/in-app-message-manager.js +158 -156
- package/src/InAppMessage/log-in-app-message-button-click.js +16 -16
- package/src/InAppMessage/log-in-app-message-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-html-click.js +15 -15
- package/src/InAppMessage/log-in-app-message-impression.js +6 -6
- package/src/InAppMessage/models/control-message.js +15 -8
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +23 -23
- package/src/InAppMessage/models/in-app-message-button.js +10 -10
- package/src/InAppMessage/models/in-app-message.js +155 -155
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +35 -35
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +3 -3
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +103 -103
- 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 +25 -25
- package/src/Push/push-manager.js +176 -176
- package/src/Push/request-push-permission.js +8 -8
- package/src/Push/unregister-push.js +4 -4
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +38 -38
- package/src/User/user.js +95 -92
- package/src/common/base-feed.js +9 -9
- package/src/common/base-provider.js +2 -2
- package/src/common/constants.js +1 -0
- package/src/common/detect-impression.js +18 -0
- package/src/common/event-logger.js +22 -22
- package/src/common/feed-display.js +53 -53
- package/src/index.js +1 -0
- package/src/l10n/l10n-manager-factory.js +15 -15
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +38 -38
- package/src/managers/braze-instance.js +212 -212
- package/src/managers/device-manager.js +30 -30
- package/src/managers/network-manager.js +234 -235
- package/src/managers/server-config-manager.js +99 -83
- package/src/managers/session-manager.js +46 -50
- package/src/managers/storage-manager-factory.js +13 -13
- package/src/managers/storage-manager.js +182 -180
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +4 -4
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +9 -9
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +15 -15
- package/src/models/push-token.js +10 -10
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +38 -34
- package/src/request-controller.js +228 -228
- package/src/triggers/models/custom-event-data.js +5 -5
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +10 -10
- package/src/triggers/models/filter.js +66 -66
- package/src/triggers/models/in-app-message-click-data.js +10 -10
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +46 -46
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +33 -33
- package/src/triggers/triggers-provider-factory.js +16 -16
- package/src/triggers/triggers-provider.js +156 -154
- package/src/ui/js/attach-css.js +7 -7
- package/src/ui/js/banner-css.js +11 -0
- package/src/ui/js/feed-css.js +4 -4
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/index.js +1 -0
- package/src/ui/js/load-font-awesome.js +8 -8
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +32 -32
- package/src/util/browser-detector.js +27 -27
- package/src/util/client-hints-parser.js +9 -9
- package/src/util/code-utils.js +5 -5
- package/src/util/component-utils.js +5 -5
- package/src/util/deprecation-utils.js +3 -3
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +13 -13
- package/src/util/html-display-utils.js +158 -0
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +21 -21
- package/src/util/request-header-utils.js +31 -30
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +9 -9
- package/src/util/validation-utils.js +89 -85
- package/src/util/window-utils.js +3 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isArray as
|
|
1
|
+
import fr from "./filter.js";
|
|
2
|
+
import { isArray as w } from "../../util/code-utils.js";
|
|
3
3
|
export default class is {
|
|
4
4
|
constructor(t) {
|
|
5
5
|
(this.filters = t), (this.filters = t);
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
xc(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].xc(t)) {
|
|
14
14
|
s = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -22,32 +22,32 @@ export default class is {
|
|
|
22
22
|
return r;
|
|
23
23
|
}
|
|
24
24
|
static fromJson(t) {
|
|
25
|
-
if (null == t || !
|
|
25
|
+
if (null == t || !w(t)) return null;
|
|
26
26
|
const r = [];
|
|
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(fr.fromJson(s[t]));
|
|
31
31
|
r.push(o);
|
|
32
32
|
}
|
|
33
33
|
return new is(r);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
Bs() {
|
|
36
36
|
const t = [];
|
|
37
37
|
for (let r = 0; r < this.filters.length; r++) {
|
|
38
38
|
const e = this.filters[r],
|
|
39
39
|
o = [];
|
|
40
|
-
for (let t = 0; t < e.length; t++) o.push(e[t].
|
|
40
|
+
for (let t = 0; t < e.length; t++) o.push(e[t].Bs());
|
|
41
41
|
t.push(o);
|
|
42
42
|
}
|
|
43
43
|
return t;
|
|
44
44
|
}
|
|
45
|
-
static
|
|
45
|
+
static Qn(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(fr.Qn(s[t]));
|
|
51
51
|
r.push(o);
|
|
52
52
|
}
|
|
53
53
|
return new is(r);
|
|
@@ -1,102 +1,102 @@
|
|
|
1
1
|
import { isDate as Nt } from "../../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
|
-
convertMsToSeconds as
|
|
4
|
-
dateFromUnixTimestamp as
|
|
3
|
+
convertMsToSeconds as L,
|
|
4
|
+
dateFromUnixTimestamp as O,
|
|
5
5
|
secondsAgo as es,
|
|
6
6
|
secondsInTheFuture as ls,
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
8
|
-
export default class
|
|
8
|
+
export default class fr {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.yE = t),
|
|
11
|
+
(this.HE = s),
|
|
12
12
|
(this.comparator = e),
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
15
|
-
(this.
|
|
13
|
+
(this.LE = i),
|
|
14
|
+
(this.yE = t),
|
|
15
|
+
(this.HE = s),
|
|
16
16
|
(this.comparator = e),
|
|
17
|
-
(this.
|
|
18
|
-
this.
|
|
19
|
-
this.comparator !==
|
|
20
|
-
this.comparator !==
|
|
21
|
-
this.comparator !==
|
|
22
|
-
this.comparator !==
|
|
23
|
-
(this.
|
|
17
|
+
(this.LE = i),
|
|
18
|
+
this.HE === fr.QE.UE &&
|
|
19
|
+
this.comparator !== fr.wE.XE &&
|
|
20
|
+
this.comparator !== fr.wE.BE &&
|
|
21
|
+
this.comparator !== fr.wE.jE &&
|
|
22
|
+
this.comparator !== fr.wE.zE &&
|
|
23
|
+
(this.LE = O(this.LE));
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
xc(t) {
|
|
26
26
|
let s = null;
|
|
27
|
-
switch ((null != t && (s = t[this.
|
|
28
|
-
case
|
|
29
|
-
return null != s && s.valueOf() === this.
|
|
30
|
-
case
|
|
31
|
-
return null == s || s.valueOf() !== this.
|
|
32
|
-
case
|
|
33
|
-
return null != s && typeof s == typeof this.
|
|
34
|
-
case
|
|
35
|
-
return this.
|
|
36
|
-
? null != s && Nt(s) && es(s) <= this.
|
|
37
|
-
: null != s && typeof s == typeof this.
|
|
38
|
-
case
|
|
39
|
-
return null != s && typeof s == typeof this.
|
|
40
|
-
case
|
|
41
|
-
return this.
|
|
42
|
-
? null != s && Nt(s) && es(s) >= this.
|
|
43
|
-
: null != s && typeof s == typeof this.
|
|
44
|
-
case
|
|
27
|
+
switch ((null != t && (s = t[this.yE]), this.comparator)) {
|
|
28
|
+
case fr.wE.FE:
|
|
29
|
+
return null != s && s.valueOf() === this.LE.valueOf();
|
|
30
|
+
case fr.wE.kE:
|
|
31
|
+
return null == s || s.valueOf() !== this.LE.valueOf();
|
|
32
|
+
case fr.wE.vE:
|
|
33
|
+
return null != s && typeof s == typeof this.LE && s > this.LE;
|
|
34
|
+
case fr.wE.XE:
|
|
35
|
+
return this.HE === fr.QE.UE
|
|
36
|
+
? null != s && Nt(s) && es(s) <= this.LE.valueOf()
|
|
37
|
+
: null != s && typeof s == typeof this.LE && s >= this.LE;
|
|
38
|
+
case fr.wE.xE:
|
|
39
|
+
return null != s && typeof s == typeof this.LE && s < this.LE;
|
|
40
|
+
case fr.wE.BE:
|
|
41
|
+
return this.HE === fr.QE.UE
|
|
42
|
+
? null != s && Nt(s) && es(s) >= this.LE.valueOf()
|
|
43
|
+
: null != s && typeof s == typeof this.LE && s <= this.LE;
|
|
44
|
+
case fr.wE.JE:
|
|
45
45
|
return (
|
|
46
46
|
null != s &&
|
|
47
47
|
"string" == typeof s &&
|
|
48
|
-
typeof s == typeof this.
|
|
49
|
-
null != s.match(this.
|
|
48
|
+
typeof s == typeof this.LE &&
|
|
49
|
+
null != s.match(this.LE)
|
|
50
50
|
);
|
|
51
|
-
case
|
|
51
|
+
case fr.wE.VE:
|
|
52
52
|
return null != s;
|
|
53
|
-
case
|
|
53
|
+
case fr.wE.qE:
|
|
54
54
|
return null == s;
|
|
55
|
-
case
|
|
56
|
-
return null != s && Nt(s) && ls(s) < this.
|
|
57
|
-
case
|
|
58
|
-
return null != s && Nt(s) && ls(s) > this.
|
|
59
|
-
case
|
|
55
|
+
case fr.wE.jE:
|
|
56
|
+
return null != s && Nt(s) && ls(s) < this.LE;
|
|
57
|
+
case fr.wE.zE:
|
|
58
|
+
return null != s && Nt(s) && ls(s) > this.LE;
|
|
59
|
+
case fr.wE.PE:
|
|
60
60
|
return (
|
|
61
61
|
null == s ||
|
|
62
|
-
typeof s != typeof this.
|
|
62
|
+
typeof s != typeof this.LE ||
|
|
63
63
|
"string" != typeof s ||
|
|
64
|
-
null == s.match(this.
|
|
64
|
+
null == s.match(this.LE)
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
return !1;
|
|
68
68
|
}
|
|
69
69
|
static fromJson(t) {
|
|
70
|
-
return new
|
|
70
|
+
return new fr(
|
|
71
71
|
t.property_key,
|
|
72
72
|
t.property_type,
|
|
73
73
|
t.comparator,
|
|
74
74
|
t.property_value,
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
let t = this.
|
|
77
|
+
Bs() {
|
|
78
|
+
let t = this.LE;
|
|
79
79
|
return (
|
|
80
|
-
Nt(this.
|
|
81
|
-
{ k: this.
|
|
80
|
+
Nt(this.LE) && (t = L(t.valueOf())),
|
|
81
|
+
{ k: this.yE, t: this.HE, c: this.comparator, v: t }
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
|
-
static
|
|
85
|
-
return new
|
|
84
|
+
static Qn(t) {
|
|
85
|
+
return new fr(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
|
+
(fr.QE = { WE: "boolean", ZE: "number", $E: "string", UE: "date" }),
|
|
89
|
+
(fr.wE = {
|
|
90
|
+
FE: 1,
|
|
91
|
+
kE: 2,
|
|
92
|
+
vE: 3,
|
|
93
|
+
XE: 4,
|
|
94
|
+
xE: 5,
|
|
95
|
+
BE: 6,
|
|
96
|
+
JE: 10,
|
|
97
|
+
VE: 11,
|
|
98
|
+
qE: 12,
|
|
99
|
+
jE: 15,
|
|
100
|
+
zE: 16,
|
|
101
|
+
PE: 17,
|
|
102
102
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import ri from "./trigger-condition.js";
|
|
2
2
|
export default class ni {
|
|
3
3
|
constructor(t, i) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.if = t), (this.rf = i), (this.if = t), (this.rf = i);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
8
|
-
const i = ri.
|
|
6
|
+
xc(t) {
|
|
7
|
+
if (null == this.if) return !1;
|
|
8
|
+
const i = ri.sf(t[0], this.if);
|
|
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.rf || 0 === this.rf.length;
|
|
11
|
+
if (null != this.rf)
|
|
12
|
+
for (let i = 0; i < this.rf.length; i++)
|
|
13
|
+
if (this.rf[i] === t[1]) {
|
|
14
14
|
r = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -19,7 +19,7 @@ export default class ni {
|
|
|
19
19
|
static fromJson(t) {
|
|
20
20
|
return new ni(t ? t.id : null, t ? t.buttons : null);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
return this.
|
|
22
|
+
Bs() {
|
|
23
|
+
return this.if;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -2,13 +2,13 @@ export default class ns {
|
|
|
2
2
|
constructor(t) {
|
|
3
3
|
(this.productId = t), (this.productId = t);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
xc(t) {
|
|
6
6
|
return null == this.productId || t[0] === this.productId;
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
9
|
return new ns(t ? t.product_id : null);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
Bs() {
|
|
12
12
|
return this.productId;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import is from "./filter-set.js";
|
|
2
2
|
export default class hs {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.productId = t), (this.
|
|
4
|
+
(this.productId = t), (this.tf = s), (this.productId = t), (this.tf = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.productId || null == this.
|
|
6
|
+
xc(t) {
|
|
7
|
+
if (null == this.productId || null == this.tf) return !1;
|
|
8
8
|
const s = t[0],
|
|
9
9
|
i = t[1];
|
|
10
|
-
return s === this.productId && this.
|
|
10
|
+
return s === this.productId && this.tf.xc(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
13
|
return new hs(
|
|
@@ -15,7 +15,7 @@ export default class hs {
|
|
|
15
15
|
t ? is.fromJson(t.property_filters) : null,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return { id: this.productId, pf: this.
|
|
18
|
+
Bs() {
|
|
19
|
+
return { id: this.productId, pf: this.tf ? this.tf.Bs() : null };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import ri from "./trigger-condition.js";
|
|
2
2
|
export default class ur {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.if = t), (this.if = t);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
return null == this.
|
|
6
|
+
xc(t) {
|
|
7
|
+
return null == this.if || ri.sf(t[0], this.if);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t) {
|
|
10
10
|
return new ur(t ? t.campaign_id : null);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
return this.
|
|
12
|
+
Bs() {
|
|
13
|
+
return this.if;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -5,99 +5,99 @@ import ni from "./in-app-message-click-data.js";
|
|
|
5
5
|
import ns from "./purchase-data.js";
|
|
6
6
|
import hs from "./purchase-property-data.js";
|
|
7
7
|
import ur from "./push-click-data.js";
|
|
8
|
-
import
|
|
9
|
-
import { logger as
|
|
8
|
+
import et from "./trigger-events.js";
|
|
9
|
+
import { logger as N } from "../../../shared-lib/index.js";
|
|
10
10
|
import { getErrorMessage as si } from "../../util/error-utils.js";
|
|
11
11
|
export default class ri {
|
|
12
12
|
constructor(e, t) {
|
|
13
13
|
(this.type = e), (this.data = t), (this.type = e), (this.data = t);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
return ri.
|
|
15
|
+
kc(e, t) {
|
|
16
|
+
return ri._c[this.type] === e && (null == this.data || this.data.xc(t));
|
|
17
17
|
}
|
|
18
|
-
static
|
|
19
|
-
let
|
|
18
|
+
static sf(e, t) {
|
|
19
|
+
let r = null;
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
r = window.atob(e);
|
|
22
22
|
} catch (t) {
|
|
23
|
-
return
|
|
23
|
+
return N.info("Failed to unencode analytics id " + e + ": " + si(t)), !1;
|
|
24
24
|
}
|
|
25
|
-
return t ===
|
|
25
|
+
return t === r.split("_")[0];
|
|
26
26
|
}
|
|
27
27
|
static fromJson(e) {
|
|
28
28
|
const t = e.type;
|
|
29
29
|
let r = null;
|
|
30
30
|
switch (t) {
|
|
31
|
-
case ri.
|
|
32
|
-
case ri.
|
|
31
|
+
case ri.ln.OPEN:
|
|
32
|
+
case ri.ln.Xt:
|
|
33
33
|
break;
|
|
34
|
-
case ri.
|
|
34
|
+
case ri.ln.Rr:
|
|
35
35
|
r = ns.fromJson(e.data);
|
|
36
36
|
break;
|
|
37
|
-
case ri.
|
|
37
|
+
case ri.ln.Ec:
|
|
38
38
|
r = hs.fromJson(e.data);
|
|
39
39
|
break;
|
|
40
|
-
case ri.
|
|
40
|
+
case ri.ln.kr:
|
|
41
41
|
r = ur.fromJson(e.data);
|
|
42
42
|
break;
|
|
43
|
-
case ri.
|
|
43
|
+
case ri.ln.ve:
|
|
44
44
|
r = ts.fromJson(e.data);
|
|
45
45
|
break;
|
|
46
|
-
case ri.
|
|
46
|
+
case ri.ln.jc:
|
|
47
47
|
r = rs.fromJson(e.data);
|
|
48
48
|
break;
|
|
49
|
-
case ri.
|
|
49
|
+
case ri.ln.Ao:
|
|
50
50
|
r = ni.fromJson(e.data);
|
|
51
51
|
}
|
|
52
52
|
return new ri(t, r);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
return { t: this.type, d: this.data ? this.data.
|
|
54
|
+
Bs() {
|
|
55
|
+
return { t: this.type, d: this.data ? this.data.Bs() : null };
|
|
56
56
|
}
|
|
57
|
-
static
|
|
57
|
+
static Qn(e) {
|
|
58
58
|
let t,
|
|
59
59
|
r = null;
|
|
60
60
|
switch (e.t) {
|
|
61
|
-
case ri.
|
|
62
|
-
case ri.
|
|
61
|
+
case ri.ln.OPEN:
|
|
62
|
+
case ri.ln.Xt:
|
|
63
63
|
break;
|
|
64
|
-
case ri.
|
|
64
|
+
case ri.ln.Rr:
|
|
65
65
|
r = new ns(e.d);
|
|
66
66
|
break;
|
|
67
|
-
case ri.
|
|
68
|
-
(t = e.d || {}), (r = new hs(t.id, is.
|
|
67
|
+
case ri.ln.Ec:
|
|
68
|
+
(t = e.d || {}), (r = new hs(t.id, is.Qn(t.pf || [])));
|
|
69
69
|
break;
|
|
70
|
-
case ri.
|
|
70
|
+
case ri.ln.kr:
|
|
71
71
|
r = new ur(e.d);
|
|
72
72
|
break;
|
|
73
|
-
case ri.
|
|
73
|
+
case ri.ln.ve:
|
|
74
74
|
r = new ts(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case ri.
|
|
77
|
-
(t = e.d || {}), (r = new rs(t.e, is.
|
|
76
|
+
case ri.ln.jc:
|
|
77
|
+
(t = e.d || {}), (r = new rs(t.e, is.Qn(t.pf || [])));
|
|
78
78
|
break;
|
|
79
|
-
case ri.
|
|
79
|
+
case ri.ln.Ao:
|
|
80
80
|
r = new ni(e.d);
|
|
81
81
|
}
|
|
82
82
|
return new ri(e.t, r);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
(ri.
|
|
85
|
+
(ri.ln = {
|
|
86
86
|
OPEN: "open",
|
|
87
87
|
Rr: "purchase",
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
Ec: "purchase_property",
|
|
89
|
+
kr: "push_click",
|
|
90
|
+
ve: "custom_event",
|
|
91
|
+
jc: "custom_event_property",
|
|
92
|
+
Ao: "iam_click",
|
|
93
|
+
Xt: "test",
|
|
94
94
|
}),
|
|
95
|
-
(ri.
|
|
96
|
-
(ri.
|
|
97
|
-
(ri.
|
|
98
|
-
(ri.
|
|
99
|
-
(ri.
|
|
100
|
-
(ri.
|
|
101
|
-
(ri.
|
|
102
|
-
(ri.
|
|
103
|
-
(ri.
|
|
95
|
+
(ri._c = {}),
|
|
96
|
+
(ri._c[ri.ln.OPEN] = et.OPEN),
|
|
97
|
+
(ri._c[ri.ln.Rr] = et.Rr),
|
|
98
|
+
(ri._c[ri.ln.Ec] = et.Rr),
|
|
99
|
+
(ri._c[ri.ln.kr] = et.kr),
|
|
100
|
+
(ri._c[ri.ln.ve] = et.ve),
|
|
101
|
+
(ri._c[ri.ln.jc] = et.ve),
|
|
102
|
+
(ri._c[ri.ln.Ao] = et.Ao),
|
|
103
|
+
(ri._c[ri.ln.Xt] = et.Xt);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
dateFromUnixTimestamp as
|
|
3
|
-
rehydrateDateAfterJsonization as
|
|
2
|
+
dateFromUnixTimestamp as O,
|
|
3
|
+
rehydrateDateAfterJsonization as V,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
|
-
import { logger as
|
|
5
|
+
import { logger as N } from "../../../shared-lib/index.js";
|
|
6
6
|
import ri from "./trigger-condition.js";
|
|
7
|
-
import { validateValueIsFromEnum as
|
|
8
|
-
export default class
|
|
9
|
-
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n =
|
|
7
|
+
import { validateValueIsFromEnum as ta } from "../../util/code-utils.js";
|
|
8
|
+
export default class pt {
|
|
9
|
+
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = pt.td, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
11
|
(this.sd = i),
|
|
12
12
|
(this.startTime = s),
|
|
@@ -16,7 +16,7 @@ export default class gt {
|
|
|
16
16
|
(this.data = l),
|
|
17
17
|
(this.ed = o),
|
|
18
18
|
(this.rd = n),
|
|
19
|
-
(this.
|
|
19
|
+
(this.mn = a),
|
|
20
20
|
(this.hd = u),
|
|
21
21
|
(this.od = d),
|
|
22
22
|
(this.id = t),
|
|
@@ -29,7 +29,7 @@ export default class gt {
|
|
|
29
29
|
(this.type = h),
|
|
30
30
|
(this.ed = o || 0),
|
|
31
31
|
null == a && (a = 1e3 * (this.ed + 30)),
|
|
32
|
-
(this.
|
|
32
|
+
(this.mn = a),
|
|
33
33
|
(this.data = l),
|
|
34
34
|
null != n && (this.rd = n),
|
|
35
35
|
(this.hd = u),
|
|
@@ -37,7 +37,7 @@ export default class gt {
|
|
|
37
37
|
}
|
|
38
38
|
nd(t) {
|
|
39
39
|
return (
|
|
40
|
-
null == this.od || (this.rd !==
|
|
40
|
+
null == this.od || (this.rd !== pt.td && t - this.od >= 1e3 * this.rd)
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
ad(t) {
|
|
@@ -49,11 +49,11 @@ export default class gt {
|
|
|
49
49
|
}
|
|
50
50
|
dd(t) {
|
|
51
51
|
const i = new Date().valueOf() - t,
|
|
52
|
-
s = null == t || isNaN(i) || null == this.
|
|
52
|
+
s = null == t || isNaN(i) || null == this.mn || i < this.mn;
|
|
53
53
|
return (
|
|
54
54
|
s ||
|
|
55
|
-
|
|
56
|
-
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.
|
|
55
|
+
N.info(
|
|
56
|
+
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.mn}ms.`,
|
|
57
57
|
),
|
|
58
58
|
!s
|
|
59
59
|
);
|
|
@@ -63,27 +63,27 @@ export default class gt {
|
|
|
63
63
|
s = [];
|
|
64
64
|
for (let i = 0; i < t.trigger_condition.length; i++)
|
|
65
65
|
s.push(ri.fromJson(t.trigger_condition[i]));
|
|
66
|
-
const e =
|
|
67
|
-
r =
|
|
66
|
+
const e = O(t.start_time),
|
|
67
|
+
r = O(t.end_time),
|
|
68
68
|
h = t.priority,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
l = t.type,
|
|
70
|
+
o = t.delay,
|
|
71
|
+
n = t.re_eligibility,
|
|
72
|
+
a = t.timeout,
|
|
73
|
+
u = t.data,
|
|
74
|
+
d = t.min_seconds_since_last_trigger;
|
|
75
|
+
return ta(
|
|
76
|
+
pt.ln,
|
|
77
|
+
l,
|
|
78
78
|
"Could not construct Trigger from server data",
|
|
79
79
|
"Trigger.Types",
|
|
80
80
|
)
|
|
81
|
-
? new
|
|
81
|
+
? new pt(i, s, e, r, h, l, u, o, n, a, d)
|
|
82
82
|
: null;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
Bs() {
|
|
85
85
|
const t = [];
|
|
86
|
-
for (let i = 0; i < this.sd.length; i++) t.push(this.sd[i].
|
|
86
|
+
for (let i = 0; i < this.sd.length; i++) t.push(this.sd[i].Bs());
|
|
87
87
|
return {
|
|
88
88
|
i: this.id,
|
|
89
89
|
c: t,
|
|
@@ -94,20 +94,20 @@ export default class gt {
|
|
|
94
94
|
da: this.data,
|
|
95
95
|
d: this.ed,
|
|
96
96
|
r: this.rd,
|
|
97
|
-
tm: this.
|
|
97
|
+
tm: this.mn,
|
|
98
98
|
ss: this.hd,
|
|
99
99
|
ld: this.od,
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
static
|
|
102
|
+
static Qn(t) {
|
|
103
103
|
const i = [],
|
|
104
104
|
s = t.c || [];
|
|
105
|
-
for (let t = 0; t < s.length; t++) i.push(ri.
|
|
106
|
-
return new
|
|
105
|
+
for (let t = 0; t < s.length; t++) i.push(ri.Qn(s[t]));
|
|
106
|
+
return new pt(
|
|
107
107
|
t.i,
|
|
108
108
|
i,
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
V(t.s),
|
|
110
|
+
V(t.e),
|
|
111
111
|
t.p,
|
|
112
112
|
t.t,
|
|
113
113
|
t.da,
|
|
@@ -119,4 +119,4 @@ export default class gt {
|
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
(
|
|
122
|
+
(pt.ln = { an: "inapp", md: "templated_iam" }), (pt.td = -1);
|