@braze/web-sdk 5.1.1 → 5.3.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 +65 -10
- 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 +52 -52
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +22 -21
- package/src/ContentCards/content-cards-provider.js +107 -135
- 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 +2 -2
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/FeatureFlags/feature-flag.js +41 -30
- package/src/FeatureFlags/feature-flags-provider.js +88 -84
- 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 +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +24 -24
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.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 +45 -42
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +23 -21
- package/src/InAppMessage/in-app-message-manager.js +95 -112
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +4 -2
- package/src/InAppMessage/models/full-screen-message.js +14 -11
- package/src/InAppMessage/models/html-message.js +11 -9
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +127 -120
- package/src/InAppMessage/models/modal-message.js +14 -11
- package/src/InAppMessage/models/slide-up-message.js +46 -21
- 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 +37 -43
- package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +118 -110
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +19 -19
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +0 -2
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +12 -12
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +27 -27
- package/src/managers/braze-instance.js +119 -112
- package/src/managers/device-manager.js +19 -19
- package/src/managers/network-manager.js +215 -165
- package/src/managers/server-config-manager.js +46 -50
- package/src/managers/session-manager.js +21 -21
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +128 -125
- package/src/managers/utils.js +6 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +19 -11
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +34 -20
- package/src/models/push-token.js +4 -4
- package/src/models/server-config.js +24 -24
- package/src/request-controller.js +134 -124
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +56 -56
- package/src/triggers/models/in-app-message-click-data.js +8 -8
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +30 -30
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +84 -95
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +25 -24
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/component-utils.js +2 -2
- package/src/util/device-constants.js +2 -2
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +36 -37
- package/src/util/user-agent-parser.js +8 -8
- package/src/util/validation-utils.js +2 -0
- package/src/util/window-utils.js +3 -3
|
@@ -3,51 +3,51 @@ import y from "../common/base-provider.js";
|
|
|
3
3
|
import e from "../managers/braze-instance.js";
|
|
4
4
|
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
5
5
|
import T from "../managers/subscription-manager.js";
|
|
6
|
-
import { randomInclusive as
|
|
6
|
+
import { randomInclusive as U } from "../util/math.js";
|
|
7
7
|
import C from "../util/net.js";
|
|
8
8
|
import {
|
|
9
9
|
newFeatureFlagFromJson as st,
|
|
10
10
|
newFeatureFlagFromSerializedValue as it,
|
|
11
11
|
} from "./feature-flag-factory.js";
|
|
12
|
-
import
|
|
12
|
+
import D from "../util/request-header-utils.js";
|
|
13
13
|
export default class er extends y {
|
|
14
14
|
constructor(t, s, i, r) {
|
|
15
15
|
super(),
|
|
16
16
|
(this.yt = t),
|
|
17
17
|
(this.qt = s),
|
|
18
18
|
(this.u = i),
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
19
|
+
(this.ri = r),
|
|
20
|
+
(this.hi = []),
|
|
21
|
+
(this.oi = 0),
|
|
22
22
|
(this.yt = t),
|
|
23
23
|
(this.qt = s),
|
|
24
24
|
(this.u = i),
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
30
|
-
(this.
|
|
31
|
-
e.$t(this.
|
|
25
|
+
(this.ri = r),
|
|
26
|
+
(this.ai = null),
|
|
27
|
+
(this.ni = new T()),
|
|
28
|
+
(this.li = 10),
|
|
29
|
+
(this.ui = null),
|
|
30
|
+
(this.fi = null),
|
|
31
|
+
e.$t(this.ni);
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
Ns(t) {
|
|
34
34
|
var s;
|
|
35
35
|
if (
|
|
36
|
-
(null === (s = this.yt) || void 0 === s ? void 0 : s.
|
|
36
|
+
(null === (s = this.yt) || void 0 === s ? void 0 : s.ci()) &&
|
|
37
37
|
null != t &&
|
|
38
38
|
t.feature_flags
|
|
39
39
|
) {
|
|
40
|
-
this.
|
|
40
|
+
this.hi = [];
|
|
41
41
|
for (const s of t.feature_flags) {
|
|
42
42
|
const t = st(s);
|
|
43
|
-
t && this.
|
|
43
|
+
t && this.hi.push(t);
|
|
44
44
|
}
|
|
45
|
-
(this.
|
|
45
|
+
(this.oi = new Date().getTime()), this.di(), this.ni.Dt(this.hi);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
mi() {
|
|
49
49
|
let t = {};
|
|
50
|
-
this.u && (t = this.u.j(o.C.
|
|
50
|
+
this.u && (t = this.u.j(o.C.gi));
|
|
51
51
|
const s = {};
|
|
52
52
|
for (const i in t) {
|
|
53
53
|
const e = it(t[i]);
|
|
@@ -55,119 +55,123 @@ export default class er extends y {
|
|
|
55
55
|
}
|
|
56
56
|
return s;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
Fi() {
|
|
59
59
|
var t;
|
|
60
|
-
return (null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.
|
|
60
|
+
return (null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.vi)) || {};
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
this.u && this.u.k(o.C.
|
|
62
|
+
pi(t) {
|
|
63
|
+
this.u && this.u.k(o.C.vi, t);
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
return this.
|
|
65
|
+
Zs(t) {
|
|
66
|
+
return this.ni.It(t);
|
|
67
67
|
}
|
|
68
68
|
refreshFeatureFlags(t, s, i = !1, e = !0) {
|
|
69
69
|
const r = () => {
|
|
70
|
-
"function" == typeof s && s(), this.
|
|
70
|
+
"function" == typeof s && s(), this.ni.Dt(this.hi);
|
|
71
71
|
};
|
|
72
|
-
if (!this.
|
|
72
|
+
if (!this.wi(i))
|
|
73
73
|
return (
|
|
74
|
-
!this.
|
|
74
|
+
!this.ai &&
|
|
75
75
|
this.yt &&
|
|
76
|
-
(this.
|
|
76
|
+
(this.ai = this.yt.ji(() => {
|
|
77
77
|
this.refreshFeatureFlags(t, s);
|
|
78
78
|
})),
|
|
79
79
|
void r()
|
|
80
80
|
);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
81
|
+
const h = this.qt;
|
|
82
|
+
if (!h) return void r();
|
|
83
|
+
e && this.yi();
|
|
84
|
+
const o = h.Js({}, !0),
|
|
85
|
+
a = h.$s(o, D.Ps.bi);
|
|
86
|
+
let n = !1;
|
|
87
|
+
h.Xs(
|
|
88
|
+
o,
|
|
89
|
+
(h = -1) => {
|
|
90
|
+
if (!this.qt) return void r();
|
|
91
|
+
const l = new Date().valueOf();
|
|
92
|
+
D._s(this.u, D.Ps.bi, l),
|
|
93
|
+
-1 !== h && a.push(["X-Braze-Req-Tokens-Remaining", h.toString()]),
|
|
94
|
+
C.Gs({
|
|
95
|
+
url: `${this.qt.Hs()}/feature_flags/sync`,
|
|
96
|
+
headers: a,
|
|
97
|
+
data: o,
|
|
98
|
+
L: (s) => {
|
|
99
|
+
if (!this.qt.Ks(o, s, a)) return (n = !0), void r();
|
|
100
|
+
this.qt.Os(),
|
|
101
|
+
this.Ns(s),
|
|
102
|
+
(n = !1),
|
|
103
|
+
D.Qs(this.u, D.Ps.bi, 1),
|
|
104
|
+
"function" == typeof t && t();
|
|
105
|
+
},
|
|
106
|
+
error: (t) => {
|
|
107
|
+
this.qt.Vs(t, "retrieving feature flags"), (n = !0), r();
|
|
108
|
+
},
|
|
109
|
+
Ws: () => {
|
|
110
|
+
if (e && n && !this.fi) {
|
|
111
|
+
D.Ys(this.u, D.Ps.bi);
|
|
112
|
+
let e = this.ui;
|
|
113
|
+
(null == e || e < 1e3 * this.li) && (e = 1e3 * this.li),
|
|
114
|
+
this.Ci(Math.min(3e5, U(1e3 * this.li, 3 * e)), t, s, i);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
});
|
|
115
118
|
},
|
|
116
|
-
|
|
119
|
+
D.Ps.bi,
|
|
120
|
+
s,
|
|
117
121
|
);
|
|
118
122
|
}
|
|
119
|
-
|
|
120
|
-
null != this.
|
|
123
|
+
yi() {
|
|
124
|
+
null != this.fi && (clearTimeout(this.fi), (this.fi = null));
|
|
121
125
|
}
|
|
122
|
-
|
|
123
|
-
this.
|
|
124
|
-
(this.
|
|
126
|
+
Ci(t = 1e3 * this.li, s, i, e = !1) {
|
|
127
|
+
this.yi(),
|
|
128
|
+
(this.fi = window.setTimeout(() => {
|
|
125
129
|
this.refreshFeatureFlags(s, i, e);
|
|
126
130
|
}, t)),
|
|
127
|
-
(this.
|
|
131
|
+
(this.ui = t);
|
|
128
132
|
}
|
|
129
|
-
|
|
133
|
+
wi(t) {
|
|
130
134
|
if (!this.yt) return !1;
|
|
131
135
|
if (!t) {
|
|
132
|
-
const t = this.yt.
|
|
136
|
+
const t = this.yt.Ri();
|
|
133
137
|
if (null == t) return !1;
|
|
134
138
|
let s = !1;
|
|
135
139
|
if (!isNaN(t)) {
|
|
136
140
|
if (-1 === t) return r.info("Feature flag refreshes not allowed"), !1;
|
|
137
|
-
s = new Date().getTime() >= (this.
|
|
141
|
+
s = new Date().getTime() >= (this.oi || 0) + 1e3 * t;
|
|
138
142
|
}
|
|
139
143
|
if (!s)
|
|
140
144
|
return (
|
|
141
145
|
r.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
142
146
|
);
|
|
143
147
|
}
|
|
144
|
-
return this.yt.
|
|
148
|
+
return this.yt.ci();
|
|
145
149
|
}
|
|
146
|
-
|
|
150
|
+
Ti() {
|
|
147
151
|
var t;
|
|
148
152
|
return (
|
|
149
|
-
(null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.
|
|
153
|
+
(null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Di)) || null
|
|
150
154
|
);
|
|
151
155
|
}
|
|
152
|
-
|
|
156
|
+
Ii() {
|
|
153
157
|
var t, s;
|
|
154
158
|
null === (t = this.u) ||
|
|
155
159
|
void 0 === t ||
|
|
156
|
-
t.k(o.C.
|
|
160
|
+
t.k(o.C.Di, null === (s = this.ri) || void 0 === s ? void 0 : s.Si());
|
|
157
161
|
}
|
|
158
|
-
|
|
162
|
+
qi() {
|
|
159
163
|
var t;
|
|
160
|
-
const s = null === (t = this.
|
|
161
|
-
i = this.
|
|
164
|
+
const s = null === (t = this.ri) || void 0 === t ? void 0 : t.Si(),
|
|
165
|
+
i = this.Ti();
|
|
162
166
|
return null == i || s === i;
|
|
163
167
|
}
|
|
164
|
-
|
|
168
|
+
di() {
|
|
165
169
|
if (!this.u) return;
|
|
166
170
|
const t = {};
|
|
167
|
-
for (const s of this.
|
|
171
|
+
for (const s of this.hi) {
|
|
168
172
|
const i = s.Y();
|
|
169
173
|
t[s.id] = i;
|
|
170
174
|
}
|
|
171
|
-
this.u.k(o.C.
|
|
175
|
+
this.u.k(o.C.gi, t), this.u.k(o.C.xi, this.oi), this.Ii();
|
|
172
176
|
}
|
|
173
177
|
}
|
|
@@ -5,8 +5,8 @@ export function getAllFeatureFlags() {
|
|
|
5
5
|
if (!e.X()) return;
|
|
6
6
|
const t = [],
|
|
7
7
|
n = e.ir();
|
|
8
|
-
if (n && !n.
|
|
9
|
-
const o = ir.rr().
|
|
8
|
+
if (n && !n.ci()) return r.info("Feature flags are not enabled."), t;
|
|
9
|
+
const o = ir.rr().mi();
|
|
10
10
|
for (const r in o) t.push(o[r]);
|
|
11
11
|
return t;
|
|
12
12
|
}
|
|
@@ -4,7 +4,7 @@ import ir from "./feature-flags-provider-factory.js";
|
|
|
4
4
|
export function getFeatureFlag(t) {
|
|
5
5
|
if (!e.X()) return;
|
|
6
6
|
const n = e.ir();
|
|
7
|
-
if (n && !n.
|
|
8
|
-
const a = ir.rr().
|
|
7
|
+
if (n && !n.ci()) return r.info("Feature flags are not enabled."), null;
|
|
8
|
+
const a = ir.rr().mi();
|
|
9
9
|
return a[t] ? a[t] : null;
|
|
10
10
|
}
|
|
@@ -7,11 +7,11 @@ export function logFeatureFlagImpression(t) {
|
|
|
7
7
|
if (!t) return !1;
|
|
8
8
|
const o =
|
|
9
9
|
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
|
|
10
|
-
n = ir.rr().
|
|
10
|
+
n = ir.rr().mi();
|
|
11
11
|
if (!n[t]) return r.info(o), !1;
|
|
12
12
|
const a = n[t].trackingString;
|
|
13
13
|
if (!a) return r.info(o), !1;
|
|
14
|
-
const f = ir.rr().
|
|
14
|
+
const f = ir.rr().Fi();
|
|
15
15
|
if (f[a])
|
|
16
16
|
return (
|
|
17
17
|
r.info(
|
|
@@ -19,7 +19,7 @@ export function logFeatureFlagImpression(t) {
|
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
(f[a] = !0), ir.rr().
|
|
22
|
+
(f[a] = !0), ir.rr().pi(f);
|
|
23
23
|
const g = { fid: t, fts: a };
|
|
24
24
|
return s.q(i.Fr, g).L;
|
|
25
25
|
}
|
|
@@ -4,9 +4,9 @@ import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
|
4
4
|
export function subscribeToFeatureFlagsUpdates(r) {
|
|
5
5
|
if (!e.X()) return;
|
|
6
6
|
const t = ir.rr();
|
|
7
|
-
if (t.
|
|
7
|
+
if (t.qi()) {
|
|
8
8
|
const t = getAllFeatureFlags();
|
|
9
9
|
t && "function" == typeof r && r(t);
|
|
10
10
|
}
|
|
11
|
-
return t.
|
|
11
|
+
return t.Zs(r);
|
|
12
12
|
}
|
|
@@ -3,7 +3,7 @@ import e from "../managers/braze-instance.js";
|
|
|
3
3
|
import Feed from "./feed.js";
|
|
4
4
|
import {
|
|
5
5
|
newCardFromFeedJson as ht,
|
|
6
|
-
newCardFromSerializedValue as
|
|
6
|
+
newCardFromSerializedValue as S,
|
|
7
7
|
} from "../Card/util/card-factory.js";
|
|
8
8
|
import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
@@ -12,26 +12,26 @@ export default class ee extends y {
|
|
|
12
12
|
constructor(t, s) {
|
|
13
13
|
super(),
|
|
14
14
|
(this.u = t),
|
|
15
|
-
(this.
|
|
15
|
+
(this.zi = s),
|
|
16
16
|
(this.cards = []),
|
|
17
|
-
(this.
|
|
17
|
+
(this.Ni = null),
|
|
18
18
|
(this.u = t),
|
|
19
|
-
(this.
|
|
19
|
+
(this.zi = s),
|
|
20
20
|
(this.Jt = new T()),
|
|
21
21
|
e.$t(this.Jt),
|
|
22
22
|
this.Kt();
|
|
23
23
|
}
|
|
24
24
|
Kt() {
|
|
25
25
|
let t = [];
|
|
26
|
-
this.u && (t = this.u.j(o.C.
|
|
26
|
+
this.u && (t = this.u.j(o.C.Ui) || []);
|
|
27
27
|
const s = [];
|
|
28
28
|
for (let i = 0; i < t.length; i++) {
|
|
29
|
-
const e =
|
|
29
|
+
const e = S(t[i]);
|
|
30
30
|
null != e && s.push(e);
|
|
31
31
|
}
|
|
32
|
-
(this.cards = s), this.u && (this.
|
|
32
|
+
(this.cards = s), this.u && (this.Ni = w(this.u.j(o.C.ki)));
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
Ai(t) {
|
|
35
35
|
const s = [];
|
|
36
36
|
let i = null,
|
|
37
37
|
e = {};
|
|
@@ -46,24 +46,24 @@ export default class ee extends y {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
(this.cards = s),
|
|
49
|
-
this.
|
|
50
|
-
(this.
|
|
51
|
-
this.u && (this.u.k(o.C.J, r), this.u.k(o.C.
|
|
49
|
+
this.Rs(),
|
|
50
|
+
(this.Ni = new Date()),
|
|
51
|
+
this.u && (this.u.k(o.C.J, r), this.u.k(o.C.ki, this.Ni));
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
Rs() {
|
|
54
54
|
var t;
|
|
55
55
|
const s = [];
|
|
56
56
|
for (let t = 0; t < this.cards.length; t++) s.push(this.cards[t].Y());
|
|
57
|
-
null === (t = this.u) || void 0 === t || t.k(o.C.
|
|
57
|
+
null === (t = this.u) || void 0 === t || t.k(o.C.Ui, s);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
Ns(t) {
|
|
60
60
|
null != t &&
|
|
61
61
|
t.feed &&
|
|
62
62
|
(this.Kt(),
|
|
63
|
-
this.
|
|
64
|
-
this.Jt.Dt(new Feed(this.cards.slice(), this.
|
|
63
|
+
this.Ai(t.feed),
|
|
64
|
+
this.Jt.Dt(new Feed(this.cards.slice(), this.Ni)));
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
Bi() {
|
|
67
67
|
this.Kt();
|
|
68
68
|
const t = [],
|
|
69
69
|
s = new Date();
|
|
@@ -72,19 +72,19 @@ export default class ee extends y {
|
|
|
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.Ni);
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
this.
|
|
77
|
+
xs() {
|
|
78
|
+
this.zi && this.zi.requestFeedRefresh();
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
Zs(t) {
|
|
81
81
|
return this.Jt.It(t);
|
|
82
82
|
}
|
|
83
83
|
clearData(t) {
|
|
84
84
|
null == t && (t = !1),
|
|
85
85
|
(this.cards = []),
|
|
86
|
-
(this.
|
|
87
|
-
t && this.u && (this.u.
|
|
88
|
-
this.Jt.Dt(new Feed(this.cards.slice(), this.
|
|
86
|
+
(this.Ni = null),
|
|
87
|
+
t && this.u && (this.u.ti(o.C.Ui), this.u.ti(o.C.ki)),
|
|
88
|
+
this.Jt.Dt(new Feed(this.cards.slice(), this.Ni));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -3,5 +3,5 @@ import { InternalEventTypes as or } from "../../shared-lib/index.js";
|
|
|
3
3
|
export function logFeedDisplayed() {
|
|
4
4
|
var r;
|
|
5
5
|
if (e.X())
|
|
6
|
-
return null === (r = e.nr()) || void 0 === r ? void 0 : r.qr(or.
|
|
6
|
+
return null === (r = e.nr()) || void 0 === r ? void 0 : r.qr(or.Ar).L;
|
|
7
7
|
}
|
package/src/Feed/ui/show-feed.js
CHANGED
|
@@ -8,6 +8,6 @@ export function deferInAppMessage(s) {
|
|
|
8
8
|
return s instanceof ControlMessage
|
|
9
9
|
? (r.info("Not deferring since this is a ControlMessage."), !1)
|
|
10
10
|
: s instanceof InAppMessage
|
|
11
|
-
? se.m().
|
|
11
|
+
? se.m().je(s)
|
|
12
12
|
: (r.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -9,7 +9,8 @@ import { WindowUtils as eo } from "../../util/window-utils.js";
|
|
|
9
9
|
import e from "../../managers/braze-instance.js";
|
|
10
10
|
import { logger as r } from "../../../shared-lib/index.js";
|
|
11
11
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../../common/constants.js";
|
|
12
|
-
|
|
12
|
+
import { nodeScriptReplace as ct } from "../utils/in-app-message-utils.js";
|
|
13
|
+
export default function at(t, o, n, s, i, u) {
|
|
13
14
|
const c = document.createElement("iframe");
|
|
14
15
|
c.setAttribute("title", "Modal Message"),
|
|
15
16
|
i && (c.style.zIndex = (i + 1).toString());
|
|
@@ -30,7 +31,7 @@ export default function ct(t, o, n, s, i, u) {
|
|
|
30
31
|
a = () => {
|
|
31
32
|
logInAppMessageHtmlClick(t, i, o), eo.openUri(o, u, r);
|
|
32
33
|
};
|
|
33
|
-
u ? a() : t.
|
|
34
|
+
u ? a() : t.Ae(c, a);
|
|
34
35
|
} else logInAppMessageHtmlClick(t, i, o || void 0);
|
|
35
36
|
return r.stopPropagation(), !1;
|
|
36
37
|
};
|
|
@@ -67,24 +68,26 @@ export default function ct(t, o, n, s, i, u) {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
const i = c.contentWindow;
|
|
70
|
-
i.focus()
|
|
71
|
-
const l = i.document.
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
i.focus();
|
|
72
|
+
const l = i.document.querySelector("html");
|
|
73
|
+
l && ((l.innerHTML = s ? s.innerHTML : t.message || ""), ct(l));
|
|
74
|
+
const f = i.document.getElementsByTagName("head")[0];
|
|
75
|
+
if (null != f) {
|
|
76
|
+
if (t.Ce()) {
|
|
74
77
|
const e = document.createElement("style");
|
|
75
78
|
(e.innerHTML = t.css || ""),
|
|
76
|
-
(e.id = t.
|
|
79
|
+
(e.id = t.ve() || ""),
|
|
77
80
|
null != u && e.setAttribute("nonce", u),
|
|
78
|
-
|
|
81
|
+
f.appendChild(e);
|
|
79
82
|
}
|
|
80
83
|
const e = i.document.createElement("base");
|
|
81
|
-
null != e && (e.setAttribute("target", "_parent"),
|
|
84
|
+
null != e && (e.setAttribute("target", "_parent"), f.appendChild(e));
|
|
82
85
|
}
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
+
const d = i.document.getElementsByTagName("title");
|
|
87
|
+
d && d.length > 0 && c.setAttribute("title", d[0].textContent || "");
|
|
88
|
+
const p = {
|
|
86
89
|
closeMessage: function () {
|
|
87
|
-
t.
|
|
90
|
+
t.Ae(c);
|
|
88
91
|
},
|
|
89
92
|
logClick: function () {
|
|
90
93
|
logInAppMessageHtmlClick(t, ...arguments);
|
|
@@ -102,7 +105,7 @@ export default function ct(t, o, n, s, i, u) {
|
|
|
102
105
|
});
|
|
103
106
|
};
|
|
104
107
|
},
|
|
105
|
-
|
|
108
|
+
g = {
|
|
106
109
|
requestImmediateDataFlush: function () {
|
|
107
110
|
const t = arguments;
|
|
108
111
|
import("../../Core/request-immediate-data-flush.js").then(
|
|
@@ -152,13 +155,13 @@ export default function ct(t, o, n, s, i, u) {
|
|
|
152
155
|
);
|
|
153
156
|
},
|
|
154
157
|
},
|
|
155
|
-
|
|
158
|
+
h = function (t) {
|
|
156
159
|
return function () {
|
|
157
|
-
|
|
160
|
+
g[t](...Array.prototype.slice.call(arguments));
|
|
158
161
|
};
|
|
159
162
|
};
|
|
160
|
-
for (const t of to(
|
|
161
|
-
const
|
|
163
|
+
for (const t of to(g)) p[t] = h(t);
|
|
164
|
+
const b = [
|
|
162
165
|
"setFirstName",
|
|
163
166
|
"setLastName",
|
|
164
167
|
"setEmail",
|
|
@@ -179,51 +182,51 @@ export default function ct(t, o, n, s, i, u) {
|
|
|
179
182
|
"addToSubscriptionGroup",
|
|
180
183
|
"removeFromSubscriptionGroup",
|
|
181
184
|
],
|
|
182
|
-
|
|
185
|
+
y = function (t) {
|
|
183
186
|
return function () {
|
|
184
187
|
const e = ro();
|
|
185
188
|
e && e[t](...Array.prototype.slice.call(arguments));
|
|
186
189
|
};
|
|
187
190
|
},
|
|
188
|
-
|
|
189
|
-
for (let t = 0; t <
|
|
190
|
-
|
|
191
|
-
return
|
|
191
|
+
A = {};
|
|
192
|
+
for (let t = 0; t < b.length; t++) A[b[t]] = y(b[t]);
|
|
193
|
+
p.getUser = function () {
|
|
194
|
+
return A;
|
|
192
195
|
};
|
|
193
|
-
const
|
|
194
|
-
|
|
196
|
+
const j = { showFeed: o },
|
|
197
|
+
C = function (e) {
|
|
195
198
|
return function () {
|
|
196
199
|
const o = arguments;
|
|
197
|
-
t.
|
|
198
|
-
|
|
200
|
+
t.Ae(c, function () {
|
|
201
|
+
j[e](...Array.prototype.slice.call(o));
|
|
199
202
|
});
|
|
200
203
|
};
|
|
201
204
|
},
|
|
202
|
-
|
|
203
|
-
for (const t of to(
|
|
204
|
-
const
|
|
205
|
-
|
|
205
|
+
v = p.display;
|
|
206
|
+
for (const t of to(j)) v[t] = C(t);
|
|
207
|
+
const P = { registerAppboyPushMessages: requestPushPermission() },
|
|
208
|
+
w = function (t) {
|
|
206
209
|
return function () {
|
|
207
|
-
|
|
210
|
+
P[t](...Array.prototype.slice.call(arguments));
|
|
208
211
|
};
|
|
209
212
|
},
|
|
210
|
-
|
|
211
|
-
for (const t of to(
|
|
213
|
+
E = p.web;
|
|
214
|
+
for (const t of to(P)) E[t] = w(t);
|
|
212
215
|
if (
|
|
213
|
-
((i.appboyBridge =
|
|
216
|
+
((i.appboyBridge = p), (i.brazeBridge = p), t.we !== InAppMessage.qe.$e)
|
|
214
217
|
) {
|
|
215
218
|
const t = i.document.getElementsByTagName("a");
|
|
216
219
|
for (let e = 0; e < t.length; e++) t[e].onclick = a(t[e]);
|
|
217
220
|
const e = i.document.getElementsByTagName("button");
|
|
218
221
|
for (let t = 0; t < e.length; t++) e[t].onclick = a(e[t]);
|
|
219
222
|
}
|
|
220
|
-
const
|
|
221
|
-
if (null !=
|
|
222
|
-
t.
|
|
223
|
+
const $ = i.document.body;
|
|
224
|
+
if (null != $) {
|
|
225
|
+
t.xe() && ($.id = t.htmlId || "");
|
|
223
226
|
const e = document.createElement("hidden");
|
|
224
|
-
(e.onclick =
|
|
227
|
+
(e.onclick = p.closeMessage),
|
|
225
228
|
(e.className = "ab-programmatic-close-button"),
|
|
226
|
-
|
|
229
|
+
$.appendChild(e);
|
|
227
230
|
}
|
|
228
231
|
i.dispatchEvent(new CustomEvent("ab.BridgeReady")),
|
|
229
232
|
-1 !== c.className.indexOf("ab-start-hidden") &&
|
|
@@ -236,8 +239,8 @@ export default function ct(t, o, n, s, i, u) {
|
|
|
236
239
|
) {
|
|
237
240
|
const e = document.createElement("div");
|
|
238
241
|
return (
|
|
239
|
-
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(c), (t.
|
|
242
|
+
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(c), (t.Me = e), e
|
|
240
243
|
);
|
|
241
244
|
}
|
|
242
|
-
return (t.
|
|
245
|
+
return (t.Me = c), c;
|
|
243
246
|
}
|