@braze/web-sdk 6.9.0 → 6.10.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.
@@ -5,12 +5,12 @@ export default class ui {
5
5
  (this.Wu = i),
6
6
  (this.publicKey = s),
7
7
  (this.sc = l),
8
- (this.ad = h),
8
+ (this.hd = h),
9
9
  (this.endpoint = t || null),
10
10
  (this.Wu = i || null),
11
11
  (this.publicKey = s || null),
12
12
  (this.sc = l || null),
13
- (this.ad = h || null);
13
+ (this.hd = h || null);
14
14
  }
15
15
  qt() {
16
16
  return {
@@ -18,7 +18,7 @@ export default class ui {
18
18
  c: this.Wu,
19
19
  p: this.publicKey,
20
20
  u: this.sc,
21
- v: this.ad,
21
+ v: this.hd,
22
22
  };
23
23
  }
24
24
  static _u(t) {
@@ -19,44 +19,44 @@ export default class di {
19
19
  d = null,
20
20
  m = null,
21
21
  ) {
22
- (this.nd = t),
23
- (this.gd = i),
24
- (this.bd = s),
25
- (this.fd = h),
26
- (this.Rd = l),
27
- (this.ad = e),
28
- (this.hd = r),
22
+ (this.ld = t),
23
+ (this.bd = i),
24
+ (this.fd = s),
25
+ (this.pd = h),
26
+ (this.Cd = l),
27
+ (this.hd = e),
28
+ (this.dd = r),
29
29
  (this.Xr = n),
30
- (this.ud = a),
30
+ (this.ad = a),
31
31
  (this.banners = o),
32
32
  (this.dust = u),
33
- (this.wd = c),
34
- (this.Td = d),
35
- (this.dd = m);
33
+ (this.Bd = c),
34
+ (this.yd = d),
35
+ (this.vd = m);
36
36
  }
37
37
  qt() {
38
38
  return {
39
- s: "6.9.0",
40
- l: this.nd,
41
- e: this.gd,
42
- a: this.bd,
43
- p: this.fd,
44
- m: this.Rd,
45
- v: this.ad,
46
- c: this.hd,
39
+ s: "6.10.1",
40
+ l: this.ld,
41
+ e: this.bd,
42
+ a: this.fd,
43
+ p: this.pd,
44
+ m: this.Cd,
45
+ v: this.hd,
46
+ c: this.dd,
47
47
  f: this.Xr,
48
- grl: this.ud,
48
+ grl: this.ad,
49
49
  b: this.banners,
50
50
  d: this.dust,
51
- rb: this.wd,
52
- mst: this.Td,
53
- ch: this.dd,
51
+ rb: this.Bd,
52
+ mst: this.yd,
53
+ ch: this.vd,
54
54
  };
55
55
  }
56
56
  static _u(t) {
57
57
  let i = t.l;
58
58
  return (
59
- "6.9.0" !== t.s && (i = 0),
59
+ "6.10.1" !== t.s && (i = 0),
60
60
  new di(
61
61
  i,
62
62
  t.e,
@@ -79,15 +79,15 @@ export default class Kt {
79
79
  (this.nc = Math.max(this.nc - 1, 0)),
80
80
  this.B.ut(t, i, r)
81
81
  ? (this.Gh.ct(),
82
- this.h.ld(i),
82
+ this.h.ud(i),
83
83
  (null != t.respond_with &&
84
84
  t.respond_with.user_id != this.Ss.getUserId()) ||
85
- (null != t.device && this.j.Pt(s.It.Ba, t.device),
85
+ (null != t.device && this.j.Pt(s.It.Ha, t.device),
86
86
  null != t.sdk_metadata &&
87
- (this.j.Pt(s.It.Ka, t.sdk_metadata),
88
- this.j.Pt(s.It.Pa, this.C.$t())),
87
+ (this.j.Pt(s.It.Pa, t.sdk_metadata),
88
+ this.j.Pt(s.It.Ua, this.C.$t())),
89
89
  this.hc(i),
90
- h.Dl(this.j, h.it.pn, 1),
90
+ h.Tl(this.j, h.it.pn, 1),
91
91
  "function" == typeof e && e()))
92
92
  : i.auth_error && (d = !0);
93
93
  },
@@ -96,12 +96,12 @@ export default class Kt {
96
96
  null != t.respond_with &&
97
97
  t.respond_with.triggers &&
98
98
  (this.nc = Math.max(this.nc - 1, 0)),
99
- this.B.Ua(t.events, t.attributes),
99
+ this.B.Wa(t.events, t.attributes),
100
100
  "function" == typeof n && n();
101
101
  },
102
102
  ft: (t, s) => {
103
103
  "function" == typeof o && o(!d);
104
- const e = this.B.Cl(s);
104
+ const e = this.B.zl(s);
105
105
  let n = 0;
106
106
  if (e)
107
107
  switch (e.type) {
@@ -113,7 +113,7 @@ export default class Kt {
113
113
  }
114
114
  if (i && !m) {
115
115
  if (d) {
116
- h.zl(this.j, h.it.pn);
116
+ h.jl(this.j, h.it.pn);
117
117
  const t = this.h.vt(),
118
118
  i = this.h.gt(),
119
119
  s = this.h.bt();
@@ -133,9 +133,9 @@ export default class Kt {
133
133
  return void b.info(
134
134
  "Declining to flush data due to 50 consecutive authentication failures",
135
135
  );
136
- if (i && !this.B.fl(c, d, p))
136
+ if (i && !this.B.ml(c, d, p))
137
137
  return this.kc(), void ("function" == typeof o && o(!0));
138
- const v = this.B.ml(p, c, d, u);
138
+ const v = this.B.vl(p, c, d, u);
139
139
  p && this.nc++;
140
140
  let w = !1;
141
141
  if (v)
@@ -188,7 +188,8 @@ export default class Kt {
188
188
  (this.fc = !1);
189
189
  }
190
190
  rn(t) {
191
- return this.fc ? (t(), null) : this.uc.Ut(t);
191
+ const i = this.uc.Ut(t);
192
+ return this.fc && t(), i;
192
193
  }
193
194
  openSession() {
194
195
  const t = this.C.$t() !== this.C.el();
@@ -228,10 +229,10 @@ export default class Kt {
228
229
  this.j.Vt(s.It.Fo), this.j.Vt(s.It.bi), this.j.Vt(s.It.pa);
229
230
  }
230
231
  Sc() {
231
- this.j.Vt(s.It.Bl),
232
+ this.j.Vt(s.It.Sl),
232
233
  this.j.Vt(s.It.ES),
233
- this.j.Vt(s.It.Ml),
234
- this.j.Vt(s.It.Ll);
234
+ this.j.Vt(s.It.Xl),
235
+ this.j.Vt(s.It.El);
235
236
  }
236
237
  changeUser(t, i, e) {
237
238
  const h = this.Ss.getUserId();
@@ -245,7 +246,7 @@ export default class Kt {
245
246
  for (let t = 0; t < i.length; t++) i[t].changeUser(null == h);
246
247
  this.B.fo(),
247
248
  null != h && this.j.Vt(s.It.eS),
248
- this.j.Vt(s.It.Ba),
249
+ this.j.Vt(s.It.Ha),
249
250
  this.j.Vt(s.It.lS),
250
251
  this.Sc(),
251
252
  this.openSession(),
@@ -329,7 +330,7 @@ export default class Kt {
329
330
  }
330
331
  Dr(t) {
331
332
  for (const i of t)
332
- if (i.api_key === this.tu) this.B.Ua(i.events, i.attributes);
333
+ if (i.api_key === this.tu) this.B.Wa(i.events, i.attributes);
333
334
  else {
334
335
  const t = et._s.Xs;
335
336
  new et(t, b).setItem(t.Ws.Br, V.de(), i);
@@ -1,5 +1,5 @@
1
1
  import pi from "./trigger-condition.js";
2
- export default class jr {
2
+ export default class wr {
3
3
  constructor(t) {
4
4
  (this.if = t), (this.if = t);
5
5
  }
@@ -7,7 +7,7 @@ export default class jr {
7
7
  return null == this.if || pi.sf(t[0], this.if);
8
8
  }
9
9
  static fromJson(t) {
10
- return new jr(t ? t.campaign_id : null);
10
+ return new wr(t ? t.campaign_id : null);
11
11
  }
12
12
  qt() {
13
13
  return this.if;
@@ -4,7 +4,7 @@ import ls from "./filter-set.js";
4
4
  import bi from "./in-app-message-click-data.js";
5
5
  import os from "./purchase-data.js";
6
6
  import fs from "./purchase-property-data.js";
7
- import jr from "./push-click-data.js";
7
+ import wr from "./push-click-data.js";
8
8
  import ot from "./trigger-events.js";
9
9
  import { logger as b } from "../../../shared-lib/index.js";
10
10
  import { getErrorMessage as hi } from "../../util/error-utils.js";
@@ -38,7 +38,7 @@ export default class pi {
38
38
  r = fs.fromJson(e.data);
39
39
  break;
40
40
  case pi.la.Sr:
41
- r = jr.fromJson(e.data);
41
+ r = wr.fromJson(e.data);
42
42
  break;
43
43
  case pi.la.he:
44
44
  r = es.fromJson(e.data);
@@ -68,7 +68,7 @@ export default class pi {
68
68
  (t = e.d || {}), (r = new fs(t.id, ls._u(t.pf || [])));
69
69
  break;
70
70
  case pi.la.Sr:
71
- r = new jr(e.d);
71
+ r = new wr(e.d);
72
72
  break;
73
73
  case pi.la.he:
74
74
  r = new es(e.d);
@@ -14,11 +14,11 @@ export default class gt {
14
14
  (this.priority = r),
15
15
  (this.type = h),
16
16
  (this.data = l),
17
- (this.yd = o),
18
- (this.jd = n),
17
+ (this.jd = o),
18
+ (this.Nd = n),
19
19
  (this.ca = a),
20
- (this.Nd = u),
21
- (this._d = d),
20
+ (this._d = u),
21
+ (this.Ad = d),
22
22
  (this.id = t),
23
23
  (this.Pd = i || []),
24
24
  void 0 === s && (s = null),
@@ -27,27 +27,27 @@ export default class gt {
27
27
  (this.endTime = e),
28
28
  (this.priority = r || 0),
29
29
  (this.type = h),
30
- (this.yd = o || 0),
31
- null == a && (a = 1e3 * (this.yd + 30)),
30
+ (this.jd = o || 0),
31
+ null == a && (a = 1e3 * (this.jd + 30)),
32
32
  (this.ca = a),
33
33
  (this.data = l),
34
- null != n && (this.jd = n),
35
- (this.Nd = u),
36
- (this._d = d || null);
34
+ null != n && (this.Nd = n),
35
+ (this._d = u),
36
+ (this.Ad = d || null);
37
37
  }
38
- Ad(t) {
38
+ Id(t) {
39
39
  return (
40
- null == this._d || (this.jd !== gt.Dd && t - this._d >= 1e3 * this.jd)
40
+ null == this.Ad || (this.Nd !== gt.Dd && t - this.Ad >= 1e3 * this.Nd)
41
41
  );
42
42
  }
43
- Id(t) {
44
- this._d = t;
45
- }
46
43
  $d(t) {
47
- const i = t + 1e3 * this.yd;
48
- return Math.max(i - new Date().valueOf(), 0);
44
+ this.Ad = t;
49
45
  }
50
46
  xd(t) {
47
+ const i = t + 1e3 * this.jd;
48
+ return Math.max(i - new Date().valueOf(), 0);
49
+ }
50
+ zd(t) {
51
51
  const i = new Date().valueOf() - t,
52
52
  s = null == t || isNaN(i) || null == this.ca || i < this.ca;
53
53
  return (
@@ -92,11 +92,11 @@ export default class gt {
92
92
  p: this.priority,
93
93
  t: this.type,
94
94
  da: this.data,
95
- d: this.yd,
96
- r: this.jd,
95
+ d: this.jd,
96
+ r: this.Nd,
97
97
  tm: this.ca,
98
- ss: this.Nd,
99
- ld: this._d,
98
+ ss: this._d,
99
+ ld: this.Ad,
100
100
  };
101
101
  }
102
102
  static _u(t) {
@@ -119,4 +119,4 @@ export default class gt {
119
119
  );
120
120
  }
121
121
  }
122
- (gt.la = { oa: "inapp", zd: "templated_iam" }), (gt.Dd = -1);
122
+ (gt.la = { oa: "inapp", Md: "templated_iam" }), (gt.Dd = -1);
@@ -41,7 +41,7 @@ export default class vr extends t {
41
41
  (this.og = this.j.St(s.It.oS) || this.og);
42
42
  for (let t = 0; t < this.triggers.length; t++) {
43
43
  const i = this.triggers[t];
44
- i.id && null != this.og[i.id] && i.Id(this.og[i.id]);
44
+ i.id && null != this.og[i.id] && i.$d(this.og[i.id]);
45
45
  }
46
46
  }
47
47
  }
@@ -70,7 +70,7 @@ export default class vr extends t {
70
70
  h = [];
71
71
  for (let r = 0; r < t.length; r++) {
72
72
  const n = t[r],
73
- o = s.$d(n.ma || 0);
73
+ o = s.xd(n.ma || 0);
74
74
  if (o > 0) {
75
75
  let t, r;
76
76
  h.push(n),
@@ -118,7 +118,7 @@ export default class vr extends t {
118
118
  if (h) {
119
119
  h.id &&
120
120
  null != this.og[h.id] &&
121
- (h.Id(this.og[h.id]), (e[h.id] = this.og[h.id])),
121
+ (h.$d(this.og[h.id]), (e[h.id] = this.og[h.id])),
122
122
  h.id && null != this.ng[h.id] && (r[h.id] = this.ng[h.id]);
123
123
  for (let t = 0; t < h.Pd.length; t++)
124
124
  if (h.Pd[t]._c(ot.Os, null)) {
@@ -147,12 +147,12 @@ export default class vr extends t {
147
147
  const h = (e) => {
148
148
  this.fg();
149
149
  const r = new Date().valueOf();
150
- t.xd(i) ||
150
+ t.zd(i) ||
151
151
  (!1 === navigator.onLine && t.type === gt.la.oa && e.imageUrl
152
152
  ? b.info(
153
153
  `Not showing ${t.type} trigger action ${t.id} due to offline state.`,
154
154
  )
155
- : t.Ad(r) && this.wg(t, r, s)
155
+ : t.Id(r) && this.wg(t, r, s)
156
156
  ? 0 === this.Rs.Ve()
157
157
  ? b.info(
158
158
  `Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
@@ -166,14 +166,14 @@ export default class vr extends t {
166
166
  this.fg();
167
167
  const h = r.pop();
168
168
  if (null != h)
169
- if ((this.Tg(h, i, s, e, r), h.xd(i))) {
169
+ if ((this.Tg(h, i, s, e, r), h.zd(i))) {
170
170
  let t = `Server aborted in-app message display, but the timeout on fallback trigger ${h.id} has already elapsed.`;
171
171
  r.length > 0 && (t += " Continuing to fall back."), b.info(t), n();
172
172
  } else {
173
173
  b.info(
174
174
  `Server aborted in-app message display. Falling back to lower priority ${h.type} trigger action ${t.id}.`,
175
175
  );
176
- const n = 1e3 * h.yd - (new Date().valueOf() - i);
176
+ const n = 1e3 * h.jd - (new Date().valueOf() - i);
177
177
  n > 0
178
178
  ? this.eg.push(
179
179
  window.setTimeout(() => {
@@ -198,7 +198,7 @@ export default class vr extends t {
198
198
  }
199
199
  h(o);
200
200
  break;
201
- case gt.la.zd:
201
+ case gt.la.Md:
202
202
  if (((a = Jt.fromJson(t.data, h, n, i, t.ca || 0)), null == a)) {
203
203
  b.error(
204
204
  `Could not parse trigger data for trigger ${t.id}, ignoring.`,
@@ -228,9 +228,9 @@ export default class vr extends t {
228
228
  const o = [];
229
229
  for (let s = 0; s < this.triggers.length; s++) {
230
230
  const r = this.triggers[s],
231
- l = e + 1e3 * r.yd;
231
+ l = e + 1e3 * r.jd;
232
232
  if (
233
- r.Ad(l) &&
233
+ r.Id(l) &&
234
234
  (null == r.startTime || r.startTime.valueOf() <= e) &&
235
235
  (null == r.endTime || r.endTime.valueOf() >= e)
236
236
  ) {
@@ -260,12 +260,12 @@ export default class vr extends t {
260
260
  `Firing ${l.type} trigger action ${l.id} from trigger event ${t}.`,
261
261
  ),
262
262
  this.Tg(l, e, t, s, o),
263
- 0 === l.yd
263
+ 0 === l.jd
264
264
  ? this.cg(l, e, t, s, o)
265
265
  : this.eg.push(
266
266
  window.setTimeout(() => {
267
267
  this.cg(l, e, t, s, o);
268
- }, 1e3 * l.yd),
268
+ }, 1e3 * l.jd),
269
269
  ));
270
270
  }
271
271
  changeUser(t = !1) {
@@ -290,7 +290,7 @@ export default class vr extends t {
290
290
  ),
291
291
  !0
292
292
  );
293
- let e = t.Nd;
293
+ let e = t._d;
294
294
  return null == e && (e = this.tg), i - this.hg >= 1e3 * e;
295
295
  }
296
296
  Tg(t, i, e, r, h) {
@@ -306,7 +306,7 @@ export default class vr extends t {
306
306
  }
307
307
  yg(t, i) {
308
308
  this.fg(),
309
- t.Id(i),
309
+ t.$d(i),
310
310
  (this.hg = i),
311
311
  t.id && (this.og[t.id] = i),
312
312
  this.j && (this.j.Pt(s.It.nS, i), this.j.Pt(s.It.oS, this.og));
package/src/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const CartUpdatedActions = {
2
2
  REPLACE: "replace",
3
3
  Ld: "add",
4
- Md: "remove",
4
+ Od: "remove",
5
5
  };
@@ -1,7 +1,7 @@
1
1
  import r, { OPTIONS as U } from "../../managers/braze-instance.js";
2
2
  export function attachCSS(n, t, o) {
3
3
  const c = n || document.querySelector("head"),
4
- e = `ab-${t}-css-definitions-${"6.9.0".replace(/\./g, "-")}`;
4
+ e = `ab-${t}-css-definitions-${"6.10.1".replace(/\./g, "-")}`;
5
5
  if (!c) return;
6
6
  const s = c.ownerDocument || document;
7
7
  if (null == s.getElementById(e)) {
@@ -28,7 +28,7 @@ class xi {
28
28
  bS() {
29
29
  return this.browser === yi.Bg;
30
30
  }
31
- Aa() {
31
+ Ba() {
32
32
  return this.OS || null;
33
33
  }
34
34
  Fa() {
@@ -208,7 +208,7 @@ function kn(n, t) {
208
208
  var u;
209
209
  const o = Cn(n.products);
210
210
  if (!1 === e || !1 === r || null == o) return null;
211
- const c = r === un.Ld || r === un.Md,
211
+ const c = r === un.Ld || r === un.Od,
212
212
  i =
213
213
  void 0 === n.total_value && c ? void 0 : pn(n.total_value, "total_value");
214
214
  if (!1 === i) return null;
package/src/util/net.js CHANGED
@@ -27,7 +27,7 @@ const l = {
27
27
  o = JSON.parse(e.responseText);
28
28
  } catch (o) {
29
29
  const n = {
30
- error: "" === e.responseText ? Ne.Wa : Ne.Qa,
30
+ error: "" === e.responseText ? Ne.Ya : Ne.Va,
31
31
  response: e.responseText,
32
32
  };
33
33
  (0, t.lt)(n, r);
@@ -7,45 +7,46 @@ const h = {
7
7
  Co: "feature_flags/sync",
8
8
  Yo: "template",
9
9
  st: "banners/sync",
10
+ qa: "unregister",
10
11
  },
11
- Pl: (t) => (null == t ? void 0 : t.St(s.It.ES)),
12
- Am: (t) => (null == t ? void 0 : t.St(s.It.SS)),
13
- Rm: (t, e) => {
14
- null == t || t.Pt(s.It.ES, e);
12
+ Ul: (e) => (null == e ? void 0 : e.St(s.It.ES)),
13
+ Rm: (e) => (null == e ? void 0 : e.St(s.It.SS)),
14
+ Am: (e, t) => {
15
+ null == e || e.Pt(s.It.ES, t);
15
16
  },
16
- qm: (t, e) => {
17
- null == t || t.Pt(s.It.SS, e);
17
+ qm: (e, t) => {
18
+ null == e || e.Pt(s.It.SS, t);
18
19
  },
19
- ql: (t, e) => {
20
- if (!t || !e) return -1;
21
- const s = h.Pl(t);
20
+ Al: (e, t) => {
21
+ if (!e || !t) return -1;
22
+ const s = h.Ul(e);
22
23
  if (null == s) return -1;
23
- const n = s[e];
24
+ const n = s[t];
24
25
  return null == n || isNaN(n) ? -1 : n;
25
26
  },
26
- Al: (t, e) => {
27
+ Dl: (e, t) => {
27
28
  let s = Qe;
28
- if (!t || !e) return s;
29
- const n = h.Am(t);
30
- return null == n ? s : ((s = n[e]), null == s || isNaN(s) ? Qe : s);
31
- },
32
- nt: (t, e, s) => {
33
- if (!t || !e) return;
34
- let n = h.Pl(t);
35
- null == n && (n = {}), (n[e] = s), h.Rm(t, n);
36
- },
37
- Dl: (t, e, s) => {
38
- if (!t || !e) return;
39
- let n = h.Am(t);
40
- null == n && (n = {}), (n[e] = s), h.qm(t, n);
41
- },
42
- Ji: (t, e) => {
43
- t && e && h.Dl(t, e, Qe);
44
- },
45
- zl: (t, e) => {
46
- if (!t || !e) return;
47
- const s = h.Al(t, e);
48
- h.Dl(t, e, s + 1);
29
+ if (!e || !t) return s;
30
+ const n = h.Rm(e);
31
+ return null == n ? s : ((s = n[t]), null == s || isNaN(s) ? Qe : s);
32
+ },
33
+ nt: (e, t, s) => {
34
+ if (!e || !t) return;
35
+ let n = h.Ul(e);
36
+ null == n && (n = {}), (n[t] = s), h.Am(e, n);
37
+ },
38
+ Tl: (e, t, s) => {
39
+ if (!e || !t) return;
40
+ let n = h.Rm(e);
41
+ null == n && (n = {}), (n[t] = s), h.qm(e, n);
42
+ },
43
+ Ji: (e, t) => {
44
+ e && t && h.Tl(e, t, Qe);
45
+ },
46
+ jl: (e, t) => {
47
+ if (!e || !t) return;
48
+ const s = h.Dl(e, t);
49
+ h.Tl(e, t, s + 1);
49
50
  },
50
51
  };
51
52
  export default h;