@braze/web-sdk 5.3.2 → 5.4.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 +20 -4
- package/package.json +1 -1
- package/shared-lib/event-types.js +7 -7
- package/shared-lib/indexed-db-adapter.js +1 -1
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +9 -8
- package/src/Card/display/card-display.js +59 -58
- package/src/Core/index.js +1 -0
- package/src/Core/is-initialized.js +4 -0
- package/src/InAppMessage/display/in-app-message-to-html.js +64 -62
- package/src/InAppMessage/ui/show-in-app-message.js +42 -40
- package/src/Push/push-manager-factory.js +2 -1
- package/src/Push/push-manager.js +73 -85
- package/src/Push/utils/push-utils.js +3 -3
- package/src/User/user-manager.js +2 -2
- package/src/User/user.js +4 -4
- package/src/common/event-logger.js +4 -4
- package/src/common/feed-display.js +17 -16
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +15 -5
- package/src/managers/braze-instance.js +53 -51
- package/src/managers/device-manager.js +17 -17
- package/src/managers/network-manager.js +89 -89
- package/src/managers/server-config-manager.js +4 -4
- package/src/managers/session-manager.js +4 -4
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +17 -17
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +3 -3
- package/src/models/device.js +1 -1
- package/src/models/server-config.js +2 -2
- package/src/request-controller.js +74 -74
- package/src/triggers/models/filter.js +3 -3
- 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 +1 -1
- package/src/triggers/triggers-provider.js +3 -3
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/browser-detector.js +21 -21
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/component-utils.js +13 -12
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +7 -7
- package/src/util/user-agent-parser.js +3 -3
- package/src/util/window-utils.js +1 -1
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.4.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
|
|
@@ -2138,7 +2138,7 @@ export function openSession(): void;
|
|
|
2138
2138
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2139
2139
|
*
|
|
2140
2140
|
* ```
|
|
2141
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2141
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.4/service-worker.js');
|
|
2142
2142
|
* ```
|
|
2143
2143
|
*
|
|
2144
2144
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -2408,7 +2408,7 @@ export function subscribeToFeatureFlagsUpdates(
|
|
|
2408
2408
|
export function getAllFeatureFlags(): FeatureFlag[];
|
|
2409
2409
|
|
|
2410
2410
|
/**
|
|
2411
|
-
* Logs impression for a given feature flag.
|
|
2411
|
+
* Logs impression for a given feature flag. This is limited to one impression per session per feature flag ID.
|
|
2412
2412
|
*
|
|
2413
2413
|
* @param featureFlagId - ID of the feature flag that has received the impression.
|
|
2414
2414
|
*
|
|
@@ -2418,6 +2418,11 @@ export function logFeatureFlagImpression(
|
|
|
2418
2418
|
featureFlagId: string,
|
|
2419
2419
|
): boolean | undefined;
|
|
2420
2420
|
|
|
2421
|
+
/**
|
|
2422
|
+
* Getter method to determine if the Braze SDK has been initialized.
|
|
2423
|
+
*/
|
|
2424
|
+
export function isInitialized(): boolean;
|
|
2425
|
+
|
|
2421
2426
|
/**
|
|
2422
2427
|
* Supported initialization options
|
|
2423
2428
|
*
|
|
@@ -2513,7 +2518,7 @@ export type InitializationOptions = {
|
|
|
2513
2518
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2514
2519
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2515
2520
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2516
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2521
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.4/service-worker.js');` or by including the content
|
|
2517
2522
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2518
2523
|
*/
|
|
2519
2524
|
manageServiceWorkerExternally?: boolean;
|
|
@@ -2570,6 +2575,17 @@ export type InitializationOptions = {
|
|
|
2570
2575
|
* default with a value of your own.
|
|
2571
2576
|
*/
|
|
2572
2577
|
deviceId?: string;
|
|
2578
|
+
/**
|
|
2579
|
+
* By default, Braze will register service worker with scope as the directory where the service worker script is located.
|
|
2580
|
+
*
|
|
2581
|
+
* Provide a value for this option to override that with a different scope. If you are using Service-Worker-Allowed header to specify scope,
|
|
2582
|
+
* ensure that the value provided here either matches the value returned by the header or is a subdirectory of it.
|
|
2583
|
+
*
|
|
2584
|
+
* For example, if the scope is '/path/to/subdirectory/' and the header is set to '/', the registration will succeed. However, if the scope is '/' and the
|
|
2585
|
+
* header is set to '/path/to/subdirectory/', the registration will fail because the provided scope ('/') is not under the maximum scope allowed
|
|
2586
|
+
* by Service-Worker-Allowed: '/path/to/subdirectory/'.
|
|
2587
|
+
*/
|
|
2588
|
+
serviceWorkerScope?: string;
|
|
2573
2589
|
};
|
|
2574
2590
|
|
|
2575
2591
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const i = {
|
|
2
2
|
CustomEvent: "ce",
|
|
3
3
|
Pr: "p",
|
|
4
|
-
|
|
4
|
+
Eu: "pc",
|
|
5
5
|
vc: "ca",
|
|
6
|
-
|
|
6
|
+
Ka: "i",
|
|
7
7
|
qs: "ie",
|
|
8
8
|
M: "cci",
|
|
9
9
|
R: "ccic",
|
|
@@ -16,18 +16,18 @@ const i = {
|
|
|
16
16
|
Ei: "sbc",
|
|
17
17
|
Cc: "sfe",
|
|
18
18
|
mo: "iec",
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Bu: "lr",
|
|
20
|
+
_u: "uae",
|
|
21
21
|
O: "ci",
|
|
22
22
|
$: "cc",
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Wu: "lcaa",
|
|
24
|
+
Ku: "lcar",
|
|
25
25
|
On: "inc",
|
|
26
26
|
Ln: "add",
|
|
27
27
|
Rn: "rem",
|
|
28
28
|
$n: "set",
|
|
29
29
|
Bn: "ncam",
|
|
30
|
-
|
|
30
|
+
Gu: "sgu",
|
|
31
31
|
Fr: "ffi",
|
|
32
32
|
},
|
|
33
33
|
or = { Ar: "feed_displayed", Ec: "content_cards_displayed" };
|
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.4.0)";
|
|
28
28
|
null != r.vd ? r.vd(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.4.0)";
|
|
34
34
|
null != r.vd ? r.vd(o) : console.error(o);
|
|
35
35
|
}
|
|
36
36
|
},
|
|
@@ -2,17 +2,17 @@ export default {
|
|
|
2
2
|
Eo: "allowCrawlerActivity",
|
|
3
3
|
_o: "baseUrl",
|
|
4
4
|
Io: "noCookies",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
So: "devicePropertyAllowlist",
|
|
6
|
+
ka: "disablePushTokenMaintenance",
|
|
7
|
+
Ao: "enableLogging",
|
|
8
8
|
No: "enableSdkAuthentication",
|
|
9
|
-
|
|
9
|
+
_a: "manageServiceWorkerExternally",
|
|
10
10
|
Oo: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Ro: "sessionTimeoutInSeconds",
|
|
12
|
+
Po: "appVersion",
|
|
13
13
|
Lo: "appVersionNumber",
|
|
14
14
|
wa: "serviceWorkerLocation",
|
|
15
|
-
|
|
15
|
+
Ma: "safariWebsitePushId",
|
|
16
16
|
zn: "localization",
|
|
17
17
|
bo: "contentSecurityNonce",
|
|
18
18
|
Do: "allowUserSuppliedJavascript",
|
|
@@ -22,6 +22,7 @@ export default {
|
|
|
22
22
|
Lh: "requireExplicitInAppMessageDismissal",
|
|
23
23
|
Mo: "doNotLoadFontAwesome",
|
|
24
24
|
Uo: "deviceId",
|
|
25
|
-
|
|
25
|
+
ya: "serviceWorkerScope",
|
|
26
|
+
Wo: "sdkFlavor",
|
|
26
27
|
tn: "openCardsInNewTab",
|
|
27
28
|
};
|
|
@@ -41,98 +41,99 @@ export function setCardHeight(t, o) {
|
|
|
41
41
|
t && (a.style.height = `${t}px`);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
export function cardToHtml(t, logCardClick, o) {
|
|
45
|
-
const
|
|
46
|
-
(
|
|
44
|
+
export function cardToHtml(t, logCardClick, o, e = "ltr") {
|
|
45
|
+
const a = document.createElement("div");
|
|
46
|
+
(a.dir = e),
|
|
47
|
+
(a.className = "ab-card ab-effect-card " + t._),
|
|
47
48
|
t.id &&
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
t.url && "" !== t.url && ((
|
|
54
|
-
const
|
|
49
|
+
(a.setAttribute("data-ab-card-id", t.id), a.setAttribute("id", t.id)),
|
|
50
|
+
a.setAttribute("role", "article"),
|
|
51
|
+
a.setAttribute("tabindex", "0");
|
|
52
|
+
let n = "",
|
|
53
|
+
i = !1;
|
|
54
|
+
t.url && "" !== t.url && ((n = t.url), (i = !0));
|
|
55
|
+
const r = (e) => (markCardAsRead(a), i && (logCardClick(t), u(n, o, e)), !1);
|
|
55
56
|
if (t.pinned) {
|
|
56
57
|
const t = document.createElement("div");
|
|
57
58
|
t.className = "ab-pinned-indicator";
|
|
58
59
|
const o = document.createElement("i");
|
|
59
|
-
(o.className = "fa fa-star"), t.appendChild(o),
|
|
60
|
+
(o.className = "fa fa-star"), t.appendChild(o), a.appendChild(t);
|
|
60
61
|
}
|
|
61
62
|
if (t.imageUrl && "" !== t.imageUrl) {
|
|
62
63
|
const o = document.createElement("div");
|
|
63
|
-
o.className = "ab-image-area";
|
|
64
|
-
const
|
|
64
|
+
(o.dir = e), (o.className = "ab-image-area");
|
|
65
|
+
const d = document.createElement("img");
|
|
65
66
|
if (
|
|
66
|
-
(
|
|
67
|
-
(
|
|
68
|
-
|
|
67
|
+
(d.setAttribute("src", t.imageUrl),
|
|
68
|
+
(d.onload = () => {
|
|
69
|
+
a.style.height = "auto";
|
|
69
70
|
}),
|
|
70
|
-
_setImageAltText(t,
|
|
71
|
-
o.appendChild(
|
|
72
|
-
(
|
|
73
|
-
|
|
71
|
+
_setImageAltText(t, d),
|
|
72
|
+
o.appendChild(d),
|
|
73
|
+
(a.className += " with-image"),
|
|
74
|
+
i && !t.S)
|
|
74
75
|
) {
|
|
75
76
|
const t = document.createElement("a");
|
|
76
|
-
t.setAttribute("href",
|
|
77
|
-
(t.onclick =
|
|
77
|
+
t.setAttribute("href", n),
|
|
78
|
+
(t.onclick = r),
|
|
78
79
|
t.appendChild(o),
|
|
79
|
-
|
|
80
|
-
} else
|
|
80
|
+
a.appendChild(t);
|
|
81
|
+
} else a.appendChild(o);
|
|
81
82
|
}
|
|
82
|
-
const
|
|
83
|
-
if (((
|
|
83
|
+
const s = document.createElement("div");
|
|
84
|
+
if (((s.className = "ab-card-body"), (s.dir = e), t.dismissible)) {
|
|
84
85
|
t.logCardDismissal = () => logCardDismissal(t);
|
|
85
|
-
const o = d("Dismiss Card", void 0, t.dismissCard.bind(t));
|
|
86
|
-
|
|
87
|
-
c(
|
|
88
|
-
(
|
|
86
|
+
const o = d("Dismiss Card", void 0, t.dismissCard.bind(t), e);
|
|
87
|
+
a.appendChild(o),
|
|
88
|
+
c(s, m.U, (t) => {
|
|
89
|
+
(a.className += " ab-swiped-left"), o.onclick(t);
|
|
89
90
|
}),
|
|
90
|
-
c(
|
|
91
|
-
(
|
|
91
|
+
c(s, m.V, (t) => {
|
|
92
|
+
(a.className += " ab-swiped-right"), o.onclick(t);
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
if ((t.title && "" !== t.title && ((
|
|
95
|
+
let l = "",
|
|
96
|
+
b = !1;
|
|
97
|
+
if ((t.title && "" !== t.title && ((l = t.title), (b = !0)), b)) {
|
|
97
98
|
const t = document.createElement("h1");
|
|
98
99
|
if (
|
|
99
100
|
((t.className = "ab-title"),
|
|
100
101
|
(t.id = p.W()),
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
a.setAttribute("aria-labelledby", t.id),
|
|
103
|
+
i)
|
|
103
104
|
) {
|
|
104
105
|
const o = document.createElement("a");
|
|
105
|
-
o.setAttribute("href",
|
|
106
|
-
(o.onclick =
|
|
107
|
-
o.appendChild(document.createTextNode(
|
|
106
|
+
o.setAttribute("href", n),
|
|
107
|
+
(o.onclick = r),
|
|
108
|
+
o.appendChild(document.createTextNode(l)),
|
|
108
109
|
t.appendChild(o);
|
|
109
|
-
} else t.appendChild(document.createTextNode(
|
|
110
|
-
|
|
110
|
+
} else t.appendChild(document.createTextNode(l));
|
|
111
|
+
s.appendChild(t);
|
|
111
112
|
}
|
|
112
|
-
const
|
|
113
|
+
const f = document.createElement("div");
|
|
113
114
|
if (
|
|
114
|
-
((
|
|
115
|
-
(
|
|
116
|
-
|
|
117
|
-
t.description &&
|
|
118
|
-
|
|
115
|
+
((f.className = b ? "ab-description" : "ab-description ab-no-title"),
|
|
116
|
+
(f.id = p.W()),
|
|
117
|
+
a.setAttribute("aria-describedby", f.id),
|
|
118
|
+
t.description && f.appendChild(document.createTextNode(t.description)),
|
|
119
|
+
i)
|
|
119
120
|
) {
|
|
120
121
|
const o = document.createElement("div");
|
|
121
122
|
o.className = "ab-url-area";
|
|
122
123
|
const e = document.createElement("a");
|
|
123
|
-
e.setAttribute("href",
|
|
124
|
+
e.setAttribute("href", n),
|
|
124
125
|
t.linkText && e.appendChild(document.createTextNode(t.linkText)),
|
|
125
|
-
(e.onclick =
|
|
126
|
+
(e.onclick = r),
|
|
126
127
|
o.appendChild(e),
|
|
127
|
-
|
|
128
|
+
f.appendChild(o);
|
|
128
129
|
}
|
|
129
|
-
|
|
130
|
-
const
|
|
130
|
+
s.appendChild(f), a.appendChild(s);
|
|
131
|
+
const x = document.createElement("div");
|
|
131
132
|
return (
|
|
132
|
-
(
|
|
133
|
-
t.viewed && (
|
|
134
|
-
|
|
135
|
-
(t.T =
|
|
136
|
-
|
|
133
|
+
(x.className = "ab-unread-indicator"),
|
|
134
|
+
t.viewed && (x.className += " read"),
|
|
135
|
+
a.appendChild(x),
|
|
136
|
+
(t.T = a),
|
|
137
|
+
a
|
|
137
138
|
);
|
|
138
139
|
}
|
package/src/Core/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { getDeviceId } from "./get-device-id.js";
|
|
|
9
9
|
export { getUser } from "./get-user.js";
|
|
10
10
|
export { initialize } from "./initialize.js";
|
|
11
11
|
export { isDisabled } from "./is-disabled.js";
|
|
12
|
+
export { isInitialized } from "./is-initialized.js";
|
|
12
13
|
export { logCustomEvent } from "./log-custom-event.js";
|
|
13
14
|
export { logPurchase } from "./log-purchase.js";
|
|
14
15
|
export { openSession } from "./open-session.js";
|
|
@@ -16,54 +16,55 @@ import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js";
|
|
|
16
16
|
import dt 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
|
-
export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
19
|
+
export default function ce(e, o, a, t, n, s, i, l = document.body, b = "ltr") {
|
|
20
20
|
if (((e.ke = document.activeElement), e instanceof HtmlMessage))
|
|
21
21
|
return dt(e, o, a, n, s, i);
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
const
|
|
25
|
-
(
|
|
26
|
-
|
|
22
|
+
const g = (function (e, o, a, t, n, s, i = document.body, m = "ltr") {
|
|
23
|
+
let l = null;
|
|
24
|
+
const c = document.createElement("div");
|
|
25
|
+
(c.dir = m),
|
|
26
|
+
(c.className = "ab-in-app-message ab-start-hidden ab-background"),
|
|
27
|
+
s && (c.style.zIndex = (s + 1).toString()),
|
|
27
28
|
e.$e() &&
|
|
28
|
-
((
|
|
29
|
-
|
|
29
|
+
((c.className += " ab-modal-interactions"),
|
|
30
|
+
c.setAttribute("tabindex", "-1")),
|
|
30
31
|
e.ve() ||
|
|
31
|
-
((
|
|
32
|
-
(
|
|
33
|
-
ne(e.backgroundColor) && (
|
|
34
|
-
const
|
|
35
|
-
-1 !==
|
|
36
|
-
((
|
|
32
|
+
((c.style.color = ie(e.textColor)),
|
|
33
|
+
(c.style.backgroundColor = ie(e.backgroundColor)),
|
|
34
|
+
ne(e.backgroundColor) && (c.className += " ab-no-shadow"));
|
|
35
|
+
const b = () => {
|
|
36
|
+
-1 !== c.className.indexOf("ab-start-hidden") &&
|
|
37
|
+
((c.className = c.className.replace("ab-start-hidden", "")),
|
|
37
38
|
document.querySelectorAll(".ab-iam-img-loading").length > 0
|
|
38
39
|
? t(
|
|
39
40
|
`Cannot show in-app message ${e.message} because another message is being shown.`,
|
|
40
41
|
InAppMessage.Le.ze,
|
|
41
42
|
)
|
|
42
|
-
: a(
|
|
43
|
+
: a(c));
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
+
g = (o = !0) => {
|
|
45
46
|
let a = document.querySelectorAll(".ab-iam-root");
|
|
46
47
|
(a && 0 !== a.length) || (a = i.querySelectorAll(".ab-iam-root")),
|
|
47
48
|
a &&
|
|
48
49
|
a.length > 0 &&
|
|
49
50
|
(a[0].classList.remove("ab-iam-img-loading"),
|
|
50
|
-
|
|
51
|
+
l && (clearTimeout(l), (l = null)),
|
|
51
52
|
o
|
|
52
|
-
?
|
|
53
|
+
? b()
|
|
53
54
|
: r.error(
|
|
54
55
|
`Cannot show in-app message ${e.message} because the image failed to load.`,
|
|
55
56
|
));
|
|
56
57
|
};
|
|
57
58
|
e.imageStyle === InAppMessage.ImageStyle.GRAPHIC &&
|
|
58
|
-
(
|
|
59
|
+
(c.className += " graphic"),
|
|
59
60
|
e.orientation === InAppMessage.Orientation.LANDSCAPE &&
|
|
60
|
-
(
|
|
61
|
+
(c.className += " landscape"),
|
|
61
62
|
null != e.buttons &&
|
|
62
63
|
0 === e.buttons.length &&
|
|
63
64
|
(e.clickAction !== InAppMessage.ClickAction.NONE &&
|
|
64
|
-
(
|
|
65
|
-
(
|
|
66
|
-
e.Cr(
|
|
65
|
+
(c.className += " ab-clickable"),
|
|
66
|
+
(c.onclick = (a) => (
|
|
67
|
+
e.Cr(c, () => {
|
|
67
68
|
logInAppMessageClick(e),
|
|
68
69
|
e.clickAction === InAppMessage.ClickAction.URI
|
|
69
70
|
? u(
|
|
@@ -76,21 +77,22 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
76
77
|
a.stopPropagation(),
|
|
77
78
|
!1
|
|
78
79
|
)));
|
|
79
|
-
const
|
|
80
|
+
const f = d(
|
|
80
81
|
"Close Message",
|
|
81
82
|
e.ve() ? void 0 : ie(e.closeButtonColor),
|
|
82
83
|
() => {
|
|
83
|
-
e.Cr(
|
|
84
|
+
e.Cr(c);
|
|
84
85
|
},
|
|
86
|
+
m,
|
|
85
87
|
);
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
let
|
|
92
|
-
const
|
|
93
|
-
if (((
|
|
88
|
+
c.appendChild(f), s && (f.style.zIndex = (s + 2).toString());
|
|
89
|
+
const h = document.createElement("div");
|
|
90
|
+
(h.className = "ab-message-text"), (h.dir = m);
|
|
91
|
+
const j = (e.messageAlignment || e.qe).toLowerCase();
|
|
92
|
+
h.className += " " + j + "-aligned";
|
|
93
|
+
let w = !1;
|
|
94
|
+
const v = document.createElement("div");
|
|
95
|
+
if (((v.className = "ab-image-area"), e.imageUrl)) {
|
|
94
96
|
if (e.cropType === InAppMessage.CropType.CENTER_CROP) {
|
|
95
97
|
const o = document.createElement("span");
|
|
96
98
|
(o.className = "ab-center-cropped-img"),
|
|
@@ -98,7 +100,7 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
98
100
|
o.setAttribute("role", "img"),
|
|
99
101
|
o.setAttribute("aria-label", "Modal Image"),
|
|
100
102
|
e.Ae(o),
|
|
101
|
-
|
|
103
|
+
v.appendChild(o);
|
|
102
104
|
} else {
|
|
103
105
|
const o = document.createElement("img");
|
|
104
106
|
if (
|
|
@@ -106,24 +108,24 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
106
108
|
e.Ae(o),
|
|
107
109
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
108
110
|
) {
|
|
109
|
-
|
|
111
|
+
w = !0;
|
|
110
112
|
const e = document.querySelectorAll(".ab-iam-root");
|
|
111
113
|
e && e.length > 0 && e[0].classList.add("ab-iam-img-loading"),
|
|
112
|
-
(
|
|
113
|
-
|
|
114
|
+
(l = window.setTimeout(() => {
|
|
115
|
+
g(!1);
|
|
114
116
|
}, 6e4)),
|
|
115
117
|
(o.onload = () => {
|
|
116
|
-
|
|
118
|
+
g();
|
|
117
119
|
}),
|
|
118
120
|
(o.onerror = () => {
|
|
119
|
-
|
|
121
|
+
g(!1);
|
|
120
122
|
});
|
|
121
123
|
}
|
|
122
|
-
|
|
124
|
+
v.appendChild(o);
|
|
123
125
|
}
|
|
124
|
-
|
|
126
|
+
c.appendChild(v), (h.className += " ab-with-image");
|
|
125
127
|
} else if (e.icon) {
|
|
126
|
-
|
|
128
|
+
v.className += " ab-icon-area";
|
|
127
129
|
const o = document.createElement("span");
|
|
128
130
|
(o.className = "ab-icon"),
|
|
129
131
|
e.ve() ||
|
|
@@ -134,11 +136,11 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
134
136
|
a.appendChild(document.createTextNode(e.icon)),
|
|
135
137
|
a.setAttribute("aria-hidden", "true"),
|
|
136
138
|
o.appendChild(a),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(
|
|
139
|
+
v.appendChild(o),
|
|
140
|
+
c.appendChild(v),
|
|
141
|
+
(h.className += " ab-with-icon");
|
|
140
142
|
}
|
|
141
|
-
if ((oe(
|
|
143
|
+
if ((oe(h, "touchstart"), e.header && e.header.length > 0)) {
|
|
142
144
|
const o = document.createElement("h1");
|
|
143
145
|
(o.className = "ab-message-header"), (e.De = p.W()), (o.id = e.De);
|
|
144
146
|
const a = (
|
|
@@ -147,19 +149,19 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
147
149
|
(o.className += " " + a + "-aligned"),
|
|
148
150
|
e.ve() || (o.style.color = ie(e.headerTextColor)),
|
|
149
151
|
o.appendChild(document.createTextNode(e.header)),
|
|
150
|
-
|
|
152
|
+
h.appendChild(o);
|
|
151
153
|
}
|
|
152
|
-
return
|
|
153
|
-
})(e, o, a, t, n, s, l);
|
|
154
|
+
return h.appendChild(e.Ge()), c.appendChild(h), w || b(), (e.Re = c), c;
|
|
155
|
+
})(e, o, a, t, n, s, l, b);
|
|
154
156
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
155
157
|
const a = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
156
|
-
(
|
|
157
|
-
le.He(e, o,
|
|
158
|
-
le.Je(
|
|
159
|
-
le.Ke(e.De,
|
|
158
|
+
(g.className += ` ${a} ab-centered`),
|
|
159
|
+
le.He(e, o, g, n),
|
|
160
|
+
le.Je(g),
|
|
161
|
+
le.Ke(e.De, g);
|
|
160
162
|
} else if (e instanceof SlideUpMessage) {
|
|
161
|
-
|
|
162
|
-
const o =
|
|
163
|
+
g.className += " ab-slideup";
|
|
164
|
+
const o = g.getElementsByClassName("ab-close-button")[0];
|
|
163
165
|
if (null != o) {
|
|
164
166
|
const a = ae(
|
|
165
167
|
"0 0 11.38 19.44",
|
|
@@ -169,20 +171,20 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
169
171
|
a.setAttribute("class", "ab-chevron"), o.appendChild(a);
|
|
170
172
|
}
|
|
171
173
|
let a, t;
|
|
172
|
-
c(
|
|
173
|
-
(
|
|
174
|
+
c(g, m.U, (e) => {
|
|
175
|
+
(g.className += " ab-swiped-left"),
|
|
174
176
|
null != o && null != o.onclick && o.onclick(e);
|
|
175
177
|
}),
|
|
176
|
-
c(
|
|
177
|
-
(
|
|
178
|
+
c(g, m.V, (e) => {
|
|
179
|
+
(g.className += " ab-swiped-right"),
|
|
178
180
|
null != o && null != o.onclick && o.onclick(e);
|
|
179
181
|
}),
|
|
180
182
|
e.slideFrom === InAppMessage.SlideFrom.TOP
|
|
181
183
|
? ((a = m.Oe), (t = " ab-swiped-up"))
|
|
182
184
|
: ((a = m.Qe), (t = " ab-swiped-down")),
|
|
183
|
-
c(
|
|
184
|
-
(
|
|
185
|
+
c(g, a, (e) => {
|
|
186
|
+
(g.className += t), null != o && null != o.onclick && o.onclick(e);
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
|
-
return
|
|
189
|
+
return g;
|
|
188
190
|
}
|