@braze/web-sdk 5.5.0 → 5.6.1

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 (183) hide show
  1. package/index.d.ts +109 -7
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +33 -31
  5. package/shared-lib/guid.js +3 -3
  6. package/shared-lib/indexed-db-adapter.js +20 -20
  7. package/shared-lib/logger.js +18 -18
  8. package/shared-lib/supported-options.js +24 -24
  9. package/src/Banner/banner-factory.js +14 -0
  10. package/src/Banner/banner-provider-factory.js +19 -0
  11. package/src/Banner/banner-provider.js +198 -0
  12. package/src/Banner/banner.js +30 -0
  13. package/src/Banner/display/banner-to-html.js +57 -0
  14. package/src/Banner/display/destroy-banner-html.js +7 -0
  15. package/src/Banner/display/detect-banner-impressions.js +28 -0
  16. package/src/Banner/get-all-banners.js +13 -0
  17. package/src/Banner/get-banner.js +19 -0
  18. package/src/Banner/index.js +7 -0
  19. package/src/Banner/log-banner-click.js +22 -0
  20. package/src/Banner/log-banner-impressions.js +31 -0
  21. package/src/Banner/request-banners-refresh.js +35 -0
  22. package/src/Banner/subscribe-to-banners-updates.js +23 -0
  23. package/src/Banner/types.js +1 -0
  24. package/src/Banner/ui/insert-banner.js +24 -0
  25. package/src/Card/card-manager-factory.js +10 -10
  26. package/src/Card/card-manager.js +54 -52
  27. package/src/Card/display/card-display.js +77 -91
  28. package/src/Card/log-card-click.js +6 -6
  29. package/src/Card/log-card-dismissal.js +6 -5
  30. package/src/Card/log-card-impressions.js +11 -11
  31. package/src/Card/models/captioned-image.js +21 -21
  32. package/src/Card/models/card.js +99 -99
  33. package/src/Card/models/classic-card.js +21 -21
  34. package/src/Card/models/control-card.js +11 -11
  35. package/src/Card/models/image-only.js +19 -19
  36. package/src/Card/util/card-factory.js +58 -58
  37. package/src/ContentCards/content-cards-provider-factory.js +14 -14
  38. package/src/ContentCards/content-cards-provider.js +261 -263
  39. package/src/ContentCards/content-cards.js +5 -5
  40. package/src/ContentCards/get-cached-content-cards.js +3 -3
  41. package/src/ContentCards/request-content-cards-refresh.js +4 -4
  42. package/src/ContentCards/subscribe-to-content-cards-updates.js +13 -13
  43. package/src/ContentCards/ui/hide-content-cards.js +7 -7
  44. package/src/ContentCards/ui/show-content-cards.js +52 -52
  45. package/src/ContentCards/ui/toggle-content-cards.js +4 -4
  46. package/src/Core/add-sdk-metadata.js +9 -9
  47. package/src/Core/change-user.js +14 -14
  48. package/src/Core/destroy.js +3 -3
  49. package/src/Core/disable-sdk.js +13 -13
  50. package/src/Core/enable-sdk.js +9 -9
  51. package/src/Core/get-device-id.js +10 -10
  52. package/src/Core/get-user.js +2 -2
  53. package/src/Core/handle-braze-action.js +53 -53
  54. package/src/Core/initialize.js +2 -2
  55. package/src/Core/is-disabled.js +2 -2
  56. package/src/Core/is-initialized.js +2 -2
  57. package/src/Core/log-custom-event.js +27 -27
  58. package/src/Core/log-purchase.js +38 -38
  59. package/src/Core/open-session.js +18 -18
  60. package/src/Core/remove-all-subscriptions.js +2 -2
  61. package/src/Core/remove-subscription.js +3 -3
  62. package/src/Core/request-immediate-data-flush.js +5 -5
  63. package/src/Core/set-logger.js +2 -2
  64. package/src/Core/set-sdk-authentication-signature.js +6 -6
  65. package/src/Core/subscribe-to-sdk-authentication-failures.js +5 -5
  66. package/src/Core/toggle-logging.js +2 -2
  67. package/src/Core/wipe-data.js +10 -10
  68. package/src/FeatureFlags/feature-flag-factory.js +13 -13
  69. package/src/FeatureFlags/feature-flag.js +10 -10
  70. package/src/FeatureFlags/feature-flags-provider-factory.js +13 -14
  71. package/src/FeatureFlags/feature-flags-provider.js +118 -116
  72. package/src/FeatureFlags/get-all-feature-flags.js +10 -10
  73. package/src/FeatureFlags/get-feature-flag.js +9 -9
  74. package/src/FeatureFlags/log-feature-flag-impression.js +18 -18
  75. package/src/FeatureFlags/refresh-feature-flags.js +6 -6
  76. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +9 -9
  77. package/src/Feed/feed-provider-factory.js +12 -12
  78. package/src/Feed/feed-provider.js +59 -59
  79. package/src/Feed/feed.js +4 -4
  80. package/src/Feed/get-cached-feed.js +3 -3
  81. package/src/Feed/log-feed-displayed.js +5 -5
  82. package/src/Feed/request-feed-refresh.js +3 -3
  83. package/src/Feed/subscribe-to-feed-updates.js +4 -4
  84. package/src/Feed/ui/hide-feed.js +5 -5
  85. package/src/Feed/ui/show-feed.js +53 -53
  86. package/src/Feed/ui/toggle-feed.js +4 -4
  87. package/src/InAppMessage/defer-in-app-message.js +9 -9
  88. package/src/InAppMessage/display/html-message-display-utils.js +18 -164
  89. package/src/InAppMessage/display/html-message-to-html.js +55 -62
  90. package/src/InAppMessage/display/in-app-message-to-html.js +74 -74
  91. package/src/InAppMessage/display/modal-utils.js +17 -17
  92. package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
  93. package/src/InAppMessage/in-app-message-factory.js +61 -61
  94. package/src/InAppMessage/in-app-message-manager-factory.js +9 -9
  95. package/src/InAppMessage/in-app-message-manager.js +158 -156
  96. package/src/InAppMessage/log-in-app-message-button-click.js +16 -16
  97. package/src/InAppMessage/log-in-app-message-click.js +11 -11
  98. package/src/InAppMessage/log-in-app-message-html-click.js +15 -15
  99. package/src/InAppMessage/log-in-app-message-impression.js +6 -6
  100. package/src/InAppMessage/models/control-message.js +15 -8
  101. package/src/InAppMessage/models/full-screen-message.js +34 -34
  102. package/src/InAppMessage/models/html-message.js +23 -23
  103. package/src/InAppMessage/models/in-app-message-button.js +10 -10
  104. package/src/InAppMessage/models/in-app-message.js +155 -155
  105. package/src/InAppMessage/models/modal-message.js +33 -33
  106. package/src/InAppMessage/models/slide-up-message.js +35 -35
  107. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  108. package/src/InAppMessage/subscribe-to-in-app-message.js +3 -3
  109. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
  110. package/src/InAppMessage/ui/show-in-app-message.js +103 -103
  111. package/src/Push/is-push-blocked.js +2 -2
  112. package/src/Push/is-push-permission-granted.js +2 -2
  113. package/src/Push/is-push-supported.js +2 -2
  114. package/src/Push/push-manager-factory.js +25 -25
  115. package/src/Push/push-manager.js +176 -176
  116. package/src/Push/request-push-permission.js +8 -8
  117. package/src/Push/unregister-push.js +4 -4
  118. package/src/Push/utils/push-utils.js +4 -4
  119. package/src/User/user-manager.js +38 -38
  120. package/src/User/user.js +95 -92
  121. package/src/common/base-feed.js +9 -9
  122. package/src/common/base-provider.js +2 -2
  123. package/src/common/constants.js +1 -0
  124. package/src/common/detect-impression.js +18 -0
  125. package/src/common/event-logger.js +22 -22
  126. package/src/common/feed-display.js +53 -53
  127. package/src/index.js +1 -0
  128. package/src/l10n/l10n-manager-factory.js +15 -15
  129. package/src/l10n/l10n-manager.js +4 -4
  130. package/src/managers/auth-manager.js +38 -38
  131. package/src/managers/braze-instance.js +212 -212
  132. package/src/managers/device-manager.js +30 -30
  133. package/src/managers/network-manager.js +234 -235
  134. package/src/managers/server-config-manager.js +99 -83
  135. package/src/managers/session-manager.js +46 -50
  136. package/src/managers/storage-manager-factory.js +13 -13
  137. package/src/managers/storage-manager.js +182 -180
  138. package/src/managers/subscription-manager.js +12 -12
  139. package/src/managers/utils.js +4 -4
  140. package/src/models/backend-errors.js +5 -5
  141. package/src/models/braze-event.js +9 -9
  142. package/src/models/device.js +2 -2
  143. package/src/models/identifier.js +15 -15
  144. package/src/models/push-token.js +10 -10
  145. package/src/models/request-result.js +4 -4
  146. package/src/models/server-config.js +38 -34
  147. package/src/request-controller.js +228 -228
  148. package/src/triggers/models/custom-event-data.js +5 -5
  149. package/src/triggers/models/custom-event-property-data.js +6 -6
  150. package/src/triggers/models/filter-set.js +10 -10
  151. package/src/triggers/models/filter.js +66 -66
  152. package/src/triggers/models/in-app-message-click-data.js +10 -10
  153. package/src/triggers/models/purchase-data.js +2 -2
  154. package/src/triggers/models/purchase-property-data.js +6 -6
  155. package/src/triggers/models/push-click-data.js +5 -5
  156. package/src/triggers/models/trigger-condition.js +46 -46
  157. package/src/triggers/models/trigger-events.js +4 -4
  158. package/src/triggers/models/trigger.js +33 -33
  159. package/src/triggers/triggers-provider-factory.js +16 -16
  160. package/src/triggers/triggers-provider.js +156 -154
  161. package/src/ui/js/attach-css.js +7 -7
  162. package/src/ui/js/banner-css.js +11 -0
  163. package/src/ui/js/feed-css.js +4 -4
  164. package/src/ui/js/iam-css.js +4 -4
  165. package/src/ui/js/index.js +1 -0
  166. package/src/ui/js/load-font-awesome.js +8 -8
  167. package/src/util/base-device-parser.js +9 -9
  168. package/src/util/braze-actions.js +32 -32
  169. package/src/util/browser-detector.js +31 -30
  170. package/src/util/client-hints-parser.js +10 -10
  171. package/src/util/code-utils.js +5 -5
  172. package/src/util/component-utils.js +5 -5
  173. package/src/util/deprecation-utils.js +3 -3
  174. package/src/util/device-constants.js +1 -1
  175. package/src/util/dom-utils.js +13 -13
  176. package/src/util/html-display-utils.js +158 -0
  177. package/src/util/key-codes.js +1 -1
  178. package/src/util/net.js +21 -21
  179. package/src/util/request-header-utils.js +31 -30
  180. package/src/util/string-utils.js +2 -2
  181. package/src/util/user-agent-parser.js +18 -18
  182. package/src/util/validation-utils.js +89 -85
  183. package/src/util/window-utils.js +3 -3
@@ -1,159 +1,159 @@
1
- import C, { readResponseHeaders as b } from "../util/net.js";
2
- import y from "../common/base-provider.js";
3
- import e from "../managers/braze-instance.js";
1
+ import l, { readResponseHeaders as X } from "../util/net.js";
2
+ import s from "../common/base-provider.js";
3
+ import r from "../managers/braze-instance.js";
4
4
  import ContentCards from "./content-cards.js";
5
- import { dateFromUnixTimestamp as l } from "../util/date-utils.js";
6
- import { isURIJavascriptOrData as R } from "../util/url-utils.js";
5
+ import { dateFromUnixTimestamp as O } from "../util/date-utils.js";
6
+ import { isURIJavascriptOrData as Y } from "../util/url-utils.js";
7
7
  import {
8
- newCardFromContentCardsJson as N,
9
- newCardFromSerializedValue as S,
8
+ newCardFromContentCardsJson as Z,
9
+ newCardFromSerializedValue as tt,
10
10
  } from "../Card/util/card-factory.js";
11
- import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
12
- import T from "../managers/subscription-manager.js";
13
- import t from "../common/event-logger.js";
14
- import D from "../util/request-header-utils.js";
15
- import { randomInclusive as U } from "../util/math.js";
16
- import { MAX_ERROR_RETRIES_CONTENT_CARDS as k } from "../common/constants.js";
11
+ import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
12
+ import u from "../managers/subscription-manager.js";
13
+ import c from "../common/event-logger.js";
14
+ import h from "../util/request-header-utils.js";
15
+ import { randomInclusive as a } from "../util/math.js";
16
+ import { MAX_ERROR_RETRIES_CONTENT_CARDS as st } from "../common/constants.js";
17
17
  import {
18
- logger as r,
19
- IndexedDBAdapter as A,
20
- EventTypes as i,
18
+ logger as N,
19
+ IndexedDBAdapter as it,
20
+ EventTypes as d,
21
21
  } from "../../shared-lib/index.js";
22
- export default class v extends y {
23
- constructor(t, s, i, h, n) {
22
+ export default class Q extends s {
23
+ constructor(t, s, i, e, h) {
24
24
  super(),
25
- (this.yt = t),
26
- (this.u = s),
27
- (this.qt = i),
28
- (this.Jt = h),
29
- (this.$t = n),
30
- (this.yt = t),
31
- (this.u = s),
32
- (this.qt = i),
33
- (this.Jt = h),
34
- (this.$t = n),
35
- (this.Bt = new T()),
36
- e.Ht(this.Bt),
37
- (this.Kt = 0),
38
- (this.Qt = 0),
25
+ (this.As = t),
26
+ (this.C = s),
27
+ (this.B = i),
28
+ (this.Js = e),
29
+ (this.S = h),
30
+ (this.As = t),
31
+ (this.C = s),
32
+ (this.B = i),
33
+ (this.Js = e),
34
+ (this.S = h),
35
+ (this.Ms = new u()),
36
+ r.N(this.Ms),
37
+ (this.$s = 0),
38
+ (this.Ps = 0),
39
39
  (this.cards = []),
40
- this.Yt();
41
- const o = A.ts.Zt;
42
- new A(o, r).ss(o.hs.es, (t) => {
43
- this.rs(t);
40
+ this.Xs();
41
+ const n = it.Gs._s;
42
+ new it(n, N).Hs(n.Os.Ks, (t) => {
43
+ this.Qs(t);
44
44
  }),
45
- (this.ns = null),
46
- (this.os = null),
47
- (this.ls = null),
48
- (this.us = null),
49
- (this.cs = null),
50
- (this.fs = 10),
51
- (this.ds = 0);
45
+ (this.Vs = null),
46
+ (this.k = null),
47
+ (this.Ws = null),
48
+ (this.Ys = null),
49
+ (this.Zs = null),
50
+ (this.fi = 10),
51
+ (this.di = 0);
52
52
  }
53
- ps() {
54
- return this.ns;
53
+ pi() {
54
+ return this.Vs;
55
55
  }
56
- vs(t) {
57
- this.ns = t;
56
+ vi(t) {
57
+ this.Vs = t;
58
58
  }
59
- ws() {
60
- return this.os;
59
+ Ts() {
60
+ return this.k;
61
61
  }
62
- Cs(t) {
63
- this.os = t;
62
+ Rs(t) {
63
+ this.k = t;
64
64
  }
65
- Yt() {
66
- if (!this.u) return;
67
- const t = this.u.j(o.C.bs) || [],
68
- s = [];
69
- for (let i = 0; i < t.length; i++) {
70
- const e = S(t[i]);
71
- null != e && s.push(e);
65
+ Xs() {
66
+ if (!this.C) return;
67
+ const s = this.C.ps(t.bs.wi) || [],
68
+ i = [];
69
+ for (let t = 0; t < s.length; t++) {
70
+ const e = tt(s[t]);
71
+ null != e && i.push(e);
72
72
  }
73
- (this.cards = this.gs(this.ys(s, !1))),
74
- (this.Kt = this.u.j(o.C.js) || this.Kt),
75
- (this.Qt = this.u.j(o.C.Rs) || this.Qt);
73
+ (this.cards = this.Ci(this.bi(i, !1))),
74
+ (this.$s = this.C.ps(t.bs.gi) || this.$s),
75
+ (this.Ps = this.C.ps(t.bs.yi) || this.Ps);
76
76
  }
77
- Ns(t, s = !1, i = 0, e = 0) {
78
- let h;
79
- if (s) {
80
- h = [];
81
- for (const t of this.cards) t.test && h.push(t);
82
- } else h = this.cards.slice();
83
- for (let i = 0; i < t.length; i++) {
84
- const e = t[i];
85
- let r = null;
77
+ ji(s, i = !1, e = 0, h = 0) {
78
+ let r;
79
+ if (i) {
80
+ r = [];
81
+ for (const t of this.cards) t.test && r.push(t);
82
+ } else r = this.cards.slice();
83
+ for (let t = 0; t < s.length; t++) {
84
+ const e = s[t];
85
+ let h = null;
86
86
  for (let t = 0; t < this.cards.length; t++)
87
87
  if (e.id === this.cards[t].id) {
88
- r = this.cards[t];
88
+ h = this.cards[t];
89
89
  break;
90
90
  }
91
- if (s) {
92
- const t = N(e);
93
- null != r && r.viewed && t && (t.viewed = !0), null != t && h.push(t);
94
- } else if (null == r) {
95
- const t = N(e);
96
- null != t && h.push(t);
91
+ if (i) {
92
+ const t = Z(e);
93
+ null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
94
+ } else if (null == h) {
95
+ const t = Z(e);
96
+ null != t && r.push(t);
97
97
  } else {
98
- if (!r.Lt(e))
99
- for (let t = 0; t < h.length; t++)
100
- if (e.id === h[t].id) {
101
- h.splice(t, 1);
98
+ if (!h.ni(e))
99
+ for (let t = 0; t < r.length; t++)
100
+ if (e.id === r[t].id) {
101
+ r.splice(t, 1);
102
102
  break;
103
103
  }
104
104
  }
105
105
  }
106
- (this.cards = this.gs(this.ys(h, s))),
107
- this.Ts(),
108
- (this.Kt = i),
109
- (this.Qt = e),
110
- this.u && (this.u.I(o.C.js, this.Kt), this.u.I(o.C.Rs, this.Qt));
106
+ (this.cards = this.Ci(this.bi(r, i))),
107
+ this.Ri(),
108
+ (this.$s = e),
109
+ (this.Ps = h),
110
+ this.C && (this.C.js(t.bs.gi, this.$s), this.C.js(t.bs.yi, this.Ps));
111
111
  }
112
- Ss(t) {
113
- if (this.Ds() && null != t && t.cards) {
114
- this.u && this.u.I(o.C.Us, e.ks());
115
- const s = t.full_sync;
116
- s || this.Yt(),
117
- this.Ns(t.cards, s, t.last_full_sync_at, t.last_card_updated_at),
118
- this.Bt.Rt(this.As(!0));
112
+ U(s) {
113
+ if (this.Si() && null != s && s.cards) {
114
+ this.C && this.C.js(t.bs.Di, r.Ui());
115
+ const i = s.full_sync;
116
+ i || this.Xs(),
117
+ this.ji(s.cards, i, s.last_full_sync_at, s.last_card_updated_at),
118
+ this.Ms.X(this.ki(!0));
119
119
  }
120
120
  }
121
- Fs(t) {
122
- this.u && this.u.I(o.C.xs, t);
121
+ Ai(s) {
122
+ this.C && this.C.js(t.bs.Fi, s);
123
123
  }
124
- zs(s, e, h) {
125
- const r = () => {
126
- this.qs(e, h, !0);
124
+ xi(s, i, e) {
125
+ const h = () => {
126
+ this.zi(i, e, !0);
127
127
  },
128
- n = s ? b(s) : null;
129
- let l;
130
- if ((this.Es(), !n || !n["retry-after"])) return void this.Fs(0);
131
- const a = n["retry-after"];
132
- if (isNaN(a) && !isNaN(Date.parse(a)))
133
- (l = Date.parse(a) - new Date().getTime()), l < 0 && r();
128
+ r = s ? X(s) : null;
129
+ let n;
130
+ if ((this.qi(), !r || !r["retry-after"])) return void this.Ai(0);
131
+ const o = r["retry-after"];
132
+ if (isNaN(o) && !isNaN(Date.parse(o)))
133
+ (n = Date.parse(o) - new Date().getTime()), n < 0 && h();
134
134
  else {
135
- if (isNaN(parseFloat(a.toString()))) {
136
- const s =
135
+ if (isNaN(parseFloat(o.toString()))) {
136
+ const t =
137
137
  "Received unexpected value for retry-after header in /sync response";
138
- return t.q(i.Ls, { e: s + ": " + a }), void this.Fs(0);
138
+ return c.ds(d.Li, { e: t + ": " + o }), void this.Ai(0);
139
139
  }
140
- l = 1e3 * parseFloat(a.toString());
140
+ n = 1e3 * parseFloat(o.toString());
141
141
  }
142
- this.ls = window.setTimeout(() => {
143
- r();
144
- }, l);
145
- let u = 0;
146
- this.u && (u = this.u.j(o.C.xs)),
147
- (null == u || isNaN(parseInt(u.toString()))) && (u = 0),
148
- this.Fs(parseInt(u.toString()) + 1);
142
+ this.Ws = window.setTimeout(() => {
143
+ h();
144
+ }, n);
145
+ let l = 0;
146
+ this.C && (l = this.C.ps(t.bs.Fi)),
147
+ (null == l || isNaN(parseInt(l.toString()))) && (l = 0),
148
+ this.Ai(parseInt(l.toString()) + 1);
149
149
  }
150
- rs(t) {
150
+ Qs(t) {
151
151
  var s;
152
- if (!this.Ds()) return;
153
- this.Yt();
152
+ if (!this.Si()) return;
153
+ this.Xs();
154
154
  const i = this.cards.slice();
155
155
  let e = null;
156
- e = null === (s = this.yt) || void 0 === s ? void 0 : s.getUserId();
156
+ e = null === (s = this.As) || void 0 === s ? void 0 : s.getUserId();
157
157
  for (let s = 0; s < t.length; s++)
158
158
  if (e === t[s].userId || (null == e && null == t[s].userId)) {
159
159
  const e = t[s].card;
@@ -164,10 +164,10 @@ export default class v extends y {
164
164
  break;
165
165
  }
166
166
  if (null == h) {
167
- const t = N(e);
167
+ const t = Z(e);
168
168
  null != t && i.push(t);
169
169
  } else {
170
- if (!h.Lt(e))
170
+ if (!h.ni(e))
171
171
  for (let t = 0; t < i.length; t++)
172
172
  if (e.id === i[t].id) {
173
173
  i.splice(t, 1);
@@ -175,143 +175,143 @@ export default class v extends y {
175
175
  }
176
176
  }
177
177
  }
178
- (this.cards = this.gs(this.ys(i, !1))), this.Ts(), this.Bt.Rt(this.As(!0));
178
+ (this.cards = this.Ci(this.bi(i, !1))), this.Ri(), this.Ms.X(this.ki(!0));
179
179
  }
180
- ys(t, s) {
181
- let i = {},
182
- e = {},
183
- h = {};
184
- this.u &&
185
- ((i = this.u.j(o.C.v) || {}),
186
- (e = this.u.j(o.C.H) || {}),
187
- (h = this.u.j(o.C.A) || {}));
188
- const r = {},
189
- n = {},
180
+ bi(s, i) {
181
+ let e = {},
182
+ h = {},
183
+ r = {};
184
+ this.C &&
185
+ ((e = this.C.ps(t.bs.ot) || {}),
186
+ (h = this.C.ps(t.bs.vt) || {}),
187
+ (r = this.C.ps(t.bs.gt) || {}));
188
+ const n = {},
189
+ o = {},
190
190
  l = {};
191
- for (let s = 0; s < t.length; s++) {
192
- const o = t[s].id;
193
- o &&
194
- (i[o] && ((t[s].clicked = !0), (r[o] = !0)),
195
- e[o] && ((t[s].viewed = !0), (n[o] = !0)),
196
- h[o] && ((t[s].dismissed = !0), (l[o] = !0)));
191
+ for (let t = 0; t < s.length; t++) {
192
+ const i = s[t].id;
193
+ i &&
194
+ (e[i] && ((s[t].clicked = !0), (n[i] = !0)),
195
+ h[i] && ((s[t].viewed = !0), (o[i] = !0)),
196
+ r[i] && ((s[t].dismissed = !0), (l[i] = !0)));
197
197
  }
198
198
  return (
199
- s &&
200
- this.u &&
201
- (this.u.I(o.C.v, r), this.u.I(o.C.H, n), this.u.I(o.C.A, l)),
202
- t
199
+ i &&
200
+ this.C &&
201
+ (this.C.js(t.bs.ot, n), this.C.js(t.bs.vt, o), this.C.js(t.bs.gt, l)),
202
+ s
203
203
  );
204
204
  }
205
- gs(t) {
206
- const s = [],
207
- i = new Date();
208
- let e = {};
209
- this.u && (e = this.u.j(o.C.A) || {});
210
- let h = !1;
211
- for (let n = 0; n < t.length; n++) {
212
- const o = t[n].url;
213
- if (!this.Jt && o && R(o)) {
214
- r.error(
215
- `Card with url ${o} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
205
+ Ci(s) {
206
+ const i = [],
207
+ e = new Date();
208
+ let h = {};
209
+ this.C && (h = this.C.ps(t.bs.gt) || {});
210
+ let r = !1;
211
+ for (let t = 0; t < s.length; t++) {
212
+ const n = s[t].url;
213
+ if (!this.Js && n && Y(n)) {
214
+ N.error(
215
+ `Card with url ${n} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
216
216
  );
217
217
  continue;
218
218
  }
219
- const l = t[n].expiresAt;
220
- let a = !0;
221
- if ((null != l && (a = l >= i), (a = a && !t[n].dismissed), a))
222
- s.push(t[n]);
219
+ const o = s[t].expiresAt;
220
+ let l = !0;
221
+ if ((null != o && (l = o >= e), (l = l && !s[t].dismissed), l))
222
+ i.push(s[t]);
223
223
  else {
224
- const s = t[n].id;
225
- s && (e[s] = !0), (h = !0);
224
+ const i = s[t].id;
225
+ i && (h[i] = !0), (r = !0);
226
226
  }
227
227
  }
228
- return h && this.u && this.u.I(o.C.A, e), s;
228
+ return r && this.C && this.C.js(t.bs.gt, h), i;
229
229
  }
230
- Ts() {
231
- var t;
232
- const s = [];
233
- for (let t = 0; t < this.cards.length; t++) s.push(this.cards[t].Y());
234
- null === (t = this.u) || void 0 === t || t.I(o.C.bs, s);
230
+ Ri() {
231
+ var s;
232
+ const i = [];
233
+ for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].Bs());
234
+ null === (s = this.C) || void 0 === s || s.js(t.bs.wi, i);
235
235
  }
236
- Es() {
237
- this.ls && (clearTimeout(this.ls), (this.ls = null));
236
+ qi() {
237
+ this.Ws && (clearTimeout(this.Ws), (this.Ws = null));
238
238
  }
239
- Is() {
240
- null != this.us && (clearTimeout(this.us), (this.us = null));
239
+ Ji() {
240
+ null != this.Ys && (clearTimeout(this.Ys), (this.Ys = null));
241
241
  }
242
- Js(t = 1e3 * this.fs, s, i) {
243
- this.Is(),
244
- (this.us = window.setTimeout(() => {
245
- this.qs(s, i, !0);
242
+ Mi(t = 1e3 * this.fi, s, i) {
243
+ this.Ji(),
244
+ (this.Ys = window.setTimeout(() => {
245
+ this.zi(s, i, !0);
246
246
  }, t)),
247
- (this.cs = t);
247
+ (this.Zs = t);
248
248
  }
249
- qs(t, s, i = !1, h = !0) {
250
- var r;
251
- const n = this.$t,
252
- l = this.u;
253
- if (!n || !l) return void ("function" == typeof s && s());
254
- if ((!i && (this.Es(), this.Fs(0)), !this.Ds()))
249
+ zi(s, i, e = !1, n = !0) {
250
+ var o;
251
+ const u = this.S,
252
+ c = this.C;
253
+ if (!u || !c) return void ("function" == typeof i && i());
254
+ if ((!e && (this.qi(), this.Ai(0)), !this.Si()))
255
255
  return void (
256
- null === (r = this.qt) ||
257
- void 0 === r ||
258
- r.Ms(() => {
259
- this.qs(t, s);
256
+ null === (o = this.B) ||
257
+ void 0 === o ||
258
+ o.$i(() => {
259
+ this.zi(s, i);
260
260
  })
261
261
  );
262
- h && this.Is();
263
- const a = n.$s({}, !0);
264
- l.j(o.C.Us) !== e.ks() && this.Bs(),
265
- (a.last_full_sync_at = this.Kt),
266
- (a.last_card_updated_at = this.Qt);
267
- const u = n.Ps(a, D._s.Xs, i);
268
- let c = !1;
269
- n.Gs(
270
- a,
271
- (i = -1) => {
272
- if (this.u) {
262
+ n && this.Ji();
263
+ const f = u.H({}, !0);
264
+ c.ps(t.bs.Di) !== r.Ui() && this.Bi(),
265
+ (f.last_full_sync_at = this.$s),
266
+ (f.last_card_updated_at = this.Ps);
267
+ const d = u.J(f, h.O.Pi, e);
268
+ let m = !1;
269
+ u.V(
270
+ f,
271
+ (t = -1) => {
272
+ if (this.C) {
273
273
  const t = new Date().valueOf();
274
- D.Hs(this.u, D._s.Xs, t);
274
+ h.W(this.C, h.O.Pi, t);
275
275
  }
276
- -1 !== i && u.push(["X-Braze-Req-Tokens-Remaining", i.toString()]),
277
- C.Ks({
278
- url: `${n.Os()}/content_cards/sync`,
279
- data: a,
280
- headers: u,
281
- L: (i, e) => {
282
- if (!n.Qs(a, i, u))
283
- return (c = !0), void ("function" == typeof s && s());
284
- n.Vs(),
285
- this.zs(e, t, s),
286
- this.Ss(i),
287
- (c = !1),
288
- D.Ws(this.u, D._s.Xs, 1),
289
- "function" == typeof t && t();
276
+ -1 !== t && d.push(["X-Braze-Req-Tokens-Remaining", t.toString()]),
277
+ l.Y({
278
+ url: `${u.Z()}/content_cards/sync`,
279
+ data: f,
280
+ headers: d,
281
+ ss: (t, e) => {
282
+ if (!u.ts(f, t, d))
283
+ return (m = !0), void ("function" == typeof i && i());
284
+ u.es(),
285
+ this.xi(e, s, i),
286
+ this.U(t),
287
+ (m = !1),
288
+ h.ns(this.C, h.O.Pi, 1),
289
+ "function" == typeof s && s();
290
290
  },
291
291
  error: (t) => {
292
- n.Ys(t, "retrieving content cards"),
293
- (c = !0),
294
- "function" == typeof s && s();
292
+ u.rs(t, "retrieving content cards"),
293
+ (m = !0),
294
+ "function" == typeof i && i();
295
295
  },
296
- Zs: () => {
297
- if (c && h && !this.us && this.ds + 1 < k) {
298
- D.ti(this.u, D._s.Xs);
299
- let i = this.cs;
300
- (null == i || i < 1e3 * this.fs) && (i = 1e3 * this.fs),
301
- this.Js(Math.min(3e5, U(1e3 * this.fs, 3 * i)), t, s),
302
- (this.ds = this.ds + 1);
296
+ os: () => {
297
+ if (m && n && !this.Ys && this.di + 1 < st) {
298
+ h.hs(this.C, h.O.Pi);
299
+ let t = this.Zs;
300
+ (null == t || t < 1e3 * this.fi) && (t = 1e3 * this.fi),
301
+ this.Mi(Math.min(3e5, a(1e3 * this.fi, 3 * t)), s, i),
302
+ (this.di = this.di + 1);
303
303
  }
304
304
  },
305
305
  });
306
306
  },
307
- D._s.Xs,
308
- s,
307
+ h.O.Pi,
308
+ i,
309
309
  );
310
310
  }
311
- As(t) {
312
- t || this.Yt();
313
- const s = this.gs(this.cards);
314
- s.sort((t, s) =>
311
+ ki(s) {
312
+ s || this.Xs();
313
+ const i = this.Ci(this.cards);
314
+ i.sort((t, s) =>
315
315
  t.pinned && !s.pinned
316
316
  ? -1
317
317
  : s.pinned && !t.pinned
@@ -322,52 +322,50 @@ export default class v extends y {
322
322
  ? 1
323
323
  : 0,
324
324
  );
325
- let i = Math.max(this.Qt || 0, this.Kt || 0);
325
+ let e = Math.max(this.Ps || 0, this.$s || 0);
326
326
  return (
327
- 0 === i && (i = void 0),
328
- this.u && this.u.j(o.C.Rs) === this.Qt && void 0 === i && (i = this.Qt),
329
- new ContentCards(s, l(i))
327
+ 0 === e && (e = void 0),
328
+ this.C && this.C.ps(t.bs.yi) === this.Ps && void 0 === e && (e = this.Ps),
329
+ new ContentCards(i, O(e))
330
330
  );
331
331
  }
332
- si(t) {
333
- return this.Bt.Nt(t);
332
+ Fs(t) {
333
+ return this.Ms.Ns(t);
334
334
  }
335
- Bs() {
336
- (this.Kt = 0),
337
- (this.Qt = 0),
338
- this.u && (this.u.ii(o.C.js), this.u.ii(o.C.Rs));
335
+ Bi() {
336
+ (this.$s = 0),
337
+ (this.Ps = 0),
338
+ this.C && (this.C.Ls(t.bs.gi), this.C.Ls(t.bs.yi));
339
339
  }
340
- changeUser(t) {
341
- t ||
340
+ changeUser(s) {
341
+ s ||
342
342
  ((this.cards = []),
343
- this.Bt.Rt(new ContentCards(this.cards.slice(), null)),
344
- this.u &&
345
- (this.u.ii(o.C.bs),
346
- this.u.ii(o.C.v),
347
- this.u.ii(o.C.H),
348
- this.u.ii(o.C.A))),
349
- this.Bs();
343
+ this.Ms.X(new ContentCards(this.cards.slice(), null)),
344
+ this.C &&
345
+ (this.C.Ls(t.bs.wi),
346
+ this.C.Ls(t.bs.ot),
347
+ this.C.Ls(t.bs.vt),
348
+ this.C.Ls(t.bs.gt))),
349
+ this.Bi();
350
350
  }
351
- clearData(t) {
352
- (this.Kt = 0),
353
- (this.Qt = 0),
351
+ clearData(s) {
352
+ (this.$s = 0),
353
+ (this.Ps = 0),
354
354
  (this.cards = []),
355
- this.Bt.Rt(new ContentCards(this.cards.slice(), null)),
356
- t &&
357
- this.u &&
358
- (this.u.ii(o.C.bs),
359
- this.u.ii(o.C.v),
360
- this.u.ii(o.C.H),
361
- this.u.ii(o.C.A),
362
- this.u.ii(o.C.js),
363
- this.u.ii(o.C.Rs));
355
+ this.Ms.X(new ContentCards(this.cards.slice(), null)),
356
+ s &&
357
+ this.C &&
358
+ (this.C.Ls(t.bs.wi),
359
+ this.C.Ls(t.bs.ot),
360
+ this.C.Ls(t.bs.vt),
361
+ this.C.Ls(t.bs.gt),
362
+ this.C.Ls(t.bs.gi),
363
+ this.C.Ls(t.bs.yi));
364
364
  }
365
- Ds() {
366
- return (
367
- !!this.qt && (!!this.qt.ei() || (0 !== this.qt.hi() && this.ri(), !1))
368
- );
365
+ Si() {
366
+ return !!this.B && (!!this.B.Xi() || (0 !== this.B.Es() && this._i(), !1));
369
367
  }
370
- ri() {
371
- this.Bt.Rt(new ContentCards([], new Date())), this.u && this.u.ii(o.C.bs);
368
+ _i() {
369
+ this.Ms.X(new ContentCards([], new Date())), this.C && this.C.Ls(t.bs.wi);
372
370
  }
373
371
  }