@braze/web-sdk 6.4.0 → 6.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/README.md +1 -1
- package/index.d.ts +11 -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 +3 -3
- package/shared-lib/indexed-db-adapter.js +58 -58
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +17 -16
- 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 +1 -1
- package/src/Banner/display/destroy-banner-html.js +3 -3
- package/src/Banner/display/detect-banner-impressions.js +14 -14
- package/src/Banner/get-all-banners.js +4 -4
- package/src/Banner/get-banner.js +5 -4
- 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 +3 -3
- package/src/Card/card-manager.js +32 -32
- package/src/Card/constants.js +1 -0
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-content-card-click.js +2 -2
- package/src/Card/log-content-card-impressions.js +5 -5
- package/src/Card/models/captioned-image.js +3 -3
- package/src/Card/models/card.js +16 -16
- 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/Card/util/card-factory.js +6 -6
- package/src/ContentCards/content-cards-provider-factory.js +11 -11
- package/src/ContentCards/content-cards-provider.js +110 -96
- 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 +5 -5
- 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 +4 -4
- package/src/Core/disable-sdk.js +9 -8
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +13 -13
- package/src/Core/log-purchase.js +10 -10
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-connection-core.js +23 -0
- package/src/DUST/dust-provider-factory.js +10 -8
- package/src/DUST/dust-provider.js +408 -176
- 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 +10 -0
- package/src/DUST/subscribe-to-dust.js +13 -13
- 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 +2 -2
- 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 +40 -40
- package/src/InAppMessage/display/modal-utils.js +16 -16
- 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 +97 -97
- package/src/InAppMessage/log-in-app-message-button-click.js +14 -14
- package/src/InAppMessage/log-in-app-message-click.js +13 -13
- package/src/InAppMessage/log-in-app-message-html-click.js +11 -11
- 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 +18 -18
- package/src/InAppMessage/models/html-message.js +19 -19
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +121 -119
- package/src/InAppMessage/models/modal-message.js +18 -18
- package/src/InAppMessage/models/slide-up-message.js +23 -23
- 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 +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +34 -34
- package/src/Push/push-manager-factory.js +14 -14
- package/src/Push/push-manager.js +90 -90
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +32 -32
- package/src/User/user.js +71 -71
- package/src/common/constants.js +8 -11
- package/src/common/content-cards-display.js +32 -32
- package/src/common/event-logger.js +10 -10
- 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 +14 -14
- package/src/managers/braze-instance.js +163 -159
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +154 -154
- package/src/managers/server-config-manager.js +116 -88
- package/src/managers/session-manager.js +41 -41
- package/src/managers/storage-manager-factory.js +13 -13
- package/src/managers/storage-manager.js +130 -131
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +10 -10
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +17 -17
- package/src/models/push-token.js +14 -14
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +41 -37
- package/src/request-controller.js +163 -160
- 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 +8 -8
- package/src/triggers/models/filter.js +7 -7
- 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 +2 -2
- package/src/triggers/models/trigger.js +42 -42
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +66 -66
- 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 +8 -8
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +33 -33
- package/src/util/client-hints-parser.js +10 -10
- 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 +6 -6
- package/src/util/request-header-utils.js +26 -26
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +16 -16
- package/src/util/window-utils.js +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import InAppMessage from "../models/in-app-message.js";
|
|
2
|
-
import { _handleBrazeAction as
|
|
2
|
+
import { _handleBrazeAction as O } from "../../Core/handle-braze-action.js";
|
|
3
3
|
import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.js";
|
|
4
|
-
import { toRgba as
|
|
5
|
-
import { addPassiveEventListener as
|
|
6
|
-
import { KeyCodes as
|
|
7
|
-
const
|
|
8
|
-
|
|
4
|
+
import { toRgba as ke } from "../../util/color-utils.js";
|
|
5
|
+
import { addPassiveEventListener as S } from "../../util/dom-utils.js";
|
|
6
|
+
import { KeyCodes as Ce } from "../../util/key-codes.js";
|
|
7
|
+
const xe = {
|
|
8
|
+
Qo: (t) => {
|
|
9
9
|
const o = t.querySelectorAll(".ab-close-button, .ab-message-button");
|
|
10
10
|
let e;
|
|
11
11
|
for (let t = 0; t < o.length; t++) (e = o[t]), (e.tabIndex = 0);
|
|
@@ -14,7 +14,7 @@ const ne = {
|
|
|
14
14
|
s = o[o.length - 1];
|
|
15
15
|
t.addEventListener("keydown", (o) => {
|
|
16
16
|
const a = document.activeElement;
|
|
17
|
-
o.keyCode ===
|
|
17
|
+
o.keyCode === Ce.Wo &&
|
|
18
18
|
(o.shiftKey || (a !== s && a !== t)
|
|
19
19
|
? !o.shiftKey ||
|
|
20
20
|
(a !== e && a !== t) ||
|
|
@@ -23,14 +23,14 @@ const ne = {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
So: (t, o) => {
|
|
27
27
|
o.setAttribute("role", "dialog"),
|
|
28
28
|
o.setAttribute("aria-modal", "true"),
|
|
29
29
|
t
|
|
30
30
|
? o.setAttribute("aria-labelledby", t)
|
|
31
31
|
: o.setAttribute("aria-label", "Modal Message");
|
|
32
32
|
},
|
|
33
|
-
|
|
33
|
+
Po: (t, o, e) => {
|
|
34
34
|
if (t.buttons && t.buttons.length > 0) {
|
|
35
35
|
const s = document.createElement("div");
|
|
36
36
|
(s.className = "ab-message-buttons"), o.appendChild(s);
|
|
@@ -40,7 +40,7 @@ const ne = {
|
|
|
40
40
|
t.ll(o, () => {
|
|
41
41
|
logInAppMessageButtonClick(s, t),
|
|
42
42
|
s.clickAction === InAppMessage.ClickAction.URI &&
|
|
43
|
-
|
|
43
|
+
O(
|
|
44
44
|
s.uri || "",
|
|
45
45
|
e || t.openTarget === InAppMessage.OpenTarget.BLANK,
|
|
46
46
|
a,
|
|
@@ -54,18 +54,18 @@ const ne = {
|
|
|
54
54
|
a = document.createElement("button");
|
|
55
55
|
(a.className = "ab-message-button"),
|
|
56
56
|
a.setAttribute("type", "button"),
|
|
57
|
-
|
|
57
|
+
S(a, "touchstart");
|
|
58
58
|
let n = e.text;
|
|
59
59
|
"" === e.text && (n = " "),
|
|
60
60
|
a.appendChild(document.createTextNode(n)),
|
|
61
|
-
t.
|
|
62
|
-
((a.style.backgroundColor =
|
|
63
|
-
(a.style.color =
|
|
64
|
-
(a.style.borderColor =
|
|
61
|
+
t.Mo() ||
|
|
62
|
+
((a.style.backgroundColor = ke(e.backgroundColor)),
|
|
63
|
+
(a.style.color = ke(e.textColor)),
|
|
64
|
+
(a.style.borderColor = ke(e.borderColor))),
|
|
65
65
|
(a.onclick = l(e)),
|
|
66
66
|
s.appendChild(a);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
|
-
export default
|
|
71
|
+
export default xe;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import je from "./in-app-message-manager-factory.js";
|
|
3
3
|
export function getDeferredInAppMessage() {
|
|
4
|
-
if (r.rr()) return
|
|
4
|
+
if (r.rr()) return je.ra().sa();
|
|
5
5
|
}
|
|
@@ -49,7 +49,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
49
49
|
C = e.language,
|
|
50
50
|
D = e.image_alt;
|
|
51
51
|
let G;
|
|
52
|
-
if (o === ModalMessage.es || o === InAppMessage.
|
|
52
|
+
if (o === ModalMessage.es || o === InAppMessage.Eo.Xo)
|
|
53
53
|
G = new ModalMessage(
|
|
54
54
|
s,
|
|
55
55
|
n,
|
|
@@ -146,8 +146,8 @@ export function newInAppMessageFromJson(e) {
|
|
|
146
146
|
else {
|
|
147
147
|
if (
|
|
148
148
|
o !== HtmlMessage.es &&
|
|
149
|
-
o !== InAppMessage.
|
|
150
|
-
o !== InAppMessage.
|
|
149
|
+
o !== InAppMessage.Eo.Bo &&
|
|
150
|
+
o !== InAppMessage.Eo.Yo
|
|
151
151
|
)
|
|
152
152
|
return void E.error("Ignoring message with unknown type " + o);
|
|
153
153
|
{
|
|
@@ -156,7 +156,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
156
156
|
(G.trusted = e.trusted || !1);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
return (G.
|
|
159
|
+
return (G.ko = o), G;
|
|
160
160
|
}
|
|
161
161
|
export function buttonsFromSerializedInAppMessage(e) {
|
|
162
162
|
const o = [];
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import ea from "./in-app-message-manager.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const je = {
|
|
4
|
+
na: null,
|
|
5
5
|
i: !1,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
ra: () => (
|
|
7
|
+
je.t(), je.na || (je.na = new ea(r.m(), r.u(), r.p(), r.ir())), je.na
|
|
8
8
|
),
|
|
9
9
|
t: () => {
|
|
10
|
-
|
|
10
|
+
je.i || (r.g(je), (je.i = !0));
|
|
11
11
|
},
|
|
12
12
|
destroy: () => {
|
|
13
|
-
(
|
|
13
|
+
(je.na = null), (je.i = !1);
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
|
-
export default
|
|
16
|
+
export default je;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import l from "../util/net.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
3
|
import ControlMessage from "./models/control-message.js";
|
|
4
4
|
import HtmlMessage from "./models/html-message.js";
|
|
5
5
|
import InAppMessage from "./models/in-app-message.js";
|
|
6
6
|
import InAppMessageButton from "./models/in-app-message-button.js";
|
|
7
|
-
import
|
|
7
|
+
import v from "../common/event-logger.js";
|
|
8
8
|
import { newInAppMessageFromJson as ut } from "./in-app-message-factory.js";
|
|
9
|
-
import { randomInclusive as
|
|
10
|
-
import
|
|
11
|
-
import { logger as E, EventTypes as
|
|
12
|
-
import
|
|
9
|
+
import { randomInclusive as a } from "../util/math.js";
|
|
10
|
+
import H from "../models/request-result.js";
|
|
11
|
+
import { logger as E, EventTypes as f } from "../../shared-lib/index.js";
|
|
12
|
+
import m from "../managers/subscription-manager.js";
|
|
13
13
|
import pt from "../triggers/models/trigger.js";
|
|
14
14
|
import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
|
|
15
15
|
import {
|
|
@@ -25,46 +25,46 @@ import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
|
25
25
|
import { FullScreenMessage, ModalMessage, SlideUpMessage } from "./index.js";
|
|
26
26
|
export default class ea {
|
|
27
27
|
constructor(t, e, s, i) {
|
|
28
|
-
(this.
|
|
28
|
+
(this.j = t),
|
|
29
29
|
(this.C = e),
|
|
30
|
-
(this.
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
30
|
+
(this.B = s),
|
|
31
|
+
(this.vs = i),
|
|
32
|
+
(this.j = t),
|
|
33
33
|
(this.C = e),
|
|
34
|
-
(this.
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
37
|
-
r.q(this.
|
|
38
|
-
(this.
|
|
39
|
-
(this.
|
|
40
|
-
(this.
|
|
41
|
-
(this.
|
|
42
|
-
(this.
|
|
34
|
+
(this.B = s),
|
|
35
|
+
(this.vs = i),
|
|
36
|
+
(this.vn = new m()),
|
|
37
|
+
r.q(this.vn),
|
|
38
|
+
(this.yn = 1e3),
|
|
39
|
+
(this.bn = 6e4),
|
|
40
|
+
(this.In = null),
|
|
41
|
+
(this.Mn = null),
|
|
42
|
+
(this.An = null);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
return this.
|
|
44
|
+
Tn() {
|
|
45
|
+
return this.vn;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
return this.
|
|
47
|
+
kn(t) {
|
|
48
|
+
return this.vn.Rt(t);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
return this.
|
|
50
|
+
Dn() {
|
|
51
|
+
return this.In;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
this.
|
|
53
|
+
wn(t) {
|
|
54
|
+
this.In = t;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
const r = new
|
|
56
|
+
lt(t, e, s, i) {
|
|
57
|
+
const r = new H();
|
|
58
58
|
let n;
|
|
59
|
-
if (e ===
|
|
60
|
-
if (!t.
|
|
59
|
+
if (e === f.zn || t instanceof ControlMessage) {
|
|
60
|
+
if (!t.Wt())
|
|
61
61
|
return (
|
|
62
62
|
E.info(
|
|
63
63
|
"This in-app message has already received an impression. Ignoring analytics event.",
|
|
64
64
|
),
|
|
65
65
|
r
|
|
66
66
|
);
|
|
67
|
-
} else if (e ===
|
|
67
|
+
} else if (e === f.Sn || (t instanceof HtmlMessage && e === f.Bn)) {
|
|
68
68
|
if (!t.$t(i))
|
|
69
69
|
return (
|
|
70
70
|
E.info(
|
|
@@ -77,16 +77,16 @@ export default class ea {
|
|
|
77
77
|
(n =
|
|
78
78
|
t instanceof ControlMessage
|
|
79
79
|
? { trigger_ids: [t.triggerId] }
|
|
80
|
-
: this.
|
|
80
|
+
: this.Rn(t)),
|
|
81
81
|
null == n
|
|
82
82
|
? r
|
|
83
83
|
: (t.messageExtras && (n.message_extras = t.messageExtras),
|
|
84
84
|
null != s && (n.bid = s),
|
|
85
|
-
|
|
85
|
+
v.lt(e, n))
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
const s = new
|
|
88
|
+
_n(t, e) {
|
|
89
|
+
const s = new H();
|
|
90
90
|
if (!t.$t())
|
|
91
91
|
return (
|
|
92
92
|
E.info(
|
|
@@ -94,34 +94,34 @@ export default class ea {
|
|
|
94
94
|
),
|
|
95
95
|
s
|
|
96
96
|
);
|
|
97
|
-
const i = this.
|
|
97
|
+
const i = this.Rn(e);
|
|
98
98
|
return null == i
|
|
99
99
|
? s
|
|
100
|
-
: t.id === InAppMessageButton.
|
|
100
|
+
: t.id === InAppMessageButton.qn
|
|
101
101
|
? (E.info(
|
|
102
102
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers.",
|
|
103
103
|
),
|
|
104
104
|
s)
|
|
105
|
-
: (null != t.id && (i.bid = t.id),
|
|
105
|
+
: (null != t.id && (i.bid = t.id), v.lt(f.Bn, i));
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
xn(t) {
|
|
108
108
|
const e = t.messageFields;
|
|
109
109
|
return (null != e && e.is_push_primer) || !1;
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
Pn(t) {
|
|
112
112
|
if (!(t instanceof InAppMessage)) return;
|
|
113
113
|
const e = (t) => {
|
|
114
114
|
if (!t) return;
|
|
115
115
|
const e = eo(t);
|
|
116
|
-
if (gt(e)) return dt(jt.
|
|
116
|
+
if (gt(e)) return dt(jt.En, "In-App Message");
|
|
117
117
|
if (ft(e)) {
|
|
118
|
-
const t = vt.
|
|
119
|
-
if (!t.
|
|
118
|
+
const t = vt.Gn();
|
|
119
|
+
if (!t.Nn) return vt.$n(t.reason, "In-App Message");
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
if (this.
|
|
123
|
-
const t = vt.
|
|
124
|
-
if (!t.
|
|
122
|
+
if (this.xn(t)) {
|
|
123
|
+
const t = vt.Gn();
|
|
124
|
+
if (!t.Nn) return vt.$n(t.reason, "In-App Message");
|
|
125
125
|
}
|
|
126
126
|
const s = t.buttons || [];
|
|
127
127
|
let i;
|
|
@@ -139,49 +139,49 @@ export default class ea {
|
|
|
139
139
|
? e(t.uri)
|
|
140
140
|
: void 0;
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
e !== this.
|
|
142
|
+
Cn(t, e) {
|
|
143
|
+
e !== this.An && this.Fn(), (this.Mn = t), (this.An = e);
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
null != this.
|
|
147
|
-
(clearTimeout(this.
|
|
145
|
+
Fn() {
|
|
146
|
+
null != this.Mn &&
|
|
147
|
+
(clearTimeout(this.Mn), (this.Mn = null), (this.An = null));
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
const r = this.
|
|
149
|
+
On(t, e, s, i) {
|
|
150
|
+
const r = this.j;
|
|
151
151
|
if (!r) return;
|
|
152
|
-
this.
|
|
153
|
-
const n = r.
|
|
152
|
+
this.An && t.triggerId !== this.An && (this.Fn(), h.fi(this.B, h.H.Xn));
|
|
153
|
+
const n = r.Hn(!1),
|
|
154
154
|
o = r.$(n);
|
|
155
155
|
(o.template = { trigger_id: t.triggerId, trigger_event_type: e }),
|
|
156
|
-
null != s && (o.template.data = s.
|
|
157
|
-
const u = r.A(o, h.H.
|
|
156
|
+
null != s && (o.template.data = s.Jn());
|
|
157
|
+
const u = r.A(o, h.H.Xn);
|
|
158
158
|
r.J(
|
|
159
159
|
o,
|
|
160
160
|
(r = -1) => {
|
|
161
|
-
const n = this.
|
|
161
|
+
const n = this.j;
|
|
162
162
|
if (!n) return;
|
|
163
163
|
const m = new Date().valueOf();
|
|
164
|
-
h.K(this.
|
|
164
|
+
h.K(this.B, h.H.Xn, m),
|
|
165
165
|
-1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
|
|
166
166
|
let c,
|
|
167
167
|
p,
|
|
168
168
|
f = !1;
|
|
169
|
-
|
|
169
|
+
l.O({
|
|
170
170
|
url: `${n.V()}/template/`,
|
|
171
171
|
data: o,
|
|
172
172
|
headers: u,
|
|
173
173
|
W: (e) => {
|
|
174
174
|
if (!n.Y(o, e, u))
|
|
175
|
-
return void ("function" == typeof t.
|
|
175
|
+
return void ("function" == typeof t.Kn && t.Kn());
|
|
176
176
|
if ((n.Z(), null == e || null == e.templated_message)) return;
|
|
177
177
|
const s = e.templated_message;
|
|
178
|
-
if (s.type !== pt.
|
|
178
|
+
if (s.type !== pt.Qn.Ln) return;
|
|
179
179
|
const i = ut(s.data);
|
|
180
180
|
if (null == i) return;
|
|
181
|
-
const r = this.
|
|
181
|
+
const r = this.Pn(i);
|
|
182
182
|
if (r)
|
|
183
|
-
return E.error(r), void ("function" == typeof t.
|
|
184
|
-
"function" == typeof t.
|
|
183
|
+
return E.error(r), void ("function" == typeof t.Kn && t.Kn());
|
|
184
|
+
"function" == typeof t.Un && t.Un(i);
|
|
185
185
|
},
|
|
186
186
|
error: (e) => {
|
|
187
187
|
(f = !0),
|
|
@@ -189,21 +189,21 @@ export default class ea {
|
|
|
189
189
|
(p = `getting user personalization for message ${t.triggerId}.`);
|
|
190
190
|
},
|
|
191
191
|
tt: (r, o) => {
|
|
192
|
-
if (new Date().valueOf() - t.
|
|
192
|
+
if (new Date().valueOf() - t.Vn < t.Wn) {
|
|
193
193
|
let r = 0;
|
|
194
194
|
if (f) {
|
|
195
|
-
const e = Math.min(t.
|
|
196
|
-
s = this.
|
|
197
|
-
null == i && (i = s), (r = Math.min(e,
|
|
195
|
+
const e = Math.min(t.Wn, this.bn),
|
|
196
|
+
s = this.yn;
|
|
197
|
+
null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
|
|
198
198
|
}
|
|
199
|
-
n.
|
|
199
|
+
n.et(
|
|
200
200
|
o,
|
|
201
201
|
() => {
|
|
202
|
-
this.
|
|
202
|
+
this.On(t, e, s, r);
|
|
203
203
|
},
|
|
204
|
-
h.H.
|
|
205
|
-
(e) => this.
|
|
206
|
-
() => this.
|
|
204
|
+
h.H.Xn,
|
|
205
|
+
(e) => this.Cn(e, t.triggerId),
|
|
206
|
+
() => this.Fn(),
|
|
207
207
|
r,
|
|
208
208
|
);
|
|
209
209
|
}
|
|
@@ -211,10 +211,10 @@ export default class ea {
|
|
|
211
211
|
},
|
|
212
212
|
});
|
|
213
213
|
},
|
|
214
|
-
h.H.
|
|
214
|
+
h.H.Xn,
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
Rn(t) {
|
|
218
218
|
if (null == t.triggerId)
|
|
219
219
|
return (
|
|
220
220
|
E.info(
|
|
@@ -225,40 +225,40 @@ export default class ea {
|
|
|
225
225
|
const e = {};
|
|
226
226
|
return null != t.triggerId && (e.trigger_ids = [t.triggerId]), e;
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
jn(t) {
|
|
229
229
|
return (
|
|
230
|
-
!!this.
|
|
230
|
+
!!this.B &&
|
|
231
231
|
!(
|
|
232
232
|
!(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
|
|
233
233
|
t instanceof ControlMessage
|
|
234
234
|
) &&
|
|
235
|
-
this.
|
|
235
|
+
this.B.bt(s.ft.Yn, t.gt())
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
|
-
|
|
239
|
-
if (!this.
|
|
240
|
-
const t = this.
|
|
238
|
+
sa() {
|
|
239
|
+
if (!this.B) return null;
|
|
240
|
+
const t = this.B.dt(s.ft.Yn);
|
|
241
241
|
if (!t) return null;
|
|
242
242
|
let e;
|
|
243
243
|
switch (t.type) {
|
|
244
|
-
case InAppMessage.
|
|
245
|
-
e = FullScreenMessage.
|
|
244
|
+
case InAppMessage.Eo.Zn:
|
|
245
|
+
e = FullScreenMessage.Zo(t);
|
|
246
246
|
break;
|
|
247
|
-
case InAppMessage.
|
|
248
|
-
case InAppMessage.
|
|
249
|
-
case InAppMessage.
|
|
250
|
-
e = HtmlMessage.
|
|
247
|
+
case InAppMessage.Eo.ta:
|
|
248
|
+
case InAppMessage.Eo.Bo:
|
|
249
|
+
case InAppMessage.Eo.Yo:
|
|
250
|
+
e = HtmlMessage.Zo(t);
|
|
251
251
|
break;
|
|
252
|
-
case InAppMessage.
|
|
253
|
-
case InAppMessage.
|
|
254
|
-
e = ModalMessage.
|
|
252
|
+
case InAppMessage.Eo.ia:
|
|
253
|
+
case InAppMessage.Eo.Xo:
|
|
254
|
+
e = ModalMessage.Zo(t);
|
|
255
255
|
break;
|
|
256
|
-
case InAppMessage.
|
|
257
|
-
e = SlideUpMessage.
|
|
256
|
+
case InAppMessage.Eo.oa:
|
|
257
|
+
e = SlideUpMessage.Zo(t);
|
|
258
258
|
}
|
|
259
|
-
return e && this.
|
|
259
|
+
return e && this.la(), e;
|
|
260
260
|
}
|
|
261
|
-
|
|
262
|
-
this.
|
|
261
|
+
la() {
|
|
262
|
+
this.B && this.B.zt(s.ft.Yn);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import {
|
|
2
|
+
import { IamStrings as sr } from "./constants.js";
|
|
3
3
|
import InAppMessage from "./models/in-app-message.js";
|
|
4
4
|
import InAppMessageButton from "./models/in-app-message-button.js";
|
|
5
|
-
import
|
|
5
|
+
import je from "./in-app-message-manager-factory.js";
|
|
6
6
|
import { logger as E } from "../../shared-lib/index.js";
|
|
7
|
-
import
|
|
8
|
-
import { TriggersProviderFactory as
|
|
9
|
-
export function logInAppMessageButtonClick(
|
|
7
|
+
import ot from "../triggers/models/trigger-events.js";
|
|
8
|
+
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
9
|
+
export function logInAppMessageButtonClick(t, o) {
|
|
10
10
|
var e;
|
|
11
11
|
if (!r.rr()) return !1;
|
|
12
|
-
if (!(
|
|
12
|
+
if (!(t instanceof InAppMessageButton))
|
|
13
13
|
return E.error("button must be an InAppMessageButton object"), !1;
|
|
14
|
-
if (!(
|
|
15
|
-
const s =
|
|
14
|
+
if (!(o instanceof InAppMessage)) return E.error(sr.sS), !1;
|
|
15
|
+
const s = je.ra()._n(t, o);
|
|
16
16
|
if (s.W)
|
|
17
|
-
for (let r = 0; r < s.
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
for (let r = 0; r < s.Ee.length; r++)
|
|
18
|
+
rt.o().he(
|
|
19
|
+
ot.rm,
|
|
20
20
|
[
|
|
21
|
-
|
|
22
|
-
null === (e =
|
|
21
|
+
o.triggerId,
|
|
22
|
+
null === (e = t.id) || void 0 === e ? void 0 : e.toString(),
|
|
23
23
|
],
|
|
24
|
-
s.
|
|
24
|
+
s.Ee[r],
|
|
25
25
|
);
|
|
26
26
|
return s.W;
|
|
27
27
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import InAppMessage from "./models/in-app-message.js";
|
|
3
|
-
import
|
|
3
|
+
import je from "./in-app-message-manager-factory.js";
|
|
4
4
|
import { logInAppMessageImpression } from "./log-in-app-message-impression.js";
|
|
5
|
-
import {
|
|
6
|
-
import { logger as E, EventTypes as
|
|
7
|
-
import
|
|
8
|
-
import { TriggersProviderFactory as
|
|
9
|
-
export function logInAppMessageClick(
|
|
5
|
+
import { IamStrings as sr } from "./constants.js";
|
|
6
|
+
import { logger as E, EventTypes as f } from "../../shared-lib/index.js";
|
|
7
|
+
import ot from "../triggers/models/trigger-events.js";
|
|
8
|
+
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
9
|
+
export function logInAppMessageClick(s) {
|
|
10
10
|
if (!r.rr()) return !1;
|
|
11
|
-
if (!(
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
for (let r = 0; r <
|
|
16
|
-
|
|
11
|
+
if (!(s instanceof InAppMessage)) return E.error(sr.sS), !1;
|
|
12
|
+
const e = je.ra().lt(s, f.Sn);
|
|
13
|
+
if (e) {
|
|
14
|
+
s.sm() || logInAppMessageImpression(s);
|
|
15
|
+
for (let r = 0; r < e.Ee.length; r++)
|
|
16
|
+
rt.o().he(ot.rm, [s.triggerId], e.Ee[r]);
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return e.W;
|
|
19
19
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import HtmlMessage from "./models/html-message.js";
|
|
3
|
-
import
|
|
4
|
-
import { logger as E, EventTypes as
|
|
5
|
-
import
|
|
6
|
-
import { TriggersProviderFactory as
|
|
3
|
+
import je from "./in-app-message-manager-factory.js";
|
|
4
|
+
import { logger as E, EventTypes as f } from "../../shared-lib/index.js";
|
|
5
|
+
import ot from "../triggers/models/trigger-events.js";
|
|
6
|
+
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
7
7
|
export function logInAppMessageHtmlClick(e, t, s) {
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
9
|
if (!(e instanceof HtmlMessage))
|
|
@@ -13,11 +13,11 @@ export function logInAppMessageHtmlClick(e, t, s) {
|
|
|
13
13
|
),
|
|
14
14
|
!1
|
|
15
15
|
);
|
|
16
|
-
let o =
|
|
17
|
-
null != t && (o =
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
for (let r = 0; r <
|
|
21
|
-
|
|
22
|
-
return
|
|
16
|
+
let o = f.Sn;
|
|
17
|
+
null != t && (o = f.Bn);
|
|
18
|
+
const m = je.ra().lt(e, o, t, s);
|
|
19
|
+
if (m.W)
|
|
20
|
+
for (let r = 0; r < m.Ee.length; r++)
|
|
21
|
+
rt.o().he(ot.rm, [e.triggerId, t], m.Ee[r]);
|
|
22
|
+
return m.W;
|
|
23
23
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import ControlMessage from "./models/control-message.js";
|
|
3
3
|
import InAppMessage from "./models/in-app-message.js";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { logger as E, EventTypes as
|
|
7
|
-
export function logInAppMessageImpression(
|
|
4
|
+
import je from "./in-app-message-manager-factory.js";
|
|
5
|
+
import { IamStrings as sr } from "./constants.js";
|
|
6
|
+
import { logger as E, EventTypes as f } from "../../shared-lib/index.js";
|
|
7
|
+
export function logInAppMessageImpression(s) {
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
|
-
if (!(
|
|
10
|
-
return E.error(sr), !1;
|
|
11
|
-
const
|
|
12
|
-
return
|
|
9
|
+
if (!(s instanceof InAppMessage || s instanceof ControlMessage))
|
|
10
|
+
return E.error(sr.sS), !1;
|
|
11
|
+
const o = s instanceof ControlMessage ? f.om : f.zn;
|
|
12
|
+
return je.ra().lt(s, o).W;
|
|
13
13
|
}
|
|
@@ -6,15 +6,15 @@ export default class ControlMessage {
|
|
|
6
6
|
(this.messageExtras = t),
|
|
7
7
|
(this.extras = {}),
|
|
8
8
|
(this.isControl = !0),
|
|
9
|
-
(this.
|
|
9
|
+
(this.Gt = !1);
|
|
10
10
|
}
|
|
11
11
|
static fromJson(s) {
|
|
12
12
|
return new ControlMessage(s.trigger_id, s.message_extras);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
return !this.
|
|
14
|
+
Wt() {
|
|
15
|
+
return !this.Gt && ((this.Gt = !0), !0);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return this.
|
|
17
|
+
sm() {
|
|
18
|
+
return this.Gt;
|
|
19
19
|
}
|
|
20
20
|
}
|