@braze/web-sdk 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.d.ts +14 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +15 -15
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +14 -14
- package/src/Banner/banner-provider.js +53 -50
- package/src/Banner/banner.js +1 -1
- package/src/Banner/get-all-banners.js +2 -2
- package/src/Banner/get-banner.js +2 -2
- package/src/Banner/log-banner-click.js +1 -1
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +2 -2
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Card/card-manager.js +10 -10
- package/src/Card/models/captioned-image.js +1 -1
- package/src/Card/models/card.js +3 -3
- package/src/Card/models/classic-card.js +1 -1
- package/src/Card/models/control-card.js +1 -1
- package/src/Card/models/image-only.js +1 -1
- package/src/ContentCards/content-cards-provider.js +139 -180
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/disable-sdk.js +3 -3
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/log-custom-event.js +3 -3
- package/src/Core/log-purchase.js +1 -1
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +4 -4
- package/src/FeatureFlags/feature-flag.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +81 -78
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +34 -34
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +9 -9
- package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
- package/src/InAppMessage/display/modal-utils.js +5 -5
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +115 -91
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-html-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +5 -5
- package/src/InAppMessage/models/html-message.js +10 -10
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +37 -37
- package/src/InAppMessage/models/modal-message.js +5 -5
- package/src/InAppMessage/models/slide-up-message.js +7 -7
- 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/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.js +88 -88
- package/src/Push/utils/push-utils.js +12 -12
- package/src/User/user-manager.js +10 -10
- package/src/User/user.js +46 -34
- package/src/common/constants.js +1 -1
- package/src/common/event-logger.js +3 -3
- package/src/common/feed-display.js +10 -10
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +10 -10
- package/src/managers/braze-instance.js +110 -110
- package/src/managers/device-manager.js +17 -17
- package/src/managers/network-manager.js +180 -143
- package/src/managers/server-config-manager.js +65 -65
- package/src/managers/session-manager.js +22 -22
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +134 -134
- package/src/managers/subscription-manager.js +8 -8
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +8 -8
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +10 -10
- package/src/models/push-token.js +8 -8
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +158 -146
- 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 +6 -6
- package/src/triggers/models/filter.js +16 -16
- package/src/triggers/models/in-app-message-click-data.js +2 -2
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +36 -36
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +37 -37
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +11 -10
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/component-utils.js +2 -2
- package/src/util/dom-utils.js +3 -3
- package/src/util/html-display-utils.js +1 -0
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +22 -23
- package/src/util/request-header-utils.js +23 -20
- package/src/util/user-agent-parser.js +14 -14
- package/src/util/validation-utils.js +14 -14
- package/src/util/window-utils.js +2 -2
|
@@ -6,174 +6,177 @@ import u from "../managers/subscription-manager.js";
|
|
|
6
6
|
import { randomInclusive as a } from "../util/math.js";
|
|
7
7
|
import l from "../util/net.js";
|
|
8
8
|
import {
|
|
9
|
-
newFeatureFlagFromJson as
|
|
10
|
-
newFeatureFlagFromSerializedValue as
|
|
9
|
+
newFeatureFlagFromJson as st,
|
|
10
|
+
newFeatureFlagFromSerializedValue as ht,
|
|
11
11
|
} from "./feature-flag-factory.js";
|
|
12
12
|
import h from "../util/request-header-utils.js";
|
|
13
13
|
export default class tr extends s {
|
|
14
|
-
constructor(t, s,
|
|
14
|
+
constructor(t, s, e, i) {
|
|
15
15
|
super(),
|
|
16
16
|
(this.B = t),
|
|
17
17
|
(this.S = s),
|
|
18
|
-
(this.C =
|
|
19
|
-
(this.T =
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
18
|
+
(this.C = e),
|
|
19
|
+
(this.T = i),
|
|
20
|
+
(this.je = []),
|
|
21
|
+
(this.we = 0),
|
|
22
22
|
(this.B = t),
|
|
23
23
|
(this.S = s),
|
|
24
|
-
(this.C =
|
|
25
|
-
(this.T =
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
24
|
+
(this.C = e),
|
|
25
|
+
(this.T = i),
|
|
26
|
+
(this.Ce = null),
|
|
27
|
+
(this.Re = 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.Re);
|
|
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.De()) &&
|
|
37
37
|
null != t &&
|
|
38
38
|
t.feature_flags
|
|
39
39
|
) {
|
|
40
|
-
this.
|
|
40
|
+
this.je = [];
|
|
41
41
|
for (const s of t.feature_flags) {
|
|
42
|
-
const t =
|
|
43
|
-
t && this.
|
|
42
|
+
const t = st(s);
|
|
43
|
+
t && this.je.push(t);
|
|
44
44
|
}
|
|
45
|
-
(this.
|
|
45
|
+
(this.we = new Date().getTime()), this.Se(), this.Re.X(this.je);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
qe() {
|
|
49
49
|
let s = {};
|
|
50
|
-
this.C && (s = this.C.
|
|
51
|
-
const
|
|
50
|
+
this.C && (s = this.C.vs(t.gs.xe));
|
|
51
|
+
const e = {};
|
|
52
52
|
for (const t in s) {
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
const i = ht(s[t]);
|
|
54
|
+
i && (e[i.id] = i);
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return e;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
ze() {
|
|
59
59
|
var s;
|
|
60
60
|
return (
|
|
61
|
-
(null === (s = this.C) || void 0 === s ? void 0 : s.
|
|
61
|
+
(null === (s = this.C) || void 0 === s ? void 0 : s.vs(t.gs.$e)) || {}
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
this.C && this.C.
|
|
64
|
+
ke(s) {
|
|
65
|
+
this.C && this.C.Bs(t.gs.$e, s);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
return this.
|
|
67
|
+
qs(t) {
|
|
68
|
+
return this.Re.Fs(t);
|
|
69
69
|
}
|
|
70
|
-
refreshFeatureFlags(t, s,
|
|
70
|
+
refreshFeatureFlags(t, s, e = !1, i = !0) {
|
|
71
71
|
const r = () => {
|
|
72
|
-
"function" == typeof s && s(), this.
|
|
72
|
+
"function" == typeof s && s(), this.Re.X(this.je);
|
|
73
73
|
};
|
|
74
|
-
if (!this.
|
|
74
|
+
if (!this.Be(e))
|
|
75
75
|
return (
|
|
76
|
-
!this.
|
|
76
|
+
!this.Ce &&
|
|
77
77
|
this.B &&
|
|
78
|
-
(this.
|
|
78
|
+
(this.Ce = this.B.Me(() => {
|
|
79
79
|
this.refreshFeatureFlags(t, s);
|
|
80
80
|
})),
|
|
81
81
|
void r()
|
|
82
82
|
);
|
|
83
83
|
const o = this.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.Ue);
|
|
88
88
|
let f = !1;
|
|
89
89
|
o.V(
|
|
90
90
|
n,
|
|
91
|
-
(
|
|
92
|
-
|
|
91
|
+
(i = -1) => {
|
|
92
|
+
const o = this.S;
|
|
93
|
+
if (!o) return void r();
|
|
93
94
|
const c = new Date().valueOf();
|
|
94
|
-
h.W(this.C, h.O.
|
|
95
|
-
-1 !==
|
|
95
|
+
h.W(this.C, h.O.Ue, c),
|
|
96
|
+
-1 !== i && u.push(["X-Braze-Req-Tokens-Remaining", i.toString()]),
|
|
96
97
|
l.Y({
|
|
97
|
-
url: `${
|
|
98
|
+
url: `${o.Z()}/feature_flags/sync`,
|
|
98
99
|
headers: u,
|
|
99
100
|
data: n,
|
|
100
101
|
ss: (s) => {
|
|
101
|
-
if (!
|
|
102
|
-
|
|
103
|
-
this.U(s),
|
|
104
|
-
(f = !1),
|
|
105
|
-
h.ns(this.C, h.O.De, 1),
|
|
106
|
-
"function" == typeof t && t();
|
|
102
|
+
if (!o.ts(n, s, u)) return (f = !0), void r();
|
|
103
|
+
o.es(), this.U(s), (f = !1), "function" == typeof t && t();
|
|
107
104
|
},
|
|
108
105
|
error: (t) => {
|
|
109
|
-
|
|
106
|
+
o.ns(t, "retrieving feature flags"), (f = !0), r();
|
|
110
107
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
let
|
|
115
|
-
(null ==
|
|
116
|
-
|
|
108
|
+
rs: (i, r) => {
|
|
109
|
+
let n;
|
|
110
|
+
if (f) {
|
|
111
|
+
let t = this.I;
|
|
112
|
+
(null == t || t < 1e3 * this.R) && (t = 1e3 * this.R),
|
|
113
|
+
(n = Math.min(3e5, a(1e3 * this.R, 3 * t)));
|
|
117
114
|
}
|
|
115
|
+
o.os(
|
|
116
|
+
r,
|
|
117
|
+
() => {
|
|
118
|
+
this.refreshFeatureFlags(t, s, e, !0);
|
|
119
|
+
},
|
|
120
|
+
h.O.Ue,
|
|
121
|
+
(t) => this.hs(t),
|
|
122
|
+
() => this.G(),
|
|
123
|
+
n,
|
|
124
|
+
);
|
|
118
125
|
},
|
|
119
126
|
});
|
|
120
127
|
},
|
|
121
|
-
h.O.
|
|
128
|
+
h.O.Ue,
|
|
122
129
|
s,
|
|
123
130
|
);
|
|
124
131
|
}
|
|
125
132
|
G() {
|
|
126
133
|
null != this.q && (clearTimeout(this.q), (this.q = null));
|
|
127
134
|
}
|
|
128
|
-
|
|
129
|
-
this.G(),
|
|
130
|
-
(this.q = window.setTimeout(() => {
|
|
131
|
-
this.refreshFeatureFlags(s, i, e);
|
|
132
|
-
}, t)),
|
|
133
|
-
(this.I = t);
|
|
135
|
+
hs(t) {
|
|
136
|
+
this.G(), (this.q = t);
|
|
134
137
|
}
|
|
135
|
-
|
|
138
|
+
Be(t) {
|
|
136
139
|
if (!this.B) return !1;
|
|
137
140
|
if (!t) {
|
|
138
|
-
const t = this.B.
|
|
141
|
+
const t = this.B.Xe();
|
|
139
142
|
if (null == t) return !1;
|
|
140
143
|
let s = !1;
|
|
141
144
|
if (!isNaN(t)) {
|
|
142
145
|
if (-1 === t) return N.info("Feature flag refreshes not allowed"), !1;
|
|
143
|
-
s = new Date().getTime() >= (this.
|
|
146
|
+
s = new Date().getTime() >= (this.we || 0) + 1e3 * t;
|
|
144
147
|
}
|
|
145
148
|
if (!s)
|
|
146
149
|
return (
|
|
147
150
|
N.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
148
151
|
);
|
|
149
152
|
}
|
|
150
|
-
return this.B.
|
|
153
|
+
return this.B.De();
|
|
151
154
|
}
|
|
152
|
-
|
|
155
|
+
_e() {
|
|
153
156
|
var s;
|
|
154
157
|
return (
|
|
155
|
-
(null === (s = this.C) || void 0 === s ? void 0 : s.
|
|
158
|
+
(null === (s = this.C) || void 0 === s ? void 0 : s.vs(t.gs.Ae)) || null
|
|
156
159
|
);
|
|
157
160
|
}
|
|
158
|
-
|
|
159
|
-
var s,
|
|
161
|
+
Ge() {
|
|
162
|
+
var s, e;
|
|
160
163
|
null === (s = this.C) ||
|
|
161
164
|
void 0 === s ||
|
|
162
|
-
s.
|
|
165
|
+
s.Bs(t.gs.Ae, null === (e = this.T) || void 0 === e ? void 0 : e.Ss());
|
|
163
166
|
}
|
|
164
|
-
|
|
167
|
+
He() {
|
|
165
168
|
var t;
|
|
166
169
|
const s = null === (t = this.T) || void 0 === t ? void 0 : t.Ss(),
|
|
167
|
-
|
|
168
|
-
return null ==
|
|
170
|
+
e = this._e();
|
|
171
|
+
return null == e || s === e;
|
|
169
172
|
}
|
|
170
|
-
|
|
173
|
+
Se() {
|
|
171
174
|
if (!this.C) return;
|
|
172
175
|
const s = {};
|
|
173
|
-
for (const t of this.
|
|
174
|
-
const
|
|
175
|
-
s[t.id] =
|
|
176
|
+
for (const t of this.je) {
|
|
177
|
+
const e = t.bs();
|
|
178
|
+
s[t.id] = e;
|
|
176
179
|
}
|
|
177
|
-
this.C.
|
|
180
|
+
this.C.Bs(t.gs.xe, s), this.C.Bs(t.gs.Je, this.we), this.Ge();
|
|
178
181
|
}
|
|
179
182
|
}
|
|
@@ -5,8 +5,8 @@ export function getAllFeatureFlags() {
|
|
|
5
5
|
if (!r.rr()) return;
|
|
6
6
|
const e = [],
|
|
7
7
|
t = r.v();
|
|
8
|
-
if (t && !t.
|
|
9
|
-
const n = nr.m().
|
|
8
|
+
if (t && !t.De()) return N.info("Feature flags are not enabled."), e;
|
|
9
|
+
const n = nr.m().qe();
|
|
10
10
|
for (const r in n) e.push(n[r]);
|
|
11
11
|
return e;
|
|
12
12
|
}
|
|
@@ -4,7 +4,7 @@ import nr from "./feature-flags-provider-factory.js";
|
|
|
4
4
|
export function getFeatureFlag(e) {
|
|
5
5
|
if (!r.rr()) return;
|
|
6
6
|
const t = r.v();
|
|
7
|
-
if (t && !t.
|
|
8
|
-
const n = nr.m().
|
|
7
|
+
if (t && !t.De()) return N.info("Feature flags are not enabled."), null;
|
|
8
|
+
const n = nr.m().qe();
|
|
9
9
|
return n[e] ? n[e] : null;
|
|
10
10
|
}
|
|
@@ -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().qe();
|
|
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().ze();
|
|
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().ke(i);
|
|
23
23
|
const s = { fid: e, fts: n };
|
|
24
|
-
return c.
|
|
24
|
+
return c.cs(d.yr, s).ss;
|
|
25
25
|
}
|
|
@@ -4,9 +4,9 @@ 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.He()) {
|
|
8
8
|
const r = getAllFeatureFlags();
|
|
9
9
|
r && "function" == typeof t && t(r);
|
|
10
10
|
}
|
|
11
|
-
return e.
|
|
11
|
+
return e.qs(t);
|
|
12
12
|
}
|
|
@@ -2,8 +2,8 @@ import s from "../common/base-provider.js";
|
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
3
|
import Feed from "./feed.js";
|
|
4
4
|
import {
|
|
5
|
-
newCardFromFeedJson as
|
|
6
|
-
newCardFromSerializedValue as
|
|
5
|
+
newCardFromFeedJson as at,
|
|
6
|
+
newCardFromSerializedValue as Z,
|
|
7
7
|
} from "../Card/util/card-factory.js";
|
|
8
8
|
import { rehydrateDateAfterJsonization as V } from "../util/date-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
@@ -12,59 +12,59 @@ export default class re extends s {
|
|
|
12
12
|
constructor(t, s) {
|
|
13
13
|
super(),
|
|
14
14
|
(this.C = t),
|
|
15
|
-
(this.
|
|
15
|
+
(this.Bi = s),
|
|
16
16
|
(this.cards = []),
|
|
17
|
-
(this.
|
|
17
|
+
(this.Gi = null),
|
|
18
18
|
(this.C = t),
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
r.N(this.
|
|
22
|
-
this.
|
|
19
|
+
(this.Bi = s),
|
|
20
|
+
(this.Js = new u()),
|
|
21
|
+
r.N(this.Js),
|
|
22
|
+
this.Ps();
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
Ps() {
|
|
25
25
|
let s = [];
|
|
26
|
-
this.C && (s = this.C.
|
|
26
|
+
this.C && (s = this.C.vs(t.gs.Hi) || []);
|
|
27
27
|
const i = [];
|
|
28
28
|
for (let t = 0; t < s.length; t++) {
|
|
29
|
-
const e =
|
|
29
|
+
const e = Z(s[t]);
|
|
30
30
|
null != e && i.push(e);
|
|
31
31
|
}
|
|
32
|
-
(this.cards = i), this.C && (this.
|
|
32
|
+
(this.cards = i), this.C && (this.Gi = V(this.C.vs(t.gs.Ji)));
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
Ki(s) {
|
|
35
35
|
const i = [];
|
|
36
36
|
let e = null,
|
|
37
37
|
r = {};
|
|
38
|
-
this.C && (r = this.C.
|
|
38
|
+
this.C && (r = this.C.vs(t.gs.Ct) || {});
|
|
39
39
|
const h = {};
|
|
40
40
|
for (let t = 0; t < s.length; t++) {
|
|
41
41
|
e = s[t];
|
|
42
|
-
const o =
|
|
42
|
+
const o = at(e);
|
|
43
43
|
if (null != o) {
|
|
44
44
|
const t = o.id;
|
|
45
45
|
t && r[t] && ((o.viewed = !0), (h[t] = !0)), i.push(o);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
(this.cards = i),
|
|
49
|
-
this.
|
|
50
|
-
(this.
|
|
51
|
-
this.C && (this.C.
|
|
49
|
+
this.gi(),
|
|
50
|
+
(this.Gi = new Date()),
|
|
51
|
+
this.C && (this.C.Bs(t.gs.Ct, h), this.C.Bs(t.gs.Ji, this.Gi));
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
gi() {
|
|
54
54
|
var s;
|
|
55
55
|
const i = [];
|
|
56
|
-
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].
|
|
57
|
-
null === (s = this.C) || void 0 === s || s.
|
|
56
|
+
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bs());
|
|
57
|
+
null === (s = this.C) || void 0 === s || s.Bs(t.gs.Hi, i);
|
|
58
58
|
}
|
|
59
59
|
U(t) {
|
|
60
60
|
null != t &&
|
|
61
61
|
t.feed &&
|
|
62
|
-
(this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
62
|
+
(this.Ps(),
|
|
63
|
+
this.Ki(t.feed),
|
|
64
|
+
this.Js.X(new Feed(this.cards.slice(), this.Gi)));
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
this.
|
|
66
|
+
Mi() {
|
|
67
|
+
this.Ps();
|
|
68
68
|
const t = [],
|
|
69
69
|
s = new Date();
|
|
70
70
|
for (let i = 0; i < this.cards.length; i++) {
|
|
@@ -72,19 +72,19 @@ export default class re extends s {
|
|
|
72
72
|
let r = !0;
|
|
73
73
|
null != e && (r = e >= s), r && t.push(this.cards[i]);
|
|
74
74
|
}
|
|
75
|
-
return new Feed(t, this.
|
|
75
|
+
return new Feed(t, this.Gi);
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
this.
|
|
77
|
+
Di() {
|
|
78
|
+
this.Bi && this.Bi.requestFeedRefresh();
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
return this.
|
|
80
|
+
qs(t) {
|
|
81
|
+
return this.Js.Fs(t);
|
|
82
82
|
}
|
|
83
83
|
clearData(s) {
|
|
84
84
|
null == s && (s = !1),
|
|
85
85
|
(this.cards = []),
|
|
86
|
-
(this.
|
|
87
|
-
s && this.C && (this.C.
|
|
88
|
-
this.
|
|
86
|
+
(this.Gi = null),
|
|
87
|
+
s && this.C && (this.C.Es(t.gs.Hi), this.C.Es(t.gs.Ji)),
|
|
88
|
+
this.Js.X(new Feed(this.cards.slice(), this.Gi));
|
|
89
89
|
}
|
|
90
90
|
}
|
package/src/Feed/ui/show-feed.js
CHANGED
|
@@ -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().Ke(e)
|
|
12
12
|
: (N.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import ro from "../../util/browser-detector.js";
|
|
2
2
|
import { InAppMessage, logInAppMessageHtmlClick } from "../index.js";
|
|
3
3
|
import { OperatingSystems as so } from "../../util/device-constants.js";
|
|
4
|
-
import { buildHtmlClickHandler as
|
|
4
|
+
import { buildHtmlClickHandler as lt } from "./html-message-display-utils.js";
|
|
5
5
|
import { attachHtmlToIframeWithNonce as m } from "../../util/html-display-utils.js";
|
|
6
6
|
import { buildBrazeBridge as b } from "../../util/html-display-utils.js";
|
|
7
|
-
export default function
|
|
7
|
+
export default function ct(t, e, o, s, n, i) {
|
|
8
8
|
const l = document.createElement("iframe");
|
|
9
9
|
l.setAttribute("title", "Modal Message"),
|
|
10
10
|
n && (l.style.zIndex = (n + 1).toString());
|
|
@@ -18,7 +18,7 @@ export default function dt(t, e, o, s, n, i) {
|
|
|
18
18
|
if (t.Oe()) {
|
|
19
19
|
const e = document.createElement("style");
|
|
20
20
|
(e.innerHTML = t.css || ""),
|
|
21
|
-
(e.id = t.
|
|
21
|
+
(e.id = t.Le() || ""),
|
|
22
22
|
null != i && e.setAttribute("nonce", i),
|
|
23
23
|
a.appendChild(e);
|
|
24
24
|
}
|
|
@@ -42,16 +42,16 @@ export default function dt(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.Qe !== InAppMessage.We.Ve)
|
|
46
46
|
) {
|
|
47
47
|
const e = n.document.getElementsByTagName("a");
|
|
48
|
-
for (let o = 0; o < e.length; o++) e[o].onclick =
|
|
48
|
+
for (let o = 0; o < e.length; o++) e[o].onclick = lt(t, l, e[o], s);
|
|
49
49
|
const o = n.document.getElementsByTagName("button");
|
|
50
|
-
for (let e = 0; e < o.length; e++) o[e].onclick =
|
|
50
|
+
for (let e = 0; e < o.length; e++) o[e].onclick = lt(t, l, o[e], s);
|
|
51
51
|
}
|
|
52
52
|
const m = n.document.body;
|
|
53
53
|
if (null != m) {
|
|
54
|
-
t.
|
|
54
|
+
t.Ye() && (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 dt(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.Ze = e), e
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
return (t.
|
|
73
|
+
return (t.Ze = l), l;
|
|
74
74
|
}
|
|
@@ -13,19 +13,19 @@ import ModalMessage from "../models/modal-message.js";
|
|
|
13
13
|
import SlideUpMessage from "../models/slide-up-message.js";
|
|
14
14
|
import { logInAppMessageClick } from "../log-in-app-message-click.js";
|
|
15
15
|
import { _handleBrazeAction as F } from "../../Core/handle-braze-action.js";
|
|
16
|
-
import
|
|
16
|
+
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.
|
|
21
|
-
return
|
|
20
|
+
if (((e.lo = document.activeElement), e instanceof HtmlMessage))
|
|
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;
|
|
24
24
|
const c = document.createElement("div");
|
|
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.do() &&
|
|
29
29
|
((c.className += " ab-modal-interactions"),
|
|
30
30
|
c.setAttribute("tabindex", "-1")),
|
|
31
31
|
e.Oe() ||
|
|
@@ -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.bo.uo,
|
|
42
42
|
)
|
|
43
43
|
: a(c));
|
|
44
44
|
},
|
|
@@ -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.po).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.fo(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.fo(o),
|
|
109
109
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
110
110
|
) {
|
|
111
111
|
g = !0;
|
|
@@ -142,7 +142,7 @@ 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.ho = G.Rt()), (o.id = e.ho);
|
|
146
146
|
const a = (
|
|
147
147
|
e.headerAlignment || InAppMessage.TextAlignment.CENTER
|
|
148
148
|
).toLowerCase();
|
|
@@ -151,14 +151,14 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
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.jo()), c.appendChild(b), g || d(), (e.Ze = 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.wo(e, o, c, n),
|
|
160
|
+
ce.vo(c),
|
|
161
|
+
ce.xo(e.ho, c);
|
|
162
162
|
} else if (e instanceof SlideUpMessage) {
|
|
163
163
|
c.className += " ab-slideup";
|
|
164
164
|
const o = c.getElementsByClassName("ab-close-button")[0];
|
|
@@ -168,7 +168,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
168
168
|
"M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",
|
|
169
169
|
e.Oe() ? void 0 : le(e.closeButtonColor),
|
|
170
170
|
);
|
|
171
|
-
a.setAttribute("class",
|
|
171
|
+
a.setAttribute("class", `ab-chevron ${l}`), o.appendChild(a);
|
|
172
172
|
}
|
|
173
173
|
let a, t;
|
|
174
174
|
H(c, R.kt, (e) => {
|
|
@@ -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.Co), (t = " ab-swiped-up"))
|
|
184
|
+
: ((a = R.$o), (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
|
});
|