@braze/web-sdk 5.1.0 → 5.2.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 +14 -8
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +18 -18
- package/shared-lib/indexed-db-adapter.js +32 -32
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +22 -21
- package/src/InAppMessage/display/html-message-to-html.js +38 -35
- package/src/InAppMessage/display/in-app-message-to-html.js +2 -2
- package/src/InAppMessage/display/modal-utils.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +21 -19
- package/src/InAppMessage/in-app-message-manager.js +58 -78
- 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 +5 -2
- package/src/InAppMessage/models/html-message.js +6 -4
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +51 -46
- package/src/InAppMessage/models/modal-message.js +5 -2
- package/src/InAppMessage/models/slide-up-message.js +33 -8
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +28 -34
- package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
- package/src/Push/push-manager-factory.js +3 -3
- 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 +17 -17
- package/src/common/base-feed.js +1 -1
- 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 +26 -26
- package/src/managers/braze-instance.js +59 -52
- package/src/managers/device-manager.js +15 -15
- package/src/managers/network-manager.js +98 -93
- package/src/managers/server-config-manager.js +9 -9
- package/src/managers/storage-manager.js +99 -96
- package/src/managers/utils.js +6 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +20 -12
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +33 -19
- package/src/models/push-token.js +4 -4
- package/src/models/server-config.js +6 -6
- package/src/request-controller.js +77 -73
- package/src/triggers/models/custom-event-data.js +2 -2
- package/src/triggers/models/custom-event-property-data.js +4 -4
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +6 -6
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- 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 +1 -1
- package/src/triggers/models/trigger-condition.js +41 -41
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +71 -82
- 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 +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +9 -8
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +2 -2
- package/src/util/device-constants.js +2 -2
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +6 -6
- package/src/util/user-agent-parser.js +5 -5
- package/src/util/validation-utils.js +2 -0
- package/src/util/window-utils.js +3 -3
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for @braze/web-sdk v5.
|
|
2
|
+
* Type definitions for @braze/web-sdk v5.2.0
|
|
3
3
|
* Project: https://github.com/braze-inc/braze-web-sdk
|
|
4
4
|
* (c) Braze, Inc. 2024 - http://braze.com
|
|
5
5
|
* License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
|
|
@@ -1289,7 +1289,8 @@ export class User {
|
|
|
1289
1289
|
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1290
1290
|
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1291
1291
|
* @param value - Can be numeric, boolean, a Date object, a string, or an array of strings. Strings are limited to
|
|
1292
|
-
* 255 characters in length, cannot begin with a
|
|
1292
|
+
* 255 characters in length, cannot begin with a $ and cannot contain new lines, tabs or double quotes.
|
|
1293
|
+
* It can only include alphanumeric characters and other punctuation.
|
|
1293
1294
|
* Passing a null value will remove this custom attribute from the user.
|
|
1294
1295
|
* @param merge - Whether the value should be merged with the existing value on the backend. If `false` (default), any existing
|
|
1295
1296
|
* attribute will be overwritten. If `true`, existing objects and arrays of objects will be merged. To update an array of objects,
|
|
@@ -1767,9 +1768,9 @@ export function toggleFeed(
|
|
|
1767
1768
|
* Additionally, if you identify a user which has never been identified on another device, the entire history of
|
|
1768
1769
|
* that user as an "anonymous" user on this device will be preserved and associated with the newly identified
|
|
1769
1770
|
* user. However, if you identify a user which *has* been identified in another app, any history which was
|
|
1770
|
-
* already flushed to the server for the anonymous user on this device will
|
|
1771
|
-
*
|
|
1772
|
-
*
|
|
1771
|
+
* already flushed to the server for the anonymous user on this device will be merged into the identified user.
|
|
1772
|
+
* Any fields that already exist on the identified user will not be overwritten, and the merge is limited
|
|
1773
|
+
* to the fields listed [here](https://www.braze.com/docs/api/endpoints/user_data/post_users_merge/).
|
|
1773
1774
|
*
|
|
1774
1775
|
* Note: Once you identify a user, you cannot revert to the "anonymous" user. The transition from anonymous to
|
|
1775
1776
|
* identified tracking is only allowed once because the initial anonymous user receives special treatment to
|
|
@@ -2088,7 +2089,7 @@ export function openSession(): void;
|
|
|
2088
2089
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2089
2090
|
*
|
|
2090
2091
|
* ```
|
|
2091
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2092
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.2/service-worker.js');
|
|
2092
2093
|
* ```
|
|
2093
2094
|
*
|
|
2094
2095
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -2394,7 +2395,7 @@ export type InitializationOptions = {
|
|
|
2394
2395
|
/**
|
|
2395
2396
|
* A numerical app version value which can be used for user segmentation. This value must be sent with four fields, such as
|
|
2396
2397
|
* "1.2.3.4", otherwise it will be ignored.
|
|
2397
|
-
*
|
|
2398
|
+
*
|
|
2398
2399
|
* Note: `appVersion` must also be set, either with the same value or a unique name for this version.
|
|
2399
2400
|
*/
|
|
2400
2401
|
appVersionNumber?: string;
|
|
@@ -2463,7 +2464,7 @@ export type InitializationOptions = {
|
|
|
2463
2464
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2464
2465
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2465
2466
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2466
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2467
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.2/service-worker.js');` or by including the content
|
|
2467
2468
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2468
2469
|
*/
|
|
2469
2470
|
manageServiceWorkerExternally?: boolean;
|
|
@@ -2515,6 +2516,11 @@ export type InitializationOptions = {
|
|
|
2515
2516
|
* default with a value of your own.
|
|
2516
2517
|
*/
|
|
2517
2518
|
sessionTimeoutInSeconds?: number;
|
|
2519
|
+
/**
|
|
2520
|
+
* By default, Braze will assign a random guid as the device ID. Provide a value for this configuration option to override that
|
|
2521
|
+
* default with a value of your own.
|
|
2522
|
+
*/
|
|
2523
|
+
deviceId?: string;
|
|
2518
2524
|
};
|
|
2519
2525
|
|
|
2520
2526
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const i = {
|
|
2
2
|
CustomEvent: "ce",
|
|
3
3
|
Pr: "p",
|
|
4
|
-
|
|
4
|
+
xu: "pc",
|
|
5
5
|
vc: "ca",
|
|
6
|
-
|
|
6
|
+
Ua: "i",
|
|
7
7
|
Ms: "ie",
|
|
8
8
|
M: "cci",
|
|
9
9
|
R: "ccic",
|
|
@@ -11,24 +11,24 @@ const i = {
|
|
|
11
11
|
F: "ccd",
|
|
12
12
|
kl: "ss",
|
|
13
13
|
xl: "se",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
Xe: "si",
|
|
15
|
+
Ve: "sc",
|
|
16
|
+
We: "sbc",
|
|
17
|
+
Cc: "sfe",
|
|
18
|
+
po: "iec",
|
|
19
|
+
Pu: "lr",
|
|
20
|
+
Mu: "uae",
|
|
21
21
|
O: "ci",
|
|
22
22
|
$: "cc",
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
Ou: "lcaa",
|
|
24
|
+
Nu: "lcar",
|
|
25
|
+
On: "inc",
|
|
26
|
+
Ln: "add",
|
|
27
|
+
Rn: "rem",
|
|
28
|
+
$n: "set",
|
|
29
|
+
Bn: "ncam",
|
|
30
|
+
Uu: "sgu",
|
|
31
31
|
Fr: "ffi",
|
|
32
32
|
},
|
|
33
|
-
or = { Br: "feed_displayed",
|
|
33
|
+
or = { Br: "feed_displayed", Ec: "content_cards_displayed" };
|
|
34
34
|
export { i as EventTypes, or as InternalEventTypes };
|
|
@@ -6,16 +6,16 @@ export default class A {
|
|
|
6
6
|
(this.database = t),
|
|
7
7
|
(this.dd = e);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
ud() {
|
|
10
10
|
if ("indexedDB" in this.parent) return this.parent.indexedDB;
|
|
11
11
|
}
|
|
12
12
|
isSupported() {
|
|
13
13
|
var t;
|
|
14
14
|
try {
|
|
15
|
-
if (null == this.
|
|
15
|
+
if (null == this.ud()) return !1;
|
|
16
16
|
{
|
|
17
17
|
const e =
|
|
18
|
-
null === (t = this.
|
|
18
|
+
null === (t = this.ud()) || void 0 === t
|
|
19
19
|
? void 0
|
|
20
20
|
: t.open("Braze IndexedDB Support Test");
|
|
21
21
|
if (
|
|
@@ -25,7 +25,7 @@ export default class A {
|
|
|
25
25
|
"undefined" != typeof window)
|
|
26
26
|
) {
|
|
27
27
|
const t = window,
|
|
28
|
-
e = t.chrome || t.browser || t.
|
|
28
|
+
e = t.chrome || t.browser || t.fd;
|
|
29
29
|
if (e && e.runtime && e.runtime.id)
|
|
30
30
|
return (
|
|
31
31
|
this.dd.info(
|
|
@@ -45,12 +45,12 @@ export default class A {
|
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
ad(t, e) {
|
|
49
49
|
var n;
|
|
50
50
|
const o =
|
|
51
|
-
null === (n = this.
|
|
51
|
+
null === (n = this.ud()) || void 0 === n
|
|
52
52
|
? void 0
|
|
53
|
-
: n.open(this.database.
|
|
53
|
+
: n.open(this.database.vd, this.database.VERSION);
|
|
54
54
|
if (null == o) return "function" == typeof e && e(), !1;
|
|
55
55
|
const i = this;
|
|
56
56
|
return (
|
|
@@ -58,7 +58,7 @@ export default class A {
|
|
|
58
58
|
var e;
|
|
59
59
|
i.dd.info(
|
|
60
60
|
"Upgrading indexedDB " +
|
|
61
|
-
i.database.
|
|
61
|
+
i.database.vd +
|
|
62
62
|
" to v" +
|
|
63
63
|
i.database.VERSION +
|
|
64
64
|
"...",
|
|
@@ -89,7 +89,7 @@ export default class A {
|
|
|
89
89
|
return (
|
|
90
90
|
i.dd.info(
|
|
91
91
|
"Could not open indexedDB " +
|
|
92
|
-
i.database.
|
|
92
|
+
i.database.vd +
|
|
93
93
|
" v" +
|
|
94
94
|
i.database.VERSION +
|
|
95
95
|
": " +
|
|
@@ -105,7 +105,7 @@ export default class A {
|
|
|
105
105
|
setItem(t, e, n, o, i) {
|
|
106
106
|
if (!this.isSupported()) return "function" == typeof i && i(), !1;
|
|
107
107
|
const r = this;
|
|
108
|
-
return this.
|
|
108
|
+
return this.ad((d) => {
|
|
109
109
|
if (!d.objectStoreNames.contains(t))
|
|
110
110
|
return (
|
|
111
111
|
r.dd.error(
|
|
@@ -114,7 +114,7 @@ export default class A {
|
|
|
114
114
|
" in " +
|
|
115
115
|
t +
|
|
116
116
|
" on indexedDB " +
|
|
117
|
-
r.database.
|
|
117
|
+
r.database.vd +
|
|
118
118
|
" - " +
|
|
119
119
|
t +
|
|
120
120
|
" is not a valid objectStore",
|
|
@@ -132,7 +132,7 @@ export default class A {
|
|
|
132
132
|
" in " +
|
|
133
133
|
t +
|
|
134
134
|
" on indexedDB " +
|
|
135
|
-
r.database.
|
|
135
|
+
r.database.vd,
|
|
136
136
|
),
|
|
137
137
|
"function" == typeof i && i();
|
|
138
138
|
}),
|
|
@@ -144,7 +144,7 @@ export default class A {
|
|
|
144
144
|
getItem(t, e, n) {
|
|
145
145
|
if (!this.isSupported()) return !1;
|
|
146
146
|
const o = this;
|
|
147
|
-
return this.
|
|
147
|
+
return this.ad((i) => {
|
|
148
148
|
if (!i.objectStoreNames.contains(t))
|
|
149
149
|
return (
|
|
150
150
|
o.dd.error(
|
|
@@ -153,7 +153,7 @@ export default class A {
|
|
|
153
153
|
" in " +
|
|
154
154
|
t +
|
|
155
155
|
" on indexedDB " +
|
|
156
|
-
o.database.
|
|
156
|
+
o.database.vd +
|
|
157
157
|
" - " +
|
|
158
158
|
t +
|
|
159
159
|
" is not a valid objectStore",
|
|
@@ -170,7 +170,7 @@ export default class A {
|
|
|
170
170
|
" in " +
|
|
171
171
|
t +
|
|
172
172
|
" on indexedDB " +
|
|
173
|
-
o.database.
|
|
173
|
+
o.database.vd,
|
|
174
174
|
);
|
|
175
175
|
}),
|
|
176
176
|
(d.onsuccess = (t) => {
|
|
@@ -183,14 +183,14 @@ export default class A {
|
|
|
183
183
|
jr(t, e, n) {
|
|
184
184
|
if (!this.isSupported()) return "function" == typeof n && n(), !1;
|
|
185
185
|
const o = this;
|
|
186
|
-
return this.
|
|
186
|
+
return this.ad((i) => {
|
|
187
187
|
if (!i.objectStoreNames.contains(t))
|
|
188
188
|
return (
|
|
189
189
|
o.dd.error(
|
|
190
190
|
"Could not retrieve last record from " +
|
|
191
191
|
t +
|
|
192
192
|
" on indexedDB " +
|
|
193
|
-
o.database.
|
|
193
|
+
o.database.vd +
|
|
194
194
|
" - " +
|
|
195
195
|
t +
|
|
196
196
|
" is not a valid objectStore",
|
|
@@ -203,7 +203,7 @@ export default class A {
|
|
|
203
203
|
const d = r.objectStore(t).openCursor(null, "prev");
|
|
204
204
|
(d.onerror = () => {
|
|
205
205
|
o.dd.error(
|
|
206
|
-
"Could not open cursor for " + t + " on indexedDB " + o.database.
|
|
206
|
+
"Could not open cursor for " + t + " on indexedDB " + o.database.vd,
|
|
207
207
|
),
|
|
208
208
|
"function" == typeof n && n();
|
|
209
209
|
}),
|
|
@@ -219,7 +219,7 @@ export default class A {
|
|
|
219
219
|
re(t, e) {
|
|
220
220
|
if (!this.isSupported()) return !1;
|
|
221
221
|
const n = this;
|
|
222
|
-
return this.
|
|
222
|
+
return this.ad((o) => {
|
|
223
223
|
if (!o.objectStoreNames.contains(t))
|
|
224
224
|
return (
|
|
225
225
|
n.dd.error(
|
|
@@ -228,7 +228,7 @@ export default class A {
|
|
|
228
228
|
" from " +
|
|
229
229
|
t +
|
|
230
230
|
" on indexedDB " +
|
|
231
|
-
n.database.
|
|
231
|
+
n.database.vd +
|
|
232
232
|
" - " +
|
|
233
233
|
t +
|
|
234
234
|
" is not a valid objectStore",
|
|
@@ -244,7 +244,7 @@ export default class A {
|
|
|
244
244
|
" from " +
|
|
245
245
|
t +
|
|
246
246
|
" on indexedDB " +
|
|
247
|
-
n.database.
|
|
247
|
+
n.database.vd,
|
|
248
248
|
);
|
|
249
249
|
};
|
|
250
250
|
});
|
|
@@ -252,14 +252,14 @@ export default class A {
|
|
|
252
252
|
Zt(t, e) {
|
|
253
253
|
if (!this.isSupported()) return !1;
|
|
254
254
|
const n = this;
|
|
255
|
-
return this.
|
|
255
|
+
return this.ad((o) => {
|
|
256
256
|
if (!o.objectStoreNames.contains(t))
|
|
257
257
|
return (
|
|
258
258
|
n.dd.error(
|
|
259
259
|
"Could not retrieve objects from " +
|
|
260
260
|
t +
|
|
261
261
|
" on indexedDB " +
|
|
262
|
-
n.database.
|
|
262
|
+
n.database.vd +
|
|
263
263
|
" - " +
|
|
264
264
|
t +
|
|
265
265
|
" is not a valid objectStore",
|
|
@@ -277,14 +277,14 @@ export default class A {
|
|
|
277
277
|
"Cursor closed midway through for " +
|
|
278
278
|
t +
|
|
279
279
|
" on indexedDB " +
|
|
280
|
-
n.database.
|
|
280
|
+
n.database.vd,
|
|
281
281
|
),
|
|
282
282
|
e(s))
|
|
283
283
|
: n.dd.error(
|
|
284
284
|
"Could not open cursor for " +
|
|
285
285
|
t +
|
|
286
286
|
" on indexedDB " +
|
|
287
|
-
n.database.
|
|
287
|
+
n.database.vd,
|
|
288
288
|
);
|
|
289
289
|
}),
|
|
290
290
|
(d.onsuccess = (t) => {
|
|
@@ -311,7 +311,7 @@ export default class A {
|
|
|
311
311
|
t.push(this.database.ss[n]);
|
|
312
312
|
}
|
|
313
313
|
const e = this;
|
|
314
|
-
return this.
|
|
314
|
+
return this.ad(function (n) {
|
|
315
315
|
const o = n.transaction(t, "readwrite");
|
|
316
316
|
o.oncomplete = () => n.close();
|
|
317
317
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -321,13 +321,13 @@ export default class A {
|
|
|
321
321
|
"Could not clear " +
|
|
322
322
|
this.source.name +
|
|
323
323
|
" on indexedDB " +
|
|
324
|
-
e.database.
|
|
324
|
+
e.database.vd,
|
|
325
325
|
);
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
328
|
o.onerror = function () {
|
|
329
329
|
e.dd.error(
|
|
330
|
-
"Could not clear object stores on indexedDB " + e.database.
|
|
330
|
+
"Could not clear object stores on indexedDB " + e.database.vd,
|
|
331
331
|
);
|
|
332
332
|
};
|
|
333
333
|
});
|
|
@@ -335,17 +335,17 @@ export default class A {
|
|
|
335
335
|
}
|
|
336
336
|
A.Yt = {
|
|
337
337
|
Qt: {
|
|
338
|
-
|
|
338
|
+
vd: "AppboyServiceWorkerAsyncStorage",
|
|
339
339
|
VERSION: 6,
|
|
340
340
|
ss: {
|
|
341
|
-
|
|
341
|
+
La: "data",
|
|
342
342
|
hr: "pushClicks",
|
|
343
343
|
cu: "pushSubscribed",
|
|
344
|
-
|
|
344
|
+
Dd: "fallbackDevice",
|
|
345
345
|
ts: "cardUpdates",
|
|
346
346
|
ae: "optOut",
|
|
347
347
|
wr: "pendingData",
|
|
348
|
-
|
|
348
|
+
jh: "sdkAuthenticationSignature",
|
|
349
349
|
},
|
|
350
350
|
ie: 1,
|
|
351
351
|
},
|
package/shared-lib/logger.js
CHANGED
|
@@ -24,13 +24,13 @@ const r = {
|
|
|
24
24
|
},
|
|
25
25
|
warn: function (n) {
|
|
26
26
|
if (r.zg) {
|
|
27
|
-
const o = "Braze SDK Warning: " + n + " (v5.
|
|
27
|
+
const o = "Braze SDK Warning: " + n + " (v5.2.0)";
|
|
28
28
|
null != r.dd ? r.dd(o) : console.warn(o);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
error: function (n) {
|
|
32
32
|
if (r.zg) {
|
|
33
|
-
const o = "Braze SDK Error: " + n + " (v5.
|
|
33
|
+
const o = "Braze SDK Error: " + n + " (v5.2.0)";
|
|
34
34
|
null != r.dd ? r.dd(o) : console.error(o);
|
|
35
35
|
}
|
|
36
36
|
},
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
Eo: "allowCrawlerActivity",
|
|
3
|
+
_o: "baseUrl",
|
|
4
|
+
Io: "noCookies",
|
|
5
|
+
Ao: "devicePropertyAllowlist",
|
|
6
|
+
Aa: "disablePushTokenMaintenance",
|
|
7
|
+
So: "enableLogging",
|
|
8
|
+
No: "enableSdkAuthentication",
|
|
9
|
+
qa: "manageServiceWorkerExternally",
|
|
10
|
+
Oo: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
+
Po: "sessionTimeoutInSeconds",
|
|
12
|
+
Ro: "appVersion",
|
|
13
|
+
Lo: "appVersionNumber",
|
|
14
|
+
_a: "serviceWorkerLocation",
|
|
15
|
+
ka: "safariWebsitePushId",
|
|
16
|
+
zn: "localization",
|
|
17
|
+
ho: "contentSecurityNonce",
|
|
18
|
+
Do: "allowUserSuppliedJavascript",
|
|
19
|
+
bo: "inAppMessageZIndex",
|
|
20
|
+
wo: "openInAppMessagesInNewTab",
|
|
21
21
|
en: "openNewsFeedCardsInNewTab",
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Lh: "requireExplicitInAppMessageDismissal",
|
|
23
|
+
Mo: "doNotLoadFontAwesome",
|
|
24
|
+
Uo: "deviceId",
|
|
24
25
|
Bo: "sdkFlavor",
|
|
25
26
|
tn: "openCardsInNewTab",
|
|
26
27
|
};
|
|
@@ -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());
|
|
@@ -67,22 +68,24 @@ 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
|
-
|
|
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) {
|
|
73
76
|
if (t.be()) {
|
|
74
77
|
const e = document.createElement("style");
|
|
75
78
|
(e.innerHTML = t.css || ""),
|
|
76
79
|
(e.id = t.ye() || ""),
|
|
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
90
|
t.he(c);
|
|
88
91
|
},
|
|
@@ -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
200
|
t.he(c, function () {
|
|
198
|
-
|
|
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.Ae !== InAppMessage.Ce.je)
|
|
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.ve() && (
|
|
223
|
+
const $ = i.document.body;
|
|
224
|
+
if (null != $) {
|
|
225
|
+
t.ve() && ($.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") &&
|
|
@@ -13,12 +13,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
15
|
import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js";
|
|
16
|
-
import
|
|
16
|
+
import at from "./html-message-to-html.js";
|
|
17
17
|
import le from "./modal-utils.js";
|
|
18
18
|
import { logger as r, Guid as p } from "../../../shared-lib/index.js";
|
|
19
19
|
export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
20
20
|
if (((e.we = document.activeElement), e instanceof HtmlMessage))
|
|
21
|
-
return
|
|
21
|
+
return at(e, o, a, n, s, i);
|
|
22
22
|
const b = (function (e, o, a, t, n, s, i = document.body) {
|
|
23
23
|
let m = null;
|
|
24
24
|
const l = document.createElement("div");
|
|
@@ -3,7 +3,7 @@ import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js";
|
|
|
3
3
|
import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.js";
|
|
4
4
|
import { toRgba as ie } from "../../util/color-utils.js";
|
|
5
5
|
import { addPassiveEventListener as oe } from "../../util/dom-utils.js";
|
|
6
|
-
import { KeyCodes as
|
|
6
|
+
import { KeyCodes as lt } from "../../util/key-codes.js";
|
|
7
7
|
const le = {
|
|
8
8
|
qe: (t) => {
|
|
9
9
|
const o = t.querySelectorAll(
|
|
@@ -16,7 +16,7 @@ const le = {
|
|
|
16
16
|
s = o[o.length - 1];
|
|
17
17
|
t.addEventListener("keydown", (o) => {
|
|
18
18
|
const a = document.activeElement;
|
|
19
|
-
o.keyCode ===
|
|
19
|
+
o.keyCode === lt.lo &&
|
|
20
20
|
(o.shiftKey || (a !== s && a !== t)
|
|
21
21
|
? !o.shiftKey ||
|
|
22
22
|
(a !== e && a !== t) ||
|