@braze/web-sdk 6.10.2 → 6.12.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 (109) hide show
  1. package/index.d.ts +61 -6
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +3 -3
  4. package/shared-lib/event-types.js +12 -12
  5. package/shared-lib/indexed-db-adapter.js +52 -52
  6. package/shared-lib/logger.js +7 -7
  7. package/shared-lib/supported-options.js +10 -10
  8. package/src/Core/logout.js +2 -2
  9. package/src/DUST/dust-config-store.js +89 -0
  10. package/src/DUST/dust-connection-core.js +7 -21
  11. package/src/DUST/dust-message-dedup.js +33 -0
  12. package/src/DUST/dust-provider.js +367 -397
  13. package/src/DUST/dust-tab-identity.js +30 -0
  14. package/src/DUST/index.js +7 -9
  15. package/src/DUST/subscribe-to-dust.js +5 -5
  16. package/src/FeatureFlags/feature-flag-factory.js +4 -4
  17. package/src/FeatureFlags/feature-flag.js +5 -5
  18. package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
  19. package/src/FeatureFlags/feature-flags-provider.js +74 -74
  20. package/src/FeatureFlags/get-all-feature-flags.js +2 -2
  21. package/src/FeatureFlags/get-feature-flag.js +2 -2
  22. package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
  23. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  24. package/src/InAppMessage/constants.js +39 -47
  25. package/src/InAppMessage/defer-in-app-message.js +2 -2
  26. package/src/InAppMessage/display/get-animation-effect.js +1 -1
  27. package/src/InAppMessage/display/html-message-display-utils.js +4 -4
  28. package/src/InAppMessage/display/html-message-to-html.js +10 -10
  29. package/src/InAppMessage/display/in-app-message-to-html.js +68 -66
  30. package/src/InAppMessage/display/modal-utils.js +14 -14
  31. package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
  32. package/src/InAppMessage/in-app-message-factory.js +6 -6
  33. package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
  34. package/src/InAppMessage/in-app-message-manager.js +101 -80
  35. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  36. package/src/InAppMessage/log-in-app-message-click.js +2 -2
  37. package/src/InAppMessage/log-in-app-message-html-click.js +4 -4
  38. package/src/InAppMessage/log-in-app-message-impression.js +3 -3
  39. package/src/InAppMessage/models/full-screen-message.js +25 -25
  40. package/src/InAppMessage/models/html-message.js +14 -14
  41. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  42. package/src/InAppMessage/models/in-app-message.js +100 -98
  43. package/src/InAppMessage/models/modal-message.js +23 -23
  44. package/src/InAppMessage/models/slide-up-message.js +29 -29
  45. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  46. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  47. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +2 -2
  48. package/src/InAppMessage/ui/show-in-app-message.js +42 -40
  49. package/src/Push/index.js +1 -0
  50. package/src/Push/is-push-blocked.js +2 -2
  51. package/src/Push/is-push-permission-granted.js +2 -2
  52. package/src/Push/is-push-supported.js +2 -2
  53. package/src/Push/push-manager-factory.js +6 -6
  54. package/src/Push/push-manager.js +228 -185
  55. package/src/Push/register-push.js +9 -0
  56. package/src/Push/unregister-push-token-on-server.js +4 -4
  57. package/src/Push/utils/push-utils.js +16 -16
  58. package/src/User/user-manager.js +19 -19
  59. package/src/User/user.js +36 -36
  60. package/src/common/constants.js +1 -1
  61. package/src/common/content-cards-display.js +21 -21
  62. package/src/common/event-logger.js +2 -2
  63. package/src/l10n/l10n-manager-factory.js +7 -7
  64. package/src/l10n/l10n-manager.js +5 -5
  65. package/src/managers/auth-manager.js +1 -1
  66. package/src/managers/braze-instance.js +70 -66
  67. package/src/managers/device-manager.js +12 -12
  68. package/src/managers/network-manager.js +118 -118
  69. package/src/managers/server-config-manager.js +84 -84
  70. package/src/managers/session-manager.js +10 -10
  71. package/src/managers/storage-manager-factory.js +4 -4
  72. package/src/managers/storage-manager.js +138 -136
  73. package/src/managers/subscription-manager.js +1 -1
  74. package/src/managers/utils.js +1 -1
  75. package/src/models/backend-errors.js +5 -5
  76. package/src/models/braze-event.js +7 -7
  77. package/src/models/device.js +2 -2
  78. package/src/models/identifier.js +6 -6
  79. package/src/models/push-token.js +6 -6
  80. package/src/models/server-config.js +31 -31
  81. package/src/request-controller.js +91 -91
  82. package/src/triggers/models/filter.js +58 -58
  83. package/src/triggers/models/in-app-message-click-data.js +4 -4
  84. package/src/triggers/models/push-click-data.js +2 -2
  85. package/src/triggers/models/trigger-condition.js +35 -35
  86. package/src/triggers/models/trigger.js +37 -37
  87. package/src/triggers/triggers-provider-factory.js +3 -3
  88. package/src/triggers/triggers-provider.js +61 -53
  89. package/src/types.js +1 -1
  90. package/src/ui/js/attach-css.js +1 -1
  91. package/src/ui/js/feed-css.js +2 -2
  92. package/src/ui/js/iam-css.js +2 -2
  93. package/src/util/base-device-parser.js +1 -1
  94. package/src/util/braze-actions.js +4 -4
  95. package/src/util/browser-detector.js +13 -13
  96. package/src/util/client-hints-parser.js +4 -4
  97. package/src/util/component-utils.js +4 -4
  98. package/src/util/dom-utils.js +5 -5
  99. package/src/util/ecommerce-event-validation.js +77 -48
  100. package/src/util/key-codes.js +1 -1
  101. package/src/util/net.js +4 -4
  102. package/src/util/request-header-utils.js +20 -20
  103. package/src/util/string-utils.js +5 -0
  104. package/src/util/user-agent-parser.js +15 -15
  105. package/src/util/validation-utils.js +9 -9
  106. package/src/util/window-utils.js +2 -2
  107. package/src/DUST/dust-shared-worker-code.js +0 -2
  108. package/src/DUST/dust-shared-worker-impl.js +0 -234
  109. package/src/DUST/dust-worker-bridge.js +0 -151
@@ -1,11 +1,11 @@
1
- import pi from "./trigger-condition.js";
2
- export default class bi {
1
+ import ji from "./trigger-condition.js";
2
+ export default class ki {
3
3
  constructor(t, i) {
4
4
  (this.if = t), (this.rf = i), (this.if = t), (this.rf = i);
5
5
  }
6
6
  zc(t) {
7
7
  if (null == this.if) return !1;
8
- const i = pi.sf(t[0], this.if);
8
+ const i = ji.sf(t[0], this.if);
9
9
  if (!i) return !1;
10
10
  let r = null == this.rf || 0 === this.rf.length;
11
11
  if (null != this.rf)
@@ -17,7 +17,7 @@ export default class bi {
17
17
  return i && r;
18
18
  }
19
19
  static fromJson(t) {
20
- return new bi(t ? t.id : null, t ? t.buttons : null);
20
+ return new ki(t ? t.id : null, t ? t.buttons : null);
21
21
  }
22
22
  qt() {
23
23
  return this.if;
@@ -1,10 +1,10 @@
1
- import pi from "./trigger-condition.js";
1
+ import ji from "./trigger-condition.js";
2
2
  export default class wr {
3
3
  constructor(t) {
4
4
  (this.if = t), (this.if = t);
5
5
  }
6
6
  zc(t) {
7
- return null == this.if || pi.sf(t[0], this.if);
7
+ return null == this.if || ji.sf(t[0], this.if);
8
8
  }
9
9
  static fromJson(t) {
10
10
  return new wr(t ? t.campaign_id : null);
@@ -1,26 +1,26 @@
1
1
  import es from "./custom-event-data.js";
2
2
  import ns from "./custom-event-property-data.js";
3
3
  import ls from "./filter-set.js";
4
- import bi from "./in-app-message-click-data.js";
4
+ import ki 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
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
- import { getErrorMessage as hi } from "../../util/error-utils.js";
11
- export default class pi {
10
+ import { getErrorMessage as ci } from "../../util/error-utils.js";
11
+ export default class ji {
12
12
  constructor(e, t) {
13
13
  (this.type = e), (this.data = t), (this.type = e), (this.data = t);
14
14
  }
15
15
  _c(e, t) {
16
- return pi.Ec[this.type] === e && (null == this.data || this.data.zc(t));
16
+ return ji.Ec[this.type] === e && (null == this.data || this.data.zc(t));
17
17
  }
18
18
  static sf(e, t) {
19
19
  let r = null;
20
20
  try {
21
21
  r = window.atob(e);
22
22
  } catch (t) {
23
- return b.info("Failed to unencode analytics id " + e + ": " + hi(t)), !1;
23
+ return b.info("Failed to unencode analytics id " + e + ": " + ci(t)), !1;
24
24
  }
25
25
  return t === r.split("_")[0];
26
26
  }
@@ -28,28 +28,28 @@ export default class pi {
28
28
  const t = e.type;
29
29
  let r = null;
30
30
  switch (t) {
31
- case pi.la.OPEN:
32
- case pi.la.Os:
31
+ case ji.Yo.OPEN:
32
+ case ji.Yo.Os:
33
33
  break;
34
- case pi.la.qr:
34
+ case ji.Yo.qr:
35
35
  r = os.fromJson(e.data);
36
36
  break;
37
- case pi.la.Pc:
37
+ case ji.Yo.Pc:
38
38
  r = fs.fromJson(e.data);
39
39
  break;
40
- case pi.la.Sr:
40
+ case ji.Yo.Sr:
41
41
  r = wr.fromJson(e.data);
42
42
  break;
43
- case pi.la.he:
43
+ case ji.Yo.he:
44
44
  r = es.fromJson(e.data);
45
45
  break;
46
- case pi.la.Rc:
46
+ case ji.Yo.Rc:
47
47
  r = ns.fromJson(e.data);
48
48
  break;
49
- case pi.la.rm:
50
- r = bi.fromJson(e.data);
49
+ case ji.Yo.rm:
50
+ r = ki.fromJson(e.data);
51
51
  }
52
- return new pi(t, r);
52
+ return new ji(t, r);
53
53
  }
54
54
  qt() {
55
55
  return { t: this.type, d: this.data ? this.data.qt() : null };
@@ -58,31 +58,31 @@ export default class pi {
58
58
  let t,
59
59
  r = null;
60
60
  switch (e.t) {
61
- case pi.la.OPEN:
62
- case pi.la.Os:
61
+ case ji.Yo.OPEN:
62
+ case ji.Yo.Os:
63
63
  break;
64
- case pi.la.qr:
64
+ case ji.Yo.qr:
65
65
  r = new os(e.d);
66
66
  break;
67
- case pi.la.Pc:
67
+ case ji.Yo.Pc:
68
68
  (t = e.d || {}), (r = new fs(t.id, ls._u(t.pf || [])));
69
69
  break;
70
- case pi.la.Sr:
70
+ case ji.Yo.Sr:
71
71
  r = new wr(e.d);
72
72
  break;
73
- case pi.la.he:
73
+ case ji.Yo.he:
74
74
  r = new es(e.d);
75
75
  break;
76
- case pi.la.Rc:
76
+ case ji.Yo.Rc:
77
77
  (t = e.d || {}), (r = new ns(t.e, ls._u(t.pf || [])));
78
78
  break;
79
- case pi.la.rm:
80
- r = new bi(e.d);
79
+ case ji.Yo.rm:
80
+ r = new ki(e.d);
81
81
  }
82
- return new pi(e.t, r);
82
+ return new ji(e.t, r);
83
83
  }
84
84
  }
85
- (pi.la = {
85
+ (ji.Yo = {
86
86
  OPEN: "open",
87
87
  qr: "purchase",
88
88
  Pc: "purchase_property",
@@ -92,12 +92,12 @@ export default class pi {
92
92
  rm: "iam_click",
93
93
  Os: "test",
94
94
  }),
95
- (pi.Ec = {}),
96
- (pi.Ec[pi.la.OPEN] = ot.OPEN),
97
- (pi.Ec[pi.la.qr] = ot.qr),
98
- (pi.Ec[pi.la.Pc] = ot.qr),
99
- (pi.Ec[pi.la.Sr] = ot.Sr),
100
- (pi.Ec[pi.la.he] = ot.he),
101
- (pi.Ec[pi.la.Rc] = ot.he),
102
- (pi.Ec[pi.la.rm] = ot.rm),
103
- (pi.Ec[pi.la.Os] = ot.Os);
95
+ (ji.Ec = {}),
96
+ (ji.Ec[ji.Yo.OPEN] = ot.OPEN),
97
+ (ji.Ec[ji.Yo.qr] = ot.qr),
98
+ (ji.Ec[ji.Yo.Pc] = ot.qr),
99
+ (ji.Ec[ji.Yo.Sr] = ot.Sr),
100
+ (ji.Ec[ji.Yo.he] = ot.he),
101
+ (ji.Ec[ji.Yo.Rc] = ot.he),
102
+ (ji.Ec[ji.Yo.rm] = ot.rm),
103
+ (ji.Ec[ji.Yo.Os] = ot.Os);
@@ -3,57 +3,57 @@ import {
3
3
  rehydrateDateAfterJsonization as ee,
4
4
  } from "../../util/date-utils.js";
5
5
  import { logger as b } from "../../../shared-lib/index.js";
6
- import pi from "./trigger-condition.js";
6
+ import ji from "./trigger-condition.js";
7
7
  import { validateValueIsFromEnum as ta } from "../../util/code-utils.js";
8
- export default class gt {
9
- constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = gt.Dd, a, u, d) {
8
+ export default class vt {
9
+ constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = vt.Td, a, u, d) {
10
10
  (this.id = t),
11
- (this.Pd = i),
11
+ (this.Dd = i),
12
12
  (this.startTime = s),
13
13
  (this.endTime = e),
14
14
  (this.priority = r),
15
15
  (this.type = h),
16
16
  (this.data = l),
17
- (this.jd = o),
18
- (this.Nd = n),
19
- (this.ca = a),
20
- (this._d = u),
21
- (this.Ad = d),
17
+ (this.Pd = o),
18
+ (this.yd = n),
19
+ (this.ia = a),
20
+ (this.jd = u),
21
+ (this.Nd = d),
22
22
  (this.id = t),
23
- (this.Pd = i || []),
23
+ (this.Dd = i || []),
24
24
  void 0 === s && (s = null),
25
25
  (this.startTime = s),
26
26
  void 0 === e && (e = null),
27
27
  (this.endTime = e),
28
28
  (this.priority = r || 0),
29
29
  (this.type = h),
30
- (this.jd = o || 0),
31
- null == a && (a = 1e3 * (this.jd + 30)),
32
- (this.ca = a),
30
+ (this.Pd = o || 0),
31
+ null == a && (a = 1e3 * (this.Pd + 30)),
32
+ (this.ia = a),
33
33
  (this.data = l),
34
- null != n && (this.Nd = n),
35
- (this._d = u),
36
- (this.Ad = d || null);
34
+ null != n && (this.yd = n),
35
+ (this.jd = u),
36
+ (this.Nd = d || null);
37
37
  }
38
- Id(t) {
38
+ _d(t) {
39
39
  return (
40
- null == this.Ad || (this.Nd !== gt.Dd && t - this.Ad >= 1e3 * this.Nd)
40
+ null == this.Nd || (this.yd !== vt.Td && t - this.Nd >= 1e3 * this.yd)
41
41
  );
42
42
  }
43
- $d(t) {
44
- this.Ad = t;
43
+ Ad(t) {
44
+ this.Nd = t;
45
45
  }
46
- xd(t) {
47
- const i = t + 1e3 * this.jd;
46
+ Id(t) {
47
+ const i = t + 1e3 * this.Pd;
48
48
  return Math.max(i - new Date().valueOf(), 0);
49
49
  }
50
- zd(t) {
50
+ $d(t) {
51
51
  const i = new Date().valueOf() - t,
52
- s = null == t || isNaN(i) || null == this.ca || i < this.ca;
52
+ s = null == t || isNaN(i) || null == this.ia || i < this.ia;
53
53
  return (
54
54
  s ||
55
55
  b.info(
56
- `Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.ca}ms.`,
56
+ `Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.ia}ms.`,
57
57
  ),
58
58
  !s
59
59
  );
@@ -62,7 +62,7 @@ export default class gt {
62
62
  const i = t.id,
63
63
  s = [];
64
64
  for (let i = 0; i < t.trigger_condition.length; i++)
65
- s.push(pi.fromJson(t.trigger_condition[i]));
65
+ s.push(ji.fromJson(t.trigger_condition[i]));
66
66
  const e = Y(t.start_time),
67
67
  r = Y(t.end_time),
68
68
  h = t.priority,
@@ -73,17 +73,17 @@ export default class gt {
73
73
  u = t.data,
74
74
  d = t.min_seconds_since_last_trigger;
75
75
  return ta(
76
- gt.la,
76
+ vt.Yo,
77
77
  l,
78
78
  "Could not construct Trigger from server data",
79
79
  "Trigger.Types",
80
80
  )
81
- ? new gt(i, s, e, r, h, l, u, o, n, a, d)
81
+ ? new vt(i, s, e, r, h, l, u, o, n, a, d)
82
82
  : null;
83
83
  }
84
84
  qt() {
85
85
  const t = [];
86
- for (let i = 0; i < this.Pd.length; i++) t.push(this.Pd[i].qt());
86
+ for (let i = 0; i < this.Dd.length; i++) t.push(this.Dd[i].qt());
87
87
  return {
88
88
  i: this.id,
89
89
  c: t,
@@ -92,18 +92,18 @@ export default class gt {
92
92
  p: this.priority,
93
93
  t: this.type,
94
94
  da: this.data,
95
- d: this.jd,
96
- r: this.Nd,
97
- tm: this.ca,
98
- ss: this._d,
99
- ld: this.Ad,
95
+ d: this.Pd,
96
+ r: this.yd,
97
+ tm: this.ia,
98
+ ss: this.jd,
99
+ ld: this.Nd,
100
100
  };
101
101
  }
102
102
  static _u(t) {
103
103
  const i = [],
104
104
  s = t.c || [];
105
- for (let t = 0; t < s.length; t++) i.push(pi._u(s[t]));
106
- return new gt(
105
+ for (let t = 0; t < s.length; t++) i.push(ji._u(s[t]));
106
+ return new vt(
107
107
  t.i,
108
108
  i,
109
109
  ee(t.s),
@@ -119,4 +119,4 @@ export default class gt {
119
119
  );
120
120
  }
121
121
  }
122
- (gt.la = { oa: "inapp", Md: "templated_iam" }), (gt.Dd = -1);
122
+ (vt.Yo = { Wo: "inapp", xd: "templated_iam" }), (vt.Td = -1);
@@ -1,4 +1,4 @@
1
- import je from "../InAppMessage/in-app-message-manager-factory.js";
1
+ import se from "../InAppMessage/in-app-message-manager-factory.js";
2
2
  import r, { OPTIONS as U } from "../managers/braze-instance.js";
3
3
  import vr from "./triggers-provider.js";
4
4
  export const TriggersProviderFactory = {
@@ -14,10 +14,10 @@ export const TriggersProviderFactory = {
14
14
  const i = r.er(U.Dh);
15
15
  (TriggersProviderFactory.provider = new vr(
16
16
  null != i ? i : 30,
17
- je.ra().Pn(),
17
+ se.ra().Pn(),
18
18
  r.p(),
19
19
  r.nn(),
20
- je.ra(),
20
+ se.ra(),
21
21
  )),
22
22
  r.v(TriggersProviderFactory.provider);
23
23
  }
@@ -1,14 +1,14 @@
1
1
  import t from "../common/base-provider.js";
2
- import { newInAppMessageFromJson as pt } from "../InAppMessage/in-app-message-factory.js";
3
- import Ie from "../models/braze-event.js";
2
+ import { newInAppMessageFromJson as yt } from "../InAppMessage/in-app-message-factory.js";
3
+ import ve from "../models/braze-event.js";
4
4
  import {
5
5
  isArray as g,
6
- isEqual as oi,
6
+ isEqual as hi,
7
7
  validateValueIsFromEnum as ta,
8
8
  } from "../util/code-utils.js";
9
9
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
10
10
  import Jt from "../InAppMessage/models/templated-in-app-message.js";
11
- import gt from "./models/trigger.js";
11
+ import vt from "./models/trigger.js";
12
12
  import ot from "./models/trigger-events.js";
13
13
  import { logger as b } from "../../shared-lib/index.js";
14
14
  export default class vr extends t {
@@ -36,21 +36,21 @@ export default class vr extends t {
36
36
  }
37
37
  fg() {
38
38
  if (this.j) {
39
- (this.hg = this.j.St(s.It.nS) || this.hg),
40
- (this.ng = this.j.St(s.It.aS) || this.ng),
41
- (this.og = this.j.St(s.It.oS) || this.og);
39
+ (this.hg = this.j.St(s.It.iS) || this.hg),
40
+ (this.ng = this.j.St(s.It.SS) || this.ng),
41
+ (this.og = this.j.St(s.It.aS) || 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.$d(this.og[i.id]);
44
+ i.id && null != this.og[i.id] && i.Ad(this.og[i.id]);
45
45
  }
46
46
  }
47
47
  }
48
48
  ag() {
49
49
  if (!this.j) return;
50
- this.lg = this.j.St(s.It.rS) || 0;
51
- const t = this.j.St(s.It.sS) || [],
50
+ this.lg = this.j.St(s.It.nS) || 0;
51
+ const t = this.j.St(s.It.oS) || [],
52
52
  i = [];
53
- for (let s = 0; s < t.length; s++) i.push(gt._u(t[s]));
53
+ for (let s = 0; s < t.length; s++) i.push(vt._u(t[s]));
54
54
  (this.triggers = i), this.fg();
55
55
  }
56
56
  gg() {
@@ -70,19 +70,19 @@ 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.xd(n.ma || 0);
73
+ o = s.Id(n.ta || 0);
74
74
  if (o > 0) {
75
75
  let t, r;
76
76
  h.push(n),
77
77
  null != n.ug && (t = n.ug),
78
- null != n.dg && Ie.AS(n.dg) && (r = Ie._u(n.dg));
78
+ null != n.dg && ve.RS(n.dg) && (r = ve._u(n.dg));
79
79
  const l = [];
80
80
  if (n.pg && g(n.pg))
81
81
  for (let t = 0; t < n.pg.length; t++) {
82
82
  const i = e[n.pg[t]];
83
83
  null != i && l.push(i);
84
84
  }
85
- this.eg.push(window.setTimeout(i(s, n.ma || 0, t, r, l), o));
85
+ this.eg.push(window.setTimeout(i(s, n.ta || 0, t, r, l), o));
86
86
  }
87
87
  }
88
88
  this.ng[s.id].length > h.length &&
@@ -91,7 +91,7 @@ export default class vr extends t {
91
91
  0 === this.ng[s.id].length && delete this.ng[s.id]);
92
92
  }
93
93
  }
94
- r && this.j && this.j.Pt(s.It.aS, this.ng);
94
+ r && this.j && this.j.Pt(s.It.SS, this.ng);
95
95
  }
96
96
  mg() {
97
97
  if (!this.j) return;
@@ -99,38 +99,38 @@ export default class vr extends t {
99
99
  for (let i = 0; i < this.triggers.length; i++)
100
100
  t.push(this.triggers[i].qt());
101
101
  (this.lg = new Date().valueOf()),
102
- this.j.Pt(s.It.sS, t),
103
- this.j.Pt(s.It.rS, this.lg);
102
+ this.j.Pt(s.It.oS, t),
103
+ this.j.Pt(s.It.nS, this.lg);
104
104
  }
105
105
  bg() {
106
106
  if (!this.j) return;
107
- (this.j.St(s.It.rS) || 0) > this.lg ? this.ag() : this.fg();
107
+ (this.j.St(s.It.nS) || 0) > this.lg ? this.ag() : this.fg();
108
108
  }
109
109
  q(t) {
110
110
  let i = !1;
111
111
  if (null != t && t.triggers) {
112
- this.ig.fa(), this.fg();
112
+ this.ig.ma(), this.fg();
113
113
  const e = {},
114
114
  r = {};
115
115
  this.triggers = [];
116
116
  for (let s = 0; s < t.triggers.length; s++) {
117
- const h = gt.fromJson(t.triggers[s]);
117
+ const h = vt.fromJson(t.triggers[s]);
118
118
  if (h) {
119
119
  h.id &&
120
120
  null != this.og[h.id] &&
121
- (h.$d(this.og[h.id]), (e[h.id] = this.og[h.id])),
121
+ (h.Ad(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
- for (let t = 0; t < h.Pd.length; t++)
124
- if (h.Pd[t]._c(ot.Os, null)) {
123
+ for (let t = 0; t < h.Dd.length; t++)
124
+ if (h.Dd[t]._c(ot.Os, null)) {
125
125
  i = !0;
126
126
  break;
127
127
  }
128
128
  this.triggers.push(h);
129
129
  }
130
130
  }
131
- oi(this.og, e) || ((this.og = e), this.j && this.j.Pt(s.It.oS, this.og)),
132
- oi(this.ng, r) ||
133
- ((this.ng = r), this.j && this.j.Pt(s.It.aS, this.ng)),
131
+ hi(this.og, e) || ((this.og = e), this.j && this.j.Pt(s.It.aS, this.og)),
132
+ hi(this.ng, r) ||
133
+ ((this.ng = r), this.j && this.j.Pt(s.It.SS, this.ng)),
134
134
  this.mg(),
135
135
  i &&
136
136
  (b.info("Trigger with test condition found, firing test."),
@@ -147,13 +147,13 @@ export default class vr extends t {
147
147
  const h = (e) => {
148
148
  this.fg();
149
149
  const r = new Date().valueOf();
150
- t.zd(i) ||
151
- (!1 === navigator.onLine && t.type === gt.la.oa && e.imageUrl
150
+ t.$d(i) ||
151
+ (!1 === navigator.onLine && t.type === vt.Yo.Wo && e.imageUrl
152
152
  ? b.info(
153
153
  `Not showing ${t.type} trigger action ${t.id} due to offline state.`,
154
154
  )
155
- : t.Id(r) && this.wg(t, r, s)
156
- ? 0 === this.Rs.Ve()
155
+ : t._d(r) && this.wg(t, r, s)
156
+ ? 0 === this.Rs.an()
157
157
  ? b.info(
158
158
  `Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
159
159
  )
@@ -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.zd(i))) {
169
+ if ((this.Tg(h, i, s, e, r), h.$d(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.jd - (new Date().valueOf() - i);
176
+ const n = 1e3 * h.Pd - (new Date().valueOf() - i);
177
177
  n > 0
178
178
  ? this.eg.push(
179
179
  window.setTimeout(() => {
@@ -185,27 +185,27 @@ export default class vr extends t {
185
185
  };
186
186
  let o, l, a;
187
187
  switch (t.type) {
188
- case gt.la.oa:
189
- if (((o = pt(t.data)), null == o)) {
188
+ case vt.Yo.Wo:
189
+ if (((o = yt(t.data)), null == o)) {
190
190
  b.error(
191
191
  `Could not parse trigger data for trigger ${t.id}, ignoring.`,
192
192
  );
193
193
  break;
194
194
  }
195
- if (((l = this.ig.Qn(o)), l)) {
195
+ if (((l = this.ig.Vn(o)), l)) {
196
196
  b.error(l), n();
197
197
  break;
198
198
  }
199
199
  h(o);
200
200
  break;
201
- case gt.la.Md:
202
- if (((a = Jt.fromJson(t.data, h, n, i, t.ca || 0)), null == a)) {
201
+ case vt.Yo.xd:
202
+ if (((a = Jt.fromJson(t.data, h, n, i, t.ia || 0)), null == a)) {
203
203
  b.error(
204
204
  `Could not parse trigger data for trigger ${t.id}, ignoring.`,
205
205
  );
206
206
  break;
207
207
  }
208
- this.ig.Xo(a, s, e);
208
+ this.ig.Po(a, s, e);
209
209
  break;
210
210
  default:
211
211
  b.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
@@ -228,15 +228,15 @@ 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.jd;
231
+ l = e + 1e3 * r.Pd;
232
232
  if (
233
- r.Id(l) &&
233
+ r._d(l) &&
234
234
  (null == r.startTime || r.startTime.valueOf() <= e) &&
235
235
  (null == r.endTime || r.endTime.valueOf() >= e)
236
236
  ) {
237
237
  let s = !1;
238
- for (let e = 0; e < r.Pd.length; e++)
239
- if (r.Pd[e]._c(t, i)) {
238
+ for (let e = 0; e < r.Dd.length; e++)
239
+ if (r.Dd[e]._c(t, i)) {
240
240
  s = !0;
241
241
  break;
242
242
  }
@@ -260,24 +260,32 @@ 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.jd
263
+ 0 === l.Pd
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.jd),
268
+ }, 1e3 * l.Pd),
269
269
  ));
270
270
  }
271
271
  changeUser(t = !1) {
272
- if (((this.triggers = []), this.j && this.j.Vt(s.It.sS), !t)) {
273
- (this.sg = []), (this.hg = null), (this.og = {}), (this.ng = {});
272
+ if (((this.triggers = []), this.j && this.j.Vt(s.It.oS), !t)) {
273
+ (this.sg = []),
274
+ (this.hg = null),
275
+ (this.og = {}),
276
+ (this.ng = {}),
277
+ this.ig && this.ig.oa();
274
278
  for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
275
279
  (this.eg = []),
276
- this.j && (this.j.Vt(s.It.nS), this.j.Vt(s.It.oS), this.j.Vt(s.It.aS));
280
+ this.j && (this.j.Vt(s.It.iS), this.j.Vt(s.It.aS), this.j.Vt(s.It.SS));
277
281
  }
278
282
  }
279
283
  clearData() {
280
- (this.triggers = []), (this.hg = null), (this.og = {}), (this.ng = {});
284
+ (this.triggers = []),
285
+ (this.hg = null),
286
+ (this.og = {}),
287
+ (this.ng = {}),
288
+ this.ig && this.ig.oa();
281
289
  for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
282
290
  this.eg = [];
283
291
  }
@@ -290,25 +298,25 @@ export default class vr extends t {
290
298
  ),
291
299
  !0
292
300
  );
293
- let e = t._d;
301
+ let e = t.jd;
294
302
  return null == e && (e = this.tg), i - this.hg >= 1e3 * e;
295
303
  }
296
304
  Tg(t, i, e, r, h) {
297
305
  this.fg(), t.id && (this.ng[t.id] = this.ng[t.id] || []);
298
306
  const n = {};
299
307
  let o;
300
- (n.ma = i), (n.ug = e), null != r && (o = r.qt()), (n.dg = o);
308
+ (n.ta = i), (n.ug = e), null != r && (o = r.qt()), (n.dg = o);
301
309
  const l = [];
302
310
  for (const t of h) t.id && l.push(t.id);
303
311
  (n.pg = l),
304
312
  t.id && this.ng[t.id].push(n),
305
- this.j && this.j.Pt(s.It.aS, this.ng);
313
+ this.j && this.j.Pt(s.It.SS, this.ng);
306
314
  }
307
315
  yg(t, i) {
308
316
  this.fg(),
309
- t.$d(i),
317
+ t.Ad(i),
310
318
  (this.hg = i),
311
319
  t.id && (this.og[t.id] = i),
312
- this.j && (this.j.Pt(s.It.nS, i), this.j.Pt(s.It.oS, this.og));
320
+ this.j && (this.j.Pt(s.It.iS, i), this.j.Pt(s.It.aS, this.og));
313
321
  }
314
322
  }
package/src/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const CartUpdatedActions = {
2
2
  REPLACE: "replace",
3
3
  Ld: "add",
4
- Od: "remove",
4
+ Md: "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.10.2".replace(/\./g, "-")}`;
4
+ e = `ab-${t}-css-definitions-${"6.12.0".replace(/\./g, "-")}`;
5
5
  if (!c) return;
6
6
  const s = c.ownerDocument || document;
7
7
  if (null == s.getElementById(e)) {
@@ -1,5 +1,5 @@
1
1
  import { attachCSS as Sn } from "./attach-css.js";
2
- import { loadFontAwesome as _e } from "./load-font-awesome.js";
2
+ import { loadFontAwesome as Se } from "./load-font-awesome.js";
3
3
  export function attachFeedCSS(t) {
4
4
  Sn(
5
5
  t,
@@ -8,5 +8,5 @@ export function attachFeedCSS(t) {
8
8
  );
9
9
  }
10
10
  export function setupFeedUI() {
11
- attachFeedCSS(), _e();
11
+ attachFeedCSS(), Se();
12
12
  }
@@ -1,5 +1,5 @@
1
1
  import { attachCSS as Sn } from "./attach-css.js";
2
- import { loadFontAwesome as _e } from "./load-font-awesome.js";
2
+ import { loadFontAwesome as Se } from "./load-font-awesome.js";
3
3
  export function attachInAppMessageCSS(t) {
4
4
  Sn(
5
5
  t,
@@ -8,5 +8,5 @@ export function attachInAppMessageCSS(t) {
8
8
  );
9
9
  }
10
10
  export function setupInAppMessageUI() {
11
- attachInAppMessageCSS(), _e();
11
+ attachInAppMessageCSS(), Se();
12
12
  }