@braze/web-sdk 6.5.0 → 6.7.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 +258 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +21 -20
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +26 -25
- package/src/Banner/banner-factory.js +11 -1
- package/src/Banner/banner-provider.js +244 -120
- package/src/Banner/banner.js +14 -12
- package/src/Banner/display/banner-to-html.js +23 -16
- package/src/Banner/display/detect-banner-impressions.js +13 -13
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +4 -4
- package/src/Banner/log-banner-click.js +4 -4
- package/src/Banner/log-banner-dismissal.js +23 -0
- package/src/Banner/log-banner-impressions.js +7 -7
- package/src/Banner/request-banners-refresh.js +12 -16
- package/src/Banner/subscribe-to-banners-updates.js +6 -6
- package/src/Banner/ui/insert-banner.js +12 -12
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +33 -33
- package/src/Card/constants.js +1 -1
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +3 -3
- package/src/Card/log-content-card-click.js +3 -3
- package/src/Card/log-content-card-impressions.js +6 -6
- 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 +18 -18
- package/src/Card/util/card-factory.js +41 -41
- package/src/ContentCards/content-cards-provider-factory.js +12 -12
- package/src/ContentCards/content-cards-provider.js +151 -151
- package/src/ContentCards/content-cards.js +5 -5
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/show-content-cards.js +10 -10
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +9 -8
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +8 -8
- package/src/Core/log-purchase.js +5 -5
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-provider-factory.js +11 -11
- package/src/DUST/dust-provider.js +255 -255
- package/src/DUST/dust-shared-worker-impl.js +100 -100
- package/src/DUST/dust-worker-bridge.js +27 -27
- package/src/DUST/subscribe-to-dust.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +86 -86
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/InAppMessage/constants.js +83 -2
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +15 -15
- package/src/InAppMessage/display/html-message-to-html.js +36 -37
- package/src/InAppMessage/display/in-app-message-to-html.js +44 -44
- package/src/InAppMessage/display/modal-utils.js +10 -14
- package/src/InAppMessage/in-app-message-factory.js +16 -20
- package/src/InAppMessage/in-app-message-manager.js +116 -117
- package/src/InAppMessage/log-in-app-message-button-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +56 -49
- package/src/InAppMessage/models/html-message.js +31 -27
- package/src/InAppMessage/models/in-app-message-button.js +12 -12
- package/src/InAppMessage/models/in-app-message.js +202 -256
- package/src/InAppMessage/models/modal-message.js +55 -49
- package/src/InAppMessage/models/slide-up-message.js +57 -51
- package/src/InAppMessage/models/templated-in-app-message.js +10 -10
- package/src/InAppMessage/shared-types.js +1 -0
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +43 -41
- 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 +9 -9
- package/src/Push/push-manager.js +15 -15
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +14 -14
- package/src/User/user.js +60 -59
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -1
- package/src/common/content-cards-display.js +38 -38
- package/src/common/event-logger.js +8 -8
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +197 -182
- package/src/managers/constants.js +1 -0
- package/src/managers/device-manager.js +25 -25
- package/src/managers/network-manager.js +155 -155
- package/src/managers/server-config-manager.js +106 -93
- package/src/managers/session-manager.js +37 -33
- package/src/managers/storage-manager-factory.js +33 -28
- package/src/managers/storage-manager.js +194 -175
- package/src/managers/subscription-manager.js +13 -13
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +13 -13
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +9 -9
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +29 -38
- package/src/request-controller.js +159 -163
- 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 +12 -12
- package/src/triggers/models/filter.js +66 -66
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +8 -8
- package/src/triggers/models/trigger-condition.js +58 -58
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +44 -44
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +70 -70
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +3 -3
- package/src/util/browser-detector.js +37 -37
- package/src/util/client-hints-parser.js +9 -9
- package/src/util/component-utils.js +3 -3
- package/src/util/dom-utils.js +2 -2
- package/src/util/html-display-utils.js +11 -11
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +8 -8
- package/src/util/request-header-utils.js +25 -25
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +21 -21
- package/src/util/window-utils.js +3 -3
|
@@ -1,102 +1,102 @@
|
|
|
1
1
|
import { isDate as Nt } from "../../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
3
|
convertMsToSeconds as X,
|
|
4
|
-
dateFromUnixTimestamp as
|
|
5
|
-
secondsAgo as
|
|
6
|
-
secondsInTheFuture as
|
|
4
|
+
dateFromUnixTimestamp as Y,
|
|
5
|
+
secondsAgo as hs,
|
|
6
|
+
secondsInTheFuture as us,
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
8
|
-
export default class
|
|
8
|
+
export default class hr {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.tT = t),
|
|
11
|
+
(this.sT = s),
|
|
12
12
|
(this.comparator = e),
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
15
|
-
(this.
|
|
13
|
+
(this.eT = i),
|
|
14
|
+
(this.tT = t),
|
|
15
|
+
(this.sT = 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.eT = i),
|
|
18
|
+
this.sT === hr.lT.iT &&
|
|
19
|
+
this.comparator !== hr.hT.rT &&
|
|
20
|
+
this.comparator !== hr.hT.nT &&
|
|
21
|
+
this.comparator !== hr.hT.uT &&
|
|
22
|
+
this.comparator !== hr.hT.oT &&
|
|
23
|
+
(this.eT = Y(this.eT));
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
Hc(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) &&
|
|
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) &&
|
|
43
|
-
: null != s && typeof s == typeof this.
|
|
44
|
-
case
|
|
27
|
+
switch ((null != t && (s = t[this.tT]), this.comparator)) {
|
|
28
|
+
case hr.hT.ET:
|
|
29
|
+
return null != s && s.valueOf() === this.eT.valueOf();
|
|
30
|
+
case hr.hT.aT:
|
|
31
|
+
return null == s || s.valueOf() !== this.eT.valueOf();
|
|
32
|
+
case hr.hT.TT:
|
|
33
|
+
return null != s && typeof s == typeof this.eT && s > this.eT;
|
|
34
|
+
case hr.hT.rT:
|
|
35
|
+
return this.sT === hr.lT.iT
|
|
36
|
+
? null != s && Nt(s) && hs(s) <= this.eT.valueOf()
|
|
37
|
+
: null != s && typeof s == typeof this.eT && s >= this.eT;
|
|
38
|
+
case hr.hT.cT:
|
|
39
|
+
return null != s && typeof s == typeof this.eT && s < this.eT;
|
|
40
|
+
case hr.hT.nT:
|
|
41
|
+
return this.sT === hr.lT.iT
|
|
42
|
+
? null != s && Nt(s) && hs(s) >= this.eT.valueOf()
|
|
43
|
+
: null != s && typeof s == typeof this.eT && s <= this.eT;
|
|
44
|
+
case hr.hT.AT:
|
|
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.eT &&
|
|
49
|
+
null != s.match(this.eT)
|
|
50
50
|
);
|
|
51
|
-
case
|
|
51
|
+
case hr.hT._T:
|
|
52
52
|
return null != s;
|
|
53
|
-
case
|
|
53
|
+
case hr.hT.fT:
|
|
54
54
|
return null == s;
|
|
55
|
-
case
|
|
56
|
-
return null != s && Nt(s) &&
|
|
57
|
-
case
|
|
58
|
-
return null != s && Nt(s) &&
|
|
59
|
-
case
|
|
55
|
+
case hr.hT.uT:
|
|
56
|
+
return null != s && Nt(s) && us(s) < this.eT;
|
|
57
|
+
case hr.hT.oT:
|
|
58
|
+
return null != s && Nt(s) && us(s) > this.eT;
|
|
59
|
+
case hr.hT.pT:
|
|
60
60
|
return (
|
|
61
61
|
null == s ||
|
|
62
|
-
typeof s != typeof this.
|
|
62
|
+
typeof s != typeof this.eT ||
|
|
63
63
|
"string" != typeof s ||
|
|
64
|
-
null == s.match(this.
|
|
64
|
+
null == s.match(this.eT)
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
return !1;
|
|
68
68
|
}
|
|
69
69
|
static fromJson(t) {
|
|
70
|
-
return new
|
|
70
|
+
return new hr(
|
|
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
|
+
qt() {
|
|
78
|
+
let t = this.eT;
|
|
79
79
|
return (
|
|
80
|
-
Nt(this.
|
|
81
|
-
{ k: this.
|
|
80
|
+
Nt(this.eT) && (t = X(t.valueOf())),
|
|
81
|
+
{ k: this.tT, t: this.sT, c: this.comparator, v: t }
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
static _u(t) {
|
|
85
|
-
return new
|
|
85
|
+
return new hr(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
|
+
(hr.lT = { yT: "boolean", ST: "number", NT: "string", iT: "date" }),
|
|
89
|
+
(hr.hT = {
|
|
90
|
+
ET: 1,
|
|
91
|
+
aT: 2,
|
|
92
|
+
TT: 3,
|
|
93
|
+
rT: 4,
|
|
94
|
+
cT: 5,
|
|
95
|
+
nT: 6,
|
|
96
|
+
AT: 10,
|
|
97
|
+
_T: 11,
|
|
98
|
+
fT: 12,
|
|
99
|
+
uT: 15,
|
|
100
|
+
oT: 16,
|
|
101
|
+
pT: 17,
|
|
102
102
|
});
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import gi from "./trigger-condition.js";
|
|
2
|
+
export default class pi {
|
|
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 =
|
|
6
|
+
Hc(t) {
|
|
7
|
+
if (null == this.if) return !1;
|
|
8
|
+
const i = gi.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
|
}
|
|
17
17
|
return i && r;
|
|
18
18
|
}
|
|
19
19
|
static fromJson(t) {
|
|
20
|
-
return new
|
|
20
|
+
return new pi(t ? t.id : null, t ? t.buttons : null);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
return this.
|
|
22
|
+
qt() {
|
|
23
|
+
return this.if;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class os {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
(this.productId = t), (this.productId = t);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Hc(t) {
|
|
6
6
|
return null == this.productId || t[0] === this.productId;
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
|
-
return new
|
|
9
|
+
return new os(t ? t.product_id : null);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
qt() {
|
|
12
12
|
return this.productId;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import ls from "./filter-set.js";
|
|
2
|
+
export default class fs {
|
|
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
|
+
Hc(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.Hc(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
|
-
return new
|
|
13
|
+
return new fs(
|
|
14
14
|
t ? t.product_id : null,
|
|
15
|
-
t ?
|
|
15
|
+
t ? ls.fromJson(t.property_filters) : null,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return { id: this.productId, pf: this.
|
|
18
|
+
qt() {
|
|
19
|
+
return { id: this.productId, pf: this.tf ? this.tf.qt() : null };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import gi from "./trigger-condition.js";
|
|
2
|
+
export default class dr {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.if = t), (this.if = t);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
return null == this.
|
|
6
|
+
Hc(t) {
|
|
7
|
+
return null == this.if || gi.sf(t[0], this.if);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t) {
|
|
10
|
-
return new
|
|
10
|
+
return new dr(t ? t.campaign_id : null);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
return this.
|
|
12
|
+
qt() {
|
|
13
|
+
return this.if;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import es from "./custom-event-data.js";
|
|
2
|
+
import ns from "./custom-event-property-data.js";
|
|
3
|
+
import ls from "./filter-set.js";
|
|
4
|
+
import pi from "./in-app-message-click-data.js";
|
|
5
|
+
import os from "./purchase-data.js";
|
|
6
|
+
import fs from "./purchase-property-data.js";
|
|
7
|
+
import dr from "./push-click-data.js";
|
|
8
8
|
import ot from "./trigger-events.js";
|
|
9
9
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
10
10
|
import { getErrorMessage as ai } from "../../util/error-utils.js";
|
|
11
|
-
export default class
|
|
11
|
+
export default class gi {
|
|
12
12
|
constructor(e, t) {
|
|
13
13
|
(this.type = e), (this.data = t), (this.type = e), (this.data = t);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
return
|
|
15
|
+
Vc(e, t) {
|
|
16
|
+
return gi.Yc[this.type] === e && (null == this.data || this.data.Hc(t));
|
|
17
17
|
}
|
|
18
|
-
static
|
|
18
|
+
static sf(e, t) {
|
|
19
19
|
let r = null;
|
|
20
20
|
try {
|
|
21
21
|
r = window.atob(e);
|
|
@@ -28,76 +28,76 @@ export default class fi {
|
|
|
28
28
|
const t = e.type;
|
|
29
29
|
let r = null;
|
|
30
30
|
switch (t) {
|
|
31
|
-
case
|
|
32
|
-
case
|
|
31
|
+
case gi.la.OPEN:
|
|
32
|
+
case gi.la.Ls:
|
|
33
33
|
break;
|
|
34
|
-
case
|
|
35
|
-
r =
|
|
34
|
+
case gi.la.Rr:
|
|
35
|
+
r = os.fromJson(e.data);
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
38
|
-
r =
|
|
37
|
+
case gi.la.Qc:
|
|
38
|
+
r = fs.fromJson(e.data);
|
|
39
39
|
break;
|
|
40
|
-
case
|
|
41
|
-
r =
|
|
40
|
+
case gi.la.Fr:
|
|
41
|
+
r = dr.fromJson(e.data);
|
|
42
42
|
break;
|
|
43
|
-
case
|
|
44
|
-
r =
|
|
43
|
+
case gi.la.he:
|
|
44
|
+
r = es.fromJson(e.data);
|
|
45
45
|
break;
|
|
46
|
-
case
|
|
47
|
-
r =
|
|
46
|
+
case gi.la.Xc:
|
|
47
|
+
r = ns.fromJson(e.data);
|
|
48
48
|
break;
|
|
49
|
-
case
|
|
50
|
-
r =
|
|
49
|
+
case gi.la.rm:
|
|
50
|
+
r = pi.fromJson(e.data);
|
|
51
51
|
}
|
|
52
|
-
return new
|
|
52
|
+
return new gi(t, r);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
return { t: this.type, d: this.data ? this.data.
|
|
54
|
+
qt() {
|
|
55
|
+
return { t: this.type, d: this.data ? this.data.qt() : null };
|
|
56
56
|
}
|
|
57
57
|
static _u(e) {
|
|
58
58
|
let t,
|
|
59
59
|
r = null;
|
|
60
60
|
switch (e.t) {
|
|
61
|
-
case
|
|
62
|
-
case
|
|
61
|
+
case gi.la.OPEN:
|
|
62
|
+
case gi.la.Ls:
|
|
63
63
|
break;
|
|
64
|
-
case
|
|
65
|
-
r = new
|
|
64
|
+
case gi.la.Rr:
|
|
65
|
+
r = new os(e.d);
|
|
66
66
|
break;
|
|
67
|
-
case
|
|
68
|
-
(t = e.d || {}), (r = new
|
|
67
|
+
case gi.la.Qc:
|
|
68
|
+
(t = e.d || {}), (r = new fs(t.id, ls._u(t.pf || [])));
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
71
|
-
r = new
|
|
70
|
+
case gi.la.Fr:
|
|
71
|
+
r = new dr(e.d);
|
|
72
72
|
break;
|
|
73
|
-
case
|
|
74
|
-
r = new
|
|
73
|
+
case gi.la.he:
|
|
74
|
+
r = new es(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
77
|
-
(t = e.d || {}), (r = new
|
|
76
|
+
case gi.la.Xc:
|
|
77
|
+
(t = e.d || {}), (r = new ns(t.e, ls._u(t.pf || [])));
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
80
|
-
r = new
|
|
79
|
+
case gi.la.rm:
|
|
80
|
+
r = new pi(e.d);
|
|
81
81
|
}
|
|
82
|
-
return new
|
|
82
|
+
return new gi(e.t, r);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
(
|
|
85
|
+
(gi.la = {
|
|
86
86
|
OPEN: "open",
|
|
87
87
|
Rr: "purchase",
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
Qc: "purchase_property",
|
|
89
|
+
Fr: "push_click",
|
|
90
|
+
he: "custom_event",
|
|
91
|
+
Xc: "custom_event_property",
|
|
92
92
|
rm: "iam_click",
|
|
93
|
-
|
|
93
|
+
Ls: "test",
|
|
94
94
|
}),
|
|
95
|
-
(
|
|
96
|
-
(
|
|
97
|
-
(
|
|
98
|
-
(
|
|
99
|
-
(
|
|
100
|
-
(
|
|
101
|
-
(
|
|
102
|
-
(
|
|
103
|
-
(
|
|
95
|
+
(gi.Yc = {}),
|
|
96
|
+
(gi.Yc[gi.la.OPEN] = ot.OPEN),
|
|
97
|
+
(gi.Yc[gi.la.Rr] = ot.Rr),
|
|
98
|
+
(gi.Yc[gi.la.Qc] = ot.Rr),
|
|
99
|
+
(gi.Yc[gi.la.Fr] = ot.Fr),
|
|
100
|
+
(gi.Yc[gi.la.he] = ot.he),
|
|
101
|
+
(gi.Yc[gi.la.Xc] = ot.he),
|
|
102
|
+
(gi.Yc[gi.la.rm] = ot.rm),
|
|
103
|
+
(gi.Yc[gi.la.Ls] = ot.Ls);
|
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
import {
|
|
2
|
-
dateFromUnixTimestamp as
|
|
3
|
-
rehydrateDateAfterJsonization as
|
|
2
|
+
dateFromUnixTimestamp as Y,
|
|
3
|
+
rehydrateDateAfterJsonization as ee,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
5
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
6
|
-
import
|
|
6
|
+
import gi from "./trigger-condition.js";
|
|
7
7
|
import { validateValueIsFromEnum as ta } from "../../util/code-utils.js";
|
|
8
|
-
export default class
|
|
9
|
-
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n =
|
|
8
|
+
export default class gt {
|
|
9
|
+
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = gt.sd, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
|
-
(this.
|
|
11
|
+
(this.ed = 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.hd = o),
|
|
18
|
+
(this.nd = n),
|
|
19
|
+
(this.ca = a),
|
|
20
|
+
(this.ad = u),
|
|
21
|
+
(this.ud = d),
|
|
22
22
|
(this.id = t),
|
|
23
|
-
(this.
|
|
23
|
+
(this.ed = 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.hd = o || 0),
|
|
31
|
+
null == a && (a = 1e3 * (this.hd + 30)),
|
|
32
|
+
(this.ca = a),
|
|
33
33
|
(this.data = l),
|
|
34
|
-
null != n && (this.
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
34
|
+
null != n && (this.nd = n),
|
|
35
|
+
(this.ad = u),
|
|
36
|
+
(this.ud = d || null);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
dd(t) {
|
|
39
39
|
return (
|
|
40
|
-
null == this.
|
|
40
|
+
null == this.ud || (this.nd !== gt.sd && t - this.ud >= 1e3 * this.nd)
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
this.
|
|
43
|
+
md(t) {
|
|
44
|
+
this.ud = t;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
const i = t + 1e3 * this.
|
|
46
|
+
gd(t) {
|
|
47
|
+
const i = t + 1e3 * this.hd;
|
|
48
48
|
return Math.max(i - new Date().valueOf(), 0);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
fd(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.ca || i < this.ca;
|
|
53
53
|
return (
|
|
54
54
|
s ||
|
|
55
55
|
E.info(
|
|
56
|
-
`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.ca}ms.`,
|
|
57
57
|
),
|
|
58
58
|
!s
|
|
59
59
|
);
|
|
@@ -62,9 +62,9 @@ export default class pt {
|
|
|
62
62
|
const i = t.id,
|
|
63
63
|
s = [];
|
|
64
64
|
for (let i = 0; i < t.trigger_condition.length; i++)
|
|
65
|
-
s.push(
|
|
66
|
-
const e =
|
|
67
|
-
r =
|
|
65
|
+
s.push(gi.fromJson(t.trigger_condition[i]));
|
|
66
|
+
const e = Y(t.start_time),
|
|
67
|
+
r = Y(t.end_time),
|
|
68
68
|
h = t.priority,
|
|
69
69
|
l = t.type,
|
|
70
70
|
o = t.delay,
|
|
@@ -73,17 +73,17 @@ export default class pt {
|
|
|
73
73
|
u = t.data,
|
|
74
74
|
d = t.min_seconds_since_last_trigger;
|
|
75
75
|
return ta(
|
|
76
|
-
|
|
76
|
+
gt.la,
|
|
77
77
|
l,
|
|
78
78
|
"Could not construct Trigger from server data",
|
|
79
79
|
"Trigger.Types",
|
|
80
80
|
)
|
|
81
|
-
? new
|
|
81
|
+
? new gt(i, s, e, r, h, l, u, o, n, a, d)
|
|
82
82
|
: null;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
qt() {
|
|
85
85
|
const t = [];
|
|
86
|
-
for (let i = 0; i < this.
|
|
86
|
+
for (let i = 0; i < this.ed.length; i++) t.push(this.ed[i].qt());
|
|
87
87
|
return {
|
|
88
88
|
i: this.id,
|
|
89
89
|
c: t,
|
|
@@ -92,22 +92,22 @@ 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.hd,
|
|
96
|
+
r: this.nd,
|
|
97
|
+
tm: this.ca,
|
|
98
|
+
ss: this.ad,
|
|
99
|
+
ld: this.ud,
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
static _u(t) {
|
|
103
103
|
const i = [],
|
|
104
104
|
s = t.c || [];
|
|
105
|
-
for (let t = 0; t < s.length; t++) i.push(
|
|
106
|
-
return new
|
|
105
|
+
for (let t = 0; t < s.length; t++) i.push(gi._u(s[t]));
|
|
106
|
+
return new gt(
|
|
107
107
|
t.i,
|
|
108
108
|
i,
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
ee(t.s),
|
|
110
|
+
ee(t.e),
|
|
111
111
|
t.p,
|
|
112
112
|
t.t,
|
|
113
113
|
t.da,
|
|
@@ -119,4 +119,4 @@ export default class pt {
|
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
(
|
|
122
|
+
(gt.la = { oa: "inapp", pd: "templated_iam" }), (gt.sd = -1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import je from "../InAppMessage/in-app-message-manager-factory.js";
|
|
2
|
-
import r, { OPTIONS as
|
|
3
|
-
import
|
|
2
|
+
import r, { OPTIONS as U } from "../managers/braze-instance.js";
|
|
3
|
+
import vr from "./triggers-provider.js";
|
|
4
4
|
export const TriggersProviderFactory = {
|
|
5
5
|
i: !1,
|
|
6
6
|
provider: null,
|
|
@@ -11,10 +11,10 @@ export const TriggersProviderFactory = {
|
|
|
11
11
|
),
|
|
12
12
|
rg: () => {
|
|
13
13
|
if (!TriggersProviderFactory.provider) {
|
|
14
|
-
const i = r.
|
|
15
|
-
(TriggersProviderFactory.provider = new
|
|
14
|
+
const i = r.er(U.Dh);
|
|
15
|
+
(TriggersProviderFactory.provider = new vr(
|
|
16
16
|
null != i ? i : 30,
|
|
17
|
-
je.ra().
|
|
17
|
+
je.ra().Pn(),
|
|
18
18
|
r.p(),
|
|
19
19
|
r.nn(),
|
|
20
20
|
je.ra(),
|