@braze/web-sdk 6.4.0 → 6.5.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 +6 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +30 -30
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +58 -58
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +14 -14
- package/src/Banner/banner-provider.js +95 -81
- package/src/Banner/banner.js +9 -9
- package/src/Banner/constants.js +4 -0
- package/src/Banner/display/banner-to-html.js +1 -1
- package/src/Banner/display/destroy-banner-html.js +3 -3
- package/src/Banner/display/detect-banner-impressions.js +14 -14
- package/src/Banner/get-all-banners.js +4 -4
- package/src/Banner/get-banner.js +5 -4
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +6 -6
- package/src/Banner/request-banners-refresh.js +18 -20
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Banner/ui/insert-banner.js +17 -14
- package/src/Card/card-manager-factory.js +3 -3
- package/src/Card/card-manager.js +32 -32
- package/src/Card/constants.js +1 -0
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-content-card-click.js +2 -2
- package/src/Card/log-content-card-impressions.js +5 -5
- package/src/Card/models/captioned-image.js +3 -3
- package/src/Card/models/card.js +16 -16
- package/src/Card/models/classic-card.js +3 -3
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +3 -3
- package/src/Card/util/card-factory.js +6 -6
- package/src/ContentCards/content-cards-provider-factory.js +11 -11
- package/src/ContentCards/content-cards-provider.js +110 -96
- 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 +5 -5
- 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 +4 -4
- package/src/Core/disable-sdk.js +7 -7
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +13 -13
- package/src/Core/log-purchase.js +10 -10
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-connection-core.js +23 -0
- package/src/DUST/dust-provider-factory.js +10 -8
- package/src/DUST/dust-provider.js +408 -176
- package/src/DUST/dust-shared-worker-code.js +2 -0
- package/src/DUST/dust-shared-worker-impl.js +240 -0
- package/src/DUST/dust-worker-bridge.js +136 -0
- package/src/DUST/index.js +10 -0
- package/src/DUST/subscribe-to-dust.js +13 -13
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +6 -6
- package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +98 -84
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +7 -7
- package/src/FeatureFlags/refresh-feature-flags.js +2 -2
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/constants.js +4 -0
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +40 -40
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +97 -97
- package/src/InAppMessage/log-in-app-message-button-click.js +14 -14
- package/src/InAppMessage/log-in-app-message-click.js +13 -13
- package/src/InAppMessage/log-in-app-message-html-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-impression.js +8 -8
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +17 -17
- package/src/InAppMessage/models/html-message.js +19 -19
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +121 -119
- package/src/InAppMessage/models/modal-message.js +17 -17
- package/src/InAppMessage/models/slide-up-message.js +22 -22
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +34 -34
- package/src/Push/push-manager-factory.js +14 -14
- package/src/Push/push-manager.js +90 -90
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +32 -32
- package/src/User/user.js +71 -71
- package/src/common/constants.js +8 -11
- package/src/common/content-cards-display.js +32 -32
- package/src/common/event-logger.js +10 -10
- package/src/common/properties-base.js +16 -16
- package/src/l10n/l10n-manager-factory.js +11 -11
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +14 -14
- package/src/managers/braze-instance.js +152 -152
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +153 -153
- package/src/managers/server-config-manager.js +116 -88
- package/src/managers/session-manager.js +41 -41
- package/src/managers/storage-manager-factory.js +10 -10
- package/src/managers/storage-manager.js +137 -135
- 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 +10 -10
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +17 -17
- package/src/models/push-token.js +14 -14
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +41 -37
- package/src/request-controller.js +163 -160
- 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 +8 -8
- package/src/triggers/models/filter.js +7 -7
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +47 -47
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +42 -42
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +66 -66
- 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 +8 -8
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +33 -33
- package/src/util/client-hints-parser.js +10 -10
- package/src/util/component-utils.js +5 -5
- package/src/util/dom-utils.js +13 -13
- package/src/util/html-display-utils.js +7 -7
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +5 -5
- package/src/util/request-header-utils.js +26 -26
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +16 -16
- package/src/util/window-utils.js +3 -3
|
@@ -2,182 +2,196 @@ 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
|
-
import
|
|
6
|
-
import { randomInclusive as
|
|
7
|
-
import
|
|
5
|
+
import m from "../managers/subscription-manager.js";
|
|
6
|
+
import { randomInclusive as a } from "../util/math.js";
|
|
7
|
+
import {
|
|
8
|
+
REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT as u,
|
|
9
|
+
REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT as c,
|
|
10
|
+
REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT as d,
|
|
11
|
+
} from "../common/constants.js";
|
|
12
|
+
import l from "../util/net.js";
|
|
8
13
|
import {
|
|
9
14
|
newFeatureFlagFromJson as at,
|
|
10
15
|
newFeatureFlagFromSerializedValue as ht,
|
|
11
16
|
} from "./feature-flag-factory.js";
|
|
12
17
|
import h from "../util/request-header-utils.js";
|
|
13
|
-
export default class
|
|
14
|
-
constructor(t, s,
|
|
18
|
+
export default class ar extends t {
|
|
19
|
+
constructor(t, s, i, e) {
|
|
15
20
|
super(),
|
|
16
21
|
(this.h = t),
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
19
|
-
(this.C =
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
+
(this.j = s),
|
|
23
|
+
(this.B = i),
|
|
24
|
+
(this.C = e),
|
|
25
|
+
(this.Xr = []),
|
|
26
|
+
(this.Gr = 0),
|
|
22
27
|
(this.h = t),
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.C =
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
28
|
+
(this.j = s),
|
|
29
|
+
(this.B = i),
|
|
30
|
+
(this.C = e),
|
|
31
|
+
(this.Kr = null),
|
|
32
|
+
(this.Qr = new m()),
|
|
28
33
|
(this.S = 10),
|
|
29
34
|
(this.T = null),
|
|
30
35
|
(this.I = null),
|
|
31
|
-
r.q(this.
|
|
36
|
+
r.q(this.Qr);
|
|
32
37
|
}
|
|
33
38
|
N(t) {
|
|
34
39
|
var s;
|
|
35
40
|
if (
|
|
36
|
-
(null === (s = this.h) || void 0 === s ? void 0 : s.
|
|
41
|
+
(null === (s = this.h) || void 0 === s ? void 0 : s.Yr()) &&
|
|
37
42
|
null != t &&
|
|
38
43
|
t.feature_flags
|
|
39
44
|
) {
|
|
40
|
-
this.
|
|
45
|
+
this.Xr = [];
|
|
41
46
|
for (const s of t.feature_flags) {
|
|
42
47
|
const t = at(s);
|
|
43
|
-
t && this.
|
|
48
|
+
t && this.Xr.push(t);
|
|
44
49
|
}
|
|
45
|
-
(this.
|
|
50
|
+
(this.Gr = new Date().getTime()), this.Zr(), this.Qr.L(this.Xr);
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
|
|
53
|
+
ho() {
|
|
49
54
|
let t = {};
|
|
50
|
-
this.
|
|
51
|
-
const
|
|
55
|
+
this.B && (t = this.B.dt(s.ft.lo));
|
|
56
|
+
const i = {};
|
|
52
57
|
for (const s in t) {
|
|
53
|
-
const
|
|
54
|
-
|
|
58
|
+
const e = ht(t[s]);
|
|
59
|
+
e && (i[e.id] = e);
|
|
55
60
|
}
|
|
56
|
-
return
|
|
61
|
+
return i;
|
|
57
62
|
}
|
|
58
|
-
|
|
63
|
+
do() {
|
|
59
64
|
var t;
|
|
60
65
|
return (
|
|
61
|
-
(null === (t = this.
|
|
66
|
+
(null === (t = this.B) || void 0 === t ? void 0 : t.dt(s.ft.vo)) || {}
|
|
62
67
|
);
|
|
63
68
|
}
|
|
64
|
-
|
|
65
|
-
this.
|
|
69
|
+
Fo(t) {
|
|
70
|
+
this.B && this.B.bt(s.ft.vo, t);
|
|
66
71
|
}
|
|
67
|
-
|
|
68
|
-
return this.
|
|
72
|
+
It(t) {
|
|
73
|
+
return this.Qr.Rt(t);
|
|
69
74
|
}
|
|
70
|
-
refreshFeatureFlags(t, s,
|
|
75
|
+
refreshFeatureFlags(t, s, i = !1, e = !0) {
|
|
71
76
|
const r = () => {
|
|
72
|
-
"function" == typeof s && s(), this.
|
|
77
|
+
"function" == typeof s && s(), this.Qr.L(this.Xr);
|
|
73
78
|
};
|
|
74
|
-
if (!this.
|
|
79
|
+
if (!this.po(i))
|
|
75
80
|
return (
|
|
76
|
-
!this.
|
|
81
|
+
!this.Kr &&
|
|
77
82
|
this.h &&
|
|
78
|
-
(this.
|
|
83
|
+
(this.Kr = this.h.jo(() => {
|
|
79
84
|
this.refreshFeatureFlags(t, s);
|
|
80
85
|
})),
|
|
81
86
|
void r()
|
|
82
87
|
);
|
|
83
|
-
const o = this.
|
|
88
|
+
const o = this.j;
|
|
84
89
|
if (!o) return void r();
|
|
85
|
-
|
|
90
|
+
e && this.X();
|
|
86
91
|
const n = o.$({}, !0),
|
|
87
|
-
|
|
88
|
-
let
|
|
92
|
+
f = o.A(n, h.H.wo);
|
|
93
|
+
let m = !1;
|
|
89
94
|
o.J(
|
|
90
95
|
n,
|
|
91
|
-
(
|
|
92
|
-
const o = this.
|
|
96
|
+
(e = -1) => {
|
|
97
|
+
const o = this.j;
|
|
93
98
|
if (!o) return void r();
|
|
94
|
-
const
|
|
95
|
-
h.K(this.
|
|
96
|
-
-1 !==
|
|
97
|
-
|
|
99
|
+
const v = new Date().valueOf();
|
|
100
|
+
h.K(this.B, h.H.wo, v),
|
|
101
|
+
-1 !== e && f.push(["X-Braze-Req-Tokens-Remaining", e.toString()]),
|
|
102
|
+
l.O({
|
|
98
103
|
url: `${o.V()}/feature_flags/sync`,
|
|
99
|
-
headers:
|
|
104
|
+
headers: f,
|
|
100
105
|
data: n,
|
|
101
106
|
W: (s) => {
|
|
102
|
-
if (!o.Y(n, s,
|
|
103
|
-
o.Z(), this.N(s), (
|
|
107
|
+
if (!o.Y(n, s, f)) return (m = !0), void r();
|
|
108
|
+
o.Z(), this.N(s), (m = !1), "function" == typeof t && t();
|
|
104
109
|
},
|
|
105
110
|
error: (t) => {
|
|
106
|
-
o._(t, "retrieving feature flags"), (
|
|
111
|
+
o._(t, "retrieving feature flags"), (m = !0), r();
|
|
107
112
|
},
|
|
108
|
-
tt: (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
tt: (e, r) => {
|
|
114
|
+
var n, l, f;
|
|
115
|
+
let v;
|
|
116
|
+
if (m) {
|
|
117
|
+
const t =
|
|
118
|
+
(null === (n = this.h) || void 0 === n ? void 0 : n.st()) ||
|
|
119
|
+
c,
|
|
120
|
+
s =
|
|
121
|
+
(null === (l = this.h) || void 0 === l ? void 0 : l.it()) ||
|
|
122
|
+
d,
|
|
123
|
+
i =
|
|
124
|
+
(null === (f = this.h) || void 0 === f ? void 0 : f.nt()) ||
|
|
125
|
+
u;
|
|
126
|
+
let e = this.T;
|
|
127
|
+
(null == e || e < t) && (e = t), (v = Math.min(i, a(t, e * s)));
|
|
114
128
|
}
|
|
115
|
-
o.
|
|
129
|
+
o.et(
|
|
116
130
|
r,
|
|
117
131
|
() => {
|
|
118
|
-
this.refreshFeatureFlags(t, s,
|
|
132
|
+
this.refreshFeatureFlags(t, s, i, !0);
|
|
119
133
|
},
|
|
120
|
-
h.H.
|
|
121
|
-
(t) => this.
|
|
134
|
+
h.H.wo,
|
|
135
|
+
(t) => this.rt(t),
|
|
122
136
|
() => this.X(),
|
|
123
|
-
|
|
137
|
+
v,
|
|
124
138
|
);
|
|
125
139
|
},
|
|
126
140
|
});
|
|
127
141
|
},
|
|
128
|
-
h.H.
|
|
142
|
+
h.H.wo,
|
|
129
143
|
s,
|
|
130
144
|
);
|
|
131
145
|
}
|
|
132
146
|
X() {
|
|
133
147
|
null != this.I && (clearTimeout(this.I), (this.I = null));
|
|
134
148
|
}
|
|
135
|
-
|
|
149
|
+
rt(t) {
|
|
136
150
|
this.X(), (this.I = t);
|
|
137
151
|
}
|
|
138
|
-
|
|
152
|
+
po(t) {
|
|
139
153
|
if (!this.h) return !1;
|
|
140
154
|
if (!t) {
|
|
141
|
-
const t = this.h.
|
|
155
|
+
const t = this.h.yo();
|
|
142
156
|
if (null == t) return !1;
|
|
143
157
|
let s = !1;
|
|
144
158
|
if (!isNaN(t)) {
|
|
145
159
|
if (-1 === t) return E.info("Feature flag refreshes not allowed"), !1;
|
|
146
|
-
s = new Date().getTime() >= (this.
|
|
160
|
+
s = new Date().getTime() >= (this.Gr || 0) + 1e3 * t;
|
|
147
161
|
}
|
|
148
162
|
if (!s)
|
|
149
163
|
return (
|
|
150
164
|
E.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
151
165
|
);
|
|
152
166
|
}
|
|
153
|
-
return this.h.
|
|
167
|
+
return this.h.Yr();
|
|
154
168
|
}
|
|
155
|
-
|
|
169
|
+
bo() {
|
|
156
170
|
var t;
|
|
157
171
|
return (
|
|
158
|
-
(null === (t = this.
|
|
172
|
+
(null === (t = this.B) || void 0 === t ? void 0 : t.dt(s.ft.Co)) || null
|
|
159
173
|
);
|
|
160
174
|
}
|
|
161
|
-
|
|
162
|
-
var t,
|
|
163
|
-
null === (t = this.
|
|
175
|
+
Ro() {
|
|
176
|
+
var t, i;
|
|
177
|
+
null === (t = this.B) ||
|
|
164
178
|
void 0 === t ||
|
|
165
|
-
t.
|
|
179
|
+
t.bt(s.ft.Co, null === (i = this.C) || void 0 === i ? void 0 : i.yt());
|
|
166
180
|
}
|
|
167
|
-
|
|
181
|
+
To() {
|
|
168
182
|
var t;
|
|
169
|
-
const s = null === (t = this.C) || void 0 === t ? void 0 : t.
|
|
170
|
-
|
|
171
|
-
return null ==
|
|
183
|
+
const s = null === (t = this.C) || void 0 === t ? void 0 : t.yt(),
|
|
184
|
+
i = this.bo();
|
|
185
|
+
return null == i || s === i;
|
|
172
186
|
}
|
|
173
|
-
|
|
174
|
-
if (!this.
|
|
187
|
+
Zr() {
|
|
188
|
+
if (!this.B) return;
|
|
175
189
|
const t = {};
|
|
176
|
-
for (const s of this.
|
|
177
|
-
const
|
|
178
|
-
t[s.id] =
|
|
190
|
+
for (const s of this.Xr) {
|
|
191
|
+
const i = s.gt();
|
|
192
|
+
t[s.id] = i;
|
|
179
193
|
}
|
|
180
|
-
this.
|
|
194
|
+
this.B.bt(s.ft.lo, t), this.B.bt(s.ft.Do, this.Gr), this.Ro();
|
|
181
195
|
}
|
|
182
196
|
changeUser() {
|
|
183
197
|
this.X();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import lr from "./feature-flags-provider-factory.js";
|
|
3
3
|
export function getAllFeatureFlags() {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const t = [],
|
|
6
6
|
e = r.l();
|
|
7
|
-
if (e && !e.
|
|
8
|
-
const n =
|
|
7
|
+
if (e && !e.Yr()) return t;
|
|
8
|
+
const n = lr.o().ho();
|
|
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 lr from "./feature-flags-provider-factory.js";
|
|
3
3
|
export function getFeatureFlag(t) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const e = r.l();
|
|
6
|
-
if (e && !e.
|
|
7
|
-
const n =
|
|
6
|
+
if (e && !e.Yr()) return null;
|
|
7
|
+
const n = lr.o().ho();
|
|
8
8
|
return n[t] ? n[t] : null;
|
|
9
9
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { logger as E, EventTypes as
|
|
2
|
-
import
|
|
1
|
+
import { logger as E, EventTypes as f } from "../../shared-lib/index.js";
|
|
2
|
+
import v from "../common/event-logger.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
|
-
import
|
|
4
|
+
import lr 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 =
|
|
10
|
+
o = lr.o().ho();
|
|
11
11
|
if (!o[e]) return E.info(t), !1;
|
|
12
12
|
const n = o[e].trackingString;
|
|
13
13
|
if (!n) return E.info(t), !1;
|
|
14
|
-
const i =
|
|
14
|
+
const i = lr.o().do();
|
|
15
15
|
if (i[n])
|
|
16
16
|
return (
|
|
17
17
|
E.info(
|
|
@@ -19,7 +19,7 @@ export function logFeatureFlagImpression(e) {
|
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
(i[n] = !0),
|
|
22
|
+
(i[n] = !0), lr.o().Fo(i);
|
|
23
23
|
const s = { fid: e, fts: n };
|
|
24
|
-
return
|
|
24
|
+
return v.lt(f.xo, s).W;
|
|
25
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import lr from "./feature-flags-provider-factory.js";
|
|
3
3
|
function fr(e, t, a = !1) {
|
|
4
|
-
if (r.rr()) return
|
|
4
|
+
if (r.rr()) return lr.o().refreshFeatureFlags(e, t, a);
|
|
5
5
|
}
|
|
6
6
|
export function refreshFeatureFlags(r, e) {
|
|
7
7
|
fr(r, e);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import lr 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 = lr.o();
|
|
7
|
+
if (e.To()) {
|
|
8
8
|
const r = getAllFeatureFlags();
|
|
9
9
|
r && "function" == typeof t && t(r);
|
|
10
10
|
}
|
|
11
|
-
return e.
|
|
11
|
+
return e.It(t);
|
|
12
12
|
}
|
|
@@ -2,12 +2,12 @@ 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
4
|
import { logger as E } from "../../shared-lib/index.js";
|
|
5
|
-
import
|
|
5
|
+
import je 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
|
-
?
|
|
11
|
+
? je.ra().fn(e)
|
|
12
12
|
: (E.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -2,7 +2,7 @@ import FullScreenMessage from "../models/full-screen-message.js";
|
|
|
2
2
|
import HtmlMessage from "../models/html-message.js";
|
|
3
3
|
import ModalMessage from "../models/modal-message.js";
|
|
4
4
|
import SlideUpMessage from "../models/slide-up-message.js";
|
|
5
|
-
export default function
|
|
5
|
+
export default function be(e) {
|
|
6
6
|
let s = "";
|
|
7
7
|
return (
|
|
8
8
|
e.animateIn && (s += " ab-animate-in"),
|
|
@@ -15,10 +15,10 @@ export default function ct(t, e, o, s, n) {
|
|
|
15
15
|
s.focus();
|
|
16
16
|
const l = s.document.getElementsByTagName("head")[0];
|
|
17
17
|
if (null != l) {
|
|
18
|
-
if (t.
|
|
18
|
+
if (t.Mo()) {
|
|
19
19
|
const e = document.createElement("style");
|
|
20
20
|
(e.innerHTML = t.css || ""),
|
|
21
|
-
(e.id = t.
|
|
21
|
+
(e.id = t.Oo() || ""),
|
|
22
22
|
null != n && e.setAttribute("nonce", n),
|
|
23
23
|
l.appendChild(e);
|
|
24
24
|
}
|
|
@@ -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.ko !== InAppMessage.Eo.Bo)
|
|
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._o() && (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.qo = e), e
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
return (t.
|
|
73
|
+
return (t.qo = i), i;
|
|
74
74
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
addPassiveEventListener as
|
|
3
|
-
buildSvg as
|
|
4
|
-
detectSwipe as
|
|
5
|
-
DIRECTIONS as
|
|
2
|
+
addPassiveEventListener as S,
|
|
3
|
+
buildSvg as we,
|
|
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
|
-
import { isTransparent as
|
|
8
|
+
import { isTransparent as ve, toRgba as ke } from "../../util/color-utils.js";
|
|
9
9
|
import FullScreenMessage from "../models/full-screen-message.js";
|
|
10
10
|
import HtmlMessage from "../models/html-message.js";
|
|
11
11
|
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
|
-
import
|
|
18
|
-
import { logger as E, Guid as
|
|
19
|
-
import { KeyCodes as
|
|
20
|
-
export default function
|
|
21
|
-
if (((e
|
|
17
|
+
import xe from "./modal-utils.js";
|
|
18
|
+
import { logger as E, Guid as P } from "../../../shared-lib/index.js";
|
|
19
|
+
import { KeyCodes as Ce } from "../../util/key-codes.js";
|
|
20
|
+
export default function $e(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
21
|
+
if (((e.$o = 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,20 +26,20 @@ 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.zo() &&
|
|
30
30
|
((l.className += " ab-modal-interactions"),
|
|
31
31
|
l.setAttribute("tabindex", "-1")),
|
|
32
|
-
e.
|
|
33
|
-
((l.style.color =
|
|
34
|
-
(l.style.backgroundColor =
|
|
35
|
-
|
|
32
|
+
e.Mo() ||
|
|
33
|
+
((l.style.color = ke(e.textColor)),
|
|
34
|
+
(l.style.backgroundColor = ke(e.backgroundColor)),
|
|
35
|
+
ve(e.backgroundColor) && (l.className += " ab-no-shadow"));
|
|
36
36
|
const c = () => {
|
|
37
37
|
-1 !== l.className.indexOf("ab-start-hidden") &&
|
|
38
38
|
((l.className = l.className.replace("ab-start-hidden", "")),
|
|
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.Ao.Lo,
|
|
43
43
|
)
|
|
44
44
|
: o(l));
|
|
45
45
|
},
|
|
@@ -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 ===
|
|
83
|
+
if (e.keyCode === Ce.Go || e.keyCode === Ce.Ho) return o(e);
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
const d = T(
|
|
87
87
|
"Close Message",
|
|
88
|
-
e.
|
|
88
|
+
e.Mo() ? void 0 : ke(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.Io).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.Jo(o),
|
|
108
108
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
109
109
|
) {
|
|
110
110
|
f = !0;
|
|
@@ -131,9 +131,9 @@ 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.
|
|
135
|
-
((o.style.backgroundColor =
|
|
136
|
-
(o.style.color =
|
|
134
|
+
e.Mo() ||
|
|
135
|
+
((o.style.backgroundColor = ke(e.iconBackgroundColor)),
|
|
136
|
+
(o.style.color = ke(e.iconColor)));
|
|
137
137
|
const t = document.createElement("i");
|
|
138
138
|
(t.className = "fa"),
|
|
139
139
|
t.appendChild(document.createTextNode(e.icon)),
|
|
@@ -143,52 +143,52 @@ export default function le(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
143
143
|
l.appendChild(p),
|
|
144
144
|
(u.className += " ab-with-icon");
|
|
145
145
|
}
|
|
146
|
-
if ((
|
|
146
|
+
if ((S(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.Ko = P.se()), (o.id = e.Ko);
|
|
149
149
|
const t = (
|
|
150
150
|
e.headerAlignment || InAppMessage.TextAlignment.CENTER
|
|
151
151
|
).toLowerCase();
|
|
152
152
|
(o.className += " " + t + "-aligned"),
|
|
153
|
-
e.
|
|
153
|
+
e.Mo() || (o.style.color = ke(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.No();
|
|
158
|
+
return u.appendChild(g), l.appendChild(u), f || c(), (e.qo = 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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
xe.Po(e, l, a),
|
|
164
|
+
xe.Qo(l),
|
|
165
|
+
xe.So(e.Ko, l);
|
|
166
166
|
} else if (e instanceof SlideUpMessage) {
|
|
167
167
|
(l.className += " ab-slideup"),
|
|
168
168
|
l.setAttribute("tabindex", "0"),
|
|
169
169
|
l.setAttribute("role", "alert");
|
|
170
170
|
const o = l.getElementsByClassName("ab-close-button")[0];
|
|
171
171
|
if (null != o) {
|
|
172
|
-
const t =
|
|
172
|
+
const t = we(
|
|
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.Mo() ? void 0 : ke(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.de, (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.ce, (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.Uo), (a = " ab-swiped-up"))
|
|
190
|
+
: ((t = L.Vo), (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
|
}
|