@braze/web-sdk 6.8.0 → 6.9.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 +99 -19
- package/package.json +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +64 -64
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +8 -8
- package/src/Banner/banner-provider.js +67 -59
- package/src/Banner/banner.js +40 -19
- package/src/Banner/dismiss-banner.js +4 -0
- package/src/Banner/display/banner-to-html.js +10 -10
- package/src/Banner/display/destroy-banner-html.js +2 -2
- package/src/Banner/get-all-banners.js +6 -6
- package/src/Banner/get-banner.js +6 -6
- package/src/Banner/index.js +1 -0
- package/src/Banner/log-banner-click.js +7 -7
- package/src/Banner/log-banner-dismissal.js +7 -7
- package/src/Banner/log-banner-impressions.js +10 -10
- package/src/Banner/request-banners-refresh.js +8 -8
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Banner/ui/insert-banner.js +8 -8
- package/src/Card/card-manager.js +31 -31
- 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 +4 -4
- package/src/Card/models/captioned-image.js +15 -15
- package/src/Card/models/card.js +89 -89
- package/src/Card/models/classic-card.js +16 -16
- package/src/Card/models/control-card.js +7 -7
- package/src/Card/models/image-only.js +13 -13
- package/src/Card/util/card-factory.js +32 -32
- package/src/ContentCards/content-cards-provider.js +102 -102
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
- 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 +3 -3
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +4 -4
- package/src/Core/enable-sdk.js +4 -4
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +5 -5
- package/src/Core/log-custom-event.js +5 -5
- package/src/Core/log-ecommerce-event.js +5 -5
- package/src/Core/log-purchase.js +9 -9
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-logger.js +2 -2
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-provider.js +249 -240
- package/src/DUST/dust-shared-worker-code.js +1 -1
- package/src/DUST/dust-shared-worker-impl.js +15 -14
- package/src/DUST/dust-worker-bridge.js +50 -35
- package/src/DUST/subscribe-to-dust.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +3 -3
- package/src/FeatureFlags/feature-flags-provider.js +21 -21
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/InAppMessage/constants.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +4 -4
- package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
- package/src/InAppMessage/in-app-message-factory.js +36 -36
- package/src/InAppMessage/in-app-message-manager.js +78 -78
- package/src/InAppMessage/log-in-app-message-button-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-impression.js +4 -4
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +4 -4
- package/src/InAppMessage/models/html-message.js +3 -3
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +12 -12
- package/src/InAppMessage/models/modal-message.js +4 -4
- package/src/InAppMessage/models/slide-up-message.js +4 -4
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +14 -14
- package/src/Push/push-manager-factory.js +2 -2
- package/src/Push/push-manager.js +38 -38
- package/src/Push/utils/push-utils.js +6 -6
- package/src/User/user-manager.js +14 -14
- package/src/User/user.js +25 -25
- package/src/common/base-provider.js +1 -1
- package/src/common/content-cards-display.js +7 -7
- package/src/common/event-logger.js +3 -3
- package/src/common/properties-base.js +3 -3
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +3 -3
- package/src/managers/auth-manager.js +11 -11
- package/src/managers/braze-instance.js +56 -56
- package/src/managers/device-manager.js +10 -10
- package/src/managers/network-manager.js +102 -101
- package/src/managers/server-config-manager.js +115 -98
- package/src/managers/session-manager.js +20 -20
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +74 -74
- package/src/managers/subscription-manager.js +2 -2
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +1 -1
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +2 -2
- package/src/models/push-token.js +6 -6
- package/src/models/request-result.js +1 -1
- package/src/models/server-config.js +42 -24
- package/src/request-controller.js +126 -126
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +1 -1
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +33 -33
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +33 -33
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +68 -68
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/braze-actions.js +7 -7
- package/src/util/browser-detector.js +2 -2
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/code-utils.js +2 -2
- package/src/util/deprecation-utils.js +2 -2
- package/src/util/dom-utils.js +7 -7
- package/src/util/ecommerce-event-validation.js +52 -35
- package/src/util/html-display-utils.js +11 -11
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +17 -17
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +2 -2
- package/src/util/validation-utils.js +12 -12
- package/src/util/window-utils.js +2 -2
|
@@ -14,7 +14,7 @@ import { logInAppMessageClick } from "../log-in-app-message-click.js";
|
|
|
14
14
|
import { _handleBrazeAction as Q } from "../../Core/handle-braze-action.js";
|
|
15
15
|
import ft from "./html-message-to-html.js";
|
|
16
16
|
import xe from "./modal-utils.js";
|
|
17
|
-
import { logger as
|
|
17
|
+
import { logger as b, Guid as V } from "../../../shared-lib/index.js";
|
|
18
18
|
import { KeyCodes as Ce } from "../../util/key-codes.js";
|
|
19
19
|
import {
|
|
20
20
|
IamClickAction as Le,
|
|
@@ -61,7 +61,7 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
61
61
|
m && (clearTimeout(m), (m = null)),
|
|
62
62
|
o
|
|
63
63
|
? c()
|
|
64
|
-
:
|
|
64
|
+
: b.error(
|
|
65
65
|
`Cannot show in-app message ${e.message} because the image failed to load.`,
|
|
66
66
|
));
|
|
67
67
|
};
|
|
@@ -98,18 +98,18 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
98
98
|
(u.className = "ab-message-text"),
|
|
99
99
|
(u.dir = s),
|
|
100
100
|
u.setAttribute("role", "article");
|
|
101
|
-
const
|
|
102
|
-
u.className += " " +
|
|
103
|
-
let
|
|
104
|
-
const
|
|
105
|
-
if (((
|
|
101
|
+
const f = (e.messageAlignment || e.Go).toLowerCase();
|
|
102
|
+
u.className += " " + f + "-aligned";
|
|
103
|
+
let p = !1;
|
|
104
|
+
const g = document.createElement("div");
|
|
105
|
+
if (((g.className = "ab-image-area"), e.imageUrl)) {
|
|
106
106
|
const o = document.createElement("img");
|
|
107
107
|
if (
|
|
108
108
|
(o.setAttribute("src", e.imageUrl),
|
|
109
109
|
e.Ho(o),
|
|
110
110
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
111
111
|
) {
|
|
112
|
-
|
|
112
|
+
p = !0;
|
|
113
113
|
const e = document.querySelectorAll(".ab-iam-root");
|
|
114
114
|
e && e.length > 0 && e[0].classList.add("ab-iam-img-loading"),
|
|
115
115
|
(m = window.setTimeout(() => {
|
|
@@ -126,11 +126,11 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
126
126
|
const e = document.createElement("div");
|
|
127
127
|
(e.className = "ab-center-cropped-img"),
|
|
128
128
|
e.appendChild(o),
|
|
129
|
-
|
|
130
|
-
} else
|
|
131
|
-
l.appendChild(
|
|
129
|
+
g.appendChild(e);
|
|
130
|
+
} else g.appendChild(o);
|
|
131
|
+
l.appendChild(g), (u.className += " ab-with-image");
|
|
132
132
|
} else if (e.icon) {
|
|
133
|
-
|
|
133
|
+
g.className += " ab-icon-area";
|
|
134
134
|
const o = document.createElement("span");
|
|
135
135
|
(o.className = "ab-icon"),
|
|
136
136
|
e.Mo() ||
|
|
@@ -141,8 +141,8 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
141
141
|
t.appendChild(document.createTextNode(e.icon)),
|
|
142
142
|
t.setAttribute("aria-hidden", "true"),
|
|
143
143
|
o.appendChild(t),
|
|
144
|
-
|
|
145
|
-
l.appendChild(
|
|
144
|
+
g.appendChild(o),
|
|
145
|
+
l.appendChild(g),
|
|
146
146
|
(u.className += " ab-with-icon");
|
|
147
147
|
}
|
|
148
148
|
if ((F(u, "touchstart"), e.header && e.header.length > 0)) {
|
|
@@ -154,8 +154,8 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
154
154
|
o.appendChild(document.createTextNode(e.header)),
|
|
155
155
|
u.appendChild(o);
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
return u.appendChild(
|
|
157
|
+
const h = e.Ko();
|
|
158
|
+
return u.appendChild(h), l.appendChild(u), p || c(), (e.Eo = l), l;
|
|
159
159
|
})(e, o, t, a, n, s, m);
|
|
160
160
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
161
161
|
const o = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
@@ -4,7 +4,7 @@ import HtmlMessage from "./models/html-message.js";
|
|
|
4
4
|
import InAppMessageButton from "./models/in-app-message-button.js";
|
|
5
5
|
import ModalMessage from "./models/modal-message.js";
|
|
6
6
|
import SlideUpMessage from "./models/slide-up-message.js";
|
|
7
|
-
import { logger as
|
|
7
|
+
import { logger as b } from "../../shared-lib/index.js";
|
|
8
8
|
import { IamServerTypes as dt } from "./constants.js";
|
|
9
9
|
export function newInAppMessageFromJson(e) {
|
|
10
10
|
if (!e) return null;
|
|
@@ -27,27 +27,27 @@ export function newInAppMessageFromJson(e) {
|
|
|
27
27
|
g = e.icon_color,
|
|
28
28
|
j = e.icon_bg_color,
|
|
29
29
|
w = e.bg_color,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
let
|
|
38
|
-
null ==
|
|
39
|
-
for (let e = 0; e <
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
(null !=
|
|
47
|
-
((
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
h = e.text_color,
|
|
31
|
+
v = e.close_btn_color,
|
|
32
|
+
x = e.header,
|
|
33
|
+
I = e.text_align_header,
|
|
34
|
+
A = e.header_text_color,
|
|
35
|
+
F = e.frame_color,
|
|
36
|
+
M = [];
|
|
37
|
+
let k = e.btns;
|
|
38
|
+
null == k && (k = []);
|
|
39
|
+
for (let e = 0; e < k.length; e++) M.push(InAppMessageButton.fromJson(k[e]));
|
|
40
|
+
const y = e.crop_type,
|
|
41
|
+
z = e.orientation,
|
|
42
|
+
J = e.animate_in,
|
|
43
|
+
S = e.animate_out;
|
|
44
|
+
let q = e.html_id,
|
|
45
|
+
B = e.css;
|
|
46
|
+
(null != q && "" !== q && null != B && "" !== B) ||
|
|
47
|
+
((q = void 0), (B = void 0));
|
|
48
|
+
const C = e.message_extras,
|
|
49
|
+
D = e.language,
|
|
50
|
+
E = e.image_alt;
|
|
51
51
|
let G;
|
|
52
52
|
if (o === dt.aE || o === dt.UE)
|
|
53
53
|
G = new ModalMessage(
|
|
@@ -66,21 +66,21 @@ export function newInAppMessageFromJson(e) {
|
|
|
66
66
|
g,
|
|
67
67
|
j,
|
|
68
68
|
w,
|
|
69
|
-
b,
|
|
70
69
|
h,
|
|
71
|
-
z,
|
|
72
|
-
J,
|
|
73
70
|
v,
|
|
71
|
+
J,
|
|
72
|
+
S,
|
|
74
73
|
x,
|
|
75
74
|
I,
|
|
76
75
|
A,
|
|
77
76
|
F,
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
M,
|
|
78
|
+
y,
|
|
80
79
|
q,
|
|
81
80
|
B,
|
|
82
81
|
C,
|
|
83
82
|
D,
|
|
83
|
+
E,
|
|
84
84
|
);
|
|
85
85
|
else if (o === dt.cE)
|
|
86
86
|
G = new FullScreenMessage(
|
|
@@ -99,22 +99,22 @@ export function newInAppMessageFromJson(e) {
|
|
|
99
99
|
g,
|
|
100
100
|
j,
|
|
101
101
|
w,
|
|
102
|
-
b,
|
|
103
102
|
h,
|
|
104
|
-
z,
|
|
105
|
-
J,
|
|
106
103
|
v,
|
|
104
|
+
J,
|
|
105
|
+
S,
|
|
107
106
|
x,
|
|
108
107
|
I,
|
|
109
108
|
A,
|
|
110
109
|
F,
|
|
111
|
-
|
|
110
|
+
M,
|
|
112
111
|
y,
|
|
113
|
-
|
|
112
|
+
z,
|
|
114
113
|
q,
|
|
115
114
|
B,
|
|
116
115
|
C,
|
|
117
116
|
D,
|
|
117
|
+
E,
|
|
118
118
|
);
|
|
119
119
|
else if (o === dt.sE)
|
|
120
120
|
G = new SlideUpMessage(
|
|
@@ -133,22 +133,22 @@ export function newInAppMessageFromJson(e) {
|
|
|
133
133
|
g,
|
|
134
134
|
j,
|
|
135
135
|
w,
|
|
136
|
-
b,
|
|
137
136
|
h,
|
|
138
|
-
|
|
137
|
+
v,
|
|
139
138
|
J,
|
|
140
139
|
S,
|
|
141
140
|
q,
|
|
142
141
|
B,
|
|
143
142
|
C,
|
|
144
143
|
D,
|
|
144
|
+
E,
|
|
145
145
|
);
|
|
146
146
|
else {
|
|
147
147
|
if (o !== dt.iE && o !== dt.PE && o !== dt.nE)
|
|
148
|
-
return void
|
|
148
|
+
return void b.error("Ignoring message with unknown type " + o);
|
|
149
149
|
{
|
|
150
150
|
const o = e.message_fields;
|
|
151
|
-
(G = new HtmlMessage(s, r, m, p, u,
|
|
151
|
+
(G = new HtmlMessage(s, r, m, p, u, J, S, F, q, B, o, C)),
|
|
152
152
|
(G.trusted = e.trusted || !1);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -8,7 +8,7 @@ import v from "../common/event-logger.js";
|
|
|
8
8
|
import { newInAppMessageFromJson as pt } from "./in-app-message-factory.js";
|
|
9
9
|
import { randomInclusive as a } from "../util/math.js";
|
|
10
10
|
import L from "../models/request-result.js";
|
|
11
|
-
import { logger as
|
|
11
|
+
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
12
12
|
import f from "../managers/subscription-manager.js";
|
|
13
13
|
import gt from "../triggers/models/trigger.js";
|
|
14
14
|
import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
|
|
@@ -27,48 +27,48 @@ import { IamClickAction as Le, IamServerTypes as dt } from "./constants.js";
|
|
|
27
27
|
export default class ea {
|
|
28
28
|
constructor(t, e, s, i) {
|
|
29
29
|
(this.B = t),
|
|
30
|
-
(this.
|
|
31
|
-
(this.
|
|
30
|
+
(this.C = e),
|
|
31
|
+
(this.j = s),
|
|
32
32
|
(this.Ss = i),
|
|
33
33
|
(this.B = t),
|
|
34
|
-
(this.
|
|
35
|
-
(this.
|
|
34
|
+
(this.C = e),
|
|
35
|
+
(this.j = s),
|
|
36
36
|
(this.Ss = i),
|
|
37
37
|
(this.In = new f()),
|
|
38
38
|
r.S(this.In),
|
|
39
|
-
(this.
|
|
40
|
-
(this.
|
|
39
|
+
(this.An = 1e3),
|
|
40
|
+
(this.Dn = 6e4),
|
|
41
|
+
(this._n = null),
|
|
41
42
|
(this.qn = null),
|
|
42
|
-
(this.
|
|
43
|
-
(this.En = null);
|
|
43
|
+
(this.xn = null);
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
Pn() {
|
|
46
46
|
return this.In;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
return this.In.
|
|
48
|
+
En(t) {
|
|
49
|
+
return this.In.Ut(t);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
return this.
|
|
51
|
+
Gn() {
|
|
52
|
+
return this._n;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
this.
|
|
54
|
+
Nn(t) {
|
|
55
|
+
this._n = t;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
Dt(t, e, s, i) {
|
|
58
58
|
const r = new L();
|
|
59
59
|
let n;
|
|
60
|
-
if (e === p.
|
|
61
|
-
if (!t.
|
|
60
|
+
if (e === p.Fn || t instanceof ControlMessage) {
|
|
61
|
+
if (!t.js())
|
|
62
62
|
return (
|
|
63
|
-
|
|
63
|
+
b.info(
|
|
64
64
|
"This in-app message has already received an impression. Ignoring analytics event.",
|
|
65
65
|
),
|
|
66
66
|
r
|
|
67
67
|
);
|
|
68
|
-
} else if (e === p.
|
|
69
|
-
if (!t.
|
|
68
|
+
} else if (e === p.On || (t instanceof HtmlMessage && e === p.Xn)) {
|
|
69
|
+
if (!t.Yt(i))
|
|
70
70
|
return (
|
|
71
|
-
|
|
71
|
+
b.info(
|
|
72
72
|
"This in-app message has already received a click. Ignoring analytics event.",
|
|
73
73
|
),
|
|
74
74
|
r
|
|
@@ -78,51 +78,51 @@ export default class ea {
|
|
|
78
78
|
(n =
|
|
79
79
|
t instanceof ControlMessage
|
|
80
80
|
? { trigger_ids: [t.triggerId] }
|
|
81
|
-
: this.
|
|
81
|
+
: this.Hn(t)),
|
|
82
82
|
null == n
|
|
83
83
|
? r
|
|
84
84
|
: (t.messageExtras && (n.message_extras = t.messageExtras),
|
|
85
85
|
null != s && (n.bid = s),
|
|
86
|
-
v.
|
|
86
|
+
v.Dt(e, n))
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
Jn(t, e) {
|
|
90
90
|
const s = new L();
|
|
91
|
-
if (!t.
|
|
91
|
+
if (!t.Yt())
|
|
92
92
|
return (
|
|
93
|
-
|
|
93
|
+
b.info(
|
|
94
94
|
"This in-app message button has already received a click. Ignoring analytics event.",
|
|
95
95
|
),
|
|
96
96
|
s
|
|
97
97
|
);
|
|
98
|
-
const i = this.
|
|
98
|
+
const i = this.Hn(e);
|
|
99
99
|
return null == i
|
|
100
100
|
? s
|
|
101
|
-
: t.id === InAppMessageButton.
|
|
102
|
-
? (
|
|
101
|
+
: t.id === InAppMessageButton.Kn
|
|
102
|
+
? (b.info(
|
|
103
103
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers.",
|
|
104
104
|
),
|
|
105
105
|
s)
|
|
106
|
-
: (null != t.id && (i.bid = t.id), v.
|
|
106
|
+
: (null != t.id && (i.bid = t.id), v.Dt(p.Xn, i));
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
Ln(t) {
|
|
109
109
|
const e = t.messageFields;
|
|
110
110
|
return (null != e && e.is_push_primer) || !1;
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
Qn(t) {
|
|
113
113
|
if (!(t instanceof InAppMessage)) return;
|
|
114
114
|
const e = (t) => {
|
|
115
115
|
if (!t) return;
|
|
116
116
|
const e = eo(t);
|
|
117
|
-
if (vt(e)) return yt(bt.
|
|
117
|
+
if (vt(e)) return yt(bt.Un, "In-App Message");
|
|
118
118
|
if (jt(e)) {
|
|
119
|
-
const t = It.
|
|
120
|
-
if (!t.
|
|
119
|
+
const t = It.Vn();
|
|
120
|
+
if (!t.Wn) return It.Yn(t.reason, "In-App Message");
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
if (this.
|
|
124
|
-
const t = It.
|
|
125
|
-
if (!t.
|
|
123
|
+
if (this.Ln(t)) {
|
|
124
|
+
const t = It.Vn();
|
|
125
|
+
if (!t.Wn) return It.Yn(t.reason, "In-App Message");
|
|
126
126
|
}
|
|
127
127
|
const s = t.buttons || [];
|
|
128
128
|
let i;
|
|
@@ -138,29 +138,29 @@ export default class ea {
|
|
|
138
138
|
? e(t.uri)
|
|
139
139
|
: void 0;
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
e !== this.
|
|
141
|
+
Zn(t, e) {
|
|
142
|
+
e !== this.xn && this._o(), (this.qn = t), (this.xn = e);
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
null != this.
|
|
146
|
-
(clearTimeout(this.
|
|
144
|
+
_o() {
|
|
145
|
+
null != this.qn &&
|
|
146
|
+
(clearTimeout(this.qn), (this.qn = null), (this.xn = null));
|
|
147
147
|
}
|
|
148
|
-
|
|
148
|
+
Xo(t, e, s, i) {
|
|
149
149
|
const r = this.B;
|
|
150
150
|
if (!r) return;
|
|
151
|
-
this.
|
|
152
|
-
const n = r.
|
|
151
|
+
this.xn && t.triggerId !== this.xn && (this._o(), h.Ji(this.j, h.it.Yo));
|
|
152
|
+
const n = r.Zo(!1),
|
|
153
153
|
o = r.Z(n);
|
|
154
154
|
(o.template = { trigger_id: t.triggerId, trigger_event_type: e }),
|
|
155
|
-
null != s && (o.template.data = s.
|
|
156
|
-
const u = r.tt(o, h.it.
|
|
155
|
+
null != s && (o.template.data = s.ta());
|
|
156
|
+
const u = r.tt(o, h.it.Yo);
|
|
157
157
|
r.et(
|
|
158
158
|
o,
|
|
159
159
|
(r = -1) => {
|
|
160
160
|
const n = this.B;
|
|
161
161
|
if (!n) return;
|
|
162
162
|
const m = new Date().valueOf();
|
|
163
|
-
h.nt(this.
|
|
163
|
+
h.nt(this.j, h.it.Yo, m),
|
|
164
164
|
-1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
|
|
165
165
|
let c,
|
|
166
166
|
p,
|
|
@@ -171,16 +171,16 @@ export default class ea {
|
|
|
171
171
|
headers: u,
|
|
172
172
|
lt: (e) => {
|
|
173
173
|
if (!n.ut(o, e, u))
|
|
174
|
-
return void ("function" == typeof t.
|
|
174
|
+
return void ("function" == typeof t.ia && t.ia());
|
|
175
175
|
if ((n.ct(), null == e || null == e.templated_message)) return;
|
|
176
176
|
const s = e.templated_message;
|
|
177
|
-
if (s.type !== gt.
|
|
177
|
+
if (s.type !== gt.la.oa) return;
|
|
178
178
|
const i = pt(s.data);
|
|
179
179
|
if (null == i) return;
|
|
180
|
-
const r = this.
|
|
180
|
+
const r = this.Qn(i);
|
|
181
181
|
if (r)
|
|
182
|
-
return
|
|
183
|
-
"function" == typeof t.
|
|
182
|
+
return b.error(r), void ("function" == typeof t.ia && t.ia());
|
|
183
|
+
"function" == typeof t.ua && t.ua(i);
|
|
184
184
|
},
|
|
185
185
|
error: (e) => {
|
|
186
186
|
(f = !0),
|
|
@@ -188,21 +188,21 @@ export default class ea {
|
|
|
188
188
|
(p = `getting user personalization for message ${t.triggerId}.`);
|
|
189
189
|
},
|
|
190
190
|
ft: (r, o) => {
|
|
191
|
-
if (new Date().valueOf() - t.
|
|
191
|
+
if (new Date().valueOf() - t.ma < t.ca) {
|
|
192
192
|
let r = 0;
|
|
193
193
|
if (f) {
|
|
194
|
-
const e = Math.min(t.
|
|
195
|
-
s = this.
|
|
194
|
+
const e = Math.min(t.ca, this.Dn),
|
|
195
|
+
s = this.An;
|
|
196
196
|
null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
|
|
197
197
|
}
|
|
198
198
|
n.yt(
|
|
199
199
|
o,
|
|
200
200
|
() => {
|
|
201
|
-
this.
|
|
201
|
+
this.Xo(t, e, s, r);
|
|
202
202
|
},
|
|
203
|
-
h.it.
|
|
204
|
-
(e) => this.
|
|
205
|
-
() => this.
|
|
203
|
+
h.it.Yo,
|
|
204
|
+
(e) => this.Zn(e, t.triggerId),
|
|
205
|
+
() => this._o(),
|
|
206
206
|
r,
|
|
207
207
|
);
|
|
208
208
|
}
|
|
@@ -210,13 +210,13 @@ export default class ea {
|
|
|
210
210
|
},
|
|
211
211
|
});
|
|
212
212
|
},
|
|
213
|
-
h.it.
|
|
213
|
+
h.it.Yo,
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
Hn(t) {
|
|
217
217
|
if (null == t.triggerId)
|
|
218
218
|
return (
|
|
219
|
-
|
|
219
|
+
b.info(
|
|
220
220
|
"The in-app message has no analytics id. Not logging event to Braze servers.",
|
|
221
221
|
),
|
|
222
222
|
null
|
|
@@ -224,40 +224,40 @@ export default class ea {
|
|
|
224
224
|
const e = {};
|
|
225
225
|
return null != t.triggerId && (e.trigger_ids = [t.triggerId]), e;
|
|
226
226
|
}
|
|
227
|
-
|
|
227
|
+
jn(t) {
|
|
228
228
|
return (
|
|
229
|
-
!!this.
|
|
229
|
+
!!this.j &&
|
|
230
230
|
!(
|
|
231
231
|
!(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
|
|
232
232
|
t instanceof ControlMessage
|
|
233
233
|
) &&
|
|
234
|
-
this.
|
|
234
|
+
this.j.Pt(s.It.pa, t.qt())
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
237
|
sa() {
|
|
238
|
-
if (!this.
|
|
239
|
-
const t = this.
|
|
238
|
+
if (!this.j) return null;
|
|
239
|
+
const t = this.j.St(s.It.pa);
|
|
240
240
|
if (!t) return null;
|
|
241
241
|
let e;
|
|
242
242
|
switch (t.type) {
|
|
243
243
|
case dt.cE:
|
|
244
|
-
e = FullScreenMessage.
|
|
244
|
+
e = FullScreenMessage.ha(t);
|
|
245
245
|
break;
|
|
246
246
|
case dt.iE:
|
|
247
247
|
case dt.PE:
|
|
248
248
|
case dt.nE:
|
|
249
|
-
e = HtmlMessage.
|
|
249
|
+
e = HtmlMessage.ha(t);
|
|
250
250
|
break;
|
|
251
251
|
case dt.aE:
|
|
252
252
|
case dt.UE:
|
|
253
|
-
e = ModalMessage.
|
|
253
|
+
e = ModalMessage.ha(t);
|
|
254
254
|
break;
|
|
255
255
|
case dt.sE:
|
|
256
|
-
e = SlideUpMessage.
|
|
256
|
+
e = SlideUpMessage.ha(t);
|
|
257
257
|
}
|
|
258
|
-
return e && this.
|
|
258
|
+
return e && this.fa(), e;
|
|
259
259
|
}
|
|
260
|
-
|
|
261
|
-
this.
|
|
260
|
+
fa() {
|
|
261
|
+
this.j && this.j.Vt(s.It.pa);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
@@ -3,16 +3,16 @@ import { IamStrings as mr } 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
5
|
import je from "./in-app-message-manager-factory.js";
|
|
6
|
-
import { logger as
|
|
6
|
+
import { logger as b } from "../../shared-lib/index.js";
|
|
7
7
|
import ot from "../triggers/models/trigger-events.js";
|
|
8
8
|
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
9
9
|
export function logInAppMessageButtonClick(t, o) {
|
|
10
10
|
var e;
|
|
11
11
|
if (!r.rr()) return !1;
|
|
12
12
|
if (!(t instanceof InAppMessageButton))
|
|
13
|
-
return
|
|
14
|
-
if (!(o instanceof InAppMessage)) return
|
|
15
|
-
const s = je.ra().
|
|
13
|
+
return b.error("button must be an InAppMessageButton object"), !1;
|
|
14
|
+
if (!(o instanceof InAppMessage)) return b.error(mr.EE), !1;
|
|
15
|
+
const s = je.ra().Jn(t, o);
|
|
16
16
|
if (s.lt)
|
|
17
17
|
for (let r = 0; r < s.Ce.length; r++)
|
|
18
18
|
rt.o().Ee(
|
|
@@ -3,13 +3,13 @@ import InAppMessage from "./models/in-app-message.js";
|
|
|
3
3
|
import je from "./in-app-message-manager-factory.js";
|
|
4
4
|
import { logInAppMessageImpression } from "./log-in-app-message-impression.js";
|
|
5
5
|
import { IamStrings as mr } from "./constants.js";
|
|
6
|
-
import { logger as
|
|
6
|
+
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
7
7
|
import ot from "../triggers/models/trigger-events.js";
|
|
8
8
|
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
9
9
|
export function logInAppMessageClick(s) {
|
|
10
10
|
if (!r.rr()) return !1;
|
|
11
|
-
if (!(s instanceof InAppMessage)) return
|
|
12
|
-
const e = je.ra().
|
|
11
|
+
if (!(s instanceof InAppMessage)) return b.error(mr.EE), !1;
|
|
12
|
+
const e = je.ra().Dt(s, p.On);
|
|
13
13
|
if (e) {
|
|
14
14
|
s.sm() || logInAppMessageImpression(s);
|
|
15
15
|
for (let r = 0; r < e.Ce.length; r++)
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import HtmlMessage from "./models/html-message.js";
|
|
3
3
|
import je from "./in-app-message-manager-factory.js";
|
|
4
|
-
import { logger as
|
|
4
|
+
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
5
5
|
import ot from "../triggers/models/trigger-events.js";
|
|
6
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))
|
|
10
10
|
return (
|
|
11
|
-
|
|
11
|
+
b.error(
|
|
12
12
|
"inAppMessage argument to logInAppMessageHtmlClick must be an HtmlMessage object.",
|
|
13
13
|
),
|
|
14
14
|
!1
|
|
15
15
|
);
|
|
16
|
-
let o = p.
|
|
17
|
-
null != t && (o = p.
|
|
18
|
-
const m = je.ra().
|
|
16
|
+
let o = p.On;
|
|
17
|
+
null != t && (o = p.Xn);
|
|
18
|
+
const m = je.ra().Dt(e, o, t, s);
|
|
19
19
|
if (m.lt)
|
|
20
20
|
for (let r = 0; r < m.Ce.length; r++)
|
|
21
21
|
rt.o().Ee(ot.rm, [e.triggerId, t], m.Ce[r]);
|
|
@@ -3,11 +3,11 @@ import ControlMessage from "./models/control-message.js";
|
|
|
3
3
|
import InAppMessage from "./models/in-app-message.js";
|
|
4
4
|
import je from "./in-app-message-manager-factory.js";
|
|
5
5
|
import { IamStrings as mr } from "./constants.js";
|
|
6
|
-
import { logger as
|
|
6
|
+
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
7
7
|
export function logInAppMessageImpression(s) {
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
9
|
if (!(s instanceof InAppMessage || s instanceof ControlMessage))
|
|
10
|
-
return
|
|
11
|
-
const o = s instanceof ControlMessage ? p.om : p.
|
|
12
|
-
return je.ra().
|
|
10
|
+
return b.error(mr.EE), !1;
|
|
11
|
+
const o = s instanceof ControlMessage ? p.om : p.Fn;
|
|
12
|
+
return je.ra().Dt(s, o).lt;
|
|
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.hs = !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
|
+
js() {
|
|
15
|
+
return !this.hs && ((this.hs = !0), !0);
|
|
16
16
|
}
|
|
17
17
|
sm() {
|
|
18
|
-
return this.
|
|
18
|
+
return this.hs;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -83,11 +83,11 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
83
83
|
qt() {
|
|
84
84
|
return super.qt(dt.cE);
|
|
85
85
|
}
|
|
86
|
-
static
|
|
86
|
+
static ha(r) {
|
|
87
87
|
return new FullScreenMessage(
|
|
88
88
|
r[cr.rE],
|
|
89
89
|
r[cr.mE],
|
|
90
|
-
r[cr.
|
|
90
|
+
r[cr.Is],
|
|
91
91
|
r[cr.FE],
|
|
92
92
|
r[cr.HE],
|
|
93
93
|
r[cr.URI],
|
|
@@ -95,7 +95,7 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
95
95
|
r[cr.BE],
|
|
96
96
|
r[cr.lE],
|
|
97
97
|
r[cr.bE],
|
|
98
|
-
r[cr.
|
|
98
|
+
r[cr.Bs],
|
|
99
99
|
r[cr.gE],
|
|
100
100
|
r[cr.YE],
|
|
101
101
|
r[cr.KE],
|
|
@@ -115,7 +115,7 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
115
115
|
r[cr.CSS],
|
|
116
116
|
r[cr.JE],
|
|
117
117
|
r[cr.LANGUAGE],
|
|
118
|
-
r[cr.
|
|
118
|
+
r[cr.Ns],
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|