@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.
Files changed (48) hide show
  1. package/index.d.ts +20 -4
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +7 -7
  4. package/shared-lib/indexed-db-adapter.js +1 -1
  5. package/shared-lib/logger.js +2 -2
  6. package/shared-lib/supported-options.js +9 -8
  7. package/src/Card/display/card-display.js +59 -58
  8. package/src/Core/index.js +1 -0
  9. package/src/Core/is-initialized.js +4 -0
  10. package/src/InAppMessage/display/in-app-message-to-html.js +64 -62
  11. package/src/InAppMessage/ui/show-in-app-message.js +42 -40
  12. package/src/Push/push-manager-factory.js +2 -1
  13. package/src/Push/push-manager.js +73 -85
  14. package/src/Push/utils/push-utils.js +3 -3
  15. package/src/User/user-manager.js +2 -2
  16. package/src/User/user.js +4 -4
  17. package/src/common/event-logger.js +4 -4
  18. package/src/common/feed-display.js +17 -16
  19. package/src/l10n/l10n-manager-factory.js +7 -7
  20. package/src/l10n/l10n-manager.js +15 -5
  21. package/src/managers/braze-instance.js +53 -51
  22. package/src/managers/device-manager.js +17 -17
  23. package/src/managers/network-manager.js +89 -89
  24. package/src/managers/server-config-manager.js +4 -4
  25. package/src/managers/session-manager.js +4 -4
  26. package/src/managers/storage-manager-factory.js +1 -1
  27. package/src/managers/storage-manager.js +17 -17
  28. package/src/models/backend-errors.js +5 -5
  29. package/src/models/braze-event.js +3 -3
  30. package/src/models/device.js +1 -1
  31. package/src/models/server-config.js +2 -2
  32. package/src/request-controller.js +74 -74
  33. package/src/triggers/models/filter.js +3 -3
  34. package/src/triggers/models/in-app-message-click-data.js +8 -8
  35. package/src/triggers/models/push-click-data.js +3 -3
  36. package/src/triggers/models/trigger-condition.js +1 -1
  37. package/src/triggers/triggers-provider.js +3 -3
  38. package/src/ui/js/attach-css.js +1 -1
  39. package/src/ui/js/feed-css.js +1 -1
  40. package/src/ui/js/iam-css.js +1 -1
  41. package/src/util/base-device-parser.js +7 -7
  42. package/src/util/browser-detector.js +21 -21
  43. package/src/util/client-hints-parser.js +3 -3
  44. package/src/util/component-utils.js +13 -12
  45. package/src/util/net.js +1 -1
  46. package/src/util/request-header-utils.js +7 -7
  47. package/src/util/user-agent-parser.js +3 -3
  48. 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.3.2
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.3/service-worker.js');
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.3/service-worker.js');` or by including the content
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/web-sdk",
3
- "version": "5.3.2",
3
+ "version": "5.4.0",
4
4
  "description": "Braze SDK for web sites and other JS platforms.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,9 +1,9 @@
1
1
  const i = {
2
2
  CustomEvent: "ce",
3
3
  Pr: "p",
4
- _u: "pc",
4
+ Eu: "pc",
5
5
  vc: "ca",
6
- Ea: "i",
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
- Uu: "lr",
20
- zu: "uae",
19
+ Bu: "lr",
20
+ _u: "uae",
21
21
  O: "ci",
22
22
  $: "cc",
23
- Ju: "lcaa",
24
- Eu: "lcar",
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
- Ku: "sgu",
30
+ Gu: "sgu",
31
31
  Fr: "ffi",
32
32
  },
33
33
  or = { Ar: "feed_displayed", Ec: "content_cards_displayed" };
@@ -338,7 +338,7 @@ A.Yt = {
338
338
  Sd: "AppboyServiceWorkerAsyncStorage",
339
339
  VERSION: 6,
340
340
  ss: {
341
- $a: "data",
341
+ La: "data",
342
342
  hr: "pushClicks",
343
343
  cu: "pushSubscribed",
344
344
  Cd: "fallbackDevice",
@@ -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.3.2)";
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.3.2)";
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
- Ao: "devicePropertyAllowlist",
6
- _a: "disablePushTokenMaintenance",
7
- So: "enableLogging",
5
+ So: "devicePropertyAllowlist",
6
+ ka: "disablePushTokenMaintenance",
7
+ Ao: "enableLogging",
8
8
  No: "enableSdkAuthentication",
9
- Ma: "manageServiceWorkerExternally",
9
+ _a: "manageServiceWorkerExternally",
10
10
  Oo: "minimumIntervalBetweenTriggerActionsInSeconds",
11
- Po: "sessionTimeoutInSeconds",
12
- Ro: "appVersion",
11
+ Ro: "sessionTimeoutInSeconds",
12
+ Po: "appVersion",
13
13
  Lo: "appVersionNumber",
14
14
  wa: "serviceWorkerLocation",
15
- ya: "safariWebsitePushId",
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
- Bo: "sdkFlavor",
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 e = document.createElement("div");
46
- (e.className = "ab-card ab-effect-card " + t._),
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
- (e.setAttribute("data-ab-card-id", t.id), e.setAttribute("id", t.id)),
49
- e.setAttribute("role", "article"),
50
- e.setAttribute("tabindex", "0");
51
- let a = "",
52
- n = !1;
53
- t.url && "" !== t.url && ((a = t.url), (n = !0));
54
- const i = (i) => (markCardAsRead(e), n && (logCardClick(t), u(a, o, i)), !1);
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), e.appendChild(t);
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 r = document.createElement("img");
64
+ (o.dir = e), (o.className = "ab-image-area");
65
+ const d = document.createElement("img");
65
66
  if (
66
- (r.setAttribute("src", t.imageUrl),
67
- (r.onload = () => {
68
- e.style.height = "auto";
67
+ (d.setAttribute("src", t.imageUrl),
68
+ (d.onload = () => {
69
+ a.style.height = "auto";
69
70
  }),
70
- _setImageAltText(t, r),
71
- o.appendChild(r),
72
- (e.className += " with-image"),
73
- n && !t.S)
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", a),
77
- (t.onclick = i),
77
+ t.setAttribute("href", n),
78
+ (t.onclick = r),
78
79
  t.appendChild(o),
79
- e.appendChild(t);
80
- } else e.appendChild(o);
80
+ a.appendChild(t);
81
+ } else a.appendChild(o);
81
82
  }
82
- const r = document.createElement("div");
83
- if (((r.className = "ab-card-body"), t.dismissible)) {
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
- e.appendChild(o),
87
- c(r, m.U, (t) => {
88
- (e.className += " ab-swiped-left"), o.onclick(t);
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(r, m.V, (t) => {
91
- (e.className += " ab-swiped-right"), o.onclick(t);
91
+ c(s, m.V, (t) => {
92
+ (a.className += " ab-swiped-right"), o.onclick(t);
92
93
  });
93
94
  }
94
- let s = "",
95
- l = !1;
96
- if ((t.title && "" !== t.title && ((s = t.title), (l = !0)), l)) {
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
- e.setAttribute("aria-labelledby", t.id),
102
- n)
102
+ a.setAttribute("aria-labelledby", t.id),
103
+ i)
103
104
  ) {
104
105
  const o = document.createElement("a");
105
- o.setAttribute("href", a),
106
- (o.onclick = i),
107
- o.appendChild(document.createTextNode(s)),
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(s));
110
- r.appendChild(t);
110
+ } else t.appendChild(document.createTextNode(l));
111
+ s.appendChild(t);
111
112
  }
112
- const b = document.createElement("div");
113
+ const f = document.createElement("div");
113
114
  if (
114
- ((b.className = l ? "ab-description" : "ab-description ab-no-title"),
115
- (b.id = p.W()),
116
- e.setAttribute("aria-describedby", b.id),
117
- t.description && b.appendChild(document.createTextNode(t.description)),
118
- n)
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", a),
124
+ e.setAttribute("href", n),
124
125
  t.linkText && e.appendChild(document.createTextNode(t.linkText)),
125
- (e.onclick = i),
126
+ (e.onclick = r),
126
127
  o.appendChild(e),
127
- b.appendChild(o);
128
+ f.appendChild(o);
128
129
  }
129
- r.appendChild(b), e.appendChild(r);
130
- const f = document.createElement("div");
130
+ s.appendChild(f), a.appendChild(s);
131
+ const x = document.createElement("div");
131
132
  return (
132
- (f.className = "ab-unread-indicator"),
133
- t.viewed && (f.className += " read"),
134
- e.appendChild(f),
135
- (t.T = e),
136
- e
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";
@@ -0,0 +1,4 @@
1
+ import e from "../managers/braze-instance.js";
2
+ export function isInitialized() {
3
+ return e.so();
4
+ }
@@ -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 b = (function (e, o, a, t, n, s, i = document.body) {
23
- let m = null;
24
- const l = document.createElement("div");
25
- (l.className = "ab-in-app-message ab-start-hidden ab-background"),
26
- s && (l.style.zIndex = (s + 1).toString()),
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
- ((l.className += " ab-modal-interactions"),
29
- l.setAttribute("tabindex", "-1")),
29
+ ((c.className += " ab-modal-interactions"),
30
+ c.setAttribute("tabindex", "-1")),
30
31
  e.ve() ||
31
- ((l.style.color = ie(e.textColor)),
32
- (l.style.backgroundColor = ie(e.backgroundColor)),
33
- ne(e.backgroundColor) && (l.className += " ab-no-shadow"));
34
- const c = () => {
35
- -1 !== l.className.indexOf("ab-start-hidden") &&
36
- ((l.className = l.className.replace("ab-start-hidden", "")),
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(l));
43
+ : a(c));
43
44
  },
44
- b = (o = !0) => {
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
- m && (clearTimeout(m), (m = null)),
51
+ l && (clearTimeout(l), (l = null)),
51
52
  o
52
- ? c()
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
- (l.className += " graphic"),
59
+ (c.className += " graphic"),
59
60
  e.orientation === InAppMessage.Orientation.LANDSCAPE &&
60
- (l.className += " landscape"),
61
+ (c.className += " landscape"),
61
62
  null != e.buttons &&
62
63
  0 === e.buttons.length &&
63
64
  (e.clickAction !== InAppMessage.ClickAction.NONE &&
64
- (l.className += " ab-clickable"),
65
- (l.onclick = (a) => (
66
- e.Cr(l, () => {
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 g = d(
80
+ const f = d(
80
81
  "Close Message",
81
82
  e.ve() ? void 0 : ie(e.closeButtonColor),
82
83
  () => {
83
- e.Cr(l);
84
+ e.Cr(c);
84
85
  },
86
+ m,
85
87
  );
86
- l.appendChild(g), s && (g.style.zIndex = (s + 2).toString());
87
- const f = document.createElement("div");
88
- f.className = "ab-message-text";
89
- const h = (e.messageAlignment || e.qe).toLowerCase();
90
- f.className += " " + h + "-aligned";
91
- let j = !1;
92
- const w = document.createElement("div");
93
- if (((w.className = "ab-image-area"), e.imageUrl)) {
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
- w.appendChild(o);
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
- j = !0;
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
- (m = window.setTimeout(() => {
113
- b(!1);
114
+ (l = window.setTimeout(() => {
115
+ g(!1);
114
116
  }, 6e4)),
115
117
  (o.onload = () => {
116
- b();
118
+ g();
117
119
  }),
118
120
  (o.onerror = () => {
119
- b(!1);
121
+ g(!1);
120
122
  });
121
123
  }
122
- w.appendChild(o);
124
+ v.appendChild(o);
123
125
  }
124
- l.appendChild(w), (f.className += " ab-with-image");
126
+ c.appendChild(v), (h.className += " ab-with-image");
125
127
  } else if (e.icon) {
126
- w.className += " ab-icon-area";
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
- w.appendChild(o),
138
- l.appendChild(w),
139
- (f.className += " ab-with-icon");
139
+ v.appendChild(o),
140
+ c.appendChild(v),
141
+ (h.className += " ab-with-icon");
140
142
  }
141
- if ((oe(f, "touchstart"), e.header && e.header.length > 0)) {
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
- f.appendChild(o);
152
+ h.appendChild(o);
151
153
  }
152
- return f.appendChild(e.Ge()), l.appendChild(f), j || c(), (e.Re = l), l;
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
- (b.className += ` ${a} ab-centered`),
157
- le.He(e, o, b, n),
158
- le.Je(b),
159
- le.Ke(e.De, b);
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
- b.className += " ab-slideup";
162
- const o = b.getElementsByClassName("ab-close-button")[0];
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(b, m.U, (e) => {
173
- (b.className += " ab-swiped-left"),
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(b, m.V, (e) => {
177
- (b.className += " ab-swiped-right"),
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(b, a, (e) => {
184
- (b.className += t), null != o && null != o.onclick && o.onclick(e);
185
+ c(g, a, (e) => {
186
+ (g.className += t), null != o && null != o.onclick && o.onclick(e);
185
187
  });
186
188
  }
187
- return b;
189
+ return g;
188
190
  }