@braze/web-sdk 5.0.1 → 5.1.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 (158) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +10 -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 -190
  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 +178 -163
  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 +4 -4
  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 -179
  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,311 +1,319 @@
1
1
  import C from "./util/net.js";
2
2
  import ue from "./models/braze-event.js";
3
3
  import s from "./common/event-logger.js";
4
- import { randomInclusive as D } from "./util/math.js";
4
+ import { randomInclusive as k } from "./util/math.js";
5
5
  import t from "./models/request-result.js";
6
- import r from "../shared-lib/braze-shared-lib.js";
7
- import { STORAGE_KEYS as i } from "./managers/storage-manager.js";
8
- import E from "./managers/subscription-manager.js";
6
+ import {
7
+ logger as r,
8
+ IndexedDBAdapter as A,
9
+ Guid as p,
10
+ EventTypes as i,
11
+ } from "../shared-lib/index.js";
12
+ import { STORAGE_KEYS as o } from "./managers/storage-manager.js";
13
+ import T from "./managers/subscription-manager.js";
9
14
  import vt from "./Push/utils/push-utils.js";
10
- import T from "./util/request-header-utils.js";
15
+ import S from "./util/request-header-utils.js";
11
16
  export default class Lt {
12
17
  constructor(t, i, s, e, h, o, n, r, u, l) {
13
- (this.cn = t),
18
+ (this.an = t),
14
19
  (this.baseUrl = i),
15
- (this._e = s),
16
- (this.fn = e),
20
+ (this.di = s),
21
+ (this.hn = e),
17
22
  (this.wt = h),
18
23
  (this.yt = o),
19
24
  (this.u = n),
20
- (this.fu = r),
21
- (this.Mo = u),
22
- (this.$t = l),
23
- (this.cn = t),
25
+ (this.bu = r),
26
+ (this.Go = u),
27
+ (this.qt = l),
28
+ (this.an = t),
24
29
  (this.baseUrl = i),
25
- (this.gu = 0),
26
- (this.OE = n.RE() || 0),
27
- (this.vu = null),
28
- (this._e = s),
29
- (this.fn = e),
30
+ (this.wu = 0),
31
+ (this.gE = n.RE() || 0),
32
+ (this.ku = null),
33
+ (this.di = s),
34
+ (this.hn = e),
30
35
  (this.wt = h),
31
36
  (this.yt = o),
32
37
  (this.u = n),
33
- (this.Mo = u),
34
- (this.$t = l),
35
- (this.fu = r),
36
- (this.wu = new E()),
37
- (this.ku = null),
38
- (this.yu = 50),
39
- (this.ju = !1);
38
+ (this.Go = u),
39
+ (this.qt = l),
40
+ (this.bu = r),
41
+ (this.yu = new T()),
42
+ (this.ju = null),
43
+ (this.Su = 50),
44
+ (this.Au = !1);
40
45
  }
41
- Su(t, i) {
42
- return !t && !i && this.Mo.Jh() >= this.yu;
46
+ $u(t, i) {
47
+ return !t && !i && this.Go.Hh() >= this.Su;
43
48
  }
44
- $u(t) {
45
- let i = this._e.El();
49
+ Cu(t) {
50
+ let s = this.di.El();
46
51
  if (t.length > 0) {
47
- const s = this.wt.getUserId();
48
- for (const e of t) {
49
- const t = (!e.userId && !s) || e.userId === s;
50
- e.type === r.q.Wl && t && (i = !0);
52
+ const e = this.wt.getUserId();
53
+ for (const h of t) {
54
+ const t = (!h.userId && !e) || h.userId === e;
55
+ h.type === i.kl && t && (s = !0);
51
56
  }
52
57
  }
53
- return i;
58
+ return s;
54
59
  }
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(),
60
+ Du(t = !1, i = !1, s = !0, e, h, n, u = !1, l = !1) {
61
+ s && this.Fu();
62
+ const a = this.u.TE(),
58
63
  c = this.u.AE();
59
64
  let d = !1;
60
- const f = (t, s) => {
65
+ const f = (t, i) => {
61
66
  let r = !1;
62
- T.Ws(this.u, T.Os.Na, new Date().valueOf()),
63
- C.Xs({
67
+ S.Os(this.u, S.Gs.Qa, new Date().valueOf()),
68
+ C.Qs({
64
69
  url: this.baseUrl + "/data/",
65
70
  data: t,
66
- headers: s,
67
- O: (e) => {
71
+ headers: i,
72
+ L: (s) => {
68
73
  null != t.respond_with &&
69
74
  t.respond_with.triggers &&
70
- (this.gu = Math.max(this.gu - 1, 0)),
71
- this.$t.Zs(t, e, s)
72
- ? (this.Mo.ti(),
73
- this.yt.ul(e),
75
+ (this.wu = Math.max(this.wu - 1, 0)),
76
+ this.qt.Ws(t, s, i)
77
+ ? (this.Go.Xs(),
78
+ this.yt.ul(s),
74
79
  (null != t.respond_with &&
75
80
  t.respond_with.user_id != this.wt.getUserId()) ||
76
- (null != t.device && this.u.D(i.k.Fa, t.device),
81
+ (null != t.device && this.u.k(o.C.Ja, t.device),
77
82
  null != t.sdk_metadata &&
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);
83
+ (this.u.k(o.C.Na, t.sdk_metadata),
84
+ this.u.k(o.C.$a, this.di.ki())),
85
+ this.bu(s),
86
+ S.Ys(this.u, S.Gs.Qa, 1),
87
+ "function" == typeof e && e()))
88
+ : s.auth_error && (r = !0);
84
89
  },
85
90
  error: () => {
86
91
  null != t.respond_with &&
87
92
  t.respond_with.triggers &&
88
- (this.gu = Math.max(this.gu - 1, 0)),
89
- this.$t.Qh(t.events, t.attributes),
90
- "function" == typeof o && o();
93
+ (this.wu = Math.max(this.wu - 1, 0)),
94
+ this.qt.Ea(t.events, t.attributes),
95
+ "function" == typeof h && h();
91
96
  },
92
- ei: (t) => {
93
- if (("function" == typeof n && n(t), e && !d)) {
94
- if (t && !r) this.Cu();
97
+ ti: (t) => {
98
+ if (("function" == typeof n && n(t), s && !d)) {
99
+ if (t && !r) this.Tu();
95
100
  else {
96
- T.hi(this.u, T.Os.Na);
97
- let t = this.vu;
98
- (null == t || t < 1e3 * this.OE) && (t = 1e3 * this.OE),
99
- this.Cu(Math.min(3e5, D(1e3 * this.OE, 3 * t)));
101
+ S.si(this.u, S.Gs.Qa);
102
+ let t = this.ku;
103
+ (null == t || t < 1e3 * this.gE) && (t = 1e3 * this.gE),
104
+ this.Tu(Math.min(3e5, k(1e3 * this.gE, 3 * t)));
100
105
  }
101
106
  d = !0;
102
107
  }
103
108
  },
104
109
  });
105
110
  },
106
- m = this.$u(a),
107
- g = s || m;
108
- if (this.Su(u, m))
109
- return void r.j.info(
111
+ m = this.Cu(a),
112
+ g = i || m;
113
+ if (this.$u(u, m))
114
+ return void r.info(
110
115
  "Declining to flush data due to 50 consecutive authentication failures",
111
116
  );
112
- if (e && !this.$t.Pa(a, c, t, g))
113
- return this.Cu(), void ("function" == typeof n && n(!0));
114
- const v = this.$t.$a(t, g, a, c, l);
115
- g && this.gu++;
117
+ if (s && !this.qt.Wa(a, c, t, g))
118
+ return this.Tu(), void ("function" == typeof n && n(!0));
119
+ const v = this.qt.Ya(t, g, a, c, l);
120
+ g && this.wu++;
116
121
  let p = !1;
117
122
  if (v)
118
123
  for (const t of v)
119
- this.$t.Qs(t.requestData, () => f(t.requestData, t.headers)), (p = !0);
120
- this.Mo.wh() && e && !p
121
- ? this.Cu()
122
- : m && (r.j.info("Invoking new session subscriptions"), this.wu.Dt());
124
+ this.qt.Hs(t.requestData, () => f(t.requestData, t.headers), S.ii.Qa),
125
+ (p = !0);
126
+ this.Go.fh() && s && !p
127
+ ? this.Tu()
128
+ : m && (r.info("Invoking new session subscriptions"), this.yu.Dt());
123
129
  }
124
- Du() {
125
- return this.gu > 0;
130
+ Lu() {
131
+ return this.wu > 0;
126
132
  }
127
- Cu(t = 1e3 * this.OE) {
128
- this.ju ||
129
- (this.Au(),
130
- (this.ku = window.setTimeout(() => {
133
+ Tu(t = 1e3 * this.gE) {
134
+ this.Au ||
135
+ (this.Fu(),
136
+ (this.ju = window.setTimeout(() => {
131
137
  if (document.hidden) {
132
138
  const t = "visibilitychange",
133
139
  i = () => {
134
140
  document.hidden ||
135
- (document.removeEventListener(t, i, !1), this.qu());
141
+ (document.removeEventListener(t, i, !1), this.Du());
136
142
  };
137
143
  document.addEventListener(t, i, !1);
138
- } else this.qu();
144
+ } else this.Du();
139
145
  }, t)),
140
- (this.vu = t));
146
+ (this.ku = t));
141
147
  }
142
- Au() {
143
- null != this.ku && (clearTimeout(this.ku), (this.ku = null));
148
+ Fu() {
149
+ null != this.ju && (clearTimeout(this.ju), (this.ju = null));
144
150
  }
145
151
  initialize() {
146
- (this.ju = !1), this.Cu();
152
+ (this.Au = !1), this.Tu();
147
153
  }
148
154
  destroy() {
149
- this.wu.removeAllSubscriptions(),
150
- this.Mo.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);
155
+ this.yu.removeAllSubscriptions(),
156
+ this.Go.Bh(),
157
+ this.Fu(),
158
+ (this.Au = !0),
159
+ this.Du(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
160
+ (this.ju = null);
155
161
  }
156
- pr(t) {
157
- return this.wu.It(t);
162
+ mr(t) {
163
+ return this.yu.It(t);
158
164
  }
159
165
  openSession() {
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(),
166
+ const t = this.di.ki() !== this.di.xo();
167
+ t && (this.u.uE(o.iu.Ta), this.u.uE(o.iu.su)),
168
+ this.Du(void 0, !1, void 0, () => {
169
+ this.u.hi(o.C.Ii);
170
+ }),
171
+ this.Jn(),
164
172
  t &&
165
173
  import("./Push/push-manager-factory.js").then((t) => {
166
- if (this.ju) return;
167
- const s = t.default.m();
174
+ if (this.Au) return;
175
+ const i = t.default.m();
168
176
  if (
169
- null != s &&
177
+ null != i &&
170
178
  (vt.isPushPermissionGranted() || vt.isPushBlocked())
171
179
  ) {
172
180
  const t = () => {
173
- s.Sn()
174
- ? r.j.info(
181
+ i.vn()
182
+ ? r.info(
175
183
  "Push token maintenance is disabled, not refreshing token for backend.",
176
184
  )
177
- : s.subscribe();
185
+ : i.subscribe();
178
186
  },
179
- e = (i, s) => {
187
+ s = (i, s) => {
180
188
  s && t();
181
189
  },
182
- h = () => {
183
- const s = this.u.v(i.k.Bn);
184
- (null == s || s) && t();
190
+ e = () => {
191
+ const i = this.u.j(o.C.zn);
192
+ (null == i || i) && t();
185
193
  },
186
- o = r.ts.Zt;
187
- new r.es(o, r.j).hr(o.rs.cu, e, h);
194
+ h = A.Yt.Qt;
195
+ new A(h, r).jr(h.ss.cu, s, e);
188
196
  }
189
197
  });
190
198
  }
191
- Fu() {
192
- this.u.ni(i.k.Ri), this.u.ni(i.k.gs), this.u.ni(i.k.rn);
199
+ Mu() {
200
+ this.u.hi(o.C.Ti), this.u.hi(o.C.Cs), this.u.hi(o.C.Wr);
193
201
  }
194
- changeUser(t, s, e) {
195
- const h = this.wt.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.wt.ru(t),
201
- e ? this.Mo.setSdkAuthenticationSignature(e) : this.Mo.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),
202
+ changeUser(t, i, s) {
203
+ const e = this.wt.getUserId();
204
+ if (e !== t) {
205
+ this.di.ql(),
206
+ this.Mu(),
207
+ null != e && this.Du(void 0, !1, void 0, void 0, void 0),
208
+ this.wt.ou(t),
209
+ s ? this.Go.setSdkAuthenticationSignature(s) : this.Go.qh();
210
+ for (let t = 0; t < i.length; t++) i[t].changeUser(null == e);
211
+ null != e && this.u.hi(o.C.J),
212
+ this.u.hi(o.C.Ja),
213
+ this.u.hi(o.C.ai),
205
214
  this.openSession(),
206
- r.j.info('Changed user to "' + t + '".');
215
+ r.info('Changed user to "' + t + '".');
207
216
  } else {
208
217
  let i = "Doing nothing.";
209
- e &&
210
- this.Mo.jh() !== e &&
211
- (this.Mo.setSdkAuthenticationSignature(e),
218
+ s &&
219
+ this.Go.wh() !== s &&
220
+ (this.Go.setSdkAuthenticationSignature(s),
212
221
  (i = "Updated SDK authentication signature")),
213
- r.j.info(`Current user is already ${t}. ${i}`);
222
+ r.info(`Current user is already ${t}. ${i}`);
214
223
  }
215
224
  }
216
225
  requestImmediateDataFlush(t) {
217
- this.Au(), this._e.co();
218
- this.qu(
226
+ this.Fu(), this.di.xo();
227
+ this.Du(
219
228
  void 0,
220
229
  void 0,
221
230
  void 0,
222
231
  void 0,
223
232
  () => {
224
- r.j.error(
225
- "Failed to flush data, request will be retried automatically.",
226
- );
233
+ r.error("Failed to flush data, request will be retried automatically.");
227
234
  },
228
235
  t,
229
236
  !0,
230
237
  );
231
238
  }
232
239
  requestFeedRefresh() {
233
- this._e.co(), this.qu(!0);
240
+ this.di.xo(), this.Du(!0);
234
241
  }
235
242
  $r(t, i) {
236
- this._e.co(),
237
- r.j.info("Requesting explicit trigger refresh."),
238
- this.qu(void 0, !0, void 0, t, i);
243
+ this.di.xo(),
244
+ r.info("Requesting explicit trigger refresh."),
245
+ this.Du(void 0, !0, void 0, t, i);
239
246
  }
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;
247
+ Fn(t, e) {
248
+ const h = i.Pu,
249
+ o = { a: t, l: e },
250
+ n = s.q(h, o);
251
+ return n && r.info(`Logged alias ${t} with label ${e}`), n;
245
252
  }
246
- Gn(i, e, h) {
253
+ Bn(i, e, h) {
247
254
  if (this.yt.hu(e))
248
255
  return (
249
- r.j.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
256
+ r.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
250
257
  );
251
258
  const o = { key: e, value: h },
252
- n = s.N(i, o);
259
+ n = s.q(i, o);
253
260
  if (n) {
254
261
  const t = "object" == typeof h ? JSON.stringify(h, null, 2) : h;
255
- r.j.info(`Logged custom attribute: ${e} with value: ${t}`);
262
+ r.info(`Logged custom attribute: ${e} with value: ${t}`);
256
263
  }
257
264
  return n;
258
265
  }
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);
266
+ setLastKnownLocation(t, e, h, o, n, u) {
267
+ const l = { latitude: e, longitude: h };
268
+ null != o && (l.altitude = o),
269
+ null != n && (l.ll_accuracy = n),
270
+ null != u && (l.alt_accuracy = u);
271
+ const a = s.q(i.xu, l, t || void 0);
265
272
  return (
266
- l &&
267
- r.j.info(
268
- `Set user last known location as ${JSON.stringify(u, null, 2)}`,
269
- ),
270
- l
273
+ a &&
274
+ r.info(`Set user last known location as ${JSON.stringify(l, null, 2)}`),
275
+ a
271
276
  );
272
277
  }
273
- vr(t, i) {
274
- const s = this._e.co();
275
- return new ue(this.wt.getUserId(), r.q.Mu, t, s, { cid: i });
278
+ kr(t, s) {
279
+ const e = this.di.xo();
280
+ return new ue(this.wt.getUserId(), i.Iu, t, e, { cid: s });
281
+ }
282
+ Nu(t, i) {
283
+ return new A(t, i);
276
284
  }
277
- pu() {
278
- const t = r.ts.Zt;
279
- new r.es(t, r.j).setItem(t.rs.Na, 1, {
285
+ Jn() {
286
+ const t = A.Yt.Qt;
287
+ this.Nu(t, r).setItem(t.ss.Qa, 1, {
280
288
  baseUrl: this.baseUrl,
281
- data: { api_key: this.cn, device_id: this.fn.ce().id },
289
+ data: { api_key: this.an, device_id: this.hn.ce().id },
282
290
  userId: this.wt.getUserId(),
283
- sdkAuthEnabled: this.Mo.wh(),
291
+ sdkAuthEnabled: this.Go.fh(),
284
292
  });
285
293
  }
286
294
  yr(t) {
287
295
  for (const i of t)
288
- if (i.api_key === this.cn) this.$t.Qh(i.events, i.attributes);
296
+ if (i.api_key === this.an) this.qt.Ea(i.events, i.attributes);
289
297
  else {
290
- const t = r.ts.Zt;
291
- new r.es(t, r.j).setItem(t.rs.wr, r.Z.Y(), i);
298
+ const t = A.Yt.Qt;
299
+ new A(t, r).setItem(t.ss.wr, p.W(), i);
292
300
  }
293
301
  }
294
- Zn(i, e, h) {
295
- if (this.yt.hu(i))
302
+ Kn(e, h, o) {
303
+ if (this.yt.hu(e))
296
304
  return (
297
- r.j.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t()
305
+ r.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
298
306
  );
299
- let o, n;
307
+ let n, u;
300
308
  return (
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)
309
+ null === h && null === o
310
+ ? ((n = i.Ou), (u = { key: e }))
311
+ : ((n = i.Uu), (u = { key: e, latitude: h, longitude: o })),
312
+ s.q(n, u)
305
313
  );
306
314
  }
307
- au(t, i) {
308
- const e = { group_id: t, status: i };
309
- return s.N(r.q.Nu, e);
315
+ Mn(t, e) {
316
+ const h = { group_id: t, status: e };
317
+ return s.q(i._u, h);
310
318
  }
311
319
  }
@@ -1,14 +1,14 @@
1
- export default class Qt {
1
+ export default class Zt {
2
2
  constructor(t) {
3
- (this.yl = t), (this.yl = t);
3
+ (this.Bl = t), (this.Bl = t);
4
4
  }
5
- Bl(t) {
6
- return null == this.yl || this.yl === t[0];
5
+ Jl(t) {
6
+ return null == this.Bl || this.Bl === t[0];
7
7
  }
8
8
  static fromJson(t) {
9
- return new Qt(t ? t.event_name : null);
9
+ return new Zt(t ? t.event_name : null);
10
10
  }
11
- tt() {
12
- return this.yl;
11
+ Y() {
12
+ return this.Bl;
13
13
  }
14
14
  }
@@ -1,21 +1,21 @@
1
- import Wt from "./filter-set.js";
2
- export default class Yt {
1
+ import ts from "./filter-set.js";
2
+ export default class is {
3
3
  constructor(t, s) {
4
- (this.yl = t), (this.Jl = s), (this.yl = t), (this.Jl = s);
4
+ (this.Bl = t), (this.Ml = s), (this.Bl = t), (this.Ml = s);
5
5
  }
6
- Bl(t) {
7
- if (null == this.yl || null == this.Jl) return !1;
6
+ Jl(t) {
7
+ if (null == this.Bl || null == this.Ml) return !1;
8
8
  const s = t[0],
9
9
  i = t[1];
10
- return s === this.yl && this.Jl.Bl(i);
10
+ return s === this.Bl && this.Ml.Jl(i);
11
11
  }
12
12
  static fromJson(t) {
13
- return new Yt(
13
+ return new is(
14
14
  t ? t.event_name : null,
15
- t ? Wt.fromJson(t.property_filters) : null,
15
+ t ? ts.fromJson(t.property_filters) : null,
16
16
  );
17
17
  }
18
- tt() {
19
- return { e: this.yl, pf: this.Jl ? this.Jl.tt() : null };
18
+ Y() {
19
+ return { e: this.Bl, pf: this.Ml ? this.Ml.Y() : null };
20
20
  }
21
21
  }
@@ -1,16 +1,16 @@
1
- import Zt from "./filter.js";
2
- import { isArray as p } from "../../util/code-utils.js";
3
- export default class Wt {
1
+ import lr from "./filter.js";
2
+ import { isArray as j } from "../../util/code-utils.js";
3
+ export default class ts {
4
4
  constructor(t) {
5
5
  (this.filters = t), (this.filters = t);
6
6
  }
7
- Bl(t) {
7
+ Jl(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].Bl(t)) {
13
+ if (o[r].Jl(t)) {
14
14
  s = !0;
15
15
  break;
16
16
  }
@@ -22,34 +22,34 @@ export default class Wt {
22
22
  return r;
23
23
  }
24
24
  static fromJson(t) {
25
- if (null == t || !p(t)) return null;
25
+ if (null == t || !j(t)) return null;
26
26
  const r = [];
27
27
  for (let e = 0; e < t.length; e++) {
28
28
  const o = [],
29
29
  s = t[e];
30
- for (let t = 0; t < s.length; t++) o.push(Zt.fromJson(s[t]));
30
+ for (let t = 0; t < s.length; t++) o.push(lr.fromJson(s[t]));
31
31
  r.push(o);
32
32
  }
33
- return new Wt(r);
33
+ return new ts(r);
34
34
  }
35
- tt() {
35
+ Y() {
36
36
  const t = [];
37
37
  for (let r = 0; r < this.filters.length; r++) {
38
38
  const e = this.filters[r],
39
39
  o = [];
40
- for (let t = 0; t < e.length; t++) o.push(e[t].tt());
40
+ for (let t = 0; t < e.length; t++) o.push(e[t].Y());
41
41
  t.push(o);
42
42
  }
43
43
  return t;
44
44
  }
45
- static Yn(t) {
45
+ static En(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(Zt.Yn(s[t]));
50
+ for (let t = 0; t < s.length; t++) o.push(lr.En(s[t]));
51
51
  r.push(o);
52
52
  }
53
- return new Wt(r);
53
+ return new ts(r);
54
54
  }
55
55
  }