@braze/web-sdk 5.5.0 → 5.6.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 (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 +27 -27
  170. package/src/util/client-hints-parser.js +9 -9
  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 +9 -9
  182. package/src/util/validation-utils.js +89 -85
  183. package/src/util/window-utils.js +3 -3
@@ -1,329 +1,329 @@
1
- import C from "./util/net.js";
1
+ import l from "./util/net.js";
2
2
  import ve from "./models/braze-event.js";
3
- import t from "./common/event-logger.js";
4
- import { randomInclusive as U } from "./util/math.js";
5
- import s from "./models/request-result.js";
3
+ import c from "./common/event-logger.js";
4
+ import { randomInclusive as a } from "./util/math.js";
5
+ import E from "./models/request-result.js";
6
6
  import {
7
- logger as r,
8
- IndexedDBAdapter as A,
9
- Guid as p,
10
- EventTypes as i,
7
+ logger as N,
8
+ IndexedDBAdapter as it,
9
+ Guid as G,
10
+ EventTypes as d,
11
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";
12
+ import { STORAGE_KEYS as t } from "./managers/storage-manager.js";
13
+ import u from "./managers/subscription-manager.js";
14
14
  import yt from "./Push/utils/push-utils.js";
15
- import D from "./util/request-header-utils.js";
15
+ import h from "./util/request-header-utils.js";
16
16
  export default class Lt {
17
- constructor(t, i, s, e, h, o, n, r, u, l) {
18
- (this.rn = t),
17
+ constructor(t, i, s, e, h, o, n, r, l, a) {
18
+ (this.yn = t),
19
19
  (this.baseUrl = i),
20
- (this.oi = s),
21
- (this.on = e),
22
- (this.yt = h),
23
- (this.qt = o),
24
- (this.u = n),
25
- (this.yu = r),
26
- (this.Ko = u),
27
- (this.$t = l),
28
- (this.rn = t),
20
+ (this.T = s),
21
+ (this.wn = e),
22
+ (this.As = h),
23
+ (this.B = o),
24
+ (this.C = n),
25
+ (this.$l = r),
26
+ (this.Yh = l),
27
+ (this.S = a),
28
+ (this.yn = t),
29
29
  (this.baseUrl = i),
30
- (this.ju = 0),
31
- (this.fE = n.dE() || 0),
32
- (this.$u = null),
33
- (this.oi = s),
34
- (this.on = e),
35
- (this.yt = h),
36
- (this.qt = o),
37
- (this.u = n),
38
- (this.Ko = u),
39
- (this.$t = l),
40
- (this.yu = r),
41
- (this.Fu = new T()),
42
- (this.Lu = null),
43
- (this.Mu = 50),
44
- (this.Pu = !1);
30
+ (this.Pl = 0),
31
+ (this.IE = n.OE() || 0),
32
+ (this.Ol = null),
33
+ (this.T = s),
34
+ (this.wn = e),
35
+ (this.As = h),
36
+ (this.B = o),
37
+ (this.C = n),
38
+ (this.Yh = l),
39
+ (this.S = a),
40
+ (this.$l = r),
41
+ (this.Ul = new u()),
42
+ (this._l = null),
43
+ (this.Xl = 50),
44
+ (this.Ql = !1);
45
45
  }
46
- xu(t, i) {
47
- return !t && !i && this.Ko.Gh() >= this.Mu;
46
+ Yl(t, i) {
47
+ return !t && !i && this.Yh.Kh() >= this.Xl;
48
48
  }
49
- Iu(t) {
50
- let s = this.oi.Gl();
49
+ Zl(t) {
50
+ let i = this.T.Hl();
51
51
  if (t.length > 0) {
52
- const e = this.yt.getUserId();
53
- for (const h of t) {
54
- const t = (!h.userId && !e) || h.userId === e;
55
- h.type === i.ql && t && (s = !0);
52
+ const s = this.As.getUserId();
53
+ for (const e of t) {
54
+ const t = (!e.userId && !s) || e.userId === s;
55
+ e.type === d.Jl && t && (i = !0);
56
56
  }
57
57
  }
58
- return s;
58
+ return i;
59
59
  }
60
- Nu(t = !1, i = !1, s = !0, e, h, n, u = !1, l = !1) {
61
- s && this.Ou();
62
- const a = this.u.AE(),
63
- c = this.u.OE();
64
- let d = !1;
65
- const m = (t, i, r = -1) => {
66
- let u = !1;
67
- const l = new Date().valueOf();
68
- D.Hs(this.u, D._s.Ka, l),
69
- -1 !== r && i.push(["X-Braze-Req-Tokens-Remaining", r.toString()]),
70
- C.Ks({
60
+ sc(i = !1, s = !1, e = !0, o, n, r, u = !1, c = !1) {
61
+ e && this.hc();
62
+ const d = this.C.hE(),
63
+ m = this.C.gE();
64
+ let f = !1;
65
+ const g = (i, s, u = -1) => {
66
+ let c = !1;
67
+ const d = new Date().valueOf();
68
+ h.W(this.C, h.O.Xu, d),
69
+ -1 !== u && s.push(["X-Braze-Req-Tokens-Remaining", u.toString()]),
70
+ l.Y({
71
71
  url: this.baseUrl + "/data/",
72
- data: t,
73
- headers: i,
74
- L: (s) => {
75
- null != t.respond_with &&
76
- t.respond_with.triggers &&
77
- (this.ju = Math.max(this.ju - 1, 0)),
78
- this.$t.Qs(t, s, i)
79
- ? (this.Ko.Vs(),
80
- this.qt.al(s),
81
- (null != t.respond_with &&
82
- t.respond_with.user_id != this.yt.getUserId()) ||
83
- (null != t.device && this.u.I(o.C.Fa, t.device),
84
- null != t.sdk_metadata &&
85
- (this.u.I(o.C.Jh, t.sdk_metadata),
86
- this.u.I(o.C.Qh, this.oi.xi())),
87
- this.yu(s),
88
- D.Ws(this.u, D._s.Ka, 1),
89
- "function" == typeof e && e()))
90
- : s.auth_error && (u = !0);
72
+ data: i,
73
+ headers: s,
74
+ ss: (e) => {
75
+ null != i.respond_with &&
76
+ i.respond_with.triggers &&
77
+ (this.Pl = Math.max(this.Pl - 1, 0)),
78
+ this.S.ts(i, e, s)
79
+ ? (this.Yh.es(),
80
+ this.B.Rl(e),
81
+ (null != i.respond_with &&
82
+ i.respond_with.user_id != this.As.getUserId()) ||
83
+ (null != i.device && this.C.js(t.bs.Xa, i.device),
84
+ null != i.sdk_metadata &&
85
+ (this.C.js(t.bs.qu, i.sdk_metadata),
86
+ this.C.js(t.bs.Au, this.T.Ss())),
87
+ this.$l(e),
88
+ h.ns(this.C, h.O.Xu, 1),
89
+ "function" == typeof o && o()))
90
+ : e.auth_error && (c = !0);
91
91
  },
92
92
  error: () => {
93
- null != t.respond_with &&
94
- t.respond_with.triggers &&
95
- (this.ju = Math.max(this.ju - 1, 0)),
96
- this.$t.Zh(t.events, t.attributes),
97
- "function" == typeof h && h();
93
+ null != i.respond_with &&
94
+ i.respond_with.triggers &&
95
+ (this.Pl = Math.max(this.Pl - 1, 0)),
96
+ this.S.Du(i.events, i.attributes),
97
+ "function" == typeof n && n();
98
98
  },
99
- Zs: (t) => {
100
- if (("function" == typeof n && n(t), s && !d)) {
101
- if (t && !u) this.zu();
99
+ os: (t) => {
100
+ if (("function" == typeof r && r(t), e && !f)) {
101
+ if (t && !c) this.nc();
102
102
  else {
103
- D.ti(this.u, D._s.Ka);
104
- let t = this.$u;
105
- (null == t || t < 1e3 * this.fE) && (t = 1e3 * this.fE),
106
- this.zu(Math.min(3e5, U(1e3 * this.fE, 3 * t)));
103
+ h.hs(this.C, h.O.Xu);
104
+ let t = this.Ol;
105
+ (null == t || t < 1e3 * this.IE) && (t = 1e3 * this.IE),
106
+ this.nc(Math.min(3e5, a(1e3 * this.IE, 3 * t)));
107
107
  }
108
- d = !0;
108
+ f = !0;
109
109
  }
110
110
  },
111
111
  });
112
112
  },
113
- f = this.Iu(a),
114
- g = i || f;
115
- if (this.xu(u, f))
116
- return void r.info(
113
+ v = this.Zl(d),
114
+ p = s || v;
115
+ if (this.Yl(u, v))
116
+ return void N.info(
117
117
  "Declining to flush data due to 50 consecutive authentication failures",
118
118
  );
119
- if (s && !this.$t.La(a, c, t, g))
120
- return this.zu(), void ("function" == typeof n && n(!0));
121
- const v = this.$t.Ea(t, g, a, c, l);
122
- g && this.ju++;
123
- let p = !1;
124
- if (v)
125
- for (const t of v)
126
- this.$t.Gs(
119
+ if (e && !this.S.zu(d, m, i, p))
120
+ return this.nc(), void ("function" == typeof r && r(!0));
121
+ const b = this.S.ju(i, p, d, m, c);
122
+ p && this.Pl++;
123
+ let w = !1;
124
+ if (b)
125
+ for (const t of b)
126
+ this.S.V(
127
127
  t.requestData,
128
- (i) => m(t.requestData, t.headers, i),
129
- D._s.Ka,
130
- h,
128
+ (i) => g(t.requestData, t.headers, i),
129
+ h.O.Xu,
130
+ n,
131
131
  ),
132
- (p = !0);
133
- this.Ko.Fh() && s && !p
134
- ? this.zu()
135
- : f && (r.info("Invoking new session subscriptions"), this.Fu.Rt());
132
+ (w = !0);
133
+ this.Yh.jh() && e && !w
134
+ ? this.nc()
135
+ : v && (N.info("Invoking new session subscriptions"), this.Ul.X());
136
136
  }
137
- Uu() {
138
- return this.ju > 0;
137
+ uc() {
138
+ return this.Pl > 0;
139
139
  }
140
- zu(t = 1e3 * this.fE) {
141
- this.Pu ||
142
- (this.Ou(),
143
- (this.Lu = window.setTimeout(() => {
140
+ nc(t = 1e3 * this.IE) {
141
+ this.Ql ||
142
+ (this.hc(),
143
+ (this._l = window.setTimeout(() => {
144
144
  if (document.hidden) {
145
145
  const t = "visibilitychange",
146
146
  i = () => {
147
147
  document.hidden ||
148
- (document.removeEventListener(t, i, !1), this.Nu());
148
+ (document.removeEventListener(t, i, !1), this.sc());
149
149
  };
150
150
  document.addEventListener(t, i, !1);
151
- } else this.Nu();
151
+ } else this.sc();
152
152
  }, t)),
153
- (this.$u = t));
153
+ (this.Ol = t));
154
154
  }
155
- Ou() {
156
- null != this.Lu && (clearTimeout(this.Lu), (this.Lu = null));
155
+ hc() {
156
+ null != this._l && (clearTimeout(this._l), (this._l = null));
157
157
  }
158
158
  initialize() {
159
- (this.Pu = !1), this.zu();
159
+ (this.Ql = !1), this.nc();
160
160
  }
161
161
  destroy() {
162
- this.Fu.removeAllSubscriptions(),
163
- this.Ko.yh(),
164
- this.Ou(),
165
- (this.Pu = !0),
166
- this.Nu(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
167
- (this.Lu = null);
162
+ this.Ul.removeAllSubscriptions(),
163
+ this.Yh.Hh(),
164
+ this.hc(),
165
+ (this.Ql = !0),
166
+ this.sc(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
167
+ (this._l = null);
168
168
  }
169
- mr(t) {
170
- return this.Fu.Nt(t);
169
+ rn(t) {
170
+ return this.Ul.Ns(t);
171
171
  }
172
172
  openSession() {
173
- const t = this.oi.xi() !== this.oi.xo();
174
- t && (this.u.cE(o.iu.Uo), this.u.cE(o.iu.su)),
175
- this.Nu(void 0, !1, void 0, () => {
176
- this.u.ii(o.C.wi);
173
+ const i = this.T.Ss() !== this.T.qo();
174
+ i && (this.C.cE(t.iu.Qo), this.C.cE(t.iu.su)),
175
+ this.sc(void 0, !1, void 0, () => {
176
+ this.C.Ls(t.bs.we);
177
177
  }),
178
- this.Mn(),
179
- t &&
180
- import("./Push/push-manager-factory.js").then((t) => {
181
- if (this.Pu) return;
182
- const i = t.default.m();
178
+ this.vu(),
179
+ i &&
180
+ import("./Push/push-manager-factory.js").then((i) => {
181
+ if (this.Ql) return;
182
+ const s = i.default.ea();
183
183
  if (
184
- null != i &&
184
+ null != s &&
185
185
  (yt.isPushPermissionGranted() || yt.isPushBlocked())
186
186
  ) {
187
- const t = () => {
188
- i.mn()
189
- ? r.info(
187
+ const i = () => {
188
+ s.Tn()
189
+ ? N.info(
190
190
  "Push token maintenance is disabled, not refreshing token for backend.",
191
191
  )
192
- : i.subscribe();
192
+ : s.subscribe();
193
193
  },
194
- s = (i, s) => {
195
- s && t();
194
+ e = (t, s) => {
195
+ s && i();
196
196
  },
197
- e = () => {
198
- const i = this.u.j(o.C.In);
199
- (null == i || i) && t();
197
+ h = () => {
198
+ const s = this.C.ps(t.bs.Kn);
199
+ (null == s || s) && i();
200
200
  },
201
- h = A.ts.Zt;
202
- new A(h, r).jr(h.hs.cu, s, e);
201
+ o = it.Gs._s;
202
+ new it(o, N).jr(o.Os.cu, e, h);
203
203
  }
204
204
  });
205
205
  }
206
- _u() {
207
- this.u.ii(o.C.vi), this.u.ii(o.C.bs), this.u.ii(o.C.Xr);
206
+ lc() {
207
+ this.C.Ls(t.bs.Yi), this.C.Ls(t.bs.wi), this.C.Ls(t.bs.cn);
208
208
  }
209
- changeUser(t, i, s) {
210
- const e = this.yt.getUserId();
211
- if (e !== t) {
212
- this.oi.yl(),
213
- this._u(),
214
- null != e && this.Nu(void 0, !1, void 0, void 0, void 0),
215
- this.yt.ou(t),
216
- s ? this.Ko.setSdkAuthenticationSignature(s) : this.Ko.xh();
217
- for (let t = 0; t < i.length; t++) i[t].changeUser(null == e);
218
- null != e && this.u.ii(o.C.J),
219
- this.u.ii(o.C.Fa),
220
- this.u.ii(o.C.nE),
221
- this.u.ii(o.C._E),
209
+ changeUser(i, s, e) {
210
+ const h = this.As.getUserId();
211
+ if (h !== i) {
212
+ this.T.Kl(),
213
+ this.lc(),
214
+ null != h && this.sc(void 0, !1, void 0, void 0, void 0),
215
+ this.As.ou(i),
216
+ e ? this.Yh.setSdkAuthenticationSignature(e) : this.Yh.Bh();
217
+ for (let t = 0; t < s.length; t++) s[t].changeUser(null == h);
218
+ null != h && this.C.Ls(t.bs.Ct),
219
+ this.C.Ls(t.bs.Xa),
220
+ this.C.Ls(t.bs.SE),
222
221
  this.openSession(),
223
- r.info('Changed user to "' + t + '".');
222
+ N.info('Changed user to "' + i + '".');
224
223
  } else {
225
- let i = "Doing nothing.";
226
- s &&
227
- this.Ko.kh() !== s &&
228
- (this.Ko.setSdkAuthenticationSignature(s),
229
- (i = "Updated SDK authentication signature")),
230
- r.info(`Current user is already ${t}. ${i}`);
224
+ let t = "Doing nothing.";
225
+ e &&
226
+ this.Yh.xh() !== e &&
227
+ (this.Yh.setSdkAuthenticationSignature(e),
228
+ (t = "Updated SDK authentication signature")),
229
+ N.info(`Current user is already ${i}. ${t}`);
231
230
  }
232
231
  }
233
232
  requestImmediateDataFlush(t) {
234
- this.Ou(), this.oi.xo();
235
- this.Nu(
233
+ this.hc(), this.T.qo();
234
+ this.sc(
236
235
  void 0,
237
236
  void 0,
238
237
  void 0,
239
238
  void 0,
240
239
  () => {
241
- r.error("Failed to flush data, request will be retried automatically.");
240
+ N.error("Failed to flush data, request will be retried automatically.");
242
241
  },
243
242
  t,
244
243
  !0,
245
244
  );
246
245
  }
247
246
  requestFeedRefresh() {
248
- this.oi.xo(), this.Nu(!0);
247
+ this.T.qo(), this.sc(!0);
249
248
  }
250
- $r(t, i) {
251
- this.oi.xo(),
252
- r.info("Requesting explicit trigger refresh."),
253
- this.Nu(void 0, !0, void 0, t, i);
249
+ vr(t, i) {
250
+ this.T.qo(),
251
+ N.info("Requesting explicit trigger refresh."),
252
+ this.sc(void 0, !0, void 0, t, i);
254
253
  }
255
- Cn(s, e) {
256
- const h = i.Eu,
257
- n = { a: s, l: e },
258
- u = t.q(h, n);
254
+ $n(i, s) {
255
+ const e = d.cc,
256
+ h = { a: i, l: s },
257
+ o = c.ds(e, h);
259
258
  return (
260
- u && (r.info(`Logged alias ${s} with label ${e}`), this.u.I(o.C._E, n)), u
259
+ o && (N.info(`Logged alias ${i} with label ${s}`), this.C.js(t.bs.SE, h)),
260
+ o
261
261
  );
262
262
  }
263
- Fn(i, e, h) {
264
- if (this.qt.hu(e))
263
+ Zn(t, i, s) {
264
+ if (this.B.hu(i))
265
265
  return (
266
- r.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new s()
266
+ N.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new E()
267
267
  );
268
- const o = { key: e, value: h },
269
- n = t.q(i, o);
270
- if (n) {
271
- const t = "object" == typeof h ? JSON.stringify(h, null, 2) : h;
272
- r.info(`Logged custom attribute: ${e} with value: ${t}`);
268
+ const e = { key: i, value: s },
269
+ h = c.ds(t, e);
270
+ if (h) {
271
+ const t = "object" == typeof s ? JSON.stringify(s, null, 2) : s;
272
+ N.info(`Logged custom attribute: ${i} with value: ${t}`);
273
273
  }
274
- return n;
274
+ return h;
275
275
  }
276
- setLastKnownLocation(s, e, h, o, n, u) {
277
- const l = { latitude: e, longitude: h };
278
- null != o && (l.altitude = o),
279
- null != n && (l.ll_accuracy = n),
280
- null != u && (l.alt_accuracy = u);
281
- const a = t.q(i.Ju, l, s || void 0);
276
+ setLastKnownLocation(t, i, s, e, h, o) {
277
+ const n = { latitude: i, longitude: s };
278
+ null != e && (n.altitude = e),
279
+ null != h && (n.ll_accuracy = h),
280
+ null != o && (n.alt_accuracy = o);
281
+ const r = c.ds(d.dc, n, t || void 0);
282
282
  return (
283
- a &&
284
- r.info(`Set user last known location as ${JSON.stringify(l, null, 2)}`),
285
- a
283
+ r &&
284
+ N.info(`Set user last known location as ${JSON.stringify(n, null, 2)}`),
285
+ r
286
286
  );
287
287
  }
288
- kr(t, s) {
289
- const e = this.oi.xo();
290
- return new ve(this.yt.getUserId(), i.Ku, t, e, { cid: s });
288
+ br(t, i) {
289
+ const s = this.T.qo();
290
+ return new ve(this.As.getUserId(), d.mc, t, s, { cid: i });
291
291
  }
292
- Wu(t, i) {
293
- return new A(t, i);
292
+ fc(t, i) {
293
+ return new it(t, i);
294
294
  }
295
- Mn() {
296
- const t = A.ts.Zt;
297
- this.Wu(t, r).setItem(t.hs.Ka, 1, {
295
+ vu() {
296
+ const t = it.Gs._s;
297
+ this.fc(t, N).setItem(t.Os.Xu, 1, {
298
298
  baseUrl: this.baseUrl,
299
- data: { api_key: this.rn, device_id: this.on.ce().id },
300
- userId: this.yt.getUserId(),
301
- sdkAuthEnabled: this.Ko.Fh(),
299
+ data: { api_key: this.yn, device_id: this.wn.ce().id },
300
+ userId: this.As.getUserId(),
301
+ sdkAuthEnabled: this.Yh.jh(),
302
302
  });
303
303
  }
304
- yr(t) {
304
+ wr(t) {
305
305
  for (const i of t)
306
- if (i.api_key === this.rn) this.$t.Zh(i.events, i.attributes);
306
+ if (i.api_key === this.yn) this.S.Du(i.events, i.attributes);
307
307
  else {
308
- const t = A.ts.Zt;
309
- new A(t, r).setItem(t.hs.wr, p.W(), i);
308
+ const t = it.Gs._s;
309
+ new it(t, N).setItem(t.Os.$r, G.Rt(), i);
310
310
  }
311
311
  }
312
- Gn(e, h, o) {
313
- if (this.qt.hu(e))
312
+ gu(t, i, s) {
313
+ if (this.B.hu(t))
314
314
  return (
315
- r.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new s()
315
+ N.info(`Custom Attribute "${t}" is blocklisted, ignoring.`), new E()
316
316
  );
317
- let n, u;
317
+ let e, h;
318
318
  return (
319
- null === h && null === o
320
- ? ((n = i.Gu), (u = { key: e }))
321
- : ((n = i.Xu), (u = { key: e, latitude: h, longitude: o })),
322
- t.q(n, u)
319
+ null === i && null === s
320
+ ? ((e = d.gc), (h = { key: t }))
321
+ : ((e = d.vc), (h = { key: t, latitude: i, longitude: s })),
322
+ c.ds(e, h)
323
323
  );
324
324
  }
325
- Hn(s, e) {
326
- const h = { group_id: s, status: e };
327
- return t.q(i.Hu, h);
325
+ yu(t, i) {
326
+ const s = { group_id: t, status: i };
327
+ return c.ds(d.bc, s);
328
328
  }
329
329
  }
@@ -1,14 +1,14 @@
1
1
  export default class ts {
2
2
  constructor(t) {
3
- (this.Bl = t), (this.Bl = t);
3
+ (this.wc = t), (this.wc = t);
4
4
  }
5
- Jl(t) {
6
- return null == this.Bl || this.Bl === t[0];
5
+ xc(t) {
6
+ return null == this.wc || this.wc === t[0];
7
7
  }
8
8
  static fromJson(t) {
9
9
  return new ts(t ? t.event_name : null);
10
10
  }
11
- Y() {
12
- return this.Bl;
11
+ Bs() {
12
+ return this.wc;
13
13
  }
14
14
  }
@@ -1,13 +1,13 @@
1
1
  import is from "./filter-set.js";
2
2
  export default class rs {
3
3
  constructor(t, s) {
4
- (this.Bl = t), (this.Ml = s), (this.Bl = t), (this.Ml = s);
4
+ (this.wc = t), (this.tf = s), (this.wc = t), (this.tf = s);
5
5
  }
6
- Jl(t) {
7
- if (null == this.Bl || null == this.Ml) return !1;
6
+ xc(t) {
7
+ if (null == this.wc || null == this.tf) return !1;
8
8
  const s = t[0],
9
9
  i = t[1];
10
- return s === this.Bl && this.Ml.Jl(i);
10
+ return s === this.wc && this.tf.xc(i);
11
11
  }
12
12
  static fromJson(t) {
13
13
  return new rs(
@@ -15,7 +15,7 @@ export default class rs {
15
15
  t ? is.fromJson(t.property_filters) : null,
16
16
  );
17
17
  }
18
- Y() {
19
- return { e: this.Bl, pf: this.Ml ? this.Ml.Y() : null };
18
+ Bs() {
19
+ return { e: this.wc, pf: this.tf ? this.tf.Bs() : null };
20
20
  }
21
21
  }