@braze/web-sdk 6.0.0 → 6.1.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 +103 -33
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +22 -22
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +19 -19
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +15 -15
- package/src/Banner/banner-factory.js +2 -1
- package/src/Banner/banner-provider-factory.js +7 -7
- package/src/Banner/banner-provider.js +92 -98
- package/src/Banner/banner.js +21 -18
- package/src/Banner/display/banner-to-html.js +9 -9
- package/src/Banner/display/destroy-banner-html.js +2 -2
- package/src/Banner/display/detect-banner-impressions.js +2 -2
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +7 -7
- package/src/Banner/log-banner-click.js +7 -7
- package/src/Banner/log-banner-impressions.js +9 -9
- package/src/Banner/request-banners-refresh.js +16 -20
- package/src/Banner/subscribe-to-banners-updates.js +7 -7
- package/src/Banner/ui/insert-banner.js +6 -6
- package/src/Card/card-manager-factory.js +7 -7
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +4 -4
- package/src/Card/log-content-card-click.js +4 -4
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +68 -68
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +18 -18
- package/src/Card/util/card-factory.js +35 -35
- package/src/ContentCards/content-cards-provider-factory.js +13 -13
- package/src/ContentCards/content-cards-provider.js +136 -136
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/show-content-cards.js +7 -7
- package/src/Core/add-sdk-metadata.js +3 -3
- package/src/Core/change-user.js +7 -7
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +8 -8
- package/src/Core/enable-sdk.js +6 -6
- package/src/Core/get-device-id.js +4 -4
- package/src/Core/handle-braze-action.js +5 -5
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +10 -10
- package/src/Core/log-purchase.js +13 -13
- package/src/Core/open-session.js +10 -10
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +20 -71
- package/src/FeatureFlags/feature-flags-provider-factory.js +12 -12
- package/src/FeatureFlags/feature-flags-provider.js +87 -87
- package/src/FeatureFlags/get-all-feature-flags.js +4 -4
- package/src/FeatureFlags/get-feature-flag.js +4 -4
- package/src/FeatureFlags/log-feature-flag-impression.js +9 -9
- package/src/FeatureFlags/refresh-feature-flags.js +2 -2
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +28 -28
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +15 -15
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +100 -100
- package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
- 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 +35 -35
- package/src/InAppMessage/models/html-message.js +21 -21
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +75 -75
- package/src/InAppMessage/models/modal-message.js +34 -34
- package/src/InAppMessage/models/slide-up-message.js +31 -31
- 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 +19 -19
- package/src/Push/push-manager-factory.js +9 -9
- package/src/Push/push-manager.js +118 -118
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +20 -20
- package/src/User/user.js +44 -45
- package/src/common/base-provider.js +1 -1
- package/src/common/content-cards-display.js +18 -18
- package/src/common/event-logger.js +10 -10
- package/src/common/properties-base.js +56 -0
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +143 -143
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +172 -168
- package/src/managers/server-config-manager.js +73 -73
- package/src/managers/session-manager.js +40 -40
- package/src/managers/storage-manager-factory.js +6 -6
- package/src/managers/storage-manager.js +97 -97
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +5 -5
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +13 -13
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +159 -159
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +26 -26
- 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 +37 -37
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +16 -16
- package/src/triggers/triggers-provider-factory.js +12 -12
- package/src/triggers/triggers-provider.js +61 -61
- package/src/ui/js/attach-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 +6 -6
- package/src/util/browser-detector.js +20 -13
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +1 -1
- package/src/util/deprecation-utils.js +2 -2
- package/src/util/device-constants.js +4 -4
- package/src/util/dom-utils.js +9 -9
- package/src/util/html-display-utils.js +7 -7
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +12 -12
- package/src/util/request-header-utils.js +22 -22
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +16 -16
- package/src/util/validation-utils.js +12 -12
- package/src/util/window-utils.js +2 -2
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { logger as
|
|
1
|
+
import { logger as E } from "../../shared-lib/index.js";
|
|
2
2
|
import t from "../common/base-provider.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
5
5
|
import u from "../managers/subscription-manager.js";
|
|
6
|
-
import { randomInclusive as
|
|
7
|
-
import
|
|
6
|
+
import { randomInclusive as l } from "../util/math.js";
|
|
7
|
+
import a from "../util/net.js";
|
|
8
8
|
import {
|
|
9
9
|
newFeatureFlagFromJson as at,
|
|
10
10
|
newFeatureFlagFromSerializedValue as ht,
|
|
11
11
|
} from "./feature-flag-factory.js";
|
|
12
12
|
import h from "../util/request-header-utils.js";
|
|
13
|
-
export default class
|
|
13
|
+
export default class tr extends t {
|
|
14
14
|
constructor(t, s, e, i) {
|
|
15
15
|
super(),
|
|
16
|
-
(this.
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
16
|
+
(this.h = t),
|
|
17
|
+
(this.B = s),
|
|
18
|
+
(this.j = e),
|
|
19
|
+
(this.C = i),
|
|
20
|
+
(this.he = []),
|
|
21
|
+
(this.je = 0),
|
|
22
|
+
(this.h = t),
|
|
23
|
+
(this.B = s),
|
|
24
|
+
(this.j = e),
|
|
25
|
+
(this.C = i),
|
|
26
|
+
(this.ye = null),
|
|
27
|
+
(this.Ce = new u()),
|
|
28
|
+
(this.S = 10),
|
|
29
|
+
(this.T = null),
|
|
29
30
|
(this.I = null),
|
|
30
|
-
(this.
|
|
31
|
-
r.F(this.Ue);
|
|
31
|
+
r.q(this.Ce);
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
N(t) {
|
|
34
34
|
var s;
|
|
35
35
|
if (
|
|
36
|
-
(null === (s = this.
|
|
36
|
+
(null === (s = this.h) || void 0 === s ? void 0 : s.Re()) &&
|
|
37
37
|
null != t &&
|
|
38
38
|
t.feature_flags
|
|
39
39
|
) {
|
|
40
|
-
this.
|
|
40
|
+
this.he = [];
|
|
41
41
|
for (const s of t.feature_flags) {
|
|
42
42
|
const t = at(s);
|
|
43
|
-
t && this.
|
|
43
|
+
t && this.he.push(t);
|
|
44
44
|
}
|
|
45
|
-
(this.
|
|
45
|
+
(this.je = new Date().getTime()), this.Te(), this.Ce.L(this.he);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
De() {
|
|
49
49
|
let t = {};
|
|
50
|
-
this.
|
|
50
|
+
this.j && (t = this.j.lt(s.ct.Ie));
|
|
51
51
|
const e = {};
|
|
52
52
|
for (const s in t) {
|
|
53
53
|
const i = ht(t[s]);
|
|
@@ -55,134 +55,134 @@ export default class ir extends t {
|
|
|
55
55
|
}
|
|
56
56
|
return e;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
Se() {
|
|
59
59
|
var t;
|
|
60
60
|
return (
|
|
61
|
-
(null === (t = this.
|
|
61
|
+
(null === (t = this.j) || void 0 === t ? void 0 : t.lt(s.ct.qe)) || {}
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
this.
|
|
64
|
+
Ne(t) {
|
|
65
|
+
this.j && this.j.ft(s.ct.qe, t);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
return this.
|
|
67
|
+
St(t) {
|
|
68
|
+
return this.Ce.wt(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.Ce.L(this.he);
|
|
73
73
|
};
|
|
74
|
-
if (!this.
|
|
74
|
+
if (!this.ze(e))
|
|
75
75
|
return (
|
|
76
|
-
!this.
|
|
77
|
-
this.
|
|
78
|
-
(this.
|
|
76
|
+
!this.ye &&
|
|
77
|
+
this.h &&
|
|
78
|
+
(this.ye = this.h.Ue(() => {
|
|
79
79
|
this.refreshFeatureFlags(t, s);
|
|
80
80
|
})),
|
|
81
81
|
void r()
|
|
82
82
|
);
|
|
83
|
-
const o = this.
|
|
83
|
+
const o = this.B;
|
|
84
84
|
if (!o) return void r();
|
|
85
|
-
i && this.
|
|
86
|
-
const n = o
|
|
87
|
-
u = o.
|
|
85
|
+
i && this.X();
|
|
86
|
+
const n = o.$({}, !0),
|
|
87
|
+
u = o.A(n, h.H.$e);
|
|
88
88
|
let f = !1;
|
|
89
|
-
o.
|
|
89
|
+
o.J(
|
|
90
90
|
n,
|
|
91
91
|
(i = -1) => {
|
|
92
|
-
const o = this.
|
|
92
|
+
const o = this.B;
|
|
93
93
|
if (!o) return void r();
|
|
94
94
|
const c = new Date().valueOf();
|
|
95
|
-
h.
|
|
95
|
+
h.K(this.j, h.H.$e, c),
|
|
96
96
|
-1 !== i && u.push(["X-Braze-Req-Tokens-Remaining", i.toString()]),
|
|
97
|
-
|
|
98
|
-
url: `${o.
|
|
97
|
+
a.O({
|
|
98
|
+
url: `${o.V()}/feature_flags/sync`,
|
|
99
99
|
headers: u,
|
|
100
100
|
data: n,
|
|
101
|
-
|
|
102
|
-
if (!o.
|
|
103
|
-
o.
|
|
101
|
+
W: (s) => {
|
|
102
|
+
if (!o.Y(n, s, u)) return (f = !0), void r();
|
|
103
|
+
o.Z(), this.N(s), (f = !1), "function" == typeof t && t();
|
|
104
104
|
},
|
|
105
105
|
error: (t) => {
|
|
106
|
-
o.
|
|
106
|
+
o._(t, "retrieving feature flags"), (f = !0), r();
|
|
107
107
|
},
|
|
108
|
-
|
|
109
|
-
let
|
|
108
|
+
tt: (i, r) => {
|
|
109
|
+
let a;
|
|
110
110
|
if (f) {
|
|
111
|
-
let t = this.
|
|
112
|
-
(null == t || t < 1e3 * this.
|
|
113
|
-
(
|
|
111
|
+
let t = this.T;
|
|
112
|
+
(null == t || t < 1e3 * this.S) && (t = 1e3 * this.S),
|
|
113
|
+
(a = Math.min(3e5, l(1e3 * this.S, 3 * t)));
|
|
114
114
|
}
|
|
115
|
-
o.
|
|
115
|
+
o.st(
|
|
116
116
|
r,
|
|
117
117
|
() => {
|
|
118
118
|
this.refreshFeatureFlags(t, s, e, !0);
|
|
119
119
|
},
|
|
120
|
-
h.
|
|
121
|
-
(t) => this.
|
|
122
|
-
() => this.
|
|
123
|
-
|
|
120
|
+
h.H.$e,
|
|
121
|
+
(t) => this.it(t),
|
|
122
|
+
() => this.X(),
|
|
123
|
+
a,
|
|
124
124
|
);
|
|
125
125
|
},
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
|
-
h.
|
|
128
|
+
h.H.$e,
|
|
129
129
|
s,
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
null != this.
|
|
132
|
+
X() {
|
|
133
|
+
null != this.I && (clearTimeout(this.I), (this.I = null));
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
this.
|
|
135
|
+
it(t) {
|
|
136
|
+
this.X(), (this.I = t);
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
if (!this.
|
|
138
|
+
ze(t) {
|
|
139
|
+
if (!this.h) return !1;
|
|
140
140
|
if (!t) {
|
|
141
|
-
const t = this.
|
|
141
|
+
const t = this.h.ke();
|
|
142
142
|
if (null == t) return !1;
|
|
143
143
|
let s = !1;
|
|
144
144
|
if (!isNaN(t)) {
|
|
145
|
-
if (-1 === t) return
|
|
146
|
-
s = new Date().getTime() >= (this.
|
|
145
|
+
if (-1 === t) return E.info("Feature flag refreshes not allowed"), !1;
|
|
146
|
+
s = new Date().getTime() >= (this.je || 0) + 1e3 * t;
|
|
147
147
|
}
|
|
148
148
|
if (!s)
|
|
149
149
|
return (
|
|
150
|
-
|
|
150
|
+
E.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
|
-
return this.
|
|
153
|
+
return this.h.Re();
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
Be() {
|
|
156
156
|
var t;
|
|
157
157
|
return (
|
|
158
|
-
(null === (t = this.
|
|
158
|
+
(null === (t = this.j) || void 0 === t ? void 0 : t.lt(s.ct.Me)) || null
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
Xe() {
|
|
162
162
|
var t, e;
|
|
163
|
-
null === (t = this.
|
|
163
|
+
null === (t = this.j) ||
|
|
164
164
|
void 0 === t ||
|
|
165
|
-
t.
|
|
165
|
+
t.ft(s.ct.Me, null === (e = this.C) || void 0 === e ? void 0 : e.bt());
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
_e() {
|
|
168
168
|
var t;
|
|
169
|
-
const s = null === (t = this.
|
|
170
|
-
e = this.
|
|
169
|
+
const s = null === (t = this.C) || void 0 === t ? void 0 : t.bt(),
|
|
170
|
+
e = this.Be();
|
|
171
171
|
return null == e || s === e;
|
|
172
172
|
}
|
|
173
|
-
|
|
174
|
-
if (!this.
|
|
173
|
+
Te() {
|
|
174
|
+
if (!this.j) return;
|
|
175
175
|
const t = {};
|
|
176
|
-
for (const s of this.
|
|
177
|
-
const e = s.
|
|
176
|
+
for (const s of this.he) {
|
|
177
|
+
const e = s.dt();
|
|
178
178
|
t[s.id] = e;
|
|
179
179
|
}
|
|
180
|
-
this.
|
|
180
|
+
this.j.ft(s.ct.Ie, t), this.j.ft(s.ct.Ae, this.je), this.Xe();
|
|
181
181
|
}
|
|
182
182
|
changeUser() {
|
|
183
|
-
this.
|
|
183
|
+
this.X();
|
|
184
184
|
}
|
|
185
185
|
clearData() {
|
|
186
|
-
this.
|
|
186
|
+
this.X();
|
|
187
187
|
}
|
|
188
188
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
3
3
|
export function getAllFeatureFlags() {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const t = [],
|
|
6
|
-
e = r.
|
|
7
|
-
if (e && !e.
|
|
8
|
-
const n =
|
|
6
|
+
e = r.l();
|
|
7
|
+
if (e && !e.Re()) return t;
|
|
8
|
+
const n = nr.o().De();
|
|
9
9
|
for (const r in n) t.push(n[r]);
|
|
10
10
|
return t;
|
|
11
11
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
3
3
|
export function getFeatureFlag(t) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const e = r.
|
|
6
|
-
if (e && !e.
|
|
7
|
-
const n =
|
|
5
|
+
const e = r.l();
|
|
6
|
+
if (e && !e.Re()) return null;
|
|
7
|
+
const n = nr.o().De();
|
|
8
8
|
return n[t] ? n[t] : null;
|
|
9
9
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { logger as
|
|
1
|
+
import { logger as E, EventTypes as m } from "../../shared-lib/index.js";
|
|
2
2
|
import c from "../common/event-logger.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
|
-
import
|
|
4
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
5
5
|
export function logFeatureFlagImpression(e) {
|
|
6
6
|
if (!r.rr()) return;
|
|
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 =
|
|
11
|
-
if (!o[e]) return
|
|
10
|
+
o = nr.o().De();
|
|
11
|
+
if (!o[e]) return E.info(t), !1;
|
|
12
12
|
const n = o[e].trackingString;
|
|
13
|
-
if (!n) return
|
|
14
|
-
const i =
|
|
13
|
+
if (!n) return E.info(t), !1;
|
|
14
|
+
const i = nr.o().Se();
|
|
15
15
|
if (i[n])
|
|
16
16
|
return (
|
|
17
|
-
|
|
17
|
+
E.info(
|
|
18
18
|
"Not logging another feature flag impression. This ID was already logged this session.",
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
(i[n] = !0),
|
|
22
|
+
(i[n] = !0), nr.o().Ne(i);
|
|
23
23
|
const s = { fid: e, fts: n };
|
|
24
|
-
return c.
|
|
24
|
+
return c.rt(m.Fr, s).W;
|
|
25
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
3
3
|
function ar(e, t, a = !1) {
|
|
4
|
-
if (r.rr()) return
|
|
4
|
+
if (r.rr()) return nr.o().refreshFeatureFlags(e, t, a);
|
|
5
5
|
}
|
|
6
6
|
export function refreshFeatureFlags(r, e) {
|
|
7
7
|
ar(r, e);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
3
3
|
import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
4
4
|
export function subscribeToFeatureFlagsUpdates(t) {
|
|
5
5
|
if (!r.rr()) return;
|
|
6
|
-
const e =
|
|
7
|
-
if (e.
|
|
6
|
+
const e = nr.o();
|
|
7
|
+
if (e._e()) {
|
|
8
8
|
const r = getAllFeatureFlags();
|
|
9
9
|
r && "function" == typeof t && t(r);
|
|
10
10
|
}
|
|
11
|
-
return e.
|
|
11
|
+
return e.St(t);
|
|
12
12
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import InAppMessage from "./models/in-app-message.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
3
|
import ControlMessage from "./models/control-message.js";
|
|
4
|
-
import { logger as
|
|
4
|
+
import { logger as E } from "../../shared-lib/index.js";
|
|
5
5
|
import se from "./in-app-message-manager-factory.js";
|
|
6
6
|
export function deferInAppMessage(e) {
|
|
7
7
|
if (r.rr())
|
|
8
8
|
return e instanceof ControlMessage
|
|
9
|
-
? (
|
|
9
|
+
? (E.info("Not deferring since this is a ControlMessage."), !1)
|
|
10
10
|
: e instanceof InAppMessage
|
|
11
|
-
? se.ea().
|
|
12
|
-
: (
|
|
11
|
+
? se.ea().Ee(e)
|
|
12
|
+
: (E.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -2,23 +2,23 @@ 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
4
|
import { buildHtmlClickHandler as lt } from "./html-message-display-utils.js";
|
|
5
|
-
import { attachHtmlToIframeWithNonce as
|
|
6
|
-
import { buildBrazeBridge as
|
|
5
|
+
import { attachHtmlToIframeWithNonce as b } from "../../util/html-display-utils.js";
|
|
6
|
+
import { buildBrazeBridge as N } from "../../util/html-display-utils.js";
|
|
7
7
|
export default function ct(t, e, o, s, n) {
|
|
8
8
|
const i = document.createElement("iframe");
|
|
9
9
|
i.setAttribute("title", "Modal Message"),
|
|
10
10
|
s && (i.style.zIndex = (s + 1).toString());
|
|
11
11
|
if (
|
|
12
|
-
(
|
|
12
|
+
(b(i, t.message, n),
|
|
13
13
|
(i.onload = () => {
|
|
14
14
|
const s = i.contentWindow;
|
|
15
15
|
s.focus();
|
|
16
16
|
const l = s.document.getElementsByTagName("head")[0];
|
|
17
17
|
if (null != l) {
|
|
18
|
-
if (t.
|
|
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.Ge() || ""),
|
|
22
22
|
null != n && e.setAttribute("nonce", n),
|
|
23
23
|
l.appendChild(e);
|
|
24
24
|
}
|
|
@@ -30,7 +30,7 @@ export default function ct(t, e, o, s, n) {
|
|
|
30
30
|
const r = Object.assign(
|
|
31
31
|
Object.assign(
|
|
32
32
|
{},
|
|
33
|
-
|
|
33
|
+
N(i, (e, o) => t.ll(e, o)),
|
|
34
34
|
),
|
|
35
35
|
{
|
|
36
36
|
closeMessage: function () {
|
|
@@ -42,7 +42,7 @@ export default function ct(t, e, o, s, n) {
|
|
|
42
42
|
},
|
|
43
43
|
);
|
|
44
44
|
if (
|
|
45
|
-
((s.appboyBridge = r), (s.brazeBridge = r), t.
|
|
45
|
+
((s.appboyBridge = r), (s.brazeBridge = r), t.He !== InAppMessage.Ke.Je)
|
|
46
46
|
) {
|
|
47
47
|
const e = s.document.getElementsByTagName("a");
|
|
48
48
|
for (let s = 0; s < e.length; s++) e[s].onclick = lt(t, i, e[s], o);
|
|
@@ -51,7 +51,7 @@ export default function ct(t, e, o, s, n) {
|
|
|
51
51
|
}
|
|
52
52
|
const c = s.document.body;
|
|
53
53
|
if (null != c) {
|
|
54
|
-
t.
|
|
54
|
+
t.Le() && (c.id = t.htmlId || "");
|
|
55
55
|
const e = document.createElement("hidden");
|
|
56
56
|
(e.onclick = r.closeMessage),
|
|
57
57
|
(e.className = "ab-programmatic-close-button"),
|
|
@@ -67,8 +67,8 @@ export default function ct(t, e, o, s, n) {
|
|
|
67
67
|
) {
|
|
68
68
|
const e = document.createElement("div");
|
|
69
69
|
return (
|
|
70
|
-
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(i), (t.
|
|
70
|
+
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(i), (t.Pe = e), e
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
return (t.
|
|
73
|
+
return (t.Pe = i), i;
|
|
74
74
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addPassiveEventListener as J,
|
|
3
3
|
buildSvg as oe,
|
|
4
|
-
detectSwipe as
|
|
5
|
-
DIRECTIONS as
|
|
4
|
+
detectSwipe as K,
|
|
5
|
+
DIRECTIONS as L,
|
|
6
6
|
} from "../../util/dom-utils.js";
|
|
7
7
|
import { createCloseButton as T } from "../../util/component-utils.js";
|
|
8
8
|
import { isTransparent as te, toRgba as ae } from "../../util/color-utils.js";
|
|
@@ -12,13 +12,13 @@ import InAppMessage from "../models/in-app-message.js";
|
|
|
12
12
|
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
|
-
import { _handleBrazeAction as
|
|
15
|
+
import { _handleBrazeAction as O } from "../../Core/handle-braze-action.js";
|
|
16
16
|
import ct from "./html-message-to-html.js";
|
|
17
17
|
import ne from "./modal-utils.js";
|
|
18
|
-
import { logger as
|
|
18
|
+
import { logger as E, Guid as P } from "../../../shared-lib/index.js";
|
|
19
19
|
import { KeyCodes as ie } from "../../util/key-codes.js";
|
|
20
20
|
export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
21
|
-
if (((e.
|
|
21
|
+
if (((e.Qe = document.activeElement), e instanceof HtmlMessage))
|
|
22
22
|
return ct(e, o, a, n, i);
|
|
23
23
|
const l = (function (e, o, t, a, n, i = document.body, s = "ltr") {
|
|
24
24
|
let m = null;
|
|
@@ -26,10 +26,10 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
26
26
|
(l.dir = s),
|
|
27
27
|
(l.className = "ab-in-app-message ab-start-hidden ab-background"),
|
|
28
28
|
n && (l.style.zIndex = (n + 1).toString()),
|
|
29
|
-
e.
|
|
29
|
+
e.Ve() &&
|
|
30
30
|
((l.className += " ab-modal-interactions"),
|
|
31
31
|
l.setAttribute("tabindex", "-1")),
|
|
32
|
-
e.
|
|
32
|
+
e.Oe() ||
|
|
33
33
|
((l.style.color = ae(e.textColor)),
|
|
34
34
|
(l.style.backgroundColor = ae(e.backgroundColor)),
|
|
35
35
|
te(e.backgroundColor) && (l.className += " ab-no-shadow"));
|
|
@@ -39,7 +39,7 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
39
39
|
document.querySelectorAll(".ab-iam-img-loading").length > 0
|
|
40
40
|
? t(
|
|
41
41
|
`Cannot show in-app message ${e.message} because another message is being shown.`,
|
|
42
|
-
InAppMessage.
|
|
42
|
+
InAppMessage.Ye.We,
|
|
43
43
|
)
|
|
44
44
|
: o(l));
|
|
45
45
|
},
|
|
@@ -52,7 +52,7 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
52
52
|
m && (clearTimeout(m), (m = null)),
|
|
53
53
|
o
|
|
54
54
|
? c()
|
|
55
|
-
:
|
|
55
|
+
: E.error(
|
|
56
56
|
`Cannot show in-app message ${e.message} because the image failed to load.`,
|
|
57
57
|
));
|
|
58
58
|
};
|
|
@@ -69,7 +69,7 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
69
69
|
e.ll(l, () => {
|
|
70
70
|
logInAppMessageClick(e),
|
|
71
71
|
e.clickAction === InAppMessage.ClickAction.URI &&
|
|
72
|
-
|
|
72
|
+
O(
|
|
73
73
|
e.uri || "",
|
|
74
74
|
a || e.openTarget === InAppMessage.OpenTarget.BLANK,
|
|
75
75
|
o,
|
|
@@ -80,12 +80,12 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
80
80
|
);
|
|
81
81
|
(l.onclick = o),
|
|
82
82
|
l.addEventListener("keydown", (e) => {
|
|
83
|
-
if (e.keyCode === ie.
|
|
83
|
+
if (e.keyCode === ie.Ze || e.keyCode === ie.lo) return o(e);
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
const d = T(
|
|
87
87
|
"Close Message",
|
|
88
|
-
e.
|
|
88
|
+
e.Oe() ? void 0 : ae(e.closeButtonColor),
|
|
89
89
|
() => {
|
|
90
90
|
e.ll(l);
|
|
91
91
|
},
|
|
@@ -96,7 +96,7 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
96
96
|
(u.className = "ab-message-text"),
|
|
97
97
|
(u.dir = s),
|
|
98
98
|
u.setAttribute("role", "article");
|
|
99
|
-
const b = (e.messageAlignment || e.
|
|
99
|
+
const b = (e.messageAlignment || e.do).toLowerCase();
|
|
100
100
|
u.className += " " + b + "-aligned";
|
|
101
101
|
let f = !1;
|
|
102
102
|
const p = document.createElement("div");
|
|
@@ -104,7 +104,7 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
104
104
|
const o = document.createElement("img");
|
|
105
105
|
if (
|
|
106
106
|
(o.setAttribute("src", e.imageUrl),
|
|
107
|
-
e.
|
|
107
|
+
e.bo(o),
|
|
108
108
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
109
109
|
) {
|
|
110
110
|
f = !0;
|
|
@@ -131,7 +131,7 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
131
131
|
p.className += " ab-icon-area";
|
|
132
132
|
const o = document.createElement("span");
|
|
133
133
|
(o.className = "ab-icon"),
|
|
134
|
-
e.
|
|
134
|
+
e.Oe() ||
|
|
135
135
|
((o.style.backgroundColor = ae(e.iconBackgroundColor)),
|
|
136
136
|
(o.style.color = ae(e.iconColor)));
|
|
137
137
|
const t = document.createElement("i");
|
|
@@ -145,24 +145,24 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
145
145
|
}
|
|
146
146
|
if ((J(u, "touchstart"), e.header && e.header.length > 0)) {
|
|
147
147
|
const o = document.createElement("h1");
|
|
148
|
-
(o.className = "ab-message-header"), (e.
|
|
148
|
+
(o.className = "ab-message-header"), (e.po = P.oe()), (o.id = e.po);
|
|
149
149
|
const t = (
|
|
150
150
|
e.headerAlignment || InAppMessage.TextAlignment.CENTER
|
|
151
151
|
).toLowerCase();
|
|
152
152
|
(o.className += " " + t + "-aligned"),
|
|
153
|
-
e.
|
|
153
|
+
e.Oe() || (o.style.color = ae(e.headerTextColor)),
|
|
154
154
|
o.appendChild(document.createTextNode(e.header)),
|
|
155
155
|
u.appendChild(o);
|
|
156
156
|
}
|
|
157
|
-
const g = e.
|
|
158
|
-
return u.appendChild(g), l.appendChild(u), f || c(), (e.
|
|
157
|
+
const g = e.ho();
|
|
158
|
+
return u.appendChild(g), l.appendChild(u), f || c(), (e.Pe = 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";
|
|
162
162
|
(l.className += ` ${o} ab-centered`),
|
|
163
|
-
ne.
|
|
164
|
-
ne.
|
|
165
|
-
ne.
|
|
163
|
+
ne.jo(e, l, a),
|
|
164
|
+
ne.wo(l),
|
|
165
|
+
ne.vo(e.po, l);
|
|
166
166
|
} else if (e instanceof SlideUpMessage) {
|
|
167
167
|
(l.className += " ab-slideup"),
|
|
168
168
|
l.setAttribute("tabindex", "0"),
|
|
@@ -172,23 +172,23 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
172
172
|
const t = oe(
|
|
173
173
|
"0 0 11.38 19.44",
|
|
174
174
|
"M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",
|
|
175
|
-
e.
|
|
175
|
+
e.Oe() ? void 0 : ae(e.closeButtonColor),
|
|
176
176
|
);
|
|
177
177
|
t.setAttribute("class", `ab-chevron ${m}`), o.appendChild(t);
|
|
178
178
|
}
|
|
179
179
|
let t, a;
|
|
180
|
-
|
|
180
|
+
K(l, L.Zt, (e) => {
|
|
181
181
|
(l.className += " ab-swiped-left"),
|
|
182
182
|
null != o && null != o.onclick && o.onclick(e);
|
|
183
183
|
}),
|
|
184
|
-
|
|
184
|
+
K(l, L.ae, (e) => {
|
|
185
185
|
(l.className += " ab-swiped-right"),
|
|
186
186
|
null != o && null != o.onclick && o.onclick(e);
|
|
187
187
|
}),
|
|
188
188
|
e.slideFrom === InAppMessage.SlideFrom.TOP
|
|
189
|
-
? ((t =
|
|
190
|
-
: ((t =
|
|
191
|
-
|
|
189
|
+
? ((t = L.ko), (a = " ab-swiped-up"))
|
|
190
|
+
: ((t = L.xo), (a = " ab-swiped-down")),
|
|
191
|
+
K(l, t, (e) => {
|
|
192
192
|
(l.className += a), null != o && null != o.onclick && o.onclick(e);
|
|
193
193
|
});
|
|
194
194
|
}
|