@braze/web-sdk 4.8.3 → 4.9.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 (154) hide show
  1. package/index.d.ts +121 -6
  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 +22 -21
  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 +15 -15
  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 +3 -3
  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 +57 -57
  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 +125 -125
  102. package/src/managers/device-manager.js +20 -20
  103. package/src/managers/network-manager.js +100 -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 +132 -129
  108. package/src/managers/subscription-manager.js +8 -8
  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 +191 -178
  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 +64 -60
  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 +55 -59
  126. package/src/triggers/models/trigger-events.js +3 -3
  127. package/src/triggers/models/trigger.js +47 -35
  128. package/src/triggers/triggers-provider-factory.js +10 -6
  129. package/src/triggers/triggers-provider.js +203 -185
  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/ui/js/load-font-awesome.js +1 -1
  135. package/src/util/base-device-parser.js +1 -1
  136. package/src/util/braze-actions.js +35 -30
  137. package/src/util/browser-detector.js +30 -31
  138. package/src/util/client-hints-parser.js +30 -24
  139. package/src/util/code-utils.js +22 -21
  140. package/src/util/color-utils.js +19 -13
  141. package/src/util/component-utils.js +4 -4
  142. package/src/util/date-utils.js +4 -3
  143. package/src/util/device-constants.js +10 -10
  144. package/src/util/dom-utils.js +32 -28
  145. package/src/util/error-utils.js +1 -1
  146. package/src/util/key-codes.js +1 -1
  147. package/src/util/net.js +53 -57
  148. package/src/util/request-header-utils.js +34 -11
  149. package/src/util/string-utils.js +14 -14
  150. package/src/util/types.js +1 -0
  151. package/src/util/url-utils.js +1 -4
  152. package/src/util/user-agent-parser.js +39 -39
  153. package/src/util/validation-utils.js +32 -32
  154. 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.9.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.9.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,307 @@
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
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),
12
+ constructor(t, i, s, e, o, h, n, r, u, l) {
13
+ (this.cn = t),
14
+ (this.baseUrl = i),
15
+ (this._e = s),
16
+ (this.fn = e),
17
+ (this.ft = o),
18
+ (this.wt = h),
19
+ (this.u = n),
23
20
  (this.$h = r),
24
- (this.qh = u),
25
- (this.Ph = o),
26
- (this.Jh = new E()),
27
- (this.Kh = 50);
21
+ (this.Do = u),
22
+ (this.gt = l),
23
+ (this.cn = t),
24
+ (this.baseUrl = i),
25
+ (this.Kh = 0),
26
+ (this.gE = n.RE() || 0),
27
+ (this.Wh = null),
28
+ (this._e = s),
29
+ (this.fn = e),
30
+ (this.ft = o),
31
+ (this.wt = h),
32
+ (this.u = n),
33
+ (this.Do = u),
34
+ (this.gt = l),
35
+ (this.$h = r),
36
+ (this.Qh = new E()),
37
+ (this.Vh = null),
38
+ (this.Yh = 50),
39
+ (this.Zh = !1);
28
40
  }
29
- Wh(t, s) {
30
- return !t && !s && this.$h.xh() >= this.Kh;
41
+ fu(t, i) {
42
+ return !t && !i && this.Do.Jh() >= this.Yh;
31
43
  }
32
- Bh(t) {
33
- let s = this.Bl.El();
44
+ gu(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
+ vu(t = !1, s = !1, e = !0, o, h, n, u = !1, l = !1) {
56
+ e && this.wu();
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.Ja, 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.Kh = Math.max(this.Kh - 1, 0)),
71
+ this.gt.Zs(t, e, s)
72
+ ? (this.Do.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.Ca, 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.Xa, t.sdk_metadata),
79
+ this.u.D(i.k.Ea, this._e.Pa())),
80
+ this.$h(e),
81
+ T.si(this.u, T.Os.Ja, 1),
82
+ "function" == typeof o && o()))
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.Kh = Math.max(this.Kh - 1, 0)),
89
+ this.gt.$a(t.events, t.attributes),
90
+ "function" == typeof h && h();
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.ku();
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.Ja);
97
+ let t = this.Wh;
98
+ (null == t || t < 1e3 * this.gE) && (t = 1e3 * this.gE),
99
+ this.ku(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.gu(a),
107
+ g = s || m;
108
+ if (this.fu(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.Wa(a, c, t, g))
113
+ return this.ku(), void ("function" == typeof n && n(!0));
114
+ const v = this.gt.Ya(t, g, a, c, l);
115
+ g && this.Kh++;
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.Do.wh() && e && !p
121
+ ? this.ku()
122
+ : m && (r.j.info("Invoking new session subscriptions"), this.Qh.Et());
109
123
  }
110
- Vh() {
111
- return this.Ll > 0;
124
+ yu() {
125
+ return this.Kh > 0;
112
126
  }
113
- Qh(t) {
114
- this.Xh ||
115
- (null == t && (t = 1e3 * this.Pl),
116
- this.Hh(),
117
- (this.Yh = setTimeout(() => {
127
+ ku(t = 1e3 * this.gE) {
128
+ this.Zh ||
129
+ (this.wu(),
130
+ (this.Vh = 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.vu());
123
136
  };
124
- document.addEventListener(t, s, !1);
125
- } else this.Gh();
137
+ document.addEventListener(t, i, !1);
138
+ } else this.vu();
126
139
  }, t)),
127
- (this.Jl = t));
140
+ (this.Wh = t));
128
141
  }
129
- Hh() {
130
- null != this.Yh && (clearTimeout(this.Yh), (this.Yh = null));
142
+ wu() {
143
+ null != this.Vh && (clearTimeout(this.Vh), (this.Vh = null));
131
144
  }
132
145
  initialize() {
133
- (this.Xh = !1), this.Qh();
146
+ (this.Zh = !1), this.ku();
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.Qh.removeAllSubscriptions(),
150
+ this.Do.Gh(),
151
+ this.wu(),
152
+ (this.Zh = !0),
153
+ this.vu(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
154
+ (this.Vh = null);
142
155
  }
143
156
  pr(t) {
144
- return this.Jh.lt(t);
157
+ return this.Qh.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.Pa() !== this._e.co();
161
+ t && (this.u.uE(i.eu.Xo), this.u.uE(i.eu.su), this.u.ni(i.k.qi)),
162
+ this.vu(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.Zh) 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
+ o = () => {
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
+ h = r.zt.Ft;
187
+ new r.xt(h, r.j).hr(h.Jt.cu, e, o);
175
188
  }
176
189
  });
177
190
  }
178
191
  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),
192
+ const o = this.ft.getUserId();
193
+ if (o !== t) {
194
+ this._e.kl(),
195
+ null != o && this.vu(void 0, !1, void 0, void 0, void 0),
196
+ this.ft.ru(t),
197
+ e ? this.Do.setSdkAuthenticationSignature(e) : this.Do.yh();
198
+ for (let t = 0; t < s.length; t++) s[t].changeUser(null == o);
199
+ null != o && this.u.ni(i.k.L),
200
+ this.u.ni(i.k.Ca),
188
201
  this.openSession(),
189
202
  r.j.info('Changed user to "' + t + '".');
190
203
  } else {
191
- let s = "Doing nothing.";
204
+ let i = "Doing nothing.";
192
205
  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}`);
206
+ this.Do.jh() !== e &&
207
+ (this.Do.setSdkAuthenticationSignature(e),
208
+ (i = "Updated SDK authentication signature")),
209
+ r.j.info(`Current user is already ${t}. ${i}`);
197
210
  }
198
211
  }
199
212
  requestImmediateDataFlush(t) {
200
- this.Hh(), this.Bl.co();
201
- this.Gh(
202
- null,
203
- null,
204
- null,
205
- null,
213
+ this.wu(), this._e.co();
214
+ this.vu(
215
+ void 0,
216
+ void 0,
217
+ void 0,
218
+ void 0,
206
219
  () => {
207
220
  r.j.error(
208
- "Failed to flush data, request will be retried automatically."
221
+ "Failed to flush data, request will be retried automatically.",
209
222
  );
210
223
  },
211
224
  t,
212
- !0
225
+ !0,
213
226
  );
214
227
  }
215
228
  requestFeedRefresh() {
216
- this.Bl.co(), this.Gh(!0);
229
+ this._e.co(), this.vu(!0);
217
230
  }
218
- $r(t, s) {
219
- this.Bl.co(),
231
+ $r(t, i) {
232
+ this._e.co(),
220
233
  r.j.info("Requesting explicit trigger refresh."),
221
- this.Gh(null, !0, null, t, s);
234
+ this.vu(void 0, !0, void 0, t, i);
222
235
  }
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;
236
+ $n(t, i) {
237
+ const e = r.q.ju,
238
+ o = { a: t, l: i },
239
+ h = s.N(e, o);
240
+ return h && r.j.info(`Logged alias ${t} with label ${i}`), h;
228
241
  }
229
- En(i, e, n) {
230
- if (this.Zl.hu(e))
242
+ Gn(i, e, o) {
243
+ if (this.wt.hu(e))
231
244
  return (
232
245
  r.j.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
233
246
  );
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;
247
+ const h = { key: e, value: o },
248
+ n = s.N(i, h);
249
+ if (n) {
250
+ const t = "object" == typeof o ? JSON.stringify(o, null, 2) : o;
238
251
  r.j.info(`Logged custom attribute: ${e} with value: ${t}`);
239
252
  }
240
- return h;
253
+ return n;
241
254
  }
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);
255
+ setLastKnownLocation(t, i, e, o, h, n) {
256
+ const u = { latitude: i, longitude: e };
257
+ null != o && (u.altitude = o),
258
+ null != h && (u.ll_accuracy = h),
259
+ null != n && (u.alt_accuracy = n);
260
+ const l = s.N(r.q.Su, u, t || void 0);
248
261
  return (
249
- u &&
262
+ l &&
250
263
  r.j.info(
251
- `Set user last known location as ${JSON.stringify(o, null, 2)}`
264
+ `Set user last known location as ${JSON.stringify(u, null, 2)}`,
252
265
  ),
253
- u
266
+ l
254
267
  );
255
268
  }
256
- vr(t, s) {
257
- const i = this.Bl.co();
258
- return new ue(this.Xl.getUserId(), r.q.du, t, i, { cid: s });
269
+ vr(t, i) {
270
+ const s = this._e.co();
271
+ return new be(this.ft.getUserId(), r.q.$u, t, s, { cid: i });
259
272
  }
260
- Hn() {
273
+ pu() {
261
274
  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()
275
+ new r.xt(t, r.j).setItem(t.Jt.Ja, 1, {
276
+ baseUrl: this.baseUrl,
277
+ data: { api_key: this.cn, device_id: this.fn.ce().id },
278
+ userId: this.ft.getUserId(),
279
+ sdkAuthEnabled: this.Do.wh(),
267
280
  });
268
281
  }
269
- Fr(t) {
270
- for (const s of t)
271
- if (s.api_key === this.$l) this.qh.Ra(s.events, s.attributes);
282
+ yr(t) {
283
+ for (const i of t)
284
+ if (i.api_key === this.cn) this.gt.$a(i.events, i.attributes);
272
285
  else {
273
286
  const t = r.zt.Ft;
274
- new r.xt(t, r.j).setItem(t.Jt.yr, r.Z.Y(), s);
287
+ new r.xt(t, r.j).setItem(t.Jt.wr, r.Z.Y(), i);
275
288
  }
276
289
  }
277
- On(i, e, n) {
278
- if (this.Zl.hu(i))
290
+ Zn(i, e, o) {
291
+ if (this.wt.hu(i))
279
292
  return (
280
293
  r.j.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t()
281
294
  );
282
- let l, h;
295
+ let h, n;
283
296
  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)
297
+ null === e && null === o
298
+ ? ((h = r.q.qu), (n = { key: i }))
299
+ : ((h = r.q.Au), (n = { key: i, latitude: e, longitude: o })),
300
+ s.N(h, n)
288
301
  );
289
302
  }
290
- Gn(t, i) {
303
+ au(t, i) {
291
304
  const e = { group_id: t, status: i };
292
- return s.N(r.q.pu, e);
305
+ return s.N(r.q.Cu, e);
293
306
  }
294
307
  }
@@ -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);