@braze/web-sdk 5.7.0 → 5.8.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 +4 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +8 -8
- package/shared-lib/indexed-db-adapter.js +7 -7
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +17 -17
- package/src/Banner/get-all-banners.js +2 -3
- package/src/Banner/get-banner.js +11 -11
- package/src/Banner/request-banners-refresh.js +20 -12
- package/src/Banner/subscribe-to-banners-updates.js +14 -13
- package/src/Banner/ui/insert-banner.js +11 -9
- package/src/Card/log-card-impressions.js +2 -2
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards.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/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/is-disabled.js +1 -1
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +1 -1
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +17 -17
- package/src/FeatureFlags/feature-flags-provider.js +37 -37
- package/src/FeatureFlags/get-all-feature-flags.js +6 -7
- package/src/FeatureFlags/get-feature-flag.js +5 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed.js +2 -2
- package/src/Feed/ui/show-feed.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +18 -18
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +49 -49
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +3 -3
- package/src/InAppMessage/models/html-message.js +5 -5
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +32 -32
- package/src/InAppMessage/models/modal-message.js +3 -3
- package/src/InAppMessage/models/slide-up-message.js +6 -6
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +18 -18
- package/src/Push/push-manager-factory.js +8 -8
- package/src/Push/push-manager.js +83 -83
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +6 -6
- package/src/User/user.js +18 -18
- package/src/common/base-feed.js +3 -3
- package/src/common/event-logger.js +1 -1
- package/src/common/feed-display.js +8 -8
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/braze-instance.js +107 -107
- package/src/managers/device-manager.js +18 -18
- package/src/managers/network-manager.js +117 -117
- package/src/managers/server-config-manager.js +61 -61
- package/src/managers/session-manager.js +25 -25
- package/src/managers/storage-manager-factory.js +8 -8
- package/src/managers/storage-manager.js +57 -57
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +2 -2
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +10 -10
- package/src/models/push-token.js +7 -7
- package/src/models/server-config.js +30 -30
- package/src/request-controller.js +93 -93
- package/src/triggers/models/filter-set.js +4 -4
- package/src/triggers/models/filter.js +1 -1
- package/src/triggers/models/trigger-condition.js +29 -29
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +9 -9
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +15 -15
- 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 +3 -3
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +13 -13
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +4 -4
- package/src/util/window-utils.js +1 -1
|
@@ -15,30 +15,30 @@ export default class FeatureFlag {
|
|
|
15
15
|
return null == i ? (this.ye(t), null) : e(i) ? i.value : (this.Pe(r), null);
|
|
16
16
|
}
|
|
17
17
|
getStringProperty(t) {
|
|
18
|
-
return this.he(t, this.
|
|
18
|
+
return this.he(t, this.Ie, "string");
|
|
19
19
|
}
|
|
20
20
|
getNumberProperty(t) {
|
|
21
|
-
return this.he(t, this.
|
|
21
|
+
return this.he(t, this.Te, "number");
|
|
22
22
|
}
|
|
23
23
|
getBooleanProperty(t) {
|
|
24
|
-
return this.he(t, this.
|
|
24
|
+
return this.he(t, this.Ee, "boolean");
|
|
25
25
|
}
|
|
26
26
|
getImageProperty(t) {
|
|
27
|
-
return this.he(t, this.
|
|
27
|
+
return this.he(t, this.Ne, "image");
|
|
28
28
|
}
|
|
29
29
|
getJsonProperty(t) {
|
|
30
|
-
return this.he(t, this.
|
|
30
|
+
return this.he(t, this.Re, "jsonobject");
|
|
31
31
|
}
|
|
32
32
|
getTimestampProperty(t) {
|
|
33
|
-
return this.he(t, this.
|
|
33
|
+
return this.he(t, this.je, "datetime");
|
|
34
34
|
}
|
|
35
35
|
bs() {
|
|
36
36
|
const t = {};
|
|
37
37
|
return (
|
|
38
38
|
(t[FeatureFlag.qt.Et] = this.id),
|
|
39
|
-
(t[FeatureFlag.qt.
|
|
40
|
-
(t[FeatureFlag.qt.
|
|
41
|
-
(t[FeatureFlag.qt.
|
|
39
|
+
(t[FeatureFlag.qt.pe] = this.enabled),
|
|
40
|
+
(t[FeatureFlag.qt.Fe] = this.properties),
|
|
41
|
+
(t[FeatureFlag.qt.be] = this.trackingString),
|
|
42
42
|
t
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -48,28 +48,28 @@ export default class FeatureFlag {
|
|
|
48
48
|
ye(t) {
|
|
49
49
|
N.info(`${t} not found in feature flag properties.`);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
Ie(t) {
|
|
52
52
|
return "string" === t.type && "string" == typeof t.value;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
Te(t) {
|
|
55
55
|
return "number" === t.type && "number" == typeof t.value;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
Ee(t) {
|
|
58
58
|
return "boolean" === t.type && "boolean" == typeof t.value;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
Ne(t) {
|
|
61
61
|
return "image" === t.type && "string" == typeof t.value;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
Re(t) {
|
|
64
64
|
return (
|
|
65
65
|
"jsonobject" === t.type &&
|
|
66
66
|
"object" == typeof t.value &&
|
|
67
67
|
t.value.constructor == Object
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
je(t) {
|
|
71
71
|
return "datetime" === t.type && "number" == typeof t.value;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
(FeatureFlag.qt = { Et: "id",
|
|
75
|
-
(FeatureFlag.li = { Et: "id",
|
|
74
|
+
(FeatureFlag.qt = { Et: "id", pe: "e", Fe: "pr", be: "fts" }),
|
|
75
|
+
(FeatureFlag.li = { Et: "id", pe: "enabled", Fe: "properties", be: "fts" });
|
|
@@ -17,37 +17,37 @@ export default class tr extends s {
|
|
|
17
17
|
(this.S = s),
|
|
18
18
|
(this.C = e),
|
|
19
19
|
(this.T = i),
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
20
|
+
(this.we = []),
|
|
21
|
+
(this.Ce = 0),
|
|
22
22
|
(this.B = t),
|
|
23
23
|
(this.S = s),
|
|
24
24
|
(this.C = e),
|
|
25
25
|
(this.T = i),
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
26
|
+
(this.De = null),
|
|
27
|
+
(this.Se = new u()),
|
|
28
28
|
(this.R = 10),
|
|
29
29
|
(this.I = null),
|
|
30
30
|
(this.q = null),
|
|
31
|
-
r.N(this.
|
|
31
|
+
r.N(this.Se);
|
|
32
32
|
}
|
|
33
33
|
U(t) {
|
|
34
34
|
var s;
|
|
35
35
|
if (
|
|
36
|
-
(null === (s = this.B) || void 0 === s ? void 0 : s.
|
|
36
|
+
(null === (s = this.B) || void 0 === s ? void 0 : s.qe()) &&
|
|
37
37
|
null != t &&
|
|
38
38
|
t.feature_flags
|
|
39
39
|
) {
|
|
40
|
-
this.
|
|
40
|
+
this.we = [];
|
|
41
41
|
for (const s of t.feature_flags) {
|
|
42
42
|
const t = st(s);
|
|
43
|
-
t && this.
|
|
43
|
+
t && this.we.push(t);
|
|
44
44
|
}
|
|
45
|
-
(this.
|
|
45
|
+
(this.Ce = new Date().getTime()), this.xe(), this.Se.X(this.we);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
ze() {
|
|
49
49
|
let s = {};
|
|
50
|
-
this.C && (s = this.C.vs(t.gs
|
|
50
|
+
this.C && (s = this.C.vs(t.gs.$e));
|
|
51
51
|
const e = {};
|
|
52
52
|
for (const t in s) {
|
|
53
53
|
const i = ht(s[t]);
|
|
@@ -55,27 +55,27 @@ export default class tr extends s {
|
|
|
55
55
|
}
|
|
56
56
|
return e;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
ke() {
|
|
59
59
|
var s;
|
|
60
60
|
return (
|
|
61
|
-
(null === (s = this.C) || void 0 === s ? void 0 : s.vs(t.gs
|
|
61
|
+
(null === (s = this.C) || void 0 === s ? void 0 : s.vs(t.gs.Be)) || {}
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
this.C && this.C.Bs(t.gs
|
|
64
|
+
Me(s) {
|
|
65
|
+
this.C && this.C.Bs(t.gs.Be, s);
|
|
66
66
|
}
|
|
67
67
|
qs(t) {
|
|
68
|
-
return this.
|
|
68
|
+
return this.Se.Fs(t);
|
|
69
69
|
}
|
|
70
70
|
refreshFeatureFlags(t, s, e = !1, i = !0) {
|
|
71
71
|
const r = () => {
|
|
72
|
-
"function" == typeof s && s(), this.
|
|
72
|
+
"function" == typeof s && s(), this.Se.X(this.we);
|
|
73
73
|
};
|
|
74
|
-
if (!this.
|
|
74
|
+
if (!this.Ue(e))
|
|
75
75
|
return (
|
|
76
|
-
!this.
|
|
76
|
+
!this.De &&
|
|
77
77
|
this.B &&
|
|
78
|
-
(this.
|
|
78
|
+
(this.De = this.B.Xe(() => {
|
|
79
79
|
this.refreshFeatureFlags(t, s);
|
|
80
80
|
})),
|
|
81
81
|
void r()
|
|
@@ -84,7 +84,7 @@ export default class tr extends s {
|
|
|
84
84
|
if (!o) return void r();
|
|
85
85
|
i && this.G();
|
|
86
86
|
const n = o.H({}, !0),
|
|
87
|
-
u = o.J(n, h.O.
|
|
87
|
+
u = o.J(n, h.O._e);
|
|
88
88
|
let f = !1;
|
|
89
89
|
o.V(
|
|
90
90
|
n,
|
|
@@ -92,7 +92,7 @@ export default class tr extends s {
|
|
|
92
92
|
const o = this.S;
|
|
93
93
|
if (!o) return void r();
|
|
94
94
|
const c = new Date().valueOf();
|
|
95
|
-
h.W(this.C, h.O.
|
|
95
|
+
h.W(this.C, h.O._e, c),
|
|
96
96
|
-1 !== i && u.push(["X-Braze-Req-Tokens-Remaining", i.toString()]),
|
|
97
97
|
l.Y({
|
|
98
98
|
url: `${o.Z()}/feature_flags/sync`,
|
|
@@ -117,7 +117,7 @@ export default class tr extends s {
|
|
|
117
117
|
() => {
|
|
118
118
|
this.refreshFeatureFlags(t, s, e, !0);
|
|
119
119
|
},
|
|
120
|
-
h.O.
|
|
120
|
+
h.O._e,
|
|
121
121
|
(t) => this.hs(t),
|
|
122
122
|
() => this.G(),
|
|
123
123
|
n,
|
|
@@ -125,7 +125,7 @@ export default class tr extends s {
|
|
|
125
125
|
},
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
|
-
h.O.
|
|
128
|
+
h.O._e,
|
|
129
129
|
s,
|
|
130
130
|
);
|
|
131
131
|
}
|
|
@@ -135,48 +135,48 @@ export default class tr extends s {
|
|
|
135
135
|
hs(t) {
|
|
136
136
|
this.G(), (this.q = t);
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
Ue(t) {
|
|
139
139
|
if (!this.B) return !1;
|
|
140
140
|
if (!t) {
|
|
141
|
-
const t = this.B.
|
|
141
|
+
const t = this.B.Ae();
|
|
142
142
|
if (null == t) return !1;
|
|
143
143
|
let s = !1;
|
|
144
144
|
if (!isNaN(t)) {
|
|
145
145
|
if (-1 === t) return N.info("Feature flag refreshes not allowed"), !1;
|
|
146
|
-
s = new Date().getTime() >= (this.
|
|
146
|
+
s = new Date().getTime() >= (this.Ce || 0) + 1e3 * t;
|
|
147
147
|
}
|
|
148
148
|
if (!s)
|
|
149
149
|
return (
|
|
150
150
|
N.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
|
-
return this.B.
|
|
153
|
+
return this.B.qe();
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
Ge() {
|
|
156
156
|
var s;
|
|
157
157
|
return (
|
|
158
|
-
(null === (s = this.C) || void 0 === s ? void 0 : s.vs(t.gs.
|
|
158
|
+
(null === (s = this.C) || void 0 === s ? void 0 : s.vs(t.gs.He)) || null
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
Je() {
|
|
162
162
|
var s, e;
|
|
163
163
|
null === (s = this.C) ||
|
|
164
164
|
void 0 === s ||
|
|
165
|
-
s.Bs(t.gs.
|
|
165
|
+
s.Bs(t.gs.He, null === (e = this.T) || void 0 === e ? void 0 : e.Ss());
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
Ke() {
|
|
168
168
|
var t;
|
|
169
169
|
const s = null === (t = this.T) || void 0 === t ? void 0 : t.Ss(),
|
|
170
|
-
e = this.
|
|
170
|
+
e = this.Ge();
|
|
171
171
|
return null == e || s === e;
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
xe() {
|
|
174
174
|
if (!this.C) return;
|
|
175
175
|
const s = {};
|
|
176
|
-
for (const t of this.
|
|
176
|
+
for (const t of this.we) {
|
|
177
177
|
const e = t.bs();
|
|
178
178
|
s[t.id] = e;
|
|
179
179
|
}
|
|
180
|
-
this.C.Bs(t.gs
|
|
180
|
+
this.C.Bs(t.gs.$e, s), this.C.Bs(t.gs.Le, this.Ce), this.Je();
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { logger as N } from "../../shared-lib/index.js";
|
|
2
1
|
import r from "../managers/braze-instance.js";
|
|
3
2
|
import nr from "./feature-flags-provider-factory.js";
|
|
4
3
|
export function getAllFeatureFlags() {
|
|
5
4
|
if (!r.rr()) return;
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
const n = nr.m().
|
|
10
|
-
for (const r in n)
|
|
11
|
-
return
|
|
5
|
+
const t = [],
|
|
6
|
+
e = r.v();
|
|
7
|
+
if (e && !e.qe()) return t;
|
|
8
|
+
const n = nr.m().ze();
|
|
9
|
+
for (const r in n) t.push(n[r]);
|
|
10
|
+
return t;
|
|
12
11
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { logger as N } from "../../shared-lib/index.js";
|
|
2
1
|
import r from "../managers/braze-instance.js";
|
|
3
2
|
import nr from "./feature-flags-provider-factory.js";
|
|
4
|
-
export function getFeatureFlag(
|
|
3
|
+
export function getFeatureFlag(t) {
|
|
5
4
|
if (!r.rr()) return;
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
const n = nr.m().
|
|
9
|
-
return n[
|
|
5
|
+
const e = r.v();
|
|
6
|
+
if (e && !e.qe()) return null;
|
|
7
|
+
const n = nr.m().ze();
|
|
8
|
+
return n[t] ? n[t] : null;
|
|
10
9
|
}
|
|
@@ -7,11 +7,11 @@ export function logFeatureFlagImpression(e) {
|
|
|
7
7
|
if (!e) return !1;
|
|
8
8
|
const t =
|
|
9
9
|
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
|
|
10
|
-
o = nr.m().
|
|
10
|
+
o = nr.m().ze();
|
|
11
11
|
if (!o[e]) return N.info(t), !1;
|
|
12
12
|
const n = o[e].trackingString;
|
|
13
13
|
if (!n) return N.info(t), !1;
|
|
14
|
-
const i = nr.m().
|
|
14
|
+
const i = nr.m().ke();
|
|
15
15
|
if (i[n])
|
|
16
16
|
return (
|
|
17
17
|
N.info(
|
|
@@ -19,7 +19,7 @@ export function logFeatureFlagImpression(e) {
|
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
(i[n] = !0), nr.m().
|
|
22
|
+
(i[n] = !0), nr.m().Me(i);
|
|
23
23
|
const s = { fid: e, fts: n };
|
|
24
24
|
return c.cs(d.yr, s).ss;
|
|
25
25
|
}
|
|
@@ -4,7 +4,7 @@ import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
|
4
4
|
export function subscribeToFeatureFlagsUpdates(t) {
|
|
5
5
|
if (!r.rr()) return;
|
|
6
6
|
const e = nr.m();
|
|
7
|
-
if (e.
|
|
7
|
+
if (e.Ke()) {
|
|
8
8
|
const r = getAllFeatureFlags();
|
|
9
9
|
r && "function" == typeof t && t(r);
|
|
10
10
|
}
|
package/src/Feed/feed.js
CHANGED
package/src/Feed/ui/show-feed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as w } from "../../managers/braze-instance.js";
|
|
2
2
|
import {
|
|
3
3
|
destroyFeedHtml as ee,
|
|
4
4
|
detectFeedImpressions as nn,
|
|
@@ -30,7 +30,7 @@ export function showFeed(e, t, n) {
|
|
|
30
30
|
}
|
|
31
31
|
return o;
|
|
32
32
|
},
|
|
33
|
-
i = r.
|
|
33
|
+
i = r.ee(w.tn) || r.ee(w.en) || !1;
|
|
34
34
|
let s = !1;
|
|
35
35
|
null == e && ((e = document.body), (s = !0));
|
|
36
36
|
let l,
|
|
@@ -43,9 +43,9 @@ export function showFeed(e, t, n) {
|
|
|
43
43
|
const a = tn(l, i, s);
|
|
44
44
|
if (f) {
|
|
45
45
|
(null == l.lastUpdated ||
|
|
46
|
-
new Date().valueOf() - l.lastUpdated.valueOf() > Feed.
|
|
46
|
+
new Date().valueOf() - l.lastUpdated.valueOf() > Feed.dr) &&
|
|
47
47
|
(N.info(
|
|
48
|
-
`Cached feed was older than max TTL of ${Feed.
|
|
48
|
+
`Cached feed was older than max TTL of ${Feed.dr} ms, requesting an update from the server.`,
|
|
49
49
|
),
|
|
50
50
|
on(l, a));
|
|
51
51
|
const e = new Date().valueOf(),
|
|
@@ -8,6 +8,6 @@ export function deferInAppMessage(e) {
|
|
|
8
8
|
return e instanceof ControlMessage
|
|
9
9
|
? (N.info("Not deferring since this is a ControlMessage."), !1)
|
|
10
10
|
: e instanceof InAppMessage
|
|
11
|
-
? se.ea().
|
|
11
|
+
? se.ea().Oe(e)
|
|
12
12
|
: (N.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -15,10 +15,10 @@ export default function ct(t, e, o, s, n, i) {
|
|
|
15
15
|
n.focus();
|
|
16
16
|
const a = n.document.getElementsByTagName("head")[0];
|
|
17
17
|
if (null != a) {
|
|
18
|
-
if (t.
|
|
18
|
+
if (t.Qe()) {
|
|
19
19
|
const e = document.createElement("style");
|
|
20
20
|
(e.innerHTML = t.css || ""),
|
|
21
|
-
(e.id = t.
|
|
21
|
+
(e.id = t.Ve() || ""),
|
|
22
22
|
null != i && e.setAttribute("nonce", i),
|
|
23
23
|
a.appendChild(e);
|
|
24
24
|
}
|
|
@@ -42,7 +42,7 @@ export default function ct(t, e, o, s, n, i) {
|
|
|
42
42
|
},
|
|
43
43
|
);
|
|
44
44
|
if (
|
|
45
|
-
((n.appboyBridge = c), (n.brazeBridge = c), t.
|
|
45
|
+
((n.appboyBridge = c), (n.brazeBridge = c), t.We !== InAppMessage.Ze.Ye)
|
|
46
46
|
) {
|
|
47
47
|
const e = n.document.getElementsByTagName("a");
|
|
48
48
|
for (let o = 0; o < e.length; o++) e[o].onclick = lt(t, l, e[o], s);
|
|
@@ -51,7 +51,7 @@ export default function ct(t, e, o, s, n, i) {
|
|
|
51
51
|
}
|
|
52
52
|
const m = n.document.body;
|
|
53
53
|
if (null != m) {
|
|
54
|
-
t.
|
|
54
|
+
t.lo() && (m.id = t.htmlId || "");
|
|
55
55
|
const e = document.createElement("hidden");
|
|
56
56
|
(e.onclick = c.closeMessage),
|
|
57
57
|
(e.className = "ab-programmatic-close-button"),
|
|
@@ -67,8 +67,8 @@ export default function ct(t, e, o, s, n, i) {
|
|
|
67
67
|
) {
|
|
68
68
|
const e = document.createElement("div");
|
|
69
69
|
return (
|
|
70
|
-
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(l), (t.
|
|
70
|
+
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(l), (t.do = e), e
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
return (t.
|
|
73
|
+
return (t.do = l), l;
|
|
74
74
|
}
|
|
@@ -17,7 +17,7 @@ import ct from "./html-message-to-html.js";
|
|
|
17
17
|
import ce from "./modal-utils.js";
|
|
18
18
|
import { logger as N, Guid as G } from "../../../shared-lib/index.js";
|
|
19
19
|
export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
20
|
-
if (((e.
|
|
20
|
+
if (((e.uo = document.activeElement), e instanceof HtmlMessage))
|
|
21
21
|
return ct(e, o, a, n, s, i);
|
|
22
22
|
const c = (function (e, o, a, t, n, s, i = document.body, m = "ltr") {
|
|
23
23
|
let l = null;
|
|
@@ -25,10 +25,10 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
25
25
|
(c.dir = m),
|
|
26
26
|
(c.className = "ab-in-app-message ab-start-hidden ab-background"),
|
|
27
27
|
s && (c.style.zIndex = (s + 1).toString()),
|
|
28
|
-
e.
|
|
28
|
+
e.bo() &&
|
|
29
29
|
((c.className += " ab-modal-interactions"),
|
|
30
30
|
c.setAttribute("tabindex", "-1")),
|
|
31
|
-
e.
|
|
31
|
+
e.Qe() ||
|
|
32
32
|
((c.style.color = le(e.textColor)),
|
|
33
33
|
(c.style.backgroundColor = le(e.backgroundColor)),
|
|
34
34
|
ae(e.backgroundColor) && (c.className += " ab-no-shadow"));
|
|
@@ -38,7 +38,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
38
38
|
document.querySelectorAll(".ab-iam-img-loading").length > 0
|
|
39
39
|
? t(
|
|
40
40
|
`Cannot show in-app message ${e.message} because another message is being shown.`,
|
|
41
|
-
InAppMessage.
|
|
41
|
+
InAppMessage.fo.po,
|
|
42
42
|
)
|
|
43
43
|
: a(c));
|
|
44
44
|
},
|
|
@@ -79,7 +79,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
79
79
|
)));
|
|
80
80
|
const u = T(
|
|
81
81
|
"Close Message",
|
|
82
|
-
e.
|
|
82
|
+
e.Qe() ? void 0 : le(e.closeButtonColor),
|
|
83
83
|
() => {
|
|
84
84
|
e.ll(c);
|
|
85
85
|
},
|
|
@@ -88,7 +88,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
88
88
|
c.appendChild(u), s && (u.style.zIndex = (s + 2).toString());
|
|
89
89
|
const b = document.createElement("div");
|
|
90
90
|
(b.className = "ab-message-text"), (b.dir = m);
|
|
91
|
-
const p = (e.messageAlignment || e.
|
|
91
|
+
const p = (e.messageAlignment || e.ho).toLowerCase();
|
|
92
92
|
b.className += " " + p + "-aligned";
|
|
93
93
|
let g = !1;
|
|
94
94
|
const f = document.createElement("div");
|
|
@@ -99,13 +99,13 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
99
99
|
(o.style.backgroundImage = "url(" + e.imageUrl + ")"),
|
|
100
100
|
o.setAttribute("role", "img"),
|
|
101
101
|
o.setAttribute("aria-label", "Modal Image"),
|
|
102
|
-
e.
|
|
102
|
+
e.jo(o),
|
|
103
103
|
f.appendChild(o);
|
|
104
104
|
} else {
|
|
105
105
|
const o = document.createElement("img");
|
|
106
106
|
if (
|
|
107
107
|
(o.setAttribute("src", e.imageUrl),
|
|
108
|
-
e.
|
|
108
|
+
e.jo(o),
|
|
109
109
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
110
110
|
) {
|
|
111
111
|
g = !0;
|
|
@@ -128,7 +128,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
128
128
|
f.className += " ab-icon-area";
|
|
129
129
|
const o = document.createElement("span");
|
|
130
130
|
(o.className = "ab-icon"),
|
|
131
|
-
e.
|
|
131
|
+
e.Qe() ||
|
|
132
132
|
((o.style.backgroundColor = le(e.iconBackgroundColor)),
|
|
133
133
|
(o.style.color = le(e.iconColor)));
|
|
134
134
|
const a = document.createElement("i");
|
|
@@ -142,23 +142,23 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
142
142
|
}
|
|
143
143
|
if ((J(b, "touchstart"), e.header && e.header.length > 0)) {
|
|
144
144
|
const o = document.createElement("h1");
|
|
145
|
-
(o.className = "ab-message-header"), (e.
|
|
145
|
+
(o.className = "ab-message-header"), (e.wo = G.Rt()), (o.id = e.wo);
|
|
146
146
|
const a = (
|
|
147
147
|
e.headerAlignment || InAppMessage.TextAlignment.CENTER
|
|
148
148
|
).toLowerCase();
|
|
149
149
|
(o.className += " " + a + "-aligned"),
|
|
150
|
-
e.
|
|
150
|
+
e.Qe() || (o.style.color = le(e.headerTextColor)),
|
|
151
151
|
o.appendChild(document.createTextNode(e.header)),
|
|
152
152
|
b.appendChild(o);
|
|
153
153
|
}
|
|
154
|
-
return b.appendChild(e.
|
|
154
|
+
return b.appendChild(e.vo()), c.appendChild(b), g || d(), (e.do = c), c;
|
|
155
155
|
})(e, o, a, t, n, s, m, l);
|
|
156
156
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
157
157
|
const a = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
158
158
|
(c.className += ` ${a} ab-centered`),
|
|
159
|
-
ce.
|
|
160
|
-
ce.
|
|
161
|
-
ce
|
|
159
|
+
ce.xo(e, o, c, n),
|
|
160
|
+
ce.Co(c),
|
|
161
|
+
ce.$o(e.wo, c);
|
|
162
162
|
} else if (e instanceof SlideUpMessage) {
|
|
163
163
|
c.className += " ab-slideup";
|
|
164
164
|
const o = c.getElementsByClassName("ab-close-button")[0];
|
|
@@ -166,7 +166,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
166
166
|
const a = oe(
|
|
167
167
|
"0 0 11.38 19.44",
|
|
168
168
|
"M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",
|
|
169
|
-
e.
|
|
169
|
+
e.Qe() ? void 0 : le(e.closeButtonColor),
|
|
170
170
|
);
|
|
171
171
|
a.setAttribute("class", `ab-chevron ${l}`), o.appendChild(a);
|
|
172
172
|
}
|
|
@@ -180,8 +180,8 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
180
180
|
null != o && null != o.onclick && o.onclick(e);
|
|
181
181
|
}),
|
|
182
182
|
e.slideFrom === InAppMessage.SlideFrom.TOP
|
|
183
|
-
? ((a = R.
|
|
184
|
-
: ((a = R
|
|
183
|
+
? ((a = R.ko), (t = " ab-swiped-up"))
|
|
184
|
+
: ((a = R.Mo), (t = " ab-swiped-down")),
|
|
185
185
|
H(c, a, (e) => {
|
|
186
186
|
(c.className += t), null != o && null != o.onclick && o.onclick(e);
|
|
187
187
|
});
|
|
@@ -5,7 +5,7 @@ import { toRgba as le } from "../../util/color-utils.js";
|
|
|
5
5
|
import { addPassiveEventListener as J } from "../../util/dom-utils.js";
|
|
6
6
|
import { KeyCodes as mt } from "../../util/key-codes.js";
|
|
7
7
|
const ce = {
|
|
8
|
-
|
|
8
|
+
Co: (t) => {
|
|
9
9
|
const o = t.querySelectorAll(
|
|
10
10
|
".ab-close-button, .ab-message-text, .ab-message-button",
|
|
11
11
|
);
|
|
@@ -25,13 +25,13 @@ const ce = {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
$o: (t, o) => {
|
|
29
29
|
o.setAttribute("role", "dialog"),
|
|
30
30
|
o.setAttribute("aria-modal", "true"),
|
|
31
31
|
o.setAttribute("aria-label", "Modal Message"),
|
|
32
32
|
t && o.setAttribute("aria-labelledby", t);
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
xo: (t, o, e, s) => {
|
|
35
35
|
if (t.buttons && t.buttons.length > 0) {
|
|
36
36
|
const a = document.createElement("div");
|
|
37
37
|
(a.className = "ab-message-buttons"), e.appendChild(a);
|
|
@@ -60,7 +60,7 @@ const ce = {
|
|
|
60
60
|
let l = e.text;
|
|
61
61
|
"" === e.text && (l = " "),
|
|
62
62
|
s.appendChild(document.createTextNode(l)),
|
|
63
|
-
t.
|
|
63
|
+
t.Qe() ||
|
|
64
64
|
((s.style.backgroundColor = le(e.backgroundColor)),
|
|
65
65
|
(s.style.color = le(e.textColor)),
|
|
66
66
|
(s.style.borderColor = le(e.borderColor))),
|
|
@@ -47,7 +47,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
47
47
|
((S = void 0), (q = void 0));
|
|
48
48
|
const B = e.message_extras;
|
|
49
49
|
let C;
|
|
50
|
-
if (o === ModalMessage.Dt || o === InAppMessage.
|
|
50
|
+
if (o === ModalMessage.Dt || o === InAppMessage.Ze.Io)
|
|
51
51
|
C = new ModalMessage(
|
|
52
52
|
s,
|
|
53
53
|
n,
|
|
@@ -138,8 +138,8 @@ export function newInAppMessageFromJson(e) {
|
|
|
138
138
|
else {
|
|
139
139
|
if (
|
|
140
140
|
o !== HtmlMessage.Dt &&
|
|
141
|
-
o !== InAppMessage.
|
|
142
|
-
o !== InAppMessage.
|
|
141
|
+
o !== InAppMessage.Ze.Ye &&
|
|
142
|
+
o !== InAppMessage.Ze.Ao
|
|
143
143
|
)
|
|
144
144
|
return void N.error("Ignoring message with unknown type " + o);
|
|
145
145
|
{
|
|
@@ -148,7 +148,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
148
148
|
(C.trusted = e.trusted || !1);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
return (C.
|
|
151
|
+
return (C.We = o), C;
|
|
152
152
|
}
|
|
153
153
|
export function buttonsFromSerializedInAppMessage(e) {
|
|
154
154
|
const o = [];
|