@braze/web-sdk 6.7.1 → 6.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 (138) hide show
  1. package/index.d.ts +165 -38
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +2 -2
  4. package/shared-lib/event-types.js +16 -16
  5. package/shared-lib/indexed-db-adapter.js +65 -65
  6. package/shared-lib/logger.js +18 -18
  7. package/shared-lib/supported-options.js +1 -1
  8. package/src/Banner/banner-provider.js +67 -59
  9. package/src/Banner/banner.js +40 -19
  10. package/src/Banner/dismiss-banner.js +4 -0
  11. package/src/Banner/display/banner-to-html.js +10 -10
  12. package/src/Banner/display/destroy-banner-html.js +2 -2
  13. package/src/Banner/get-all-banners.js +6 -6
  14. package/src/Banner/get-banner.js +6 -6
  15. package/src/Banner/index.js +1 -0
  16. package/src/Banner/log-banner-click.js +7 -7
  17. package/src/Banner/log-banner-dismissal.js +7 -7
  18. package/src/Banner/log-banner-impressions.js +27 -18
  19. package/src/Banner/request-banners-refresh.js +8 -8
  20. package/src/Banner/subscribe-to-banners-updates.js +5 -5
  21. package/src/Banner/ui/insert-banner.js +8 -8
  22. package/src/Card/card-manager.js +31 -31
  23. package/src/Card/log-card-dismissal.js +2 -2
  24. package/src/Card/log-content-card-click.js +2 -2
  25. package/src/Card/log-content-card-impressions.js +4 -4
  26. package/src/Card/models/captioned-image.js +15 -15
  27. package/src/Card/models/card.js +89 -89
  28. package/src/Card/models/classic-card.js +16 -16
  29. package/src/Card/models/control-card.js +7 -7
  30. package/src/Card/models/image-only.js +13 -13
  31. package/src/Card/util/card-factory.js +32 -32
  32. package/src/ContentCards/content-cards-provider-factory.js +13 -11
  33. package/src/ContentCards/content-cards-provider.js +105 -105
  34. package/src/ContentCards/get-cached-content-cards.js +2 -2
  35. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  36. package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
  37. package/src/ContentCards/ui/show-content-cards.js +7 -7
  38. package/src/Core/add-sdk-metadata.js +2 -2
  39. package/src/Core/change-user.js +5 -5
  40. package/src/Core/destroy.js +2 -2
  41. package/src/Core/disable-sdk.js +4 -4
  42. package/src/Core/enable-sdk.js +4 -4
  43. package/src/Core/get-device-id.js +2 -2
  44. package/src/Core/handle-braze-action.js +5 -5
  45. package/src/Core/index.js +1 -0
  46. package/src/Core/log-custom-event.js +5 -5
  47. package/src/Core/log-ecommerce-event.js +29 -0
  48. package/src/Core/log-purchase.js +23 -198
  49. package/src/Core/open-session.js +10 -10
  50. package/src/Core/set-logger.js +2 -2
  51. package/src/Core/set-sdk-authentication-signature.js +1 -1
  52. package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
  53. package/src/Core/toggle-logging.js +2 -2
  54. package/src/Core/wipe-data.js +6 -6
  55. package/src/DUST/dust-connection-core.js +1 -0
  56. package/src/DUST/dust-provider-factory.js +10 -10
  57. package/src/DUST/dust-provider.js +258 -226
  58. package/src/DUST/dust-shared-worker-code.js +1 -1
  59. package/src/DUST/dust-shared-worker-impl.js +97 -103
  60. package/src/DUST/dust-worker-bridge.js +55 -40
  61. package/src/DUST/subscribe-to-dust.js +7 -7
  62. package/src/FeatureFlags/feature-flag-factory.js +8 -8
  63. package/src/FeatureFlags/feature-flag.js +3 -3
  64. package/src/FeatureFlags/feature-flags-provider.js +21 -21
  65. package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
  66. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  67. package/src/InAppMessage/constants.js +3 -3
  68. package/src/InAppMessage/defer-in-app-message.js +3 -3
  69. package/src/InAppMessage/display/html-message-to-html.js +4 -4
  70. package/src/InAppMessage/display/in-app-message-to-html.js +32 -32
  71. package/src/InAppMessage/display/modal-utils.js +2 -2
  72. package/src/InAppMessage/in-app-message-factory.js +36 -36
  73. package/src/InAppMessage/in-app-message-manager.js +35 -35
  74. package/src/InAppMessage/log-in-app-message-button-click.js +3 -3
  75. package/src/InAppMessage/log-in-app-message-click.js +3 -3
  76. package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
  77. package/src/InAppMessage/log-in-app-message-impression.js +3 -3
  78. package/src/InAppMessage/models/control-message.js +4 -4
  79. package/src/InAppMessage/models/full-screen-message.js +9 -9
  80. package/src/InAppMessage/models/html-message.js +2 -2
  81. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  82. package/src/InAppMessage/models/in-app-message.js +34 -34
  83. package/src/InAppMessage/models/modal-message.js +7 -7
  84. package/src/InAppMessage/models/slide-up-message.js +8 -8
  85. package/src/InAppMessage/ui/show-in-app-message.js +20 -20
  86. package/src/Push/push-manager.js +44 -44
  87. package/src/User/user-manager.js +19 -19
  88. package/src/User/user.js +17 -17
  89. package/src/common/base-provider.js +1 -1
  90. package/src/common/constants.js +1 -0
  91. package/src/common/content-cards-display.js +6 -6
  92. package/src/common/event-logger.js +3 -3
  93. package/src/common/properties-base.js +3 -3
  94. package/src/l10n/l10n-manager.js +2 -2
  95. package/src/managers/auth-manager.js +11 -11
  96. package/src/managers/braze-instance.js +59 -59
  97. package/src/managers/device-manager.js +9 -9
  98. package/src/managers/network-manager.js +65 -63
  99. package/src/managers/server-config-manager.js +110 -93
  100. package/src/managers/session-manager.js +20 -20
  101. package/src/managers/storage-manager-factory.js +9 -9
  102. package/src/managers/storage-manager.js +137 -137
  103. package/src/managers/subscription-manager.js +2 -2
  104. package/src/managers/utils.js +1 -1
  105. package/src/models/braze-event.js +2 -2
  106. package/src/models/identifier.js +5 -5
  107. package/src/models/push-token.js +8 -8
  108. package/src/models/request-result.js +1 -1
  109. package/src/models/server-config.js +46 -28
  110. package/src/request-controller.js +124 -124
  111. package/src/triggers/models/custom-event-data.js +4 -4
  112. package/src/triggers/models/custom-event-property-data.js +5 -5
  113. package/src/triggers/models/filter-set.js +2 -2
  114. package/src/triggers/models/filter.js +1 -1
  115. package/src/triggers/models/in-app-message-click-data.js +5 -5
  116. package/src/triggers/models/purchase-data.js +1 -1
  117. package/src/triggers/models/purchase-property-data.js +2 -2
  118. package/src/triggers/models/push-click-data.js +5 -5
  119. package/src/triggers/models/trigger-condition.js +45 -45
  120. package/src/triggers/models/trigger-events.js +3 -3
  121. package/src/triggers/models/trigger.js +30 -30
  122. package/src/triggers/triggers-provider.js +63 -63
  123. package/src/types.js +5 -1
  124. package/src/ui/js/attach-css.js +1 -1
  125. package/src/util/braze-actions.js +6 -6
  126. package/src/util/browser-detector.js +13 -13
  127. package/src/util/client-hints-parser.js +5 -5
  128. package/src/util/code-utils.js +2 -2
  129. package/src/util/deprecation-utils.js +2 -2
  130. package/src/util/dom-utils.js +8 -8
  131. package/src/util/ecommerce-event-validation.js +343 -0
  132. package/src/util/html-display-utils.js +11 -11
  133. package/src/util/iso-4217-currency-codes.js +176 -0
  134. package/src/util/net.js +4 -4
  135. package/src/util/request-header-utils.js +10 -10
  136. package/src/util/string-utils.js +2 -2
  137. package/src/util/user-agent-parser.js +15 -15
  138. package/src/util/validation-utils.js +14 -14
@@ -3,11 +3,11 @@ export default class fs {
3
3
  constructor(t, s) {
4
4
  (this.productId = t), (this.tf = s), (this.productId = t), (this.tf = s);
5
5
  }
6
- Hc(t) {
6
+ zc(t) {
7
7
  if (null == this.productId || null == this.tf) return !1;
8
8
  const s = t[0],
9
9
  i = t[1];
10
- return s === this.productId && this.tf.Hc(i);
10
+ return s === this.productId && this.tf.zc(i);
11
11
  }
12
12
  static fromJson(t) {
13
13
  return new fs(
@@ -1,13 +1,13 @@
1
- import gi from "./trigger-condition.js";
2
- export default class dr {
1
+ import pi from "./trigger-condition.js";
2
+ export default class jr {
3
3
  constructor(t) {
4
4
  (this.if = t), (this.if = t);
5
5
  }
6
- Hc(t) {
7
- return null == this.if || gi.sf(t[0], this.if);
6
+ zc(t) {
7
+ return null == this.if || pi.sf(t[0], this.if);
8
8
  }
9
9
  static fromJson(t) {
10
- return new dr(t ? t.campaign_id : null);
10
+ return new jr(t ? t.campaign_id : null);
11
11
  }
12
12
  qt() {
13
13
  return this.if;
@@ -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 pi from "./in-app-message-click-data.js";
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 dr from "./push-click-data.js";
7
+ import jr from "./push-click-data.js";
8
8
  import ot from "./trigger-events.js";
9
- import { logger as E } from "../../../shared-lib/index.js";
10
- import { getErrorMessage as ai } from "../../util/error-utils.js";
11
- export default class gi {
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 {
12
12
  constructor(e, t) {
13
13
  (this.type = e), (this.data = t), (this.type = e), (this.data = t);
14
14
  }
15
- Vc(e, t) {
16
- return gi.Yc[this.type] === e && (null == this.data || this.data.Hc(t));
15
+ _c(e, t) {
16
+ return pi.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 E.info("Failed to unencode analytics id " + e + ": " + ai(t)), !1;
23
+ return b.info("Failed to unencode analytics id " + e + ": " + hi(t)), !1;
24
24
  }
25
25
  return t === r.split("_")[0];
26
26
  }
@@ -28,28 +28,28 @@ export default class gi {
28
28
  const t = e.type;
29
29
  let r = null;
30
30
  switch (t) {
31
- case gi.la.OPEN:
32
- case gi.la.Ls:
31
+ case pi.la.OPEN:
32
+ case pi.la.Os:
33
33
  break;
34
- case gi.la.Rr:
34
+ case pi.la.qr:
35
35
  r = os.fromJson(e.data);
36
36
  break;
37
- case gi.la.Qc:
37
+ case pi.la.Pc:
38
38
  r = fs.fromJson(e.data);
39
39
  break;
40
- case gi.la.Fr:
41
- r = dr.fromJson(e.data);
40
+ case pi.la.Sr:
41
+ r = jr.fromJson(e.data);
42
42
  break;
43
- case gi.la.he:
43
+ case pi.la.he:
44
44
  r = es.fromJson(e.data);
45
45
  break;
46
- case gi.la.Xc:
46
+ case pi.la.Rc:
47
47
  r = ns.fromJson(e.data);
48
48
  break;
49
- case gi.la.rm:
50
- r = pi.fromJson(e.data);
49
+ case pi.la.rm:
50
+ r = bi.fromJson(e.data);
51
51
  }
52
- return new gi(t, r);
52
+ return new pi(t, r);
53
53
  }
54
54
  qt() {
55
55
  return { t: this.type, d: this.data ? this.data.qt() : null };
@@ -58,46 +58,46 @@ export default class gi {
58
58
  let t,
59
59
  r = null;
60
60
  switch (e.t) {
61
- case gi.la.OPEN:
62
- case gi.la.Ls:
61
+ case pi.la.OPEN:
62
+ case pi.la.Os:
63
63
  break;
64
- case gi.la.Rr:
64
+ case pi.la.qr:
65
65
  r = new os(e.d);
66
66
  break;
67
- case gi.la.Qc:
67
+ case pi.la.Pc:
68
68
  (t = e.d || {}), (r = new fs(t.id, ls._u(t.pf || [])));
69
69
  break;
70
- case gi.la.Fr:
71
- r = new dr(e.d);
70
+ case pi.la.Sr:
71
+ r = new jr(e.d);
72
72
  break;
73
- case gi.la.he:
73
+ case pi.la.he:
74
74
  r = new es(e.d);
75
75
  break;
76
- case gi.la.Xc:
76
+ case pi.la.Rc:
77
77
  (t = e.d || {}), (r = new ns(t.e, ls._u(t.pf || [])));
78
78
  break;
79
- case gi.la.rm:
80
- r = new pi(e.d);
79
+ case pi.la.rm:
80
+ r = new bi(e.d);
81
81
  }
82
- return new gi(e.t, r);
82
+ return new pi(e.t, r);
83
83
  }
84
84
  }
85
- (gi.la = {
85
+ (pi.la = {
86
86
  OPEN: "open",
87
- Rr: "purchase",
88
- Qc: "purchase_property",
89
- Fr: "push_click",
87
+ qr: "purchase",
88
+ Pc: "purchase_property",
89
+ Sr: "push_click",
90
90
  he: "custom_event",
91
- Xc: "custom_event_property",
91
+ Rc: "custom_event_property",
92
92
  rm: "iam_click",
93
- Ls: "test",
93
+ Os: "test",
94
94
  }),
95
- (gi.Yc = {}),
96
- (gi.Yc[gi.la.OPEN] = ot.OPEN),
97
- (gi.Yc[gi.la.Rr] = ot.Rr),
98
- (gi.Yc[gi.la.Qc] = ot.Rr),
99
- (gi.Yc[gi.la.Fr] = ot.Fr),
100
- (gi.Yc[gi.la.he] = ot.he),
101
- (gi.Yc[gi.la.Xc] = ot.he),
102
- (gi.Yc[gi.la.rm] = ot.rm),
103
- (gi.Yc[gi.la.Ls] = ot.Ls);
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);
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  OPEN: "open",
3
- Rr: "purchase",
4
- Fr: "push_click",
3
+ qr: "purchase",
4
+ Sr: "push_click",
5
5
  he: "custom_event",
6
6
  rm: "iam_click",
7
- Ls: "test",
7
+ Os: "test",
8
8
  };
@@ -2,57 +2,57 @@ import {
2
2
  dateFromUnixTimestamp as Y,
3
3
  rehydrateDateAfterJsonization as ee,
4
4
  } from "../../util/date-utils.js";
5
- import { logger as E } from "../../../shared-lib/index.js";
6
- import gi from "./trigger-condition.js";
5
+ import { logger as b } from "../../../shared-lib/index.js";
6
+ import pi from "./trigger-condition.js";
7
7
  import { validateValueIsFromEnum as ta } from "../../util/code-utils.js";
8
8
  export default class gt {
9
- constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = gt.sd, a, u, d) {
9
+ constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = gt.Dd, a, u, d) {
10
10
  (this.id = t),
11
- (this.ed = i),
11
+ (this.Pd = 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.hd = o),
18
- (this.nd = n),
17
+ (this.yd = o),
18
+ (this.jd = n),
19
19
  (this.ca = a),
20
- (this.ad = u),
21
- (this.ud = d),
20
+ (this.Nd = u),
21
+ (this._d = d),
22
22
  (this.id = t),
23
- (this.ed = i || []),
23
+ (this.Pd = 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.hd = o || 0),
31
- null == a && (a = 1e3 * (this.hd + 30)),
30
+ (this.yd = o || 0),
31
+ null == a && (a = 1e3 * (this.yd + 30)),
32
32
  (this.ca = a),
33
33
  (this.data = l),
34
- null != n && (this.nd = n),
35
- (this.ad = u),
36
- (this.ud = d || null);
34
+ null != n && (this.jd = n),
35
+ (this.Nd = u),
36
+ (this._d = d || null);
37
37
  }
38
- dd(t) {
38
+ Ad(t) {
39
39
  return (
40
- null == this.ud || (this.nd !== gt.sd && t - this.ud >= 1e3 * this.nd)
40
+ null == this._d || (this.jd !== gt.Dd && t - this._d >= 1e3 * this.jd)
41
41
  );
42
42
  }
43
- md(t) {
44
- this.ud = t;
43
+ Id(t) {
44
+ this._d = t;
45
45
  }
46
- gd(t) {
47
- const i = t + 1e3 * this.hd;
46
+ $d(t) {
47
+ const i = t + 1e3 * this.yd;
48
48
  return Math.max(i - new Date().valueOf(), 0);
49
49
  }
50
- fd(t) {
50
+ xd(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 (
54
54
  s ||
55
- E.info(
55
+ b.info(
56
56
  `Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.ca}ms.`,
57
57
  ),
58
58
  !s
@@ -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(gi.fromJson(t.trigger_condition[i]));
65
+ s.push(pi.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,
@@ -83,7 +83,7 @@ export default class gt {
83
83
  }
84
84
  qt() {
85
85
  const t = [];
86
- for (let i = 0; i < this.ed.length; i++) t.push(this.ed[i].qt());
86
+ for (let i = 0; i < this.Pd.length; i++) t.push(this.Pd[i].qt());
87
87
  return {
88
88
  i: this.id,
89
89
  c: t,
@@ -92,17 +92,17 @@ export default class gt {
92
92
  p: this.priority,
93
93
  t: this.type,
94
94
  da: this.data,
95
- d: this.hd,
96
- r: this.nd,
95
+ d: this.yd,
96
+ r: this.jd,
97
97
  tm: this.ca,
98
- ss: this.ad,
99
- ld: this.ud,
98
+ ss: this.Nd,
99
+ ld: this._d,
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(gi._u(s[t]));
105
+ for (let t = 0; t < s.length; t++) i.push(pi._u(s[t]));
106
106
  return new gt(
107
107
  t.i,
108
108
  i,
@@ -119,4 +119,4 @@ export default class gt {
119
119
  );
120
120
  }
121
121
  }
122
- (gt.la = { oa: "inapp", pd: "templated_iam" }), (gt.sd = -1);
122
+ (gt.la = { oa: "inapp", zd: "templated_iam" }), (gt.Dd = -1);
@@ -3,25 +3,25 @@ import { newInAppMessageFromJson as pt } from "../InAppMessage/in-app-message-fa
3
3
  import Ie from "../models/braze-event.js";
4
4
  import {
5
5
  isArray as g,
6
- isEqual as ni,
6
+ isEqual as oi,
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
11
  import gt from "./models/trigger.js";
12
12
  import ot from "./models/trigger-events.js";
13
- import { logger as E } from "../../shared-lib/index.js";
13
+ import { logger as b } from "../../shared-lib/index.js";
14
14
  export default class vr extends t {
15
15
  constructor(t, i, s, e, r) {
16
16
  super(),
17
17
  (this.tg = t),
18
18
  (this.Rs = i),
19
- (this.C = s),
19
+ (this.j = s),
20
20
  (this.Ru = e),
21
21
  (this.ig = r),
22
22
  (this.tg = t),
23
23
  (this.Rs = i),
24
- (this.C = s),
24
+ (this.j = s),
25
25
  (this.Ru = e),
26
26
  (this.ig = r),
27
27
  (this.sg = []),
@@ -35,20 +35,20 @@ export default class vr extends t {
35
35
  this.gg();
36
36
  }
37
37
  fg() {
38
- if (this.C) {
39
- (this.hg = this.C.Rt(s.Tt.oS) || this.hg),
40
- (this.ng = this.C.Rt(s.Tt.nS) || this.ng),
41
- (this.og = this.C.Rt(s.Tt.rS) || this.og);
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);
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.md(this.og[i.id]);
44
+ i.id && null != this.og[i.id] && i.Id(this.og[i.id]);
45
45
  }
46
46
  }
47
47
  }
48
48
  ag() {
49
- if (!this.C) return;
50
- this.lg = this.C.Rt(s.Tt.sS) || 0;
51
- const t = this.C.Rt(s.Tt.eS) || [],
49
+ if (!this.j) return;
50
+ this.lg = this.j.St(s.It.rS) || 0;
51
+ const t = this.j.St(s.It.sS) || [],
52
52
  i = [];
53
53
  for (let s = 0; s < t.length; s++) i.push(gt._u(t[s]));
54
54
  (this.triggers = i), this.fg();
@@ -70,12 +70,12 @@ 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.gd(n.ma || 0);
73
+ o = s.$d(n.ma || 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.hS(n.dg) && (r = Ie._u(n.dg));
78
+ null != n.dg && Ie.AS(n.dg) && (r = Ie._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++) {
@@ -91,22 +91,22 @@ 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.C && this.C.It(s.Tt.nS, this.ng);
94
+ r && this.j && this.j.Pt(s.It.aS, this.ng);
95
95
  }
96
96
  mg() {
97
- if (!this.C) return;
97
+ if (!this.j) return;
98
98
  const 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.C.It(s.Tt.eS, t),
103
- this.C.It(s.Tt.sS, this.lg);
102
+ this.j.Pt(s.It.sS, t),
103
+ this.j.Pt(s.It.rS, this.lg);
104
104
  }
105
105
  bg() {
106
- if (!this.C) return;
107
- (this.C.Rt(s.Tt.sS) || 0) > this.lg ? this.ag() : this.fg();
106
+ if (!this.j) return;
107
+ (this.j.St(s.It.rS) || 0) > this.lg ? this.ag() : this.fg();
108
108
  }
109
- I(t) {
109
+ q(t) {
110
110
  let i = !1;
111
111
  if (null != t && t.triggers) {
112
112
  this.ig.fa(), this.fg();
@@ -118,23 +118,23 @@ export default class vr extends t {
118
118
  if (h) {
119
119
  h.id &&
120
120
  null != this.og[h.id] &&
121
- (h.md(this.og[h.id]), (e[h.id] = this.og[h.id])),
121
+ (h.Id(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.ed.length; t++)
124
- if (h.ed[t].Vc(ot.Ls, null)) {
123
+ for (let t = 0; t < h.Pd.length; t++)
124
+ if (h.Pd[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
- ni(this.og, e) || ((this.og = e), this.C && this.C.It(s.Tt.rS, this.og)),
132
- ni(this.ng, r) ||
133
- ((this.ng = r), this.C && this.C.It(s.Tt.nS, this.ng)),
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)),
134
134
  this.mg(),
135
135
  i &&
136
- (E.info("Trigger with test condition found, firing test."),
137
- this.Ee(ot.Ls)),
136
+ (b.info("Trigger with test condition found, firing test."),
137
+ this.Ee(ot.Os)),
138
138
  this.Ee(ot.OPEN);
139
139
  const h = this.sg;
140
140
  let n;
@@ -147,18 +147,18 @@ export default class vr extends t {
147
147
  const h = (e) => {
148
148
  this.fg();
149
149
  const r = new Date().valueOf();
150
- t.fd(i) ||
150
+ t.xd(i) ||
151
151
  (!1 === navigator.onLine && t.type === gt.la.oa && e.imageUrl
152
- ? E.info(
152
+ ? b.info(
153
153
  `Not showing ${t.type} trigger action ${t.id} due to offline state.`,
154
154
  )
155
- : t.dd(r) && this.wg(t, r, s)
156
- ? 0 === this.Rs.Le()
157
- ? E.info(
155
+ : t.Ad(r) && this.wg(t, r, s)
156
+ ? 0 === this.Rs.Ve()
157
+ ? b.info(
158
158
  `Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
159
159
  )
160
160
  : (this.Rs.A([e]), this.yg(t, r))
161
- : E.info(
161
+ : b.info(
162
162
  `Not displaying trigger ${t.id} because display time fell outside of the acceptable time window.`,
163
163
  ));
164
164
  },
@@ -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.fd(i))) {
169
+ if ((this.Tg(h, i, s, e, r), h.xd(i))) {
170
170
  let t = `Server aborted in-app message display, but the timeout on fallback trigger ${h.id} has already elapsed.`;
171
- r.length > 0 && (t += " Continuing to fall back."), E.info(t), n();
171
+ r.length > 0 && (t += " Continuing to fall back."), b.info(t), n();
172
172
  } else {
173
- E.info(
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.hd - (new Date().valueOf() - i);
176
+ const n = 1e3 * h.yd - (new Date().valueOf() - i);
177
177
  n > 0
178
178
  ? this.eg.push(
179
179
  window.setTimeout(() => {
@@ -187,20 +187,20 @@ export default class vr extends t {
187
187
  switch (t.type) {
188
188
  case gt.la.oa:
189
189
  if (((o = pt(t.data)), null == o)) {
190
- E.error(
190
+ b.error(
191
191
  `Could not parse trigger data for trigger ${t.id}, ignoring.`,
192
192
  );
193
193
  break;
194
194
  }
195
195
  if (((l = this.ig.Qn(o)), l)) {
196
- E.error(l), n();
196
+ b.error(l), n();
197
197
  break;
198
198
  }
199
199
  h(o);
200
200
  break;
201
- case gt.la.pd:
201
+ case gt.la.zd:
202
202
  if (((a = Jt.fromJson(t.data, h, n, i, t.ca || 0)), null == a)) {
203
- E.error(
203
+ b.error(
204
204
  `Could not parse trigger data for trigger ${t.id}, ignoring.`,
205
205
  );
206
206
  break;
@@ -208,14 +208,14 @@ export default class vr extends t {
208
208
  this.ig.Xo(a, s, e);
209
209
  break;
210
210
  default:
211
- E.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
211
+ b.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
212
212
  }
213
213
  }
214
214
  Ee(t, i = null, s) {
215
215
  if (!ta(ot, t, "Cannot fire trigger action.", "TriggerEvents")) return;
216
- if (this.Ru && this.Ru.Ic())
216
+ if (this.Ru && this.Ru.yc())
217
217
  return (
218
- E.info(
218
+ b.info(
219
219
  "Trigger sync is currently in progress, awaiting sync completion before firing trigger event.",
220
220
  ),
221
221
  void this.sg.push(arguments)
@@ -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.hd;
231
+ l = e + 1e3 * r.yd;
232
232
  if (
233
- r.dd(l) &&
233
+ r.Ad(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.ed.length; e++)
239
- if (r.ed[e].Vc(t, i)) {
238
+ for (let e = 0; e < r.Pd.length; e++)
239
+ if (r.Pd[e]._c(t, i)) {
240
240
  s = !0;
241
241
  break;
242
242
  }
@@ -244,11 +244,11 @@ export default class vr extends t {
244
244
  }
245
245
  }
246
246
  if (h)
247
- return void E.info(
247
+ return void b.info(
248
248
  `Trigger event ${t} did not match any trigger conditions.`,
249
249
  );
250
250
  if (n)
251
- return void E.info(
251
+ return void b.info(
252
252
  `Ignoring ${t} trigger event because a trigger was displayed ${
253
253
  r / 1e3
254
254
  }s ago.`,
@@ -256,24 +256,24 @@ export default class vr extends t {
256
256
  o.sort((t, i) => t.priority - i.priority);
257
257
  const l = o.pop();
258
258
  null != l &&
259
- (E.info(
259
+ (b.info(
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.hd
263
+ 0 === l.yd
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.hd),
268
+ }, 1e3 * l.yd),
269
269
  ));
270
270
  }
271
271
  changeUser(t = !1) {
272
- if (((this.triggers = []), this.C && this.C.Qt(s.Tt.eS), !t)) {
272
+ if (((this.triggers = []), this.j && this.j.Vt(s.It.sS), !t)) {
273
273
  (this.sg = []), (this.hg = null), (this.og = {}), (this.ng = {});
274
274
  for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
275
275
  (this.eg = []),
276
- this.C && (this.C.Qt(s.Tt.oS), this.C.Qt(s.Tt.rS), this.C.Qt(s.Tt.nS));
276
+ this.j && (this.j.Vt(s.It.nS), this.j.Vt(s.It.oS), this.j.Vt(s.It.aS));
277
277
  }
278
278
  }
279
279
  clearData() {
@@ -283,14 +283,14 @@ export default class vr extends t {
283
283
  }
284
284
  wg(t, i, s) {
285
285
  if (null == this.hg) return !0;
286
- if (s === ot.Ls)
286
+ if (s === ot.Os)
287
287
  return (
288
- E.info(
288
+ b.info(
289
289
  "Ignoring minimum interval between trigger because it is a test type.",
290
290
  ),
291
291
  !0
292
292
  );
293
- let e = t.ad;
293
+ let e = t.Nd;
294
294
  return null == e && (e = this.tg), i - this.hg >= 1e3 * e;
295
295
  }
296
296
  Tg(t, i, e, r, h) {
@@ -302,13 +302,13 @@ export default class vr extends t {
302
302
  for (const t of h) t.id && l.push(t.id);
303
303
  (n.pg = l),
304
304
  t.id && this.ng[t.id].push(n),
305
- this.C && this.C.It(s.Tt.nS, this.ng);
305
+ this.j && this.j.Pt(s.It.aS, this.ng);
306
306
  }
307
307
  yg(t, i) {
308
308
  this.fg(),
309
- t.md(i),
309
+ t.Id(i),
310
310
  (this.hg = i),
311
311
  t.id && (this.og[t.id] = i),
312
- this.C && (this.C.It(s.Tt.oS, i), this.C.It(s.Tt.rS, this.og));
312
+ this.j && (this.j.Pt(s.It.nS, i), this.j.Pt(s.It.oS, this.og));
313
313
  }
314
314
  }
package/src/types.js CHANGED
@@ -1 +1,5 @@
1
- export {};
1
+ export const CartUpdatedActions = {
2
+ REPLACE: "replace",
3
+ Ld: "add",
4
+ Md: "remove",
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.7.1".replace(/\./g, "-")}`;
4
+ e = `ab-${t}-css-definitions-${"6.9.0".replace(/\./g, "-")}`;
5
5
  if (!c) return;
6
6
  const s = c.ownerDocument || document;
7
7
  if (null == s.getElementById(e)) {