@braze/web-sdk 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +12 -5
  3. package/package.json +1 -1
  4. package/shared-lib/encoding-utils.js +3 -3
  5. package/shared-lib/event-types.js +29 -29
  6. package/shared-lib/guid.js +3 -3
  7. package/shared-lib/index.js +6 -0
  8. package/shared-lib/indexed-db-adapter.js +70 -70
  9. package/shared-lib/logger.js +18 -18
  10. package/shared-lib/supported-options.js +21 -21
  11. package/src/Card/card-manager.js +43 -45
  12. package/src/Card/display/card-display.js +60 -60
  13. package/src/Card/log-card-click.js +4 -4
  14. package/src/Card/log-card-dismissal.js +2 -3
  15. package/src/Card/log-card-impressions.js +7 -7
  16. package/src/Card/models/captioned-image.js +21 -21
  17. package/src/Card/models/card.js +73 -73
  18. package/src/Card/models/classic-card.js +21 -21
  19. package/src/Card/models/control-card.js +11 -11
  20. package/src/Card/models/image-only.js +19 -19
  21. package/src/Card/util/card-factory.js +68 -68
  22. package/src/ContentCards/content-cards-provider-factory.js +3 -3
  23. package/src/ContentCards/content-cards-provider.js +255 -245
  24. package/src/ContentCards/content-cards.js +2 -2
  25. package/src/ContentCards/get-cached-content-cards.js +1 -1
  26. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  27. package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
  28. package/src/ContentCards/ui/hide-content-cards.js +1 -1
  29. package/src/ContentCards/ui/show-content-cards.js +24 -24
  30. package/src/ContentCards/ui/toggle-content-cards.js +1 -1
  31. package/src/Core/add-sdk-metadata.js +21 -19
  32. package/src/Core/change-user.js +10 -10
  33. package/src/Core/destroy.js +2 -2
  34. package/src/Core/disable-sdk.js +11 -11
  35. package/src/Core/enable-sdk.js +7 -7
  36. package/src/Core/get-device-id.js +6 -6
  37. package/src/Core/get-user.js +1 -1
  38. package/src/Core/handle-braze-action.js +41 -41
  39. package/src/Core/is-disabled.js +2 -2
  40. package/src/Core/log-custom-event.js +15 -15
  41. package/src/Core/log-purchase.js +31 -37
  42. package/src/Core/open-session.js +12 -12
  43. package/src/Core/remove-all-subscriptions.js +1 -1
  44. package/src/Core/remove-subscription.js +1 -1
  45. package/src/Core/request-immediate-data-flush.js +1 -1
  46. package/src/Core/set-logger.js +2 -2
  47. package/src/Core/set-sdk-authentication-signature.js +3 -3
  48. package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -4
  49. package/src/Core/toggle-logging.js +2 -2
  50. package/src/Core/wipe-data.js +9 -9
  51. package/src/FeatureFlags/feature-flag-factory.js +12 -12
  52. package/src/FeatureFlags/feature-flag.js +10 -10
  53. package/src/FeatureFlags/feature-flags-provider-factory.js +3 -2
  54. package/src/FeatureFlags/feature-flags-provider.js +108 -80
  55. package/src/FeatureFlags/get-all-feature-flags.js +5 -5
  56. package/src/FeatureFlags/get-feature-flag.js +6 -6
  57. package/src/FeatureFlags/log-feature-flag-impression.js +15 -13
  58. package/src/FeatureFlags/refresh-feature-flags.js +1 -1
  59. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +7 -4
  60. package/src/Feed/feed-provider-factory.js +2 -2
  61. package/src/Feed/feed-provider.js +44 -44
  62. package/src/Feed/feed.js +1 -1
  63. package/src/Feed/get-cached-feed.js +1 -1
  64. package/src/Feed/log-feed-displayed.js +4 -4
  65. package/src/Feed/request-feed-refresh.js +1 -1
  66. package/src/Feed/subscribe-to-feed-updates.js +1 -1
  67. package/src/Feed/ui/hide-feed.js +1 -1
  68. package/src/Feed/ui/show-feed.js +28 -28
  69. package/src/Feed/ui/toggle-feed.js +1 -1
  70. package/src/InAppMessage/defer-in-app-message.js +5 -5
  71. package/src/InAppMessage/display/html-message-to-html.js +54 -54
  72. package/src/InAppMessage/display/in-app-message-to-html.js +79 -79
  73. package/src/InAppMessage/display/modal-utils.js +8 -8
  74. package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
  75. package/src/InAppMessage/in-app-message-factory.js +49 -49
  76. package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
  77. package/src/InAppMessage/in-app-message-manager.js +143 -138
  78. package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
  79. package/src/InAppMessage/log-in-app-message-click.js +9 -9
  80. package/src/InAppMessage/log-in-app-message-html-click.js +12 -12
  81. package/src/InAppMessage/log-in-app-message-impression.js +6 -6
  82. package/src/InAppMessage/models/full-screen-message.js +33 -33
  83. package/src/InAppMessage/models/html-message.js +20 -20
  84. package/src/InAppMessage/models/in-app-message-button.js +6 -6
  85. package/src/InAppMessage/models/in-app-message.js +99 -99
  86. package/src/InAppMessage/models/modal-message.js +32 -32
  87. package/src/InAppMessage/models/slide-up-message.js +28 -28
  88. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  89. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  90. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
  91. package/src/InAppMessage/ui/show-in-app-message.js +81 -81
  92. package/src/Push/is-push-blocked.js +1 -1
  93. package/src/Push/is-push-permission-granted.js +1 -1
  94. package/src/Push/is-push-supported.js +1 -1
  95. package/src/Push/push-manager-factory.js +5 -5
  96. package/src/Push/push-manager.js +176 -173
  97. package/src/Push/request-push-permission.js +1 -1
  98. package/src/Push/unregister-push.js +1 -1
  99. package/src/Push/utils/push-utils.js +4 -4
  100. package/src/User/user-manager.js +29 -29
  101. package/src/User/user.js +72 -74
  102. package/src/common/base-feed.js +7 -7
  103. package/src/common/base-provider.js +1 -1
  104. package/src/common/constants.js +2 -0
  105. package/src/common/event-logger.js +21 -18
  106. package/src/common/feed-display.js +44 -44
  107. package/src/l10n/l10n-manager-factory.js +3 -3
  108. package/src/l10n/l10n-manager.js +7 -7
  109. package/src/managers/auth-manager.js +32 -32
  110. package/src/managers/braze-instance.js +188 -189
  111. package/src/managers/device-manager.js +28 -28
  112. package/src/managers/network-manager.js +189 -138
  113. package/src/managers/server-config-manager.js +69 -53
  114. package/src/managers/session-manager.js +34 -30
  115. package/src/managers/storage-manager-factory.js +16 -16
  116. package/src/managers/storage-manager.js +210 -188
  117. package/src/managers/subscription-manager.js +12 -12
  118. package/src/models/backend-errors.js +5 -5
  119. package/src/models/braze-event.js +3 -3
  120. package/src/models/device.js +2 -2
  121. package/src/models/identifier.js +34 -14
  122. package/src/models/push-token.js +8 -8
  123. package/src/models/request-result.js +3 -3
  124. package/src/models/server-config.js +32 -23
  125. package/src/request-controller.js +187 -180
  126. package/src/triggers/models/custom-event-data.js +7 -7
  127. package/src/triggers/models/custom-event-property-data.js +10 -10
  128. package/src/triggers/models/filter-set.js +13 -13
  129. package/src/triggers/models/filter.js +45 -45
  130. package/src/triggers/models/in-app-message-click-data.js +12 -12
  131. package/src/triggers/models/purchase-data.js +2 -2
  132. package/src/triggers/models/purchase-property-data.js +10 -10
  133. package/src/triggers/models/push-click-data.js +7 -7
  134. package/src/triggers/models/trigger-condition.js +57 -59
  135. package/src/triggers/models/trigger-events.js +4 -4
  136. package/src/triggers/models/trigger.js +38 -38
  137. package/src/triggers/triggers-provider-factory.js +4 -4
  138. package/src/triggers/triggers-provider.js +127 -130
  139. package/src/ui/js/attach-css.js +2 -2
  140. package/src/ui/js/iam-css.js +1 -1
  141. package/src/ui/js/load-font-awesome.js +1 -1
  142. package/src/util/base-device-parser.js +3 -3
  143. package/src/util/braze-actions.js +35 -35
  144. package/src/util/browser-detector.js +21 -21
  145. package/src/util/client-hints-parser.js +8 -8
  146. package/src/util/code-utils.js +2 -2
  147. package/src/util/component-utils.js +1 -1
  148. package/src/util/deprecation-utils.js +4 -4
  149. package/src/util/device-constants.js +1 -1
  150. package/src/util/dom-utils.js +18 -18
  151. package/src/util/key-codes.js +1 -1
  152. package/src/util/net.js +18 -18
  153. package/src/util/request-header-utils.js +39 -37
  154. package/src/util/string-utils.js +10 -10
  155. package/src/util/user-agent-parser.js +18 -18
  156. package/src/util/validation-utils.js +37 -39
  157. package/src/util/window-utils.js +3 -3
  158. package/shared-lib/braze-shared-lib.js +0 -8
@@ -1,78 +1,76 @@
1
1
  import { ControlCard } from "./models/index.js";
2
2
  import s from "../common/event-logger.js";
3
3
  import t from "../models/request-result.js";
4
- import r from "../../shared-lib/braze-shared-lib.js";
5
- import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
4
+ import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
5
+ import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
6
6
  export default class a {
7
7
  constructor(s) {
8
8
  (this.u = s), (this.u = s);
9
9
  }
10
- h(n, o) {
11
- const e = new t();
10
+ h(n, e) {
11
+ const l = new t();
12
12
  if ((n.p(), null == n.url || "" === n.url))
13
13
  return (
14
- r.j.info(
15
- `Card ${n.id} has no url. Not logging click to Braze servers.`,
16
- ),
17
- e
14
+ r.info(`Card ${n.id} has no url. Not logging click to Braze servers.`),
15
+ l
18
16
  );
19
- if (o && n.id && this.u) {
20
- const s = this.u.v(i.k.C) || {};
21
- (s[n.id] = !0), this.u.D(i.k.C, s);
17
+ if (e && n.id && this.u) {
18
+ const s = this.u.j(o.C.v) || {};
19
+ (s[n.id] = !0), this.u.k(o.C.v, s);
22
20
  }
23
- const l = this.I([n]);
24
- if (null == l) return e;
25
- const u = o ? r.q.$ : r.q.B;
26
- return s.N(u, l);
21
+ const u = this.D([n]);
22
+ if (null == u) return l;
23
+ const c = e ? i.I : i.$;
24
+ return s.q(c, u);
27
25
  }
28
- A(n) {
29
- const o = new t();
30
- if (!n.F())
26
+ B(n) {
27
+ const e = new t();
28
+ if (!n.N())
31
29
  return (
32
- r.j.info(
30
+ r.info(
33
31
  `Card ${n.id} refused this dismissal. Ignoring analytics event.`,
34
32
  ),
35
- o
33
+ e
36
34
  );
37
35
  if (n.id && this.u) {
38
- const s = this.u.v(i.k.G) || {};
39
- (s[n.id] = !0), this.u.D(i.k.G, s);
36
+ const s = this.u.j(o.C.A) || {};
37
+ (s[n.id] = !0), this.u.k(o.C.A, s);
40
38
  }
41
- const e = this.I([n]);
42
- return null == e ? o : s.N(r.q.H, e);
39
+ const l = this.D([n]);
40
+ return null == l ? e : s.q(i.F, l);
43
41
  }
44
- J(n, o) {
42
+ G(n, r) {
45
43
  const e = new t(!0),
46
44
  l = [],
47
45
  u = [];
48
- let a = {};
49
- this.u && (a = o ? this.u.v(i.k.K) || {} : this.u.v(i.k.L) || {});
46
+ let c = {};
47
+ this.u && (c = r ? this.u.j(o.C.H) || {} : this.u.j(o.C.J) || {});
50
48
  for (const s of n)
51
- s.M(),
49
+ s.K(),
52
50
  s instanceof ControlCard ? u.push(s) : l.push(s),
53
- s.id && (a[s.id] = !0);
54
- const h = this.I(l),
55
- c = this.I(u);
56
- if (null == h && null == c) return (e.O = !1), e;
57
- if ((this.u && (o ? this.u.D(i.k.K, a) : this.u.D(i.k.L, a)), null != h)) {
58
- const t = o ? r.q.P : r.q.R,
59
- n = s.N(t, h);
60
- e.S(n);
51
+ s.id && (c[s.id] = !0);
52
+ const h = this.D(l),
53
+ a = this.D(u);
54
+ if (null == h && null == a) return (e.L = !1), e;
55
+ if ((this.u && (r ? this.u.k(o.C.H, c) : this.u.k(o.C.J, c)), null != h)) {
56
+ const t = r ? i.M : i.O,
57
+ n = s.q(t, h);
58
+ e.P(n);
61
59
  }
62
- if (null != c && o) {
63
- const t = s.N(r.q.T, c);
64
- e.S(t);
60
+ if (null != a && r) {
61
+ const t = s.q(i.R, a);
62
+ e.P(t);
65
63
  }
66
64
  return e;
67
65
  }
68
- I(s) {
66
+ D(s) {
69
67
  let t,
70
- r = null;
71
- for (let n = 0; n < s.length; n++)
72
- (t = s[n].id),
68
+ n = null;
69
+ for (let r = 0; r < s.length; r++)
70
+ (t = s[r].id),
73
71
  null != t &&
74
72
  "" !== t &&
75
- ((r = r || {}), (r.ids = r.ids || []), r.ids.push(t));
76
- return r;
73
+ ((n = n || {}), (n.ids = n.ids || []), n.ids.push(t));
74
+ return n;
77
75
  }
78
76
  }
@@ -1,8 +1,8 @@
1
- import { createCloseButton as o } from "../../util/component-utils.js";
2
- import { detectSwipe as d, DIRECTIONS as c } from "../../util/dom-utils.js";
3
- import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js";
1
+ import { createCloseButton as d } from "../../util/component-utils.js";
2
+ import { detectSwipe as c, DIRECTIONS as m } from "../../util/dom-utils.js";
3
+ import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js";
4
4
  import { logCardDismissal } from "../index.js";
5
- import r from "../../../shared-lib/braze-shared-lib.js";
5
+ import { Guid as p } from "../../../shared-lib/index.js";
6
6
  export const TOP_IMPRESSION_DATA_ATTRIBUTE = "data-ab-had-top-impression";
7
7
  export const BOTTOM_IMPRESSION_DATA_ATTRIBUTE = "data-ab-had-bottom-impression";
8
8
  export function topHadImpression(t) {
@@ -36,103 +36,103 @@ export function setCardHeight(t, o) {
36
36
  n = 0;
37
37
  e.length > 0 && (n = e[0].offsetWidth);
38
38
  for (const o of t)
39
- if (((a = o._), a && o.imageUrl && "number" == typeof o.aspectRatio)) {
39
+ if (((a = o.T), a && o.imageUrl && "number" == typeof o.aspectRatio)) {
40
40
  const t = n / o.aspectRatio;
41
41
  t && (a.style.height = `${t}px`);
42
42
  }
43
43
  }
44
- export function cardToHtml(t, logCardClick, e) {
45
- const a = document.createElement("div");
46
- (a.className = "ab-card ab-effect-card " + t.U),
44
+ export function cardToHtml(t, logCardClick, o) {
45
+ const e = document.createElement("div");
46
+ (e.className = "ab-card ab-effect-card " + t._),
47
47
  t.id &&
48
- (a.setAttribute("data-ab-card-id", t.id), a.setAttribute("id", t.id)),
49
- a.setAttribute("role", "article"),
50
- a.setAttribute("tabindex", "0");
51
- let n = "",
52
- i = !1;
53
- t.url && "" !== t.url && ((n = t.url), (i = !0));
54
- const s = (o) => (markCardAsRead(a), i && (logCardClick(t), m(n, e, o)), !1);
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);
55
55
  if (t.pinned) {
56
56
  const t = document.createElement("div");
57
57
  t.className = "ab-pinned-indicator";
58
58
  const o = document.createElement("i");
59
- (o.className = "fa fa-star"), t.appendChild(o), a.appendChild(t);
59
+ (o.className = "fa fa-star"), t.appendChild(o), e.appendChild(t);
60
60
  }
61
61
  if (t.imageUrl && "" !== t.imageUrl) {
62
62
  const o = document.createElement("div");
63
63
  o.className = "ab-image-area";
64
- const e = document.createElement("img");
64
+ const r = document.createElement("img");
65
65
  if (
66
- (e.setAttribute("src", t.imageUrl),
67
- (e.onload = () => {
68
- a.style.height = "auto";
66
+ (r.setAttribute("src", t.imageUrl),
67
+ (r.onload = () => {
68
+ e.style.height = "auto";
69
69
  }),
70
- _setImageAltText(t, e),
71
- o.appendChild(e),
72
- (a.className += " with-image"),
73
- i && !t.V)
70
+ _setImageAltText(t, r),
71
+ o.appendChild(r),
72
+ (e.className += " with-image"),
73
+ n && !t.S)
74
74
  ) {
75
75
  const t = document.createElement("a");
76
- t.setAttribute("href", n),
77
- (t.onclick = s),
76
+ t.setAttribute("href", a),
77
+ (t.onclick = i),
78
78
  t.appendChild(o),
79
- a.appendChild(t);
80
- } else a.appendChild(o);
79
+ e.appendChild(t);
80
+ } else e.appendChild(o);
81
81
  }
82
- const u = document.createElement("div");
83
- if (((u.className = "ab-card-body"), t.dismissible)) {
82
+ const r = document.createElement("div");
83
+ if (((r.className = "ab-card-body"), t.dismissible)) {
84
84
  t.logCardDismissal = () => logCardDismissal(t);
85
- const e = o("Dismiss Card", void 0, t.dismissCard.bind(t));
86
- a.appendChild(e),
87
- d(u, c.W, (t) => {
88
- (a.className += " ab-swiped-left"), e.onclick(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);
89
89
  }),
90
- d(u, c.X, (t) => {
91
- (a.className += " ab-swiped-right"), e.onclick(t);
90
+ c(r, m.V, (t) => {
91
+ (e.className += " ab-swiped-right"), o.onclick(t);
92
92
  });
93
93
  }
94
- let p = "",
95
- b = !1;
96
- if ((t.title && "" !== t.title && ((p = t.title), (b = !0)), b)) {
94
+ let s = "",
95
+ l = !1;
96
+ if ((t.title && "" !== t.title && ((s = t.title), (l = !0)), l)) {
97
97
  const t = document.createElement("h1");
98
98
  if (
99
99
  ((t.className = "ab-title"),
100
- (t.id = r.Z.Y()),
101
- a.setAttribute("aria-labelledby", t.id),
102
- i)
100
+ (t.id = p.W()),
101
+ e.setAttribute("aria-labelledby", t.id),
102
+ n)
103
103
  ) {
104
104
  const o = document.createElement("a");
105
- o.setAttribute("href", n),
106
- (o.onclick = s),
107
- o.appendChild(document.createTextNode(p)),
105
+ o.setAttribute("href", a),
106
+ (o.onclick = i),
107
+ o.appendChild(document.createTextNode(s)),
108
108
  t.appendChild(o);
109
- } else t.appendChild(document.createTextNode(p));
110
- u.appendChild(t);
109
+ } else t.appendChild(document.createTextNode(s));
110
+ r.appendChild(t);
111
111
  }
112
- const l = document.createElement("div");
112
+ const b = document.createElement("div");
113
113
  if (
114
- ((l.className = b ? "ab-description" : "ab-description ab-no-title"),
115
- (l.id = r.Z.Y()),
116
- a.setAttribute("aria-describedby", l.id),
117
- t.description && l.appendChild(document.createTextNode(t.description)),
118
- i)
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)
119
119
  ) {
120
120
  const o = document.createElement("div");
121
121
  o.className = "ab-url-area";
122
122
  const e = document.createElement("a");
123
- e.setAttribute("href", n),
123
+ e.setAttribute("href", a),
124
124
  t.linkText && e.appendChild(document.createTextNode(t.linkText)),
125
- (e.onclick = s),
125
+ (e.onclick = i),
126
126
  o.appendChild(e),
127
- l.appendChild(o);
127
+ b.appendChild(o);
128
128
  }
129
- u.appendChild(l), a.appendChild(u);
129
+ r.appendChild(b), e.appendChild(r);
130
130
  const f = document.createElement("div");
131
131
  return (
132
132
  (f.className = "ab-unread-indicator"),
133
133
  t.viewed && (f.className += " read"),
134
- a.appendChild(f),
135
- (t._ = a),
136
- a
134
+ e.appendChild(f),
135
+ (t.T = e),
136
+ e
137
137
  );
138
138
  }
@@ -2,10 +2,10 @@ import { Card } from "./models/index.js";
2
2
  import n from "./card-manager-factory.js";
3
3
  import { MUST_BE_CARD_WARNING_SUFFIX as f } from "../common/constants.js";
4
4
  import e from "../managers/braze-instance.js";
5
- import r from "../../shared-lib/braze-shared-lib.js";
6
- export function logCardClick(o, a) {
5
+ import { logger as r } from "../../shared-lib/index.js";
6
+ export function logCardClick(o, m) {
7
7
  return (
8
- !!e.rr() &&
9
- (o instanceof Card ? n.m().h(o, a).O : (r.j.error("card " + f), !1))
8
+ !!e.X() &&
9
+ (o instanceof Card ? n.m().h(o, m).L : (r.error("card " + f), !1))
10
10
  );
11
11
  }
@@ -2,10 +2,9 @@ import { Card } from "./models/index.js";
2
2
  import n from "./card-manager-factory.js";
3
3
  import { MUST_BE_CARD_WARNING_SUFFIX as f } from "../common/constants.js";
4
4
  import e from "../managers/braze-instance.js";
5
- import r from "../../shared-lib/braze-shared-lib.js";
5
+ import { logger as r } from "../../shared-lib/index.js";
6
6
  export function logCardDismissal(o) {
7
7
  return (
8
- !!e.rr() &&
9
- (o instanceof Card ? n.m().A(o).O : (r.j.error("card " + f), !1))
8
+ !!e.X() && (o instanceof Card ? n.m().B(o).L : (r.error("card " + f), !1))
10
9
  );
11
10
  }
@@ -1,13 +1,13 @@
1
1
  import { Card } from "./models/index.js";
2
2
  import n from "./card-manager-factory.js";
3
3
  import e from "../managers/braze-instance.js";
4
- import { isArray as p } from "../util/code-utils.js";
4
+ import { isArray as j } from "../util/code-utils.js";
5
5
  import { MUST_BE_CARD_WARNING_SUFFIX as f } from "../common/constants.js";
6
- import r from "../../shared-lib/braze-shared-lib.js";
6
+ import { logger as r } from "../../shared-lib/index.js";
7
7
  export function logCardImpressions(o, s) {
8
- if (!e.rr()) return !1;
9
- if (!p(o)) return r.j.error("cards must be an array"), !1;
10
- for (const s of o)
11
- if (!(s instanceof Card)) return r.j.error(`Each card in cards ${f}`), !1;
12
- return n.m().J(o, s).O;
8
+ if (!e.X()) return !1;
9
+ if (!j(o)) return r.error("cards must be an array"), !1;
10
+ for (const n of o)
11
+ if (!(n instanceof Card)) return r.error(`Each card in cards ${f}`), !1;
12
+ return n.m().G(o, s).L;
13
13
  }
@@ -2,31 +2,31 @@ import Card from "./card.js";
2
2
  export default class CaptionedImage extends Card {
3
3
  constructor(t, s, i, h, e, r, a, o, c, n, d, p, u, l, m, f) {
4
4
  super(t, s, i, h, e, r, a, o, c, n, d, p, u, l, m, f),
5
- (this.U = "ab-captioned-image"),
6
- (this.V = !0),
5
+ (this._ = "ab-captioned-image"),
6
+ (this.S = !0),
7
7
  (this.test = !1);
8
8
  }
9
- tt() {
9
+ Y() {
10
10
  const t = {};
11
11
  return (
12
- (t[Card.it.st] = Card.et.ht),
13
- (t[Card.it.rt] = this.id),
14
- (t[Card.it.ot] = this.viewed),
15
- (t[Card.it.ct] = this.title),
16
- (t[Card.it.nt] = this.imageUrl),
17
- (t[Card.it.dt] = this.description),
18
- (t[Card.it.ut] = this.updated),
19
- (t[Card.it.lt] = this.created),
20
- (t[Card.it.ft] = this.categories),
21
- (t[Card.it.xt] = this.expiresAt),
22
- (t[Card.it.URL] = this.url),
23
- (t[Card.it.bt] = this.linkText),
24
- (t[Card.it.gt] = this.aspectRatio),
25
- (t[Card.it.jt] = this.extras),
26
- (t[Card.it.zt] = this.pinned),
27
- (t[Card.it.kt] = this.dismissible),
28
- (t[Card.it.qt] = this.clicked),
29
- (t[Card.it.vt] = this.test),
12
+ (t[Card.tt.Z] = Card.it.st),
13
+ (t[Card.tt.ht] = this.id),
14
+ (t[Card.tt.et] = this.viewed),
15
+ (t[Card.tt.rt] = this.title),
16
+ (t[Card.tt.ot] = this.imageUrl),
17
+ (t[Card.tt.ct] = this.description),
18
+ (t[Card.tt.nt] = this.updated),
19
+ (t[Card.tt.dt] = this.created),
20
+ (t[Card.tt.ut] = this.categories),
21
+ (t[Card.tt.lt] = this.expiresAt),
22
+ (t[Card.tt.URL] = this.url),
23
+ (t[Card.tt.ft] = this.linkText),
24
+ (t[Card.tt.xt] = this.aspectRatio),
25
+ (t[Card.tt.bt] = this.extras),
26
+ (t[Card.tt.gt] = this.pinned),
27
+ (t[Card.tt.jt] = this.dismissible),
28
+ (t[Card.tt.zt] = this.clicked),
29
+ (t[Card.tt.kt] = this.test),
30
30
  t
31
31
  );
32
32
  }
@@ -2,11 +2,11 @@ import {
2
2
  convertMsToSeconds as h,
3
3
  dateFromUnixTimestamp as l,
4
4
  } from "../../util/date-utils.js";
5
- import { FEED_ANIMATION_DURATION as u } from "../../common/constants.js";
6
- import E from "../../managers/subscription-manager.js";
7
- import r from "../../../shared-lib/braze-shared-lib.js";
5
+ import { FEED_ANIMATION_DURATION as E } from "../../common/constants.js";
6
+ import T from "../../managers/subscription-manager.js";
7
+ import r from "../../../shared-lib/logger.js";
8
8
  export default class Card {
9
- constructor(t, i, s, h, l, n, e, r, u, E, o, T, a, I, N, c) {
9
+ constructor(t, i, s, h, l, n, e, r, u, E, o, T, I, a, N, c) {
10
10
  (this.id = t),
11
11
  (this.viewed = i),
12
12
  (this.title = s),
@@ -19,8 +19,8 @@ export default class Card {
19
19
  (this.url = E),
20
20
  (this.linkText = o),
21
21
  (this.aspectRatio = T),
22
- (this.extras = a),
23
- (this.pinned = I),
22
+ (this.extras = I),
23
+ (this.pinned = a),
24
24
  (this.dismissible = N),
25
25
  (this.clicked = c),
26
26
  (this.id = t),
@@ -38,8 +38,8 @@ export default class Card {
38
38
  ? (this.aspectRatio = null)
39
39
  : ((T = parseFloat(T.toString())),
40
40
  (this.aspectRatio = isNaN(T) ? null : T)),
41
- (this.extras = a || {}),
42
- (this.pinned = I || !1),
41
+ (this.extras = I || {}),
42
+ (this.pinned = a || !1),
43
43
  (this.dismissible = N || !1),
44
44
  (this.dismissed = !1),
45
45
  (this.clicked = c || !1),
@@ -63,7 +63,7 @@ export default class Card {
63
63
  dismissCard() {
64
64
  if (!this.dismissible || this.dismissed) return;
65
65
  "function" == typeof this.logCardDismissal && this.logCardDismissal();
66
- let t = this._;
66
+ let t = this.T;
67
67
  !t && this.id && (t = document.getElementById(this.id)),
68
68
  t &&
69
69
  ((t.style.height = t.offsetHeight + "px"),
@@ -76,122 +76,122 @@ export default class Card {
76
76
  setTimeout(function () {
77
77
  t && t.parentNode && t.parentNode.removeChild(t);
78
78
  }, Card.At));
79
- }, u));
79
+ }, E));
80
80
  }
81
81
  Nt() {
82
- return null == this.Et && (this.Et = new E()), this.Et;
82
+ return null == this.Et && (this.Et = new T()), this.Et;
83
83
  }
84
84
  St() {
85
- return null == this.Tt && (this.Tt = new E()), this.Tt;
85
+ return null == this.Tt && (this.Tt = new T()), this.Tt;
86
86
  }
87
- M() {
87
+ K() {
88
88
  this.viewed = !0;
89
89
  }
90
90
  p() {
91
91
  (this.viewed = !0), (this.clicked = !0), this.Nt().Dt();
92
92
  }
93
- F() {
93
+ N() {
94
94
  return (
95
95
  !(!this.dismissible || this.dismissed) &&
96
96
  ((this.dismissed = !0), this.St().Dt(), !0)
97
97
  );
98
98
  }
99
99
  Ct(t) {
100
- if (null == t || t[Card.Rt.rt] !== this.id) return !0;
100
+ if (null == t || t[Card.Rt.ht] !== this.id) return !0;
101
101
  if (t[Card.Rt.Lt]) return !1;
102
102
  if (
103
- null != t[Card.Rt.ut] &&
103
+ null != t[Card.Rt.nt] &&
104
104
  null != this.updated &&
105
- parseInt(t[Card.Rt.ut]) < h(this.updated.valueOf())
105
+ parseInt(t[Card.Rt.nt]) < h(this.updated.valueOf())
106
106
  )
107
107
  return !0;
108
108
  if (
109
- (t[Card.Rt.ot] && !this.viewed && (this.viewed = !0),
110
- t[Card.Rt.qt] && !this.clicked && (this.clicked = t[Card.Rt.qt]),
111
- null != t[Card.Rt.ct] && (this.title = t[Card.Rt.ct]),
112
- null != t[Card.Rt.nt] && (this.imageUrl = t[Card.Rt.nt]),
113
- null != t[Card.Rt.dt] && (this.description = t[Card.Rt.dt]),
114
- null != t[Card.Rt.ut])
109
+ (t[Card.Rt.et] && !this.viewed && (this.viewed = !0),
110
+ t[Card.Rt.zt] && !this.clicked && (this.clicked = t[Card.Rt.zt]),
111
+ null != t[Card.Rt.rt] && (this.title = t[Card.Rt.rt]),
112
+ null != t[Card.Rt.ot] && (this.imageUrl = t[Card.Rt.ot]),
113
+ null != t[Card.Rt.ct] && (this.description = t[Card.Rt.ct]),
114
+ null != t[Card.Rt.nt])
115
115
  ) {
116
- const i = l(t[Card.Rt.ut]);
116
+ const i = l(t[Card.Rt.nt]);
117
117
  null != i && (this.updated = i);
118
118
  }
119
- if (null != t[Card.Rt.xt]) {
119
+ if (null != t[Card.Rt.lt]) {
120
120
  let i;
121
- (i = t[Card.Rt.xt] === Card._t ? null : l(t[Card.Rt.xt])),
121
+ (i = t[Card.Rt.lt] === Card._t ? null : l(t[Card.Rt.lt])),
122
122
  (this.expiresAt = i);
123
123
  }
124
124
  if (
125
125
  (null != t[Card.Rt.URL] && (this.url = t[Card.Rt.URL]),
126
- null != t[Card.Rt.bt] && (this.linkText = t[Card.Rt.bt]),
127
- null != t[Card.Rt.gt])
126
+ null != t[Card.Rt.ft] && (this.linkText = t[Card.Rt.ft]),
127
+ null != t[Card.Rt.xt])
128
128
  ) {
129
- const i = parseFloat(t[Card.Rt.gt].toString());
129
+ const i = parseFloat(t[Card.Rt.xt].toString());
130
130
  this.aspectRatio = isNaN(i) ? null : i;
131
131
  }
132
132
  return (
133
- null != t[Card.Rt.jt] && (this.extras = t[Card.Rt.jt]),
134
- null != t[Card.Rt.zt] && (this.pinned = t[Card.Rt.zt]),
135
- null != t[Card.Rt.kt] && (this.dismissible = t[Card.Rt.kt]),
136
- null != t[Card.Rt.vt] && (this.test = t[Card.Rt.vt]),
133
+ null != t[Card.Rt.bt] && (this.extras = t[Card.Rt.bt]),
134
+ null != t[Card.Rt.gt] && (this.pinned = t[Card.Rt.gt]),
135
+ null != t[Card.Rt.jt] && (this.dismissible = t[Card.Rt.jt]),
136
+ null != t[Card.Rt.kt] && (this.test = t[Card.Rt.kt]),
137
137
  !0
138
138
  );
139
139
  }
140
- tt() {
141
- r.j.error("Must be implemented in a subclass");
140
+ Y() {
141
+ r.error("Must be implemented in a subclass");
142
142
  }
143
143
  }
144
144
  (Card._t = -1),
145
145
  (Card.Rt = {
146
- rt: "id",
147
- ot: "v",
148
- kt: "db",
146
+ ht: "id",
147
+ et: "v",
148
+ jt: "db",
149
149
  Lt: "r",
150
- ut: "ca",
151
- zt: "p",
152
- xt: "ea",
153
- jt: "e",
154
- st: "tp",
155
- nt: "i",
156
- ct: "tt",
157
- dt: "ds",
150
+ nt: "ca",
151
+ gt: "p",
152
+ lt: "ea",
153
+ bt: "e",
154
+ Z: "tp",
155
+ ot: "i",
156
+ rt: "tt",
157
+ ct: "ds",
158
158
  URL: "u",
159
- bt: "dm",
160
- gt: "ar",
161
- qt: "cl",
162
- vt: "t",
159
+ ft: "dm",
160
+ xt: "ar",
161
+ zt: "cl",
162
+ kt: "t",
163
163
  }),
164
- (Card.et = {
165
- ht: "captioned_image",
164
+ (Card.it = {
165
+ st: "captioned_image",
166
166
  Ot: "text_announcement",
167
167
  Mt: "short_news",
168
168
  Pt: "banner_image",
169
169
  Ut: "control",
170
170
  }),
171
- (Card.it = {
172
- rt: "id",
173
- ot: "v",
174
- kt: "db",
175
- lt: "cr",
176
- ut: "ca",
177
- zt: "p",
178
- ft: "t",
179
- xt: "ea",
180
- jt: "e",
181
- st: "tp",
182
- nt: "i",
183
- ct: "tt",
184
- dt: "ds",
171
+ (Card.tt = {
172
+ ht: "id",
173
+ et: "v",
174
+ jt: "db",
175
+ dt: "cr",
176
+ nt: "ca",
177
+ gt: "p",
178
+ ut: "t",
179
+ lt: "ea",
180
+ bt: "e",
181
+ Z: "tp",
182
+ ot: "i",
183
+ rt: "tt",
184
+ ct: "ds",
185
185
  URL: "u",
186
- bt: "dm",
187
- gt: "ar",
188
- qt: "cl",
189
- vt: "s",
186
+ ft: "dm",
187
+ xt: "ar",
188
+ zt: "cl",
189
+ kt: "s",
190
190
  }),
191
191
  (Card.Gt = {
192
192
  Xt: "ADVERTISING",
193
- Vt: "ANNOUNCEMENTS",
194
- Wt: "NEWS",
195
- Ft: "SOCIAL",
193
+ vt: "ANNOUNCEMENTS",
194
+ Vt: "NEWS",
195
+ Wt: "SOCIAL",
196
196
  }),
197
197
  (Card.At = 400);