@braze/web-sdk 6.12.1 → 6.13.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 (149) hide show
  1. package/index.d.ts +240 -3
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +18 -18
  4. package/shared-lib/indexed-db-adapter.js +58 -58
  5. package/shared-lib/logger.js +7 -7
  6. package/shared-lib/supported-options.js +25 -24
  7. package/src/ConversationalChat/automatically-manage-chat.js +5 -0
  8. package/src/ConversationalChat/chat-message-factory.js +25 -0
  9. package/src/ConversationalChat/chat-message.js +33 -0
  10. package/src/ConversationalChat/constants.js +1 -0
  11. package/src/ConversationalChat/conversational-chat-provider-factory.js +26 -0
  12. package/src/ConversationalChat/conversational-chat-provider.js +372 -0
  13. package/src/ConversationalChat/display/chat-widget-manager.js +113 -0
  14. package/src/ConversationalChat/display/chat-widget-to-html.js +58 -0
  15. package/src/ConversationalChat/get-chat-messages.js +7 -0
  16. package/src/ConversationalChat/index.js +12 -0
  17. package/src/ConversationalChat/is-chat-conversation-ended.js +7 -0
  18. package/src/ConversationalChat/is-chat-turn-errored.js +7 -0
  19. package/src/ConversationalChat/is-chat-turn-in-progress.js +7 -0
  20. package/src/ConversationalChat/register-chat-action-handler.js +10 -0
  21. package/src/ConversationalChat/reset-chat-conversation.js +5 -0
  22. package/src/ConversationalChat/retrieve-chat-config.js +7 -0
  23. package/src/ConversationalChat/send-chat-message.js +17 -0
  24. package/src/ConversationalChat/subscribe-to-chat-action.js +5 -0
  25. package/src/ConversationalChat/subscribe-to-chat-conversation-updated.js +5 -0
  26. package/src/ConversationalChat/subscribe-to-chat-message-received.js +5 -0
  27. package/src/ConversationalChat/trigger-chat-action.js +11 -0
  28. package/src/ConversationalChat/types.js +1 -0
  29. package/src/Core/add-sdk-metadata.js +5 -5
  30. package/src/Core/change-user.js +6 -6
  31. package/src/Core/disable-sdk.js +6 -6
  32. package/src/Core/enable-sdk.js +3 -3
  33. package/src/Core/get-device-id.js +2 -2
  34. package/src/Core/handle-braze-action.js +20 -13
  35. package/src/Core/is-disabled.js +1 -1
  36. package/src/Core/is-initialized.js +1 -1
  37. package/src/Core/log-custom-event.js +9 -9
  38. package/src/Core/log-ecommerce-event.js +4 -4
  39. package/src/Core/log-purchase.js +14 -14
  40. package/src/Core/open-session.js +8 -8
  41. package/src/Core/set-sdk-authentication-signature.js +3 -3
  42. package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
  43. package/src/Core/wipe-data.js +1 -1
  44. package/src/DUST/dust-config-store.js +35 -35
  45. package/src/DUST/dust-message-dedup.js +3 -3
  46. package/src/DUST/dust-provider-factory.js +10 -10
  47. package/src/DUST/dust-provider.js +234 -234
  48. package/src/DUST/subscribe-to-dust.js +7 -7
  49. package/src/FeatureFlags/feature-flag-factory.js +2 -2
  50. package/src/FeatureFlags/feature-flag.js +4 -4
  51. package/src/FeatureFlags/feature-flags-provider-factory.js +11 -11
  52. package/src/FeatureFlags/feature-flags-provider.js +38 -38
  53. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  54. package/src/FeatureFlags/get-feature-flag.js +3 -3
  55. package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
  56. package/src/FeatureFlags/refresh-feature-flags.js +5 -5
  57. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
  58. package/src/InAppMessage/defer-in-app-message.js +1 -1
  59. package/src/InAppMessage/display/html-message-display-utils.js +4 -4
  60. package/src/InAppMessage/display/html-message-to-html.js +13 -13
  61. package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
  62. package/src/InAppMessage/display/modal-utils.js +7 -7
  63. package/src/InAppMessage/in-app-message-factory.js +6 -6
  64. package/src/InAppMessage/in-app-message-manager.js +92 -92
  65. package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
  66. package/src/InAppMessage/log-in-app-message-click.js +7 -7
  67. package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
  68. package/src/InAppMessage/log-in-app-message-impression.js +3 -3
  69. package/src/InAppMessage/models/full-screen-message.js +39 -39
  70. package/src/InAppMessage/models/html-message.js +20 -20
  71. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  72. package/src/InAppMessage/models/in-app-message.js +102 -102
  73. package/src/InAppMessage/models/modal-message.js +38 -38
  74. package/src/InAppMessage/models/slide-up-message.js +34 -34
  75. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  76. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  77. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  78. package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +3 -3
  79. package/src/InAppMessage/ui/show-in-app-message.js +23 -23
  80. package/src/Push/is-push-blocked.js +2 -2
  81. package/src/Push/is-push-permission-granted.js +2 -2
  82. package/src/Push/is-push-supported.js +2 -2
  83. package/src/Push/push-manager-factory.js +15 -15
  84. package/src/Push/push-manager.js +13 -13
  85. package/src/Push/register-push.js +2 -2
  86. package/src/Push/request-push-permission.js +2 -2
  87. package/src/Push/unregister-push-token-on-server.js +3 -3
  88. package/src/Push/unregister-push.js +3 -3
  89. package/src/Push/utils/push-utils.js +15 -15
  90. package/src/User/user-manager.js +9 -9
  91. package/src/User/user.js +50 -50
  92. package/src/common/constants.js +1 -1
  93. package/src/common/content-cards-display.js +22 -22
  94. package/src/common/event-logger.js +3 -3
  95. package/src/index.js +2 -9
  96. package/src/l10n/l10n-manager-factory.js +4 -4
  97. package/src/l10n/l10n-manager.js +6 -6
  98. package/src/managers/auth-manager.js +28 -28
  99. package/src/managers/braze-action-manager.js +14 -0
  100. package/src/managers/braze-instance.js +159 -151
  101. package/src/managers/device-manager.js +26 -26
  102. package/src/managers/network-manager.js +120 -120
  103. package/src/managers/server-config-manager.js +95 -86
  104. package/src/managers/session-manager.js +25 -25
  105. package/src/managers/storage-manager-factory.js +12 -12
  106. package/src/managers/storage-manager.js +129 -124
  107. package/src/managers/subscription-manager.js +8 -8
  108. package/src/models/backend-errors.js +5 -5
  109. package/src/models/braze-event.js +5 -5
  110. package/src/models/device.js +2 -2
  111. package/src/models/identifier.js +8 -8
  112. package/src/models/push-token.js +6 -6
  113. package/src/models/request-result.js +2 -2
  114. package/src/models/server-config.js +27 -27
  115. package/src/request-controller.js +117 -117
  116. package/src/standard-index.js +9 -0
  117. package/src/triggers/models/custom-event-data.js +4 -4
  118. package/src/triggers/models/custom-event-property-data.js +5 -5
  119. package/src/triggers/models/filter-set.js +5 -5
  120. package/src/triggers/models/filter.js +31 -31
  121. package/src/triggers/models/in-app-message-click-data.js +9 -9
  122. package/src/triggers/models/purchase-data.js +1 -1
  123. package/src/triggers/models/purchase-property-data.js +5 -5
  124. package/src/triggers/models/push-click-data.js +4 -4
  125. package/src/triggers/models/trigger-condition.js +35 -35
  126. package/src/triggers/models/trigger-events.js +3 -3
  127. package/src/triggers/models/trigger.js +36 -36
  128. package/src/triggers/triggers-provider-factory.js +5 -5
  129. package/src/triggers/triggers-provider.js +128 -128
  130. package/src/types.js +2 -2
  131. package/src/ui/js/attach-css.js +1 -1
  132. package/src/ui/js/chat-widget-css.js +11 -0
  133. package/src/ui/js/load-font-awesome.js +1 -1
  134. package/src/util/base-device-parser.js +7 -7
  135. package/src/util/braze-actions.js +5 -5
  136. package/src/util/browser-detector.js +41 -41
  137. package/src/util/client-hints-parser.js +10 -10
  138. package/src/util/component-utils.js +1 -1
  139. package/src/util/date-utils.js +2 -2
  140. package/src/util/device-constants.js +5 -5
  141. package/src/util/dom-utils.js +8 -8
  142. package/src/util/ecommerce-event-validation.js +13 -13
  143. package/src/util/html-display-utils.js +6 -6
  144. package/src/util/key-codes.js +1 -1
  145. package/src/util/net.js +82 -44
  146. package/src/util/request-header-utils.js +26 -24
  147. package/src/util/user-agent-parser.js +21 -21
  148. package/src/util/validation-utils.js +29 -21
  149. package/src/util/window-utils.js +3 -3
@@ -1,63 +1,63 @@
1
1
  import t from "../common/base-provider.js";
2
- import { newInAppMessageFromJson as yt } from "../InAppMessage/in-app-message-factory.js";
2
+ import { newInAppMessageFromJson as It } from "../InAppMessage/in-app-message-factory.js";
3
3
  import ve from "../models/braze-event.js";
4
4
  import {
5
5
  isArray as g,
6
6
  isEqual as hi,
7
- validateValueIsFromEnum as ta,
7
+ validateValueIsFromEnum as ra,
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 vt from "./models/trigger.js";
12
- import ot from "./models/trigger-events.js";
11
+ import Tt from "./models/trigger.js";
12
+ import gt from "./models/trigger-events.js";
13
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
- (this.tg = t),
17
+ (this.sg = t),
18
18
  (this.Rs = i),
19
19
  (this.j = s),
20
20
  (this.Ru = e),
21
- (this.ig = r),
22
- (this.tg = t),
21
+ (this.hg = r),
22
+ (this.sg = t),
23
23
  (this.Rs = i),
24
24
  (this.j = s),
25
25
  (this.Ru = e),
26
- (this.ig = r),
27
- (this.sg = []),
28
- (this.eg = []),
29
- (this.hg = null),
30
- (this.ng = {}),
31
- (this.og = {}),
26
+ (this.hg = r),
27
+ (this.ng = []),
28
+ (this.lg = []),
29
+ (this.gg = null),
30
+ (this.fg = {}),
31
+ (this.cg = {}),
32
32
  (this.triggers = []),
33
- (this.lg = 0),
34
- this.ag(),
35
- this.gg();
33
+ (this.ug = 0),
34
+ this.dg(),
35
+ this.pg();
36
36
  }
37
- fg() {
37
+ mg() {
38
38
  if (this.j) {
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);
39
+ (this.gg = this.j.St(s.It.iS) || this.gg),
40
+ (this.fg = this.j.St(s.It.SS) || this.fg),
41
+ (this.cg = this.j.St(s.It.nS) || this.cg);
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.Ad(this.og[i.id]);
44
+ i.id && null != this.cg[i.id] && i.Hm(this.cg[i.id]);
45
45
  }
46
46
  }
47
47
  }
48
- ag() {
48
+ dg() {
49
49
  if (!this.j) return;
50
- this.lg = this.j.St(s.It.nS) || 0;
50
+ this.ug = this.j.St(s.It.aS) || 0;
51
51
  const t = this.j.St(s.It.oS) || [],
52
52
  i = [];
53
- for (let s = 0; s < t.length; s++) i.push(vt._u(t[s]));
54
- (this.triggers = i), this.fg();
53
+ for (let s = 0; s < t.length; s++) i.push(Tt._u(t[s]));
54
+ (this.triggers = i), this.mg();
55
55
  }
56
- gg() {
56
+ pg() {
57
57
  const t = this,
58
58
  i = function (i, s, e, r, h) {
59
59
  return function () {
60
- t.cg(i, s, e, r, h);
60
+ t.bg(i, s, e, r, h);
61
61
  };
62
62
  },
63
63
  e = {};
@@ -65,182 +65,182 @@ export default class vr extends t {
65
65
  let r = !1;
66
66
  for (let t = 0; t < this.triggers.length; t++) {
67
67
  const s = this.triggers[t];
68
- if (s.id && null != this.ng[s.id]) {
69
- const t = this.ng[s.id],
68
+ if (s.id && null != this.fg[s.id]) {
69
+ const t = this.fg[s.id],
70
70
  h = [];
71
71
  for (let r = 0; r < t.length; r++) {
72
72
  const n = t[r],
73
- o = s.Id(n.ta || 0);
73
+ o = s.Jm(n._a || 0);
74
74
  if (o > 0) {
75
75
  let t, r;
76
76
  h.push(n),
77
- null != n.ug && (t = n.ug),
78
- null != n.dg && ve.RS(n.dg) && (r = ve._u(n.dg));
77
+ null != n.wg && (t = n.wg),
78
+ null != n.yg && ve.gS(n.yg) && (r = ve._u(n.yg));
79
79
  const l = [];
80
- if (n.pg && g(n.pg))
81
- for (let t = 0; t < n.pg.length; t++) {
82
- const i = e[n.pg[t]];
80
+ if (n.Tg && g(n.Tg))
81
+ for (let t = 0; t < n.Tg.length; t++) {
82
+ const i = e[n.Tg[t]];
83
83
  null != i && l.push(i);
84
84
  }
85
- this.eg.push(window.setTimeout(i(s, n.ta || 0, t, r, l), o));
85
+ this.lg.push(window.setTimeout(i(s, n._a || 0, t, r, l), o));
86
86
  }
87
87
  }
88
- this.ng[s.id].length > h.length &&
89
- ((this.ng[s.id] = h),
88
+ this.fg[s.id].length > h.length &&
89
+ ((this.fg[s.id] = h),
90
90
  (r = !0),
91
- 0 === this.ng[s.id].length && delete this.ng[s.id]);
91
+ 0 === this.fg[s.id].length && delete this.fg[s.id]);
92
92
  }
93
93
  }
94
- r && this.j && this.j.Pt(s.It.SS, this.ng);
94
+ r && this.j && this.j.Pt(s.It.SS, this.fg);
95
95
  }
96
- mg() {
96
+ $g() {
97
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
- (this.lg = new Date().valueOf()),
101
+ (this.ug = new Date().valueOf()),
102
102
  this.j.Pt(s.It.oS, t),
103
- this.j.Pt(s.It.nS, this.lg);
103
+ this.j.Pt(s.It.aS, this.ug);
104
104
  }
105
- bg() {
105
+ vg() {
106
106
  if (!this.j) return;
107
- (this.j.St(s.It.nS) || 0) > this.lg ? this.ag() : this.fg();
107
+ (this.j.St(s.It.aS) || 0) > this.ug ? this.dg() : this.mg();
108
108
  }
109
109
  q(t) {
110
110
  let i = !1;
111
111
  if (null != t && t.triggers) {
112
- this.ig.ma(), this.fg();
112
+ this.hg.Ga(), this.mg();
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 = vt.fromJson(t.triggers[s]);
117
+ const h = Tt.fromJson(t.triggers[s]);
118
118
  if (h) {
119
119
  h.id &&
120
- null != this.og[h.id] &&
121
- (h.Ad(this.og[h.id]), (e[h.id] = this.og[h.id])),
122
- h.id && null != this.ng[h.id] && (r[h.id] = this.ng[h.id]);
123
- for (let t = 0; t < h.Dd.length; t++)
124
- if (h.Dd[t]._c(ot.Os, null)) {
120
+ null != this.cg[h.id] &&
121
+ (h.Hm(this.cg[h.id]), (e[h.id] = this.cg[h.id])),
122
+ h.id && null != this.fg[h.id] && (r[h.id] = this.fg[h.id]);
123
+ for (let t = 0; t < h.Nm.length; t++)
124
+ if (h.Nm[t]._m(gt.Os, null)) {
125
125
  i = !0;
126
126
  break;
127
127
  }
128
128
  this.triggers.push(h);
129
129
  }
130
130
  }
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
- this.mg(),
131
+ hi(this.cg, e) || ((this.cg = e), this.j && this.j.Pt(s.It.nS, this.cg)),
132
+ hi(this.fg, r) ||
133
+ ((this.fg = r), this.j && this.j.Pt(s.It.SS, this.fg)),
134
+ this.$g(),
135
135
  i &&
136
136
  (b.info("Trigger with test condition found, firing test."),
137
- this.Ee(ot.Os)),
138
- this.Ee(ot.OPEN);
139
- const h = this.sg;
137
+ this.Pe(gt.Os)),
138
+ this.Pe(gt.OPEN);
139
+ const h = this.ng;
140
140
  let n;
141
- this.sg = [];
141
+ this.ng = [];
142
142
  for (let t = 0; t < h.length; t++)
143
- (n = Array.prototype.slice.call(h[t])), this.Ee(...n);
143
+ (n = Array.prototype.slice.call(h[t])), this.Pe(...n);
144
144
  }
145
145
  }
146
- cg(t, i, s, e, r) {
146
+ bg(t, i, s, e, r) {
147
147
  const h = (e) => {
148
- this.fg();
148
+ this.mg();
149
149
  const r = new Date().valueOf();
150
- t.$d(i) ||
151
- (!1 === navigator.onLine && t.type === vt.Yo.Wo && e.imageUrl
150
+ t.Lm(i) ||
151
+ (!1 === navigator.onLine && t.type === Tt.Ba.za && e.imageUrl
152
152
  ? b.info(
153
153
  `Not showing ${t.type} trigger action ${t.id} due to offline state.`,
154
154
  )
155
- : t._d(r) && this.wg(t, r, s)
156
- ? 0 === this.Rs.an()
155
+ : t.Fm(r) && this.kg(t, r, s)
156
+ ? 0 === this.Rs.$h()
157
157
  ? b.info(
158
158
  `Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
159
159
  )
160
- : (this.Rs.A([e]), this.yg(t, r))
160
+ : (this.Rs.A([e]), this.jg(t, r))
161
161
  : b.info(
162
162
  `Not displaying trigger ${t.id} because display time fell outside of the acceptable time window.`,
163
163
  ));
164
164
  },
165
165
  n = () => {
166
- this.fg();
166
+ this.mg();
167
167
  const h = r.pop();
168
168
  if (null != h)
169
- if ((this.Tg(h, i, s, e, r), h.$d(i))) {
169
+ if ((this.Dg(h, i, s, e, r), h.Lm(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.Pd - (new Date().valueOf() - i);
176
+ const n = 1e3 * h.Im - (new Date().valueOf() - i);
177
177
  n > 0
178
- ? this.eg.push(
178
+ ? this.lg.push(
179
179
  window.setTimeout(() => {
180
- this.cg(h, i, s, e, r);
180
+ this.bg(h, i, s, e, r);
181
181
  }, n),
182
182
  )
183
- : this.cg(h, i, s, e, r);
183
+ : this.bg(h, i, s, e, r);
184
184
  }
185
185
  };
186
186
  let o, l, a;
187
187
  switch (t.type) {
188
- case vt.Yo.Wo:
189
- if (((o = yt(t.data)), null == o)) {
188
+ case Tt.Ba.za:
189
+ if (((o = It(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.Vn(o)), l)) {
195
+ if (((l = this.hg.ja(o)), l)) {
196
196
  b.error(l), n();
197
197
  break;
198
198
  }
199
199
  h(o);
200
200
  break;
201
- case vt.Yo.xd:
202
- if (((a = Jt.fromJson(t.data, h, n, i, t.ia || 0)), null == a)) {
201
+ case Tt.Ba.Rm:
202
+ if (((a = Jt.fromJson(t.data, h, n, i, t.qa || 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.Po(a, s, e);
208
+ this.hg.Ta(a, s, e);
209
209
  break;
210
210
  default:
211
211
  b.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
212
212
  }
213
213
  }
214
- Ee(t, i = null, s) {
215
- if (!ta(ot, t, "Cannot fire trigger action.", "TriggerEvents")) return;
216
- if (this.Ru && this.Ru.yc())
214
+ Pe(t, i = null, s) {
215
+ if (!ra(gt, t, "Cannot fire trigger action.", "TriggerEvents")) return;
216
+ if (this.Ru && this.Ru.Vd())
217
217
  return (
218
218
  b.info(
219
219
  "Trigger sync is currently in progress, awaiting sync completion before firing trigger event.",
220
220
  ),
221
- void this.sg.push(arguments)
221
+ void this.ng.push(arguments)
222
222
  );
223
- this.bg();
223
+ this.vg();
224
224
  const e = new Date().valueOf(),
225
- r = e - (this.hg || 0);
225
+ r = e - (this.gg || 0);
226
226
  let h = !0,
227
227
  n = !0;
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.Pd;
231
+ l = e + 1e3 * r.Im;
232
232
  if (
233
- r._d(l) &&
233
+ r.Fm(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.Dd.length; e++)
239
- if (r.Dd[e]._c(t, i)) {
238
+ for (let e = 0; e < r.Nm.length; e++)
239
+ if (r.Nm[e]._m(t, i)) {
240
240
  s = !0;
241
241
  break;
242
242
  }
243
- s && ((h = !1), this.wg(r, l, t) && ((n = !1), o.push(r)));
243
+ s && ((h = !1), this.kg(r, l, t) && ((n = !1), o.push(r)));
244
244
  }
245
245
  }
246
246
  if (h)
@@ -259,64 +259,64 @@ export default class vr extends t {
259
259
  (b.info(
260
260
  `Firing ${l.type} trigger action ${l.id} from trigger event ${t}.`,
261
261
  ),
262
- this.Tg(l, e, t, s, o),
263
- 0 === l.Pd
264
- ? this.cg(l, e, t, s, o)
265
- : this.eg.push(
262
+ this.Dg(l, e, t, s, o),
263
+ 0 === l.Im
264
+ ? this.bg(l, e, t, s, o)
265
+ : this.lg.push(
266
266
  window.setTimeout(() => {
267
- this.cg(l, e, t, s, o);
268
- }, 1e3 * l.Pd),
267
+ this.bg(l, e, t, s, o);
268
+ }, 1e3 * l.Im),
269
269
  ));
270
270
  }
271
271
  changeUser(t = !1) {
272
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();
278
- for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
279
- (this.eg = []),
280
- this.j && (this.j.Vt(s.It.iS), this.j.Vt(s.It.aS), this.j.Vt(s.It.SS));
273
+ (this.ng = []),
274
+ (this.gg = null),
275
+ (this.cg = {}),
276
+ (this.fg = {}),
277
+ this.hg && this.hg.xa();
278
+ for (let t = 0; t < this.lg.length; t++) clearTimeout(this.lg[t]);
279
+ (this.lg = []),
280
+ this.j && (this.j.Vt(s.It.iS), this.j.Vt(s.It.nS), this.j.Vt(s.It.SS));
281
281
  }
282
282
  }
283
283
  clearData() {
284
284
  (this.triggers = []),
285
- (this.hg = null),
286
- (this.og = {}),
287
- (this.ng = {}),
288
- this.ig && this.ig.oa();
289
- for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
290
- this.eg = [];
285
+ (this.gg = null),
286
+ (this.cg = {}),
287
+ (this.fg = {}),
288
+ this.hg && this.hg.xa();
289
+ for (let t = 0; t < this.lg.length; t++) clearTimeout(this.lg[t]);
290
+ this.lg = [];
291
291
  }
292
- wg(t, i, s) {
293
- if (null == this.hg) return !0;
294
- if (s === ot.Os)
292
+ kg(t, i, s) {
293
+ if (null == this.gg) return !0;
294
+ if (s === gt.Os)
295
295
  return (
296
296
  b.info(
297
297
  "Ignoring minimum interval between trigger because it is a test type.",
298
298
  ),
299
299
  !0
300
300
  );
301
- let e = t.jd;
302
- return null == e && (e = this.tg), i - this.hg >= 1e3 * e;
301
+ let e = t.Mm;
302
+ return null == e && (e = this.sg), i - this.gg >= 1e3 * e;
303
303
  }
304
- Tg(t, i, e, r, h) {
305
- this.fg(), t.id && (this.ng[t.id] = this.ng[t.id] || []);
304
+ Dg(t, i, e, r, h) {
305
+ this.mg(), t.id && (this.fg[t.id] = this.fg[t.id] || []);
306
306
  const n = {};
307
307
  let o;
308
- (n.ta = i), (n.ug = e), null != r && (o = r.qt()), (n.dg = o);
308
+ (n._a = i), (n.wg = e), null != r && (o = r.qt()), (n.yg = o);
309
309
  const l = [];
310
310
  for (const t of h) t.id && l.push(t.id);
311
- (n.pg = l),
312
- t.id && this.ng[t.id].push(n),
313
- this.j && this.j.Pt(s.It.SS, this.ng);
311
+ (n.Tg = l),
312
+ t.id && this.fg[t.id].push(n),
313
+ this.j && this.j.Pt(s.It.SS, this.fg);
314
314
  }
315
- yg(t, i) {
316
- this.fg(),
317
- t.Ad(i),
318
- (this.hg = i),
319
- t.id && (this.og[t.id] = i),
320
- this.j && (this.j.Pt(s.It.iS, i), this.j.Pt(s.It.aS, this.og));
315
+ jg(t, i) {
316
+ this.mg(),
317
+ t.Hm(i),
318
+ (this.gg = i),
319
+ t.id && (this.cg[t.id] = i),
320
+ this.j && (this.j.Pt(s.It.iS, i), this.j.Pt(s.It.nS, this.cg));
321
321
  }
322
322
  }
package/src/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const CartUpdatedActions = {
2
2
  REPLACE: "replace",
3
- Ld: "add",
4
- Md: "remove",
3
+ ap: "add",
4
+ dp: "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.12.1".replace(/\./g, "-")}`;
4
+ e = `ab-${t}-css-definitions-${"6.13.0".replace(/\./g, "-")}`;
5
5
  if (!c) return;
6
6
  const s = c.ownerDocument || document;
7
7
  if (null == s.getElementById(e)) {
@@ -0,0 +1,11 @@
1
+ import { attachCSS as Sn } from "./attach-css.js";
2
+ export function attachChatWidgetCSS(t) {
3
+ Sn(
4
+ t,
5
+ "chat-widget",
6
+ ".ab-chat-widget{position:fixed;right:0;bottom:0;width:0;height:0;border:none;background:0 0;z-index:9000}",
7
+ );
8
+ }
9
+ export function setupChatWidgetUI() {
10
+ attachChatWidgetCSS();
11
+ }
@@ -1,6 +1,6 @@
1
1
  import r, { OPTIONS as U } from "../../managers/braze-instance.js";
2
2
  export function loadFontAwesome() {
3
- if (r.er(U.Uh)) return;
3
+ if (r.er(U.vl)) return;
4
4
  const e = "https://use.fontawesome.com/7f85a56ba4.css";
5
5
  if (
6
6
  !(null !== document.querySelector('link[rel=stylesheet][href="' + e + '"]'))
@@ -1,14 +1,14 @@
1
1
  import { isArray as g } from "./code-utils.js";
2
2
  export default class Oe {
3
3
  constructor() {}
4
- ef() {}
5
4
  ff() {}
6
- Fa(t) {}
7
- static nf(t, e) {
5
+ cf() {}
6
+ jc(t) {}
7
+ static lf(t, e) {
8
8
  if (t && e)
9
- if (((t = t.toLowerCase()), g(e.cf))) {
10
- for (let r = 0; r < e.cf.length; r++)
11
- if (-1 !== t.indexOf(e.cf[r].toLowerCase())) return e.identity;
12
- } else if (-1 !== t.indexOf(e.cf.toLowerCase())) return e.identity;
9
+ if (((t = t.toLowerCase()), g(e.uf))) {
10
+ for (let r = 0; r < e.uf.length; r++)
11
+ if (-1 !== t.indexOf(e.uf[r].toLowerCase())) return e.identity;
12
+ } else if (-1 !== t.indexOf(e.uf.toLowerCase())) return e.identity;
13
13
  }
14
14
  }
@@ -19,17 +19,17 @@ export const BRAZE_ACTIONS = {
19
19
  removeFromSubscriptionGroup: "removeFromSubscriptionGroup",
20
20
  addToCustomAttributeArray: "addToCustomAttributeArray",
21
21
  removeFromCustomAttributeArray: "removeFromCustomAttributeArray",
22
- mo: "openLink",
23
- uo: "openLinkInWebView",
22
+ co: "openLink",
23
+ mo: "openLinkInWebView",
24
24
  },
25
25
  properties: { type: "type", eo: "steps", so: "args" },
26
26
  };
27
27
  export const INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES = {
28
- Wn: "unknownBrazeAction",
29
- Nc: "noPushPrompt",
28
+ ya: "unknownBrazeAction",
29
+ cp: "noPushPrompt",
30
30
  };
31
31
  export const ineligibleBrazeActionURLErrorMessage = (t, o) =>
32
- t === INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Wn
32
+ t === INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.ya
33
33
  ? `${o} contains an unknown braze action type and will not be displayed.`
34
34
  : "";
35
35
  export function getDecodedBrazeAction(t) {
@@ -1,20 +1,20 @@
1
- import Si from "./client-hints-parser.js";
2
- import yi from "./user-agent-parser.js";
3
- import { Browsers as xi, OperatingSystems as so } from "./device-constants.js";
4
- class Bi {
1
+ import yi from "./client-hints-parser.js";
2
+ import xi from "./user-agent-parser.js";
3
+ import { Browsers as Bi, OperatingSystems as so } from "./device-constants.js";
4
+ class Oi {
5
5
  constructor() {
6
6
  let t;
7
7
  (t =
8
- navigator.userAgent.toLowerCase().includes(xi.Sg.toLowerCase()) ||
8
+ navigator.userAgent.toLowerCase().includes(Bi.Sg.toLowerCase()) ||
9
9
  !navigator.userAgentData
10
- ? yi
11
- : Si),
12
- (this.vg = new t()),
10
+ ? xi
11
+ : yi),
12
+ (this.xg = new t()),
13
13
  (this.userAgent = navigator.userAgent),
14
- (this.browser = this.vg.ef()),
15
- (this.version = this.vg.ff()),
14
+ (this.browser = this.xg.ff()),
15
+ (this.version = this.xg.cf()),
16
16
  (this.OS = null),
17
- this.Fa().then((t) => (this.OS = t));
17
+ this.jc().then((t) => (this.OS = t));
18
18
  const i = navigator;
19
19
  (this.language = (
20
20
  i.userLanguage ||
@@ -23,20 +23,20 @@ class Bi {
23
23
  i.systemLanguage ||
24
24
  ""
25
25
  ).toLowerCase()),
26
- (this.il = Bi.xg(this.userAgent));
26
+ (this.kl = Oi.Bg(this.userAgent));
27
27
  }
28
- mS() {
29
- return this.browser === xi.Bg;
28
+ NS() {
29
+ return this.browser === Bi.Og;
30
30
  }
31
- qa() {
31
+ Ic() {
32
32
  return this.OS || null;
33
33
  }
34
- Fa() {
34
+ jc() {
35
35
  return this.OS
36
36
  ? Promise.resolve(this.OS)
37
- : this.vg.Fa(Bi.Og).then((t) => ((this.OS = t), t));
37
+ : this.xg.jc(Oi.Pg).then((t) => ((this.OS = t), t));
38
38
  }
39
- static xg(t) {
39
+ static Bg(t) {
40
40
  t = t.toLowerCase();
41
41
  const i = [
42
42
  "bot",
@@ -63,33 +63,33 @@ class Bi {
63
63
  return !1;
64
64
  }
65
65
  }
66
- Bi.Og = [
67
- { string: navigator.platform, cf: "Win", identity: so.kg },
68
- { string: navigator.platform, cf: "Mac", identity: so.Pg },
69
- { string: navigator.platform, cf: "BlackBerry", identity: "BlackBerry" },
70
- { string: navigator.platform, cf: "FreeBSD", identity: "FreeBSD" },
71
- { string: navigator.platform, cf: "OpenBSD", identity: "OpenBSD" },
72
- { string: navigator.platform, cf: "Nintendo", identity: "Nintendo" },
73
- { string: navigator.platform, cf: "SunOS", identity: "SunOS" },
74
- { string: navigator.platform, cf: "PlayStation", identity: "PlayStation" },
75
- { string: navigator.platform, cf: "X11", identity: "X11" },
66
+ Oi.Pg = [
67
+ { string: navigator.platform, uf: "Win", identity: so.Wg },
68
+ { string: navigator.platform, uf: "Mac", identity: so.Cg },
69
+ { string: navigator.platform, uf: "BlackBerry", identity: "BlackBerry" },
70
+ { string: navigator.platform, uf: "FreeBSD", identity: "FreeBSD" },
71
+ { string: navigator.platform, uf: "OpenBSD", identity: "OpenBSD" },
72
+ { string: navigator.platform, uf: "Nintendo", identity: "Nintendo" },
73
+ { string: navigator.platform, uf: "SunOS", identity: "SunOS" },
74
+ { string: navigator.platform, uf: "PlayStation", identity: "PlayStation" },
75
+ { string: navigator.platform, uf: "X11", identity: "X11" },
76
76
  {
77
77
  string: navigator.userAgent,
78
- cf: ["iPhone", "iPad", "iPod"],
79
- identity: so.co,
78
+ uf: ["iPhone", "iPad", "iPod"],
79
+ identity: so.ao,
80
80
  },
81
- { string: navigator.platform, cf: "Pike v", identity: so.co },
82
- { string: navigator.userAgent, cf: ["Web0S"], identity: "WebOS" },
83
- { string: navigator.userAgent, cf: "Tizen", identity: "Tizen" },
84
- { string: navigator.userAgent, cf: "Coolita", identity: "Other Smart TV" },
85
- { string: navigator.userAgent, cf: "WhaleTV", identity: "Other Smart TV" },
81
+ { string: navigator.platform, uf: "Pike v", identity: so.ao },
82
+ { string: navigator.userAgent, uf: ["Web0S"], identity: "WebOS" },
83
+ { string: navigator.userAgent, uf: "Tizen", identity: "Tizen" },
84
+ { string: navigator.userAgent, uf: "Coolita", identity: "Other Smart TV" },
85
+ { string: navigator.userAgent, uf: "WhaleTV", identity: "Other Smart TV" },
86
86
  {
87
87
  string: navigator.platform,
88
- cf: ["Linux armv7l", "Android"],
89
- identity: so.Dg,
88
+ uf: ["Linux armv7l", "Android"],
89
+ identity: so.Fg,
90
90
  },
91
- { string: navigator.userAgent, cf: ["Android"], identity: so.Dg },
92
- { string: navigator.platform, cf: "Linux", identity: "Linux" },
91
+ { string: navigator.userAgent, uf: ["Android"], identity: so.Fg },
92
+ { string: navigator.platform, uf: "Linux", identity: "Linux" },
93
93
  ];
94
- const ro = new Bi();
95
- export { ro as default, Bi as BrowserDetector };
94
+ const eo = new Oi();
95
+ export { eo as default, Oi as BrowserDetector };