@braze/web-sdk 4.8.3 → 4.10.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 (153) hide show
  1. package/index.d.ts +2247 -2071
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +7 -7
  4. package/shared-lib/encoding-utils.js +4 -4
  5. package/shared-lib/event-types.js +23 -22
  6. package/shared-lib/guid.js +7 -7
  7. package/shared-lib/indexed-db-adapter.js +172 -135
  8. package/shared-lib/logger.js +26 -26
  9. package/shared-lib/supported-options.js +14 -13
  10. package/shared-lib/types.js +1 -0
  11. package/src/Card/card-manager-factory.js +1 -1
  12. package/src/Card/card-manager.js +2 -2
  13. package/src/Card/display/card-display.js +5 -4
  14. package/src/Card/models/banner.js +10 -10
  15. package/src/Card/models/captioned-image.js +7 -7
  16. package/src/Card/models/card.js +37 -36
  17. package/src/Card/models/classic-card.js +7 -7
  18. package/src/Card/models/control-card.js +3 -3
  19. package/src/Card/models/image-only.js +32 -0
  20. package/src/Card/models/index.js +1 -0
  21. package/src/Card/util/card-factory.js +16 -16
  22. package/src/ContentCards/content-cards-provider-factory.js +1 -1
  23. package/src/ContentCards/content-cards-provider.js +102 -102
  24. package/src/ContentCards/get-cached-content-cards.js +1 -1
  25. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  26. package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
  27. package/src/ContentCards/ui/show-content-cards.js +15 -12
  28. package/src/Core/add-sdk-metadata.js +2 -2
  29. package/src/Core/braze-sdk-metadata.js +1 -1
  30. package/src/Core/change-user.js +1 -1
  31. package/src/Core/device-properties.js +1 -1
  32. package/src/Core/disable-sdk.js +10 -7
  33. package/src/Core/enable-sdk.js +5 -2
  34. package/src/Core/get-device-id.js +9 -7
  35. package/src/Core/get-user.js +1 -1
  36. package/src/Core/handle-braze-action.js +14 -14
  37. package/src/Core/is-disabled.js +1 -1
  38. package/src/Core/log-custom-event.js +4 -4
  39. package/src/Core/log-purchase.js +9 -9
  40. package/src/Core/open-session.js +10 -10
  41. package/src/FeatureFlags/feature-flag-factory.js +5 -3
  42. package/src/FeatureFlags/feature-flag.js +17 -14
  43. package/src/FeatureFlags/feature-flags-provider-factory.js +1 -1
  44. package/src/FeatureFlags/feature-flags-provider.js +56 -43
  45. package/src/FeatureFlags/get-all-feature-flags.js +2 -2
  46. package/src/FeatureFlags/get-feature-flag.js +2 -2
  47. package/src/FeatureFlags/index.js +1 -0
  48. package/src/FeatureFlags/log-feature-flag-impression.js +23 -0
  49. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  50. package/src/Feed/feed-provider-factory.js +1 -1
  51. package/src/Feed/feed-provider.js +20 -20
  52. package/src/Feed/get-cached-feed.js +1 -1
  53. package/src/Feed/log-feed-displayed.js +1 -1
  54. package/src/Feed/request-feed-refresh.js +1 -1
  55. package/src/Feed/subscribe-to-feed-updates.js +1 -1
  56. package/src/Feed/ui/show-feed.js +13 -10
  57. package/src/InAppMessage/defer-in-app-message.js +13 -0
  58. package/src/InAppMessage/display/get-animation-effect.js +1 -1
  59. package/src/InAppMessage/display/html-message-to-html.js +47 -47
  60. package/src/InAppMessage/display/in-app-message-to-html.js +92 -91
  61. package/src/InAppMessage/display/modal-utils.js +16 -16
  62. package/src/InAppMessage/get-deferred-in-app-message.js +5 -0
  63. package/src/InAppMessage/in-app-message-factory.js +77 -57
  64. package/src/InAppMessage/in-app-message-manager-factory.js +6 -6
  65. package/src/InAppMessage/in-app-message-manager.js +121 -82
  66. package/src/InAppMessage/index.js +2 -0
  67. package/src/InAppMessage/log-in-app-message-button-click.js +17 -9
  68. package/src/InAppMessage/log-in-app-message-click.js +4 -4
  69. package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
  70. package/src/InAppMessage/log-in-app-message-impression.js +3 -3
  71. package/src/InAppMessage/models/full-screen-message.js +65 -29
  72. package/src/InAppMessage/models/html-message.js +32 -13
  73. package/src/InAppMessage/models/in-app-message-button.js +7 -7
  74. package/src/InAppMessage/models/in-app-message.js +203 -134
  75. package/src/InAppMessage/models/modal-message.js +64 -29
  76. package/src/InAppMessage/models/slide-up-message.js +52 -24
  77. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  78. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  79. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
  80. package/src/InAppMessage/ui/show-in-app-message.js +49 -47
  81. package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
  82. package/src/Push/is-push-blocked.js +2 -2
  83. package/src/Push/is-push-permission-granted.js +2 -2
  84. package/src/Push/is-push-supported.js +2 -2
  85. package/src/Push/push-manager-factory.js +19 -19
  86. package/src/Push/push-manager.js +131 -131
  87. package/src/Push/request-push-permission.js +2 -2
  88. package/src/Push/unregister-push.js +2 -2
  89. package/src/Push/utils/push-utils.js +12 -10
  90. package/src/User/user-manager.js +4 -4
  91. package/src/User/user.js +63 -62
  92. package/src/common/base-feed.js +1 -1
  93. package/src/common/constants.js +1 -0
  94. package/src/common/event-logger.js +6 -6
  95. package/src/common/feed-display.js +34 -34
  96. package/src/common/translations.js +33 -33
  97. package/src/l10n/l10n-manager-factory.js +8 -8
  98. package/src/l10n/l10n-manager.js +6 -2
  99. package/src/l10n/types.js +1 -0
  100. package/src/managers/auth-manager.js +29 -29
  101. package/src/managers/braze-instance.js +132 -130
  102. package/src/managers/device-manager.js +22 -22
  103. package/src/managers/network-manager.js +103 -98
  104. package/src/managers/server-config-manager.js +23 -23
  105. package/src/managers/session-manager.js +5 -5
  106. package/src/managers/storage-manager-factory.js +9 -9
  107. package/src/managers/storage-manager.js +134 -131
  108. package/src/managers/subscription-manager.js +7 -7
  109. package/src/models/backend-errors.js +6 -6
  110. package/src/models/braze-event.js +11 -11
  111. package/src/models/braze-sdk-metadata.js +1 -1
  112. package/src/models/device.js +2 -2
  113. package/src/models/identifier.js +1 -1
  114. package/src/models/push-token.js +5 -5
  115. package/src/models/server-config.js +7 -7
  116. package/src/request-controller.js +197 -180
  117. package/src/triggers/models/custom-event-data.js +4 -4
  118. package/src/triggers/models/custom-event-property-data.js +7 -7
  119. package/src/triggers/models/filter-set.js +5 -5
  120. package/src/triggers/models/filter.js +65 -61
  121. package/src/triggers/models/in-app-message-click-data.js +9 -9
  122. package/src/triggers/models/purchase-data.js +4 -4
  123. package/src/triggers/models/purchase-property-data.js +6 -6
  124. package/src/triggers/models/push-click-data.js +6 -6
  125. package/src/triggers/models/trigger-condition.js +52 -56
  126. package/src/triggers/models/trigger-events.js +3 -3
  127. package/src/triggers/models/trigger.js +50 -38
  128. package/src/triggers/triggers-provider-factory.js +10 -6
  129. package/src/triggers/triggers-provider.js +204 -186
  130. package/src/triggers/types.js +1 -0
  131. package/src/ui/js/attach-css.js +5 -4
  132. package/src/ui/js/feed-css.js +5 -5
  133. package/src/ui/js/iam-css.js +5 -5
  134. package/src/util/base-device-parser.js +1 -1
  135. package/src/util/braze-actions.js +35 -30
  136. package/src/util/browser-detector.js +30 -31
  137. package/src/util/client-hints-parser.js +28 -22
  138. package/src/util/code-utils.js +22 -21
  139. package/src/util/color-utils.js +19 -13
  140. package/src/util/component-utils.js +4 -4
  141. package/src/util/date-utils.js +6 -5
  142. package/src/util/device-constants.js +10 -10
  143. package/src/util/dom-utils.js +28 -24
  144. package/src/util/error-utils.js +1 -1
  145. package/src/util/key-codes.js +1 -1
  146. package/src/util/net.js +53 -57
  147. package/src/util/request-header-utils.js +34 -11
  148. package/src/util/string-utils.js +14 -14
  149. package/src/util/types.js +1 -0
  150. package/src/util/url-utils.js +1 -4
  151. package/src/util/user-agent-parser.js +39 -39
  152. package/src/util/validation-utils.js +34 -34
  153. package/src/util/window-utils.js +11 -12
@@ -7,7 +7,7 @@ export default class Kt {
7
7
  e = null,
8
8
  l = null,
9
9
  r = { enabled: !1 },
10
- a = { enabled: !1, refresh_rate_limit: -1 }
10
+ a = { enabled: !1, refresh_rate_limit: void 0 },
11
11
  ) {
12
12
  (this.ol = t),
13
13
  (this.cl = i),
@@ -16,7 +16,7 @@ export default class Kt {
16
16
  (this.bl = e),
17
17
  (this.al = l),
18
18
  (this.ml = r),
19
- (this.mi = a),
19
+ (this.pi = a),
20
20
  (this.ol = t),
21
21
  (this.cl = i),
22
22
  (this.gl = s),
@@ -24,11 +24,11 @@ export default class Kt {
24
24
  (this.bl = e),
25
25
  (this.al = l),
26
26
  (this.ml = r),
27
- (this.mi = a);
27
+ (this.pi = a);
28
28
  }
29
29
  ss() {
30
30
  return {
31
- s: "4.8.3",
31
+ s: "4.10.0",
32
32
  l: this.ol,
33
33
  e: this.cl,
34
34
  a: this.gl,
@@ -36,13 +36,13 @@ export default class Kt {
36
36
  m: this.bl,
37
37
  v: this.al,
38
38
  c: this.ml,
39
- f: this.mi
39
+ f: this.pi,
40
40
  };
41
41
  }
42
- static zn(t) {
42
+ static Yn(t) {
43
43
  let i = t.l;
44
44
  return (
45
- "4.8.3" !== t.s && (i = 0), new Kt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
45
+ "4.10.0" !== t.s && (i = 0), new Kt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
46
46
  );
47
47
  }
48
48
  }
@@ -1,294 +1,311 @@
1
1
  import C from "./util/net.js";
2
- import ue from "./models/braze-event.js";
2
+ import be from "./models/braze-event.js";
3
3
  import s from "./common/event-logger.js";
4
4
  import { randomInclusive as D } from "./util/math.js";
5
5
  import t from "./models/request-result.js";
6
6
  import r from "../shared-lib/braze-shared-lib.js";
7
7
  import { STORAGE_KEYS as i } from "./managers/storage-manager.js";
8
8
  import E from "./managers/subscription-manager.js";
9
- import yt from "./Push/utils/push-utils.js";
9
+ import jt from "./Push/utils/push-utils.js";
10
10
  import T from "./util/request-header-utils.js";
11
- export default class Rt {
12
- constructor(t, s, i, e, n, l, h, o, r, u) {
13
- (this.$l = t),
14
- (this.Fl = s),
15
- (this.Ll = 0),
16
- (this.Pl = h.Wa()),
17
- (this.Jl = null),
18
- (this.Bl = i),
19
- (this.Ql = e),
20
- (this.Xl = n),
21
- (this.Zl = l),
22
- (this.yh = h),
23
- (this.$h = r),
24
- (this.qh = u),
25
- (this.Ph = o),
26
- (this.Jh = new E()),
27
- (this.Kh = 50);
11
+ export default class Lt {
12
+ constructor(t, i, s, e, h, o, n, r, u, l) {
13
+ (this.cn = t),
14
+ (this.baseUrl = i),
15
+ (this._e = s),
16
+ (this.fn = e),
17
+ (this.ft = h),
18
+ (this.wt = o),
19
+ (this.u = n),
20
+ (this.fu = r),
21
+ (this.Uo = u),
22
+ (this.gt = l),
23
+ (this.cn = t),
24
+ (this.baseUrl = i),
25
+ (this.gu = 0),
26
+ (this.gE = n.RE() || 0),
27
+ (this.vu = null),
28
+ (this._e = s),
29
+ (this.fn = e),
30
+ (this.ft = h),
31
+ (this.wt = o),
32
+ (this.u = n),
33
+ (this.Uo = u),
34
+ (this.gt = l),
35
+ (this.fu = r),
36
+ (this.wu = new E()),
37
+ (this.ku = null),
38
+ (this.yu = 50),
39
+ (this.ju = !1);
28
40
  }
29
- Wh(t, s) {
30
- return !t && !s && this.$h.xh() >= this.Kh;
41
+ Su(t, i) {
42
+ return !t && !i && this.Uo.Jh() >= this.yu;
31
43
  }
32
- Bh(t) {
33
- let s = this.Bl.El();
44
+ $u(t) {
45
+ let i = this._e.El();
34
46
  if (t.length > 0) {
35
- const i = this.Xl.getUserId();
47
+ const s = this.ft.getUserId();
36
48
  for (const e of t) {
37
- const t = (!e.userId && !i) || e.userId === i;
38
- e.type === r.q.Wl && t && (s = !0);
49
+ const t = (!e.userId && !s) || e.userId === s;
50
+ e.type === r.q.Wl && t && (i = !0);
39
51
  }
40
52
  }
41
- return s;
53
+ return i;
42
54
  }
43
- Gh(t, s, e, n, l, h, o) {
44
- null == e && (e = !0), e && this.Hh();
45
- const u = this.yh.Ja(),
46
- a = this.yh.Ha();
47
- let c = !1;
48
- const m = (t, s) => {
49
- let o = !1;
50
- T.Xs(this.yh, T.Qs.Sa, new Date().valueOf()),
51
- C.Ys({
52
- url: this.Fl + "/data/",
55
+ qu(t = !1, s = !1, e = !0, h, o, n, u = !1, l = !1) {
56
+ e && this.Au();
57
+ const a = this.u.cE(),
58
+ c = this.u.AE();
59
+ let d = !1;
60
+ const f = (t, s) => {
61
+ let r = !1;
62
+ T.Ws(this.u, T.Os.Na, new Date().valueOf()),
63
+ C.Xs({
64
+ url: this.baseUrl + "/data/",
53
65
  data: t,
54
66
  headers: s,
55
- O: e => {
67
+ O: (e) => {
56
68
  null != t.respond_with &&
57
69
  t.respond_with.triggers &&
58
- (this.Ll = Math.max(this.Ll - 1, 0)),
59
- this.qh.ti(t, e, s)
60
- ? (this.$h.si(),
61
- this.Zl.ul(e),
70
+ (this.gu = Math.max(this.gu - 1, 0)),
71
+ this.gt.Zs(t, e, s)
72
+ ? (this.Uo.ti(),
73
+ this.wt.ul(e),
62
74
  (null != t.respond_with &&
63
- t.respond_with.user_id != this.Xl.getUserId()) ||
64
- (null != t.device && this.yh.D(i.k.la, t.device),
75
+ t.respond_with.user_id != this.ft.getUserId()) ||
76
+ (null != t.device && this.u.D(i.k.Fa, t.device),
65
77
  null != t.sdk_metadata &&
66
- (this.yh.D(i.k.ua, t.sdk_metadata),
67
- this.yh.D(i.k.ma, this.Bl.pa())),
68
- this.Ph(e),
69
- "function" == typeof n && n()))
70
- : e.auth_error && (o = !0);
78
+ (this.u.D(i.k.Kh, t.sdk_metadata),
79
+ this.u.D(i.k.Wh, this._e.Yh())),
80
+ this.fu(e),
81
+ T.si(this.u, T.Os.Na, 1),
82
+ "function" == typeof h && h()))
83
+ : e.auth_error && (r = !0);
71
84
  },
72
85
  error: () => {
73
86
  null != t.respond_with &&
74
87
  t.respond_with.triggers &&
75
- (this.Ll = Math.max(this.Ll - 1, 0)),
76
- this.qh.Ra(t.events, t.attributes),
77
- "function" == typeof l && l();
88
+ (this.gu = Math.max(this.gu - 1, 0)),
89
+ this.gt.Qh(t.events, t.attributes),
90
+ "function" == typeof o && o();
78
91
  },
79
- ei: t => {
80
- if (("function" == typeof h && h(t), e && !c)) {
81
- if (t && !o) this.Qh();
92
+ ei: (t) => {
93
+ if (("function" == typeof n && n(t), e && !d)) {
94
+ if (t && !r) this.Cu();
82
95
  else {
83
- let t = this.Jl;
84
- (null == t || t < 1e3 * this.Pl) && (t = 1e3 * this.Pl),
85
- this.Qh(Math.min(3e5, D(1e3 * this.Pl, 3 * t)));
96
+ T.hi(this.u, T.Os.Na);
97
+ let t = this.vu;
98
+ (null == t || t < 1e3 * this.gE) && (t = 1e3 * this.gE),
99
+ this.Cu(Math.min(3e5, D(1e3 * this.gE, 3 * t)));
86
100
  }
87
- c = !0;
101
+ d = !0;
88
102
  }
89
- }
103
+ },
90
104
  });
91
105
  },
92
- d = this.Bh(u),
93
- f = s || d;
94
- if (this.Wh(o, d))
106
+ m = this.$u(a),
107
+ g = s || m;
108
+ if (this.Su(u, m))
95
109
  return void r.j.info(
96
- "Declining to flush data due to 50 consecutive authentication failures"
110
+ "Declining to flush data due to 50 consecutive authentication failures",
97
111
  );
98
- if (e && !this.qh.Ba(u, a, t, f))
99
- return this.Qh(), void ("function" == typeof h && h(!0));
100
- const g = this.qh.Da(t, f, u, a);
101
- f && this.Ll++;
112
+ if (e && !this.gt.Pa(a, c, t, g))
113
+ return this.Cu(), void ("function" == typeof n && n(!0));
114
+ const v = this.gt.$a(t, g, a, c, l);
115
+ g && this.gu++;
102
116
  let p = !1;
103
- if (g)
104
- for (const t of g)
105
- this.qh.Vs(t.requestData, () => m(t.requestData, t.headers)), (p = !0);
106
- this.$h.Zn() && e && !p
107
- ? this.Qh()
108
- : d && (r.j.info("Invoking new session subscriptions"), this.Jh.Et());
117
+ if (v)
118
+ for (const t of v)
119
+ this.gt.Qs(t.requestData, () => f(t.requestData, t.headers)), (p = !0);
120
+ this.Uo.wh() && e && !p
121
+ ? this.Cu()
122
+ : m && (r.j.info("Invoking new session subscriptions"), this.wu.Et());
109
123
  }
110
- Vh() {
111
- return this.Ll > 0;
124
+ Du() {
125
+ return this.gu > 0;
112
126
  }
113
- Qh(t) {
114
- this.Xh ||
115
- (null == t && (t = 1e3 * this.Pl),
116
- this.Hh(),
117
- (this.Yh = setTimeout(() => {
127
+ Cu(t = 1e3 * this.gE) {
128
+ this.ju ||
129
+ (this.Au(),
130
+ (this.ku = window.setTimeout(() => {
118
131
  if (document.hidden) {
119
132
  const t = "visibilitychange",
120
- s = () => {
133
+ i = () => {
121
134
  document.hidden ||
122
- (document.removeEventListener(t, s, !1), this.Gh());
135
+ (document.removeEventListener(t, i, !1), this.qu());
123
136
  };
124
- document.addEventListener(t, s, !1);
125
- } else this.Gh();
137
+ document.addEventListener(t, i, !1);
138
+ } else this.qu();
126
139
  }, t)),
127
- (this.Jl = t));
140
+ (this.vu = t));
128
141
  }
129
- Hh() {
130
- null != this.Yh && (clearTimeout(this.Yh), (this.Yh = null));
142
+ Au() {
143
+ null != this.ku && (clearTimeout(this.ku), (this.ku = null));
131
144
  }
132
145
  initialize() {
133
- (this.Xh = !1), this.Qh();
146
+ (this.ju = !1), this.Cu();
134
147
  }
135
148
  destroy() {
136
- this.Jh.removeAllSubscriptions(),
137
- this.$h.jh(),
138
- this.Hh(),
139
- (this.Xh = !0),
140
- this.Gh(null, null, !1),
141
- (this.Yh = null);
149
+ this.wu.removeAllSubscriptions(),
150
+ this.Uo.Gh(),
151
+ this.Au(),
152
+ (this.ju = !0),
153
+ this.qu(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
154
+ (this.ku = null);
142
155
  }
143
156
  pr(t) {
144
- return this.Jh.lt(t);
157
+ return this.wu.lt(t);
145
158
  }
146
159
  openSession() {
147
- const t = this.Bl.pa() !== this.Bl.co();
148
- t && (this.yh.Pa(i.eu.Xo), this.yh.Pa(i.eu.su)),
149
- this.Gh(null, !1, null, null, null),
150
- this.Hn(),
160
+ const t = this._e.Yh() !== this._e.co();
161
+ t && (this.u.uE(i.eu.Zo), this.u.uE(i.eu.su)),
162
+ this.qu(void 0, !1, void 0, void 0, void 0),
163
+ this.pu(),
151
164
  t &&
152
- import("./Push/push-manager-factory.js").then(t => {
153
- if (this.Xh) return;
165
+ import("./Push/push-manager-factory.js").then((t) => {
166
+ if (this.ju) return;
154
167
  const s = t.default.m();
155
168
  if (
156
169
  null != s &&
157
- (yt.isPushPermissionGranted() || yt.isPushBlocked())
170
+ (jt.isPushPermissionGranted() || jt.isPushBlocked())
158
171
  ) {
159
172
  const t = () => {
160
- s.dn()
173
+ s.Sn()
161
174
  ? r.j.info(
162
- "Push token maintenance is disabled, not refreshing token for backend."
175
+ "Push token maintenance is disabled, not refreshing token for backend.",
163
176
  )
164
177
  : s.subscribe();
165
178
  },
166
- e = (s, i) => {
167
- i && t();
179
+ e = (i, s) => {
180
+ s && t();
168
181
  },
169
- n = () => {
170
- const s = this.yh.v(i.k.Nn);
182
+ h = () => {
183
+ const s = this.u.v(i.k.Bn);
171
184
  (null == s || s) && t();
172
185
  },
173
- l = r.zt.Ft;
174
- new r.xt(l, r.j).hr(l.Jt.cu, e, n);
186
+ o = r.zt.Ft;
187
+ new r.xt(o, r.j).hr(o.Jt.cu, e, h);
175
188
  }
176
189
  });
177
190
  }
191
+ Fu() {
192
+ this.u.ni(i.k.Ri), this.u.ni(i.k.Yt), this.u.ni(i.k.rn);
193
+ }
178
194
  changeUser(t, s, e) {
179
- const n = this.Xl.getUserId();
180
- if (n !== t) {
181
- this.Bl.kl(),
182
- null != n && this.Gh(null, !1, null, null, null),
183
- this.Xl.ru(t),
184
- e ? this.$h.setSdkAuthenticationSignature(e) : this.$h.fh();
185
- for (let t = 0; t < s.length; t++) s[t].changeUser(null == n);
186
- null != n && this.yh.ri(i.k.L),
187
- this.yh.ri(i.k.la),
195
+ const h = this.ft.getUserId();
196
+ if (h !== t) {
197
+ this._e.kl(),
198
+ this.Fu(),
199
+ null != h && this.qu(void 0, !1, void 0, void 0, void 0),
200
+ this.ft.ru(t),
201
+ e ? this.Uo.setSdkAuthenticationSignature(e) : this.Uo.yh();
202
+ for (let t = 0; t < s.length; t++) s[t].changeUser(null == h);
203
+ null != h && this.u.ni(i.k.L),
204
+ this.u.ni(i.k.Fa),
188
205
  this.openSession(),
189
206
  r.j.info('Changed user to "' + t + '".');
190
207
  } else {
191
- let s = "Doing nothing.";
208
+ let i = "Doing nothing.";
192
209
  e &&
193
- this.$h.gh() !== e &&
194
- (this.$h.setSdkAuthenticationSignature(e),
195
- (s = "Updated SDK authentication signature")),
196
- r.j.info(`Current user is already ${t}. ${s}`);
210
+ this.Uo.jh() !== e &&
211
+ (this.Uo.setSdkAuthenticationSignature(e),
212
+ (i = "Updated SDK authentication signature")),
213
+ r.j.info(`Current user is already ${t}. ${i}`);
197
214
  }
198
215
  }
199
216
  requestImmediateDataFlush(t) {
200
- this.Hh(), this.Bl.co();
201
- this.Gh(
202
- null,
203
- null,
204
- null,
205
- null,
217
+ this.Au(), this._e.co();
218
+ this.qu(
219
+ void 0,
220
+ void 0,
221
+ void 0,
222
+ void 0,
206
223
  () => {
207
224
  r.j.error(
208
- "Failed to flush data, request will be retried automatically."
225
+ "Failed to flush data, request will be retried automatically.",
209
226
  );
210
227
  },
211
228
  t,
212
- !0
229
+ !0,
213
230
  );
214
231
  }
215
232
  requestFeedRefresh() {
216
- this.Bl.co(), this.Gh(!0);
233
+ this._e.co(), this.qu(!0);
217
234
  }
218
- $r(t, s) {
219
- this.Bl.co(),
235
+ $r(t, i) {
236
+ this._e.co(),
220
237
  r.j.info("Requesting explicit trigger refresh."),
221
- this.Gh(null, !0, null, t, s);
238
+ this.qu(void 0, !0, void 0, t, i);
222
239
  }
223
- Cn(t, i) {
224
- const e = r.q.Zh,
225
- n = { a: t, l: i },
226
- l = s.N(e, n);
227
- return l && r.j.info(`Logged alias ${t} with label ${i}`), l;
240
+ $n(t, i) {
241
+ const e = r.q.Tu,
242
+ h = { a: t, l: i },
243
+ o = s.N(e, h);
244
+ return o && r.j.info(`Logged alias ${t} with label ${i}`), o;
228
245
  }
229
- En(i, e, n) {
230
- if (this.Zl.hu(e))
246
+ Gn(i, e, h) {
247
+ if (this.wt.hu(e))
231
248
  return (
232
249
  r.j.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
233
250
  );
234
- const l = { key: e, value: n },
235
- h = s.N(i, l);
236
- if (h) {
237
- const t = "object" == typeof n ? JSON.stringify(n, null, 2) : n;
251
+ const o = { key: e, value: h },
252
+ n = s.N(i, o);
253
+ if (n) {
254
+ const t = "object" == typeof h ? JSON.stringify(h, null, 2) : h;
238
255
  r.j.info(`Logged custom attribute: ${e} with value: ${t}`);
239
256
  }
240
- return h;
257
+ return n;
241
258
  }
242
- setLastKnownLocation(t, i, e, n, l, h) {
243
- const o = { latitude: i, longitude: e };
244
- null != n && (o.altitude = n),
245
- null != l && (o.ll_accuracy = l),
246
- null != h && (o.alt_accuracy = h);
247
- const u = s.N(r.q.au, o, t);
259
+ setLastKnownLocation(t, i, e, h, o, n) {
260
+ const u = { latitude: i, longitude: e };
261
+ null != h && (u.altitude = h),
262
+ null != o && (u.ll_accuracy = o),
263
+ null != n && (u.alt_accuracy = n);
264
+ const l = s.N(r.q.Lu, u, t || void 0);
248
265
  return (
249
- u &&
266
+ l &&
250
267
  r.j.info(
251
- `Set user last known location as ${JSON.stringify(o, null, 2)}`
268
+ `Set user last known location as ${JSON.stringify(u, null, 2)}`,
252
269
  ),
253
- u
270
+ l
254
271
  );
255
272
  }
256
- vr(t, s) {
257
- const i = this.Bl.co();
258
- return new ue(this.Xl.getUserId(), r.q.du, t, i, { cid: s });
273
+ vr(t, i) {
274
+ const s = this._e.co();
275
+ return new be(this.ft.getUserId(), r.q.Mu, t, s, { cid: i });
259
276
  }
260
- Hn() {
277
+ pu() {
261
278
  const t = r.zt.Ft;
262
- new r.xt(t, r.j).setItem(t.Jt.Sa, 1, {
263
- baseUrl: this.Fl,
264
- data: { api_key: this.$l, device_id: this.Ql.te().id },
265
- userId: this.Xl.getUserId(),
266
- sdkAuthEnabled: this.$h.Zn()
279
+ new r.xt(t, r.j).setItem(t.Jt.Na, 1, {
280
+ baseUrl: this.baseUrl,
281
+ data: { api_key: this.cn, device_id: this.fn.ce().id },
282
+ userId: this.ft.getUserId(),
283
+ sdkAuthEnabled: this.Uo.wh(),
267
284
  });
268
285
  }
269
- Fr(t) {
270
- for (const s of t)
271
- if (s.api_key === this.$l) this.qh.Ra(s.events, s.attributes);
286
+ yr(t) {
287
+ for (const i of t)
288
+ if (i.api_key === this.cn) this.gt.Qh(i.events, i.attributes);
272
289
  else {
273
290
  const t = r.zt.Ft;
274
- new r.xt(t, r.j).setItem(t.Jt.yr, r.Z.Y(), s);
291
+ new r.xt(t, r.j).setItem(t.Jt.wr, r.Z.Y(), i);
275
292
  }
276
293
  }
277
- On(i, e, n) {
278
- if (this.Zl.hu(i))
294
+ Zn(i, e, h) {
295
+ if (this.wt.hu(i))
279
296
  return (
280
297
  r.j.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t()
281
298
  );
282
- let l, h;
299
+ let o, n;
283
300
  return (
284
- null === e && null === n
285
- ? ((l = r.q.fu), (h = { key: i }))
286
- : ((l = r.q.gu), (h = { key: i, latitude: e, longitude: n })),
287
- s.N(l, h)
301
+ null === e && null === h
302
+ ? ((o = r.q.Pu), (n = { key: i }))
303
+ : ((o = r.q.Ru), (n = { key: i, latitude: e, longitude: h })),
304
+ s.N(o, n)
288
305
  );
289
306
  }
290
- Gn(t, i) {
307
+ au(t, i) {
291
308
  const e = { group_id: t, status: i };
292
- return s.N(r.q.pu, e);
309
+ return s.N(r.q.Nu, e);
293
310
  }
294
311
  }
@@ -1,14 +1,14 @@
1
1
  export default class Qt {
2
2
  constructor(t) {
3
- this.wu = t;
3
+ (this.yl = t), (this.yl = t);
4
4
  }
5
- xu(t) {
6
- return null == this.wu || this.wu === t[0];
5
+ Bl(t) {
6
+ return null == this.yl || this.yl === t[0];
7
7
  }
8
8
  static fromJson(t) {
9
9
  return new Qt(t ? t.event_name : null);
10
10
  }
11
11
  ss() {
12
- return this.wu;
12
+ return this.yl;
13
13
  }
14
14
  }
@@ -1,21 +1,21 @@
1
1
  import Yt from "./filter-set.js";
2
2
  export default class Zt {
3
3
  constructor(t, s) {
4
- (this.wu = t), (this.ju = s);
4
+ (this.yl = t), (this.Jl = s), (this.yl = t), (this.Jl = s);
5
5
  }
6
- xu(t) {
7
- if (null == this.wu || null == this.ju) return !1;
6
+ Bl(t) {
7
+ if (null == this.yl || null == this.Jl) return !1;
8
8
  const s = t[0],
9
- r = t[1];
10
- return s === this.wu && this.ju.xu(r);
9
+ i = t[1];
10
+ return s === this.yl && this.Jl.Bl(i);
11
11
  }
12
12
  static fromJson(t) {
13
13
  return new Zt(
14
14
  t ? t.event_name : null,
15
- t ? Yt.fromJson(t.property_filters) : null
15
+ t ? Yt.fromJson(t.property_filters) : null,
16
16
  );
17
17
  }
18
18
  ss() {
19
- return { e: this.wu, pf: this.ju.ss() };
19
+ return { e: this.yl, pf: this.Jl ? this.Jl.ss() : null };
20
20
  }
21
21
  }
@@ -2,15 +2,15 @@ import sr from "./filter.js";
2
2
  import { isArray as p } from "../../util/code-utils.js";
3
3
  export default class Yt {
4
4
  constructor(t) {
5
- this.filters = t;
5
+ (this.filters = t), (this.filters = t);
6
6
  }
7
- xu(t) {
7
+ Bl(t) {
8
8
  let r = !0;
9
9
  for (let e = 0; e < this.filters.length; e++) {
10
10
  const o = this.filters[e];
11
11
  let s = !1;
12
12
  for (let r = 0; r < o.length; r++)
13
- if (o[r].xu(t)) {
13
+ if (o[r].Bl(t)) {
14
14
  s = !0;
15
15
  break;
16
16
  }
@@ -42,12 +42,12 @@ export default class Yt {
42
42
  }
43
43
  return t;
44
44
  }
45
- static zn(t) {
45
+ static Yn(t) {
46
46
  const r = [];
47
47
  for (let e = 0; e < t.length; e++) {
48
48
  const o = [],
49
49
  s = t[e];
50
- for (let t = 0; t < s.length; t++) o.push(sr.zn(s[t]));
50
+ for (let t = 0; t < s.length; t++) o.push(sr.Yn(s[t]));
51
51
  r.push(o);
52
52
  }
53
53
  return new Yt(r);