@braze/web-sdk 6.3.1 → 6.5.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 +38 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +30 -30
- package/shared-lib/guid.js +1 -1
- package/shared-lib/indexed-db-adapter.js +60 -60
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +24 -23
- package/src/Banner/banner-provider.js +95 -81
- package/src/Banner/banner.js +9 -9
- package/src/Banner/constants.js +4 -0
- package/src/Banner/display/banner-to-html.js +3 -3
- package/src/Banner/display/destroy-banner-html.js +3 -3
- package/src/Banner/display/detect-banner-impressions.js +16 -16
- package/src/Banner/get-all-banners.js +4 -4
- package/src/Banner/get-banner.js +5 -4
- package/src/Banner/index.js +2 -0
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +6 -6
- package/src/Banner/request-banners-refresh.js +18 -20
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Banner/ui/insert-banner.js +17 -14
- package/src/Card/card-manager-factory.js +6 -6
- package/src/Card/card-manager.js +28 -28
- package/src/Card/constants.js +1 -0
- package/src/Card/display/card-display.js +7 -7
- 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 +3 -3
- package/src/Card/models/card.js +9 -9
- package/src/Card/models/classic-card.js +3 -3
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +3 -3
- package/src/ContentCards/content-cards-provider-factory.js +6 -2
- package/src/ContentCards/content-cards-provider.js +101 -87
- package/src/ContentCards/content-cards.js +4 -4
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
- package/src/ContentCards/ui/show-content-cards.js +5 -5
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +1 -1
- package/src/Core/disable-sdk.js +5 -5
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +7 -7
- package/src/Core/log-purchase.js +4 -4
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +3 -3
- package/src/DUST/dust-connection-core.js +23 -0
- package/src/DUST/dust-provider-factory.js +22 -0
- package/src/DUST/dust-provider.js +520 -0
- package/src/DUST/dust-shared-worker-code.js +2 -0
- package/src/DUST/dust-shared-worker-impl.js +240 -0
- package/src/DUST/dust-worker-bridge.js +136 -0
- package/src/DUST/index.js +13 -0
- package/src/DUST/subscribe-to-dust.js +24 -0
- package/src/DUST/types.js +1 -0
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +6 -6
- package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +98 -84
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +7 -7
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/constants.js +4 -0
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +34 -34
- package/src/InAppMessage/display/modal-utils.js +14 -14
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +98 -98
- package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-impression.js +8 -8
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +21 -21
- package/src/InAppMessage/models/html-message.js +18 -18
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +145 -145
- package/src/InAppMessage/models/modal-message.js +21 -21
- package/src/InAppMessage/models/slide-up-message.js +27 -27
- 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 +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +18 -0
- package/src/InAppMessage/ui/show-in-app-message.js +36 -36
- 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 +15 -15
- package/src/Push/push-manager.js +97 -97
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +17 -17
- package/src/User/user-manager.js +24 -24
- package/src/User/user.js +55 -55
- package/src/common/constants.js +8 -10
- package/src/common/content-cards-display.js +40 -40
- package/src/common/event-logger.js +8 -8
- package/src/common/properties-base.js +16 -16
- package/src/l10n/l10n-manager-factory.js +11 -11
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +30 -30
- package/src/managers/braze-instance.js +170 -162
- package/src/managers/device-manager.js +24 -24
- package/src/managers/network-manager.js +149 -149
- package/src/managers/server-config-manager.js +140 -95
- package/src/managers/session-manager.js +39 -39
- package/src/managers/storage-manager-factory.js +10 -10
- package/src/managers/storage-manager.js +145 -141
- package/src/managers/subscription-manager.js +11 -11
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +11 -11
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +16 -16
- package/src/models/push-token.js +13 -13
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +45 -37
- package/src/request-controller.js +163 -158
- 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 +27 -27
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- 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 +6 -6
- package/src/triggers/models/trigger-condition.js +47 -47
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +63 -63
- 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 +9 -9
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +37 -37
- package/src/util/client-hints-parser.js +11 -11
- package/src/util/component-utils.js +5 -5
- package/src/util/dom-utils.js +13 -13
- package/src/util/html-display-utils.js +7 -7
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +5 -5
- package/src/util/request-header-utils.js +27 -27
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/validation-utils.js +17 -17
- package/src/util/window-utils.js +3 -3
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
secondsAgo as es,
|
|
6
6
|
secondsInTheFuture as hs,
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
8
|
-
export default class
|
|
8
|
+
export default class cr {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
10
|
(this.yE = t),
|
|
11
11
|
(this.HE = s),
|
|
@@ -15,48 +15,48 @@ export default class fr {
|
|
|
15
15
|
(this.HE = s),
|
|
16
16
|
(this.comparator = e),
|
|
17
17
|
(this.LE = i),
|
|
18
|
-
this.HE ===
|
|
19
|
-
this.comparator !==
|
|
20
|
-
this.comparator !==
|
|
21
|
-
this.comparator !==
|
|
22
|
-
this.comparator !==
|
|
18
|
+
this.HE === cr.XE.QE &&
|
|
19
|
+
this.comparator !== cr.BE.wE &&
|
|
20
|
+
this.comparator !== cr.BE.jE &&
|
|
21
|
+
this.comparator !== cr.BE.zE &&
|
|
22
|
+
this.comparator !== cr.BE.FE &&
|
|
23
23
|
(this.LE = V(this.LE));
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
sf(t) {
|
|
26
26
|
let s = null;
|
|
27
27
|
switch ((null != t && (s = t[this.yE]), this.comparator)) {
|
|
28
|
-
case
|
|
28
|
+
case cr.BE.kE:
|
|
29
29
|
return null != s && s.valueOf() === this.LE.valueOf();
|
|
30
|
-
case
|
|
30
|
+
case cr.BE.xE:
|
|
31
31
|
return null == s || s.valueOf() !== this.LE.valueOf();
|
|
32
|
-
case
|
|
32
|
+
case cr.BE.JE:
|
|
33
33
|
return null != s && typeof s == typeof this.LE && s > this.LE;
|
|
34
|
-
case
|
|
35
|
-
return this.HE ===
|
|
34
|
+
case cr.BE.wE:
|
|
35
|
+
return this.HE === cr.XE.QE
|
|
36
36
|
? null != s && Nt(s) && es(s) <= this.LE.valueOf()
|
|
37
37
|
: null != s && typeof s == typeof this.LE && s >= this.LE;
|
|
38
|
-
case
|
|
38
|
+
case cr.BE.VE:
|
|
39
39
|
return null != s && typeof s == typeof this.LE && s < this.LE;
|
|
40
|
-
case
|
|
41
|
-
return this.HE ===
|
|
40
|
+
case cr.BE.jE:
|
|
41
|
+
return this.HE === cr.XE.QE
|
|
42
42
|
? null != s && Nt(s) && es(s) >= this.LE.valueOf()
|
|
43
43
|
: null != s && typeof s == typeof this.LE && s <= this.LE;
|
|
44
|
-
case
|
|
44
|
+
case cr.BE.qE:
|
|
45
45
|
return (
|
|
46
46
|
null != s &&
|
|
47
47
|
"string" == typeof s &&
|
|
48
48
|
typeof s == typeof this.LE &&
|
|
49
49
|
null != s.match(this.LE)
|
|
50
50
|
);
|
|
51
|
-
case
|
|
51
|
+
case cr.BE.PE:
|
|
52
52
|
return null != s;
|
|
53
|
-
case
|
|
53
|
+
case cr.BE.WE:
|
|
54
54
|
return null == s;
|
|
55
|
-
case
|
|
55
|
+
case cr.BE.zE:
|
|
56
56
|
return null != s && Nt(s) && hs(s) < this.LE;
|
|
57
|
-
case
|
|
57
|
+
case cr.BE.FE:
|
|
58
58
|
return null != s && Nt(s) && hs(s) > this.LE;
|
|
59
|
-
case
|
|
59
|
+
case cr.BE.ZE:
|
|
60
60
|
return (
|
|
61
61
|
null == s ||
|
|
62
62
|
typeof s != typeof this.LE ||
|
|
@@ -67,26 +67,26 @@ export default class fr {
|
|
|
67
67
|
return !1;
|
|
68
68
|
}
|
|
69
69
|
static fromJson(t) {
|
|
70
|
-
return new
|
|
70
|
+
return new cr(
|
|
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
|
+
gt() {
|
|
78
78
|
let t = this.LE;
|
|
79
79
|
return (
|
|
80
80
|
Nt(this.LE) && (t = X(t.valueOf())),
|
|
81
81
|
{ k: this.yE, t: this.HE, c: this.comparator, v: t }
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
|
-
static
|
|
85
|
-
return new
|
|
84
|
+
static _u(t) {
|
|
85
|
+
return new cr(t.k, t.t, t.c, t.v);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
(
|
|
89
|
-
(
|
|
88
|
+
(cr.XE = { $E: "boolean", tT: "number", sT: "string", QE: "date" }),
|
|
89
|
+
(cr.BE = {
|
|
90
90
|
kE: 1,
|
|
91
91
|
xE: 2,
|
|
92
92
|
JE: 3,
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import fi from "./trigger-condition.js";
|
|
2
|
+
export default class mi {
|
|
3
3
|
constructor(t, i) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.rf = t), (this.nf = i), (this.rf = t), (this.nf = i);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
8
|
-
const i =
|
|
6
|
+
sf(t) {
|
|
7
|
+
if (null == this.rf) return !1;
|
|
8
|
+
const i = fi.ef(t[0], this.rf);
|
|
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.nf || 0 === this.nf.length;
|
|
11
|
+
if (null != this.nf)
|
|
12
|
+
for (let i = 0; i < this.nf.length; i++)
|
|
13
|
+
if (this.nf[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 mi(t ? t.id : null, t ? t.buttons : null);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
return this.
|
|
22
|
+
gt() {
|
|
23
|
+
return this.rf;
|
|
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
|
+
sf(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
|
+
gt() {
|
|
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 us {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.productId = t), (this.
|
|
4
|
+
(this.productId = t), (this.if = s), (this.productId = t), (this.if = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.productId || null == this.
|
|
6
|
+
sf(t) {
|
|
7
|
+
if (null == this.productId || null == this.if) 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.if.sf(i);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
13
|
return new us(
|
|
@@ -15,7 +15,7 @@ export default class us {
|
|
|
15
15
|
t ? is.fromJson(t.property_filters) : null,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return { id: this.productId, pf: this.
|
|
18
|
+
gt() {
|
|
19
|
+
return { id: this.productId, pf: this.if ? this.if.gt() : null };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fi from "./trigger-condition.js";
|
|
2
2
|
export default class ur {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.rf = t), (this.rf = t);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
return null == this.
|
|
6
|
+
sf(t) {
|
|
7
|
+
return null == this.rf || fi.ef(t[0], this.rf);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t) {
|
|
10
10
|
return new ur(t ? t.campaign_id : null);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
return this.
|
|
12
|
+
gt() {
|
|
13
|
+
return this.rf;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import rs from "./custom-event-data.js";
|
|
2
2
|
import ls from "./custom-event-property-data.js";
|
|
3
3
|
import is from "./filter-set.js";
|
|
4
|
-
import
|
|
4
|
+
import mi from "./in-app-message-click-data.js";
|
|
5
5
|
import ns from "./purchase-data.js";
|
|
6
6
|
import us from "./purchase-property-data.js";
|
|
7
7
|
import ur 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
|
-
import { getErrorMessage as
|
|
11
|
-
export default class
|
|
10
|
+
import { getErrorMessage as ai } from "../../util/error-utils.js";
|
|
11
|
+
export default class fi {
|
|
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
|
+
km(e, t) {
|
|
16
|
+
return fi._m[this.type] === e && (null == this.data || this.data.sf(t));
|
|
17
17
|
}
|
|
18
|
-
static
|
|
18
|
+
static ef(e, t) {
|
|
19
19
|
let r = null;
|
|
20
20
|
try {
|
|
21
21
|
r = window.atob(e);
|
|
22
22
|
} catch (t) {
|
|
23
|
-
return E.info("Failed to unencode analytics id " + e + ": " +
|
|
23
|
+
return E.info("Failed to unencode analytics id " + e + ": " + ai(t)), !1;
|
|
24
24
|
}
|
|
25
25
|
return t === r.split("_")[0];
|
|
26
26
|
}
|
|
@@ -28,76 +28,76 @@ export default class ri {
|
|
|
28
28
|
const t = e.type;
|
|
29
29
|
let r = null;
|
|
30
30
|
switch (t) {
|
|
31
|
-
case
|
|
32
|
-
case
|
|
31
|
+
case fi.Ln.OPEN:
|
|
32
|
+
case fi.Ln.qs:
|
|
33
33
|
break;
|
|
34
|
-
case
|
|
34
|
+
case fi.Ln.Rr:
|
|
35
35
|
r = ns.fromJson(e.data);
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
37
|
+
case fi.Ln.bm:
|
|
38
38
|
r = us.fromJson(e.data);
|
|
39
39
|
break;
|
|
40
|
-
case
|
|
40
|
+
case fi.Ln.wr:
|
|
41
41
|
r = ur.fromJson(e.data);
|
|
42
42
|
break;
|
|
43
|
-
case
|
|
43
|
+
case fi.Ln.xe:
|
|
44
44
|
r = rs.fromJson(e.data);
|
|
45
45
|
break;
|
|
46
|
-
case
|
|
46
|
+
case fi.Ln.Em:
|
|
47
47
|
r = ls.fromJson(e.data);
|
|
48
48
|
break;
|
|
49
|
-
case
|
|
50
|
-
r =
|
|
49
|
+
case fi.Ln.rm:
|
|
50
|
+
r = mi.fromJson(e.data);
|
|
51
51
|
}
|
|
52
|
-
return new
|
|
52
|
+
return new fi(t, r);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
return { t: this.type, d: this.data ? this.data.
|
|
54
|
+
gt() {
|
|
55
|
+
return { t: this.type, d: this.data ? this.data.gt() : null };
|
|
56
56
|
}
|
|
57
|
-
static
|
|
57
|
+
static _u(e) {
|
|
58
58
|
let t,
|
|
59
59
|
r = null;
|
|
60
60
|
switch (e.t) {
|
|
61
|
-
case
|
|
62
|
-
case
|
|
61
|
+
case fi.Ln.OPEN:
|
|
62
|
+
case fi.Ln.qs:
|
|
63
63
|
break;
|
|
64
|
-
case
|
|
64
|
+
case fi.Ln.Rr:
|
|
65
65
|
r = new ns(e.d);
|
|
66
66
|
break;
|
|
67
|
-
case
|
|
68
|
-
(t = e.d || {}), (r = new us(t.id, is.
|
|
67
|
+
case fi.Ln.bm:
|
|
68
|
+
(t = e.d || {}), (r = new us(t.id, is._u(t.pf || [])));
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
70
|
+
case fi.Ln.wr:
|
|
71
71
|
r = new ur(e.d);
|
|
72
72
|
break;
|
|
73
|
-
case
|
|
73
|
+
case fi.Ln.xe:
|
|
74
74
|
r = new rs(e.d);
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
77
|
-
(t = e.d || {}), (r = new ls(t.e, is.
|
|
76
|
+
case fi.Ln.Em:
|
|
77
|
+
(t = e.d || {}), (r = new ls(t.e, is._u(t.pf || [])));
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
80
|
-
r = new
|
|
79
|
+
case fi.Ln.rm:
|
|
80
|
+
r = new mi(e.d);
|
|
81
81
|
}
|
|
82
|
-
return new
|
|
82
|
+
return new fi(e.t, r);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
(
|
|
85
|
+
(fi.Ln = {
|
|
86
86
|
OPEN: "open",
|
|
87
87
|
Rr: "purchase",
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
bm: "purchase_property",
|
|
89
|
+
wr: "push_click",
|
|
90
|
+
xe: "custom_event",
|
|
91
|
+
Em: "custom_event_property",
|
|
92
|
+
rm: "iam_click",
|
|
93
93
|
qs: "test",
|
|
94
94
|
}),
|
|
95
|
-
(
|
|
96
|
-
(
|
|
97
|
-
(
|
|
98
|
-
(
|
|
99
|
-
(
|
|
100
|
-
(
|
|
101
|
-
(
|
|
102
|
-
(
|
|
103
|
-
(
|
|
95
|
+
(fi._m = {}),
|
|
96
|
+
(fi._m[fi.Ln.OPEN] = ot.OPEN),
|
|
97
|
+
(fi._m[fi.Ln.Rr] = ot.Rr),
|
|
98
|
+
(fi._m[fi.Ln.bm] = ot.Rr),
|
|
99
|
+
(fi._m[fi.Ln.wr] = ot.wr),
|
|
100
|
+
(fi._m[fi.Ln.xe] = ot.xe),
|
|
101
|
+
(fi._m[fi.Ln.Em] = ot.xe),
|
|
102
|
+
(fi._m[fi.Ln.rm] = ot.rm),
|
|
103
|
+
(fi._m[fi.Ln.qs] = ot.qs);
|
|
@@ -3,57 +3,57 @@ import {
|
|
|
3
3
|
rehydrateDateAfterJsonization as Y,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
5
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
6
|
-
import
|
|
6
|
+
import fi from "./trigger-condition.js";
|
|
7
7
|
import { validateValueIsFromEnum as ta } 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.Td, a, u, d) {
|
|
10
10
|
(this.id = t),
|
|
11
|
-
(this.
|
|
11
|
+
(this.Pd = 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.Ed = o),
|
|
18
|
+
(this.Nd = n),
|
|
19
|
+
(this.Vn = a),
|
|
20
|
+
(this._d = u),
|
|
21
|
+
(this.Id = d),
|
|
22
22
|
(this.id = t),
|
|
23
|
-
(this.
|
|
23
|
+
(this.Pd = 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.Ed = o || 0),
|
|
31
|
+
null == a && (a = 1e3 * (this.Ed + 30)),
|
|
32
|
+
(this.Vn = a),
|
|
33
33
|
(this.data = l),
|
|
34
|
-
null != n && (this.
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
34
|
+
null != n && (this.Nd = n),
|
|
35
|
+
(this._d = u),
|
|
36
|
+
(this.Id = d || null);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
xd(t) {
|
|
39
39
|
return (
|
|
40
|
-
null == this.
|
|
40
|
+
null == this.Id || (this.Nd !== pt.Td && t - this.Id >= 1e3 * this.Nd)
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
this.
|
|
43
|
+
zd(t) {
|
|
44
|
+
this.Id = t;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
const i = t + 1e3 * this.
|
|
46
|
+
Md(t) {
|
|
47
|
+
const i = t + 1e3 * this.Ed;
|
|
48
48
|
return Math.max(i - new Date().valueOf(), 0);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
Bd(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.Vn || i < this.Vn;
|
|
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.Vn}ms.`,
|
|
57
57
|
),
|
|
58
58
|
!s
|
|
59
59
|
);
|
|
@@ -62,7 +62,7 @@ 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(
|
|
65
|
+
s.push(fi.fromJson(t.trigger_condition[i]));
|
|
66
66
|
const e = V(t.start_time),
|
|
67
67
|
r = V(t.end_time),
|
|
68
68
|
h = t.priority,
|
|
@@ -73,7 +73,7 @@ export default class pt {
|
|
|
73
73
|
u = t.data,
|
|
74
74
|
d = t.min_seconds_since_last_trigger;
|
|
75
75
|
return ta(
|
|
76
|
-
pt.
|
|
76
|
+
pt.Ln,
|
|
77
77
|
l,
|
|
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, l, u, o, n, a, d)
|
|
82
82
|
: null;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
gt() {
|
|
85
85
|
const t = [];
|
|
86
|
-
for (let i = 0; i < this.
|
|
86
|
+
for (let i = 0; i < this.Pd.length; i++) t.push(this.Pd[i].gt());
|
|
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.Ed,
|
|
96
|
+
r: this.Nd,
|
|
97
|
+
tm: this.Vn,
|
|
98
|
+
ss: this._d,
|
|
99
|
+
ld: this.Id,
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
static
|
|
102
|
+
static _u(t) {
|
|
103
103
|
const i = [],
|
|
104
104
|
s = t.c || [];
|
|
105
|
-
for (let t = 0; t < s.length; t++) i.push(
|
|
105
|
+
for (let t = 0; t < s.length; t++) i.push(fi._u(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.Ln = { Kn: "inapp", Cd: "templated_iam" }), (pt.Td = -1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import r, { OPTIONS as
|
|
1
|
+
import je from "../InAppMessage/in-app-message-manager-factory.js";
|
|
2
|
+
import r, { OPTIONS as D } from "../managers/braze-instance.js";
|
|
3
3
|
import gr from "./triggers-provider.js";
|
|
4
4
|
export const TriggersProviderFactory = {
|
|
5
5
|
i: !1,
|
|
@@ -11,13 +11,13 @@ export const TriggersProviderFactory = {
|
|
|
11
11
|
),
|
|
12
12
|
rg: () => {
|
|
13
13
|
if (!TriggersProviderFactory.provider) {
|
|
14
|
-
const i = r.
|
|
14
|
+
const i = r.re(D.Xh);
|
|
15
15
|
(TriggersProviderFactory.provider = new gr(
|
|
16
16
|
null != i ? i : 30,
|
|
17
|
-
|
|
17
|
+
je.ra().An(),
|
|
18
18
|
r.p(),
|
|
19
19
|
r.nn(),
|
|
20
|
-
|
|
20
|
+
je.ra(),
|
|
21
21
|
)),
|
|
22
22
|
r.v(TriggersProviderFactory.provider);
|
|
23
23
|
}
|