@braze/web-sdk 6.11.0 → 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 (102) hide show
  1. package/index.d.ts +36 -5
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +4 -4
  4. package/shared-lib/indexed-db-adapter.js +51 -51
  5. package/shared-lib/logger.js +7 -7
  6. package/shared-lib/supported-options.js +9 -9
  7. package/src/DUST/dust-config-store.js +89 -0
  8. package/src/DUST/dust-connection-core.js +7 -21
  9. package/src/DUST/dust-message-dedup.js +33 -0
  10. package/src/DUST/dust-provider.js +367 -397
  11. package/src/DUST/dust-tab-identity.js +30 -0
  12. package/src/DUST/index.js +7 -9
  13. package/src/DUST/subscribe-to-dust.js +5 -5
  14. package/src/FeatureFlags/feature-flag-factory.js +4 -4
  15. package/src/FeatureFlags/feature-flag.js +5 -5
  16. package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
  17. package/src/FeatureFlags/feature-flags-provider.js +74 -74
  18. package/src/FeatureFlags/get-all-feature-flags.js +2 -2
  19. package/src/FeatureFlags/get-feature-flag.js +2 -2
  20. package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
  21. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  22. package/src/InAppMessage/defer-in-app-message.js +2 -2
  23. package/src/InAppMessage/display/get-animation-effect.js +1 -1
  24. package/src/InAppMessage/display/html-message-display-utils.js +4 -4
  25. package/src/InAppMessage/display/html-message-to-html.js +10 -10
  26. package/src/InAppMessage/display/in-app-message-to-html.js +42 -42
  27. package/src/InAppMessage/display/modal-utils.js +14 -14
  28. package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
  29. package/src/InAppMessage/in-app-message-factory.js +6 -6
  30. package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
  31. package/src/InAppMessage/in-app-message-manager.js +73 -73
  32. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  33. package/src/InAppMessage/log-in-app-message-click.js +2 -2
  34. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  35. package/src/InAppMessage/log-in-app-message-impression.js +2 -2
  36. package/src/InAppMessage/models/full-screen-message.js +9 -9
  37. package/src/InAppMessage/models/html-message.js +4 -4
  38. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  39. package/src/InAppMessage/models/in-app-message.js +52 -52
  40. package/src/InAppMessage/models/modal-message.js +7 -7
  41. package/src/InAppMessage/models/slide-up-message.js +11 -11
  42. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  43. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  44. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
  45. package/src/InAppMessage/ui/show-in-app-message.js +36 -36
  46. package/src/Push/is-push-blocked.js +2 -2
  47. package/src/Push/is-push-permission-granted.js +2 -2
  48. package/src/Push/is-push-supported.js +2 -2
  49. package/src/Push/push-manager-factory.js +6 -6
  50. package/src/Push/push-manager.js +14 -14
  51. package/src/Push/unregister-push-token-on-server.js +3 -3
  52. package/src/Push/utils/push-utils.js +10 -10
  53. package/src/User/user.js +19 -19
  54. package/src/common/content-cards-display.js +21 -21
  55. package/src/common/event-logger.js +2 -2
  56. package/src/l10n/l10n-manager-factory.js +7 -7
  57. package/src/l10n/l10n-manager.js +5 -5
  58. package/src/managers/auth-manager.js +1 -1
  59. package/src/managers/braze-instance.js +41 -41
  60. package/src/managers/device-manager.js +22 -22
  61. package/src/managers/network-manager.js +108 -108
  62. package/src/managers/server-config-manager.js +83 -83
  63. package/src/managers/session-manager.js +6 -6
  64. package/src/managers/storage-manager-factory.js +4 -4
  65. package/src/managers/storage-manager.js +127 -125
  66. package/src/managers/subscription-manager.js +1 -1
  67. package/src/managers/utils.js +1 -1
  68. package/src/models/backend-errors.js +5 -5
  69. package/src/models/braze-event.js +7 -7
  70. package/src/models/device.js +3 -3
  71. package/src/models/identifier.js +3 -3
  72. package/src/models/push-token.js +3 -3
  73. package/src/models/server-config.js +31 -31
  74. package/src/request-controller.js +39 -39
  75. package/src/triggers/models/filter.js +58 -58
  76. package/src/triggers/models/in-app-message-click-data.js +4 -4
  77. package/src/triggers/models/push-click-data.js +2 -2
  78. package/src/triggers/models/trigger-condition.js +35 -35
  79. package/src/triggers/models/trigger.js +37 -37
  80. package/src/triggers/triggers-provider-factory.js +3 -3
  81. package/src/triggers/triggers-provider.js +50 -50
  82. package/src/types.js +2 -2
  83. package/src/ui/js/attach-css.js +1 -1
  84. package/src/ui/js/feed-css.js +2 -2
  85. package/src/ui/js/iam-css.js +2 -2
  86. package/src/util/base-device-parser.js +2 -2
  87. package/src/util/braze-actions.js +2 -2
  88. package/src/util/browser-detector.js +15 -15
  89. package/src/util/client-hints-parser.js +5 -5
  90. package/src/util/component-utils.js +4 -4
  91. package/src/util/dom-utils.js +5 -5
  92. package/src/util/ecommerce-event-validation.js +77 -48
  93. package/src/util/key-codes.js +1 -1
  94. package/src/util/net.js +4 -4
  95. package/src/util/request-header-utils.js +20 -20
  96. package/src/util/string-utils.js +5 -0
  97. package/src/util/user-agent-parser.js +18 -18
  98. package/src/util/validation-utils.js +4 -4
  99. package/src/util/window-utils.js +2 -2
  100. package/src/DUST/dust-shared-worker-code.js +0 -2
  101. package/src/DUST/dust-shared-worker-impl.js +0 -234
  102. package/src/DUST/dust-worker-bridge.js +0 -151
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  addPassiveEventListener as F,
3
- buildSvg as we,
3
+ buildSvg as oe,
4
4
  detectSwipe as O,
5
5
  DIRECTIONS as P,
6
6
  } from "../../util/dom-utils.js";
7
7
  import { createCloseButton as T } from "../../util/component-utils.js";
8
- import { isTransparent as ve, toRgba as ke } from "../../util/color-utils.js";
8
+ import { isTransparent as te, toRgba as ae } from "../../util/color-utils.js";
9
9
  import FullScreenMessage from "../models/full-screen-message.js";
10
10
  import HtmlMessage from "../models/html-message.js";
11
11
  import ModalMessage from "../models/modal-message.js";
12
12
  import SlideUpMessage from "../models/slide-up-message.js";
13
13
  import { logInAppMessageClick } from "../log-in-app-message-click.js";
14
14
  import { _handleBrazeAction as Q } from "../../Core/handle-braze-action.js";
15
- import ft from "./html-message-to-html.js";
16
- import xe from "./modal-utils.js";
15
+ import jt from "./html-message-to-html.js";
16
+ import ie from "./modal-utils.js";
17
17
  import { Guid as V } from "../../../shared-lib/index.js";
18
- import { KeyCodes as Ce } from "../../util/key-codes.js";
18
+ import { KeyCodes as le } from "../../util/key-codes.js";
19
19
  import {
20
- IamClickAction as Le,
21
- IamCropType as Me,
22
- IamImageStyle as qe,
23
- IamOpenTarget as ut,
24
- IamOrientation as Ae,
25
- IamSlideFrom as De,
26
- IamTextAlignment as Ee,
20
+ IamClickAction as ce,
21
+ IamCropType as de,
22
+ IamImageStyle as ue,
23
+ IamOpenTarget as dt,
24
+ IamOrientation as be,
25
+ IamSlideFrom as fe,
26
+ IamTextAlignment as pe,
27
27
  } from "../constants.js";
28
- export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
28
+ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
29
29
  if (((e.$o = document.activeElement), e instanceof HtmlMessage))
30
- return ft(e, o, a, n, i);
30
+ return jt(e, o, a, n, i);
31
31
  const l = (function (e, o, t, a, n, i = document.body, s = "ltr") {
32
32
  let m = null;
33
33
  const l = document.createElement("div");
@@ -38,9 +38,9 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
38
38
  ((l.className += " ab-modal-interactions"),
39
39
  l.setAttribute("tabindex", "-1")),
40
40
  e.Mo() ||
41
- ((l.style.color = ke(e.textColor)),
42
- (l.style.backgroundColor = ke(e.backgroundColor)),
43
- ve(e.backgroundColor) && (l.className += " ab-no-shadow"));
41
+ ((l.style.color = ae(e.textColor)),
42
+ (l.style.backgroundColor = ae(e.backgroundColor)),
43
+ te(e.backgroundColor) && (l.className += " ab-no-shadow"));
44
44
  const c = () => {
45
45
  -1 !== l.className.indexOf("ab-start-hidden") &&
46
46
  ((l.className = l.className.replace("ab-start-hidden", "")),
@@ -68,28 +68,28 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
68
68
  }
69
69
  };
70
70
  if (
71
- (e.imageStyle === qe.GRAPHIC && (l.className += " graphic"),
72
- e.orientation === Ae.LANDSCAPE && (l.className += " landscape"),
71
+ (e.imageStyle === ue.GRAPHIC && (l.className += " graphic"),
72
+ e.orientation === be.LANDSCAPE && (l.className += " landscape"),
73
73
  null != e.buttons && 0 === e.buttons.length)
74
74
  ) {
75
- e.clickAction !== Le.NONE && (l.className += " ab-clickable");
75
+ e.clickAction !== ce.NONE && (l.className += " ab-clickable");
76
76
  const o = (o) => (
77
77
  e.tl(l, () => {
78
78
  logInAppMessageClick(e),
79
- e.clickAction === Le.URI &&
80
- Q(e.uri || "", a || e.openTarget === ut.BLANK, o);
79
+ e.clickAction === ce.URI &&
80
+ Q(e.uri || "", a || e.openTarget === dt.BLANK, o);
81
81
  }),
82
82
  o.stopPropagation(),
83
83
  !1
84
84
  );
85
85
  (l.onclick = o),
86
86
  l.addEventListener("keydown", (e) => {
87
- if (e.keyCode === Ce.Lo || e.keyCode === Ce.Ao) return o(e);
87
+ if (e.keyCode === le.Lo || e.keyCode === le.To) return o(e);
88
88
  });
89
89
  }
90
90
  const d = T(
91
91
  "Close Message",
92
- e.Mo() ? void 0 : ke(e.closeButtonColor),
92
+ e.Mo() ? void 0 : ae(e.closeButtonColor),
93
93
  () => {
94
94
  e.tl(l);
95
95
  },
@@ -100,7 +100,7 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
100
100
  (u.className = "ab-message-text"),
101
101
  (u.dir = s),
102
102
  u.setAttribute("role", "article");
103
- const b = (e.messageAlignment || e.Go).toLowerCase();
103
+ const b = (e.messageAlignment || e.qo).toLowerCase();
104
104
  u.className += " " + b + "-aligned";
105
105
  let f = !1;
106
106
  const p = document.createElement("div");
@@ -108,7 +108,7 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
108
108
  const o = document.createElement("img");
109
109
  if (
110
110
  (o.setAttribute("src", e.imageUrl),
111
- e.Ho(o),
111
+ e.Ao(o),
112
112
  0 === document.querySelectorAll(".ab-iam-img-loading").length)
113
113
  ) {
114
114
  f = !0;
@@ -124,7 +124,7 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
124
124
  r(!1);
125
125
  });
126
126
  }
127
- if (e.cropType === Me.CENTER_CROP) {
127
+ if (e.cropType === de.CENTER_CROP) {
128
128
  const e = document.createElement("div");
129
129
  (e.className = "ab-center-cropped-img"),
130
130
  e.appendChild(o),
@@ -136,8 +136,8 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
136
136
  const o = document.createElement("span");
137
137
  (o.className = "ab-icon"),
138
138
  e.Mo() ||
139
- ((o.style.backgroundColor = ke(e.iconBackgroundColor)),
140
- (o.style.color = ke(e.iconColor)));
139
+ ((o.style.backgroundColor = ae(e.iconBackgroundColor)),
140
+ (o.style.color = ae(e.iconColor)));
141
141
  const t = document.createElement("i");
142
142
  (t.className = "fa"),
143
143
  t.appendChild(document.createTextNode(e.icon)),
@@ -149,32 +149,32 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
149
149
  }
150
150
  if ((F(u, "touchstart"), e.header && e.header.length > 0)) {
151
151
  const o = document.createElement("h1");
152
- (o.className = "ab-message-header"), (e.Jo = V.de()), (o.id = e.Jo);
153
- const t = (e.headerAlignment || Ee.CENTER).toLowerCase();
152
+ (o.className = "ab-message-header"), (e.Do = V.de()), (o.id = e.Do);
153
+ const t = (e.headerAlignment || pe.CENTER).toLowerCase();
154
154
  (o.className += " " + t + "-aligned"),
155
- e.Mo() || (o.style.color = ke(e.headerTextColor)),
155
+ e.Mo() || (o.style.color = ae(e.headerTextColor)),
156
156
  o.appendChild(document.createTextNode(e.header)),
157
157
  u.appendChild(o);
158
158
  }
159
- const g = e.Ko();
160
- return u.appendChild(g), l.appendChild(u), f || c(), (e.Eo = l), l;
159
+ const g = e.Eo();
160
+ return u.appendChild(g), l.appendChild(u), f || c(), (e.Bo = l), l;
161
161
  })(e, o, t, a, n, s, m);
162
162
  if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
163
163
  const o = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
164
164
  (l.className += ` ${o} ab-centered`),
165
- xe.No(e, l, a),
166
- xe.Po(l),
167
- xe.Qo(e.Jo, l);
165
+ ie.Go(e, l, a),
166
+ ie.Ho(l),
167
+ ie.Io(e.Do, l);
168
168
  } else if (e instanceof SlideUpMessage) {
169
169
  (l.className += " ab-slideup"),
170
170
  l.setAttribute("tabindex", "0"),
171
171
  l.setAttribute("role", "alert");
172
172
  const o = l.getElementsByClassName("ab-close-button")[0];
173
173
  if (null != o) {
174
- const t = we(
174
+ const t = oe(
175
175
  "0 0 11.38 19.44",
176
176
  "M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",
177
- e.Mo() ? void 0 : ke(e.closeButtonColor),
177
+ e.Mo() ? void 0 : ae(e.closeButtonColor),
178
178
  );
179
179
  t.setAttribute("class", `ab-chevron ${m}`), o.appendChild(t);
180
180
  }
@@ -187,9 +187,9 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
187
187
  (l.className += " ab-swiped-right"),
188
188
  null != o && null != o.onclick && o.onclick(e);
189
189
  }),
190
- e.slideFrom === De.TOP
191
- ? ((t = P.Uo), (a = " ab-swiped-up"))
192
- : ((t = P.Vo), (a = " ab-swiped-down")),
190
+ e.slideFrom === fe.TOP
191
+ ? ((t = P.Jo), (a = " ab-swiped-up"))
192
+ : ((t = P.Ko), (a = " ab-swiped-down")),
193
193
  O(l, t, (e) => {
194
194
  (l.className += a), null != o && null != o.onclick && o.onclick(e);
195
195
  });
@@ -1,11 +1,11 @@
1
1
  import { _handleBrazeAction as Q } from "../../Core/handle-braze-action.js";
2
2
  import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.js";
3
- import { toRgba as ke } from "../../util/color-utils.js";
3
+ import { toRgba as ae } from "../../util/color-utils.js";
4
4
  import { addPassiveEventListener as F } from "../../util/dom-utils.js";
5
- import { KeyCodes as Ce } from "../../util/key-codes.js";
6
- import { IamClickAction as Le, IamOpenTarget as ut } from "../constants.js";
7
- const xe = {
8
- Po: (t) => {
5
+ import { KeyCodes as le } from "../../util/key-codes.js";
6
+ import { IamClickAction as ce, IamOpenTarget as dt } from "../constants.js";
7
+ const ie = {
8
+ Ho: (t) => {
9
9
  const o = t.querySelectorAll(".ab-close-button, .ab-message-button");
10
10
  let e;
11
11
  for (let t = 0; t < o.length; t++) (e = o[t]), (e.tabIndex = 0);
@@ -14,7 +14,7 @@ const xe = {
14
14
  s = o[o.length - 1];
15
15
  t.addEventListener("keydown", (o) => {
16
16
  const a = document.activeElement;
17
- o.keyCode === Ce.Wo &&
17
+ o.keyCode === le.No &&
18
18
  (o.shiftKey || (a !== s && a !== t)
19
19
  ? !o.shiftKey ||
20
20
  (a !== e && a !== t) ||
@@ -23,14 +23,14 @@ const xe = {
23
23
  });
24
24
  }
25
25
  },
26
- Qo: (t, o) => {
26
+ Io: (t, o) => {
27
27
  o.setAttribute("role", "dialog"),
28
28
  o.setAttribute("aria-modal", "true"),
29
29
  t
30
30
  ? o.setAttribute("aria-labelledby", t)
31
31
  : o.setAttribute("aria-label", "Modal Message");
32
32
  },
33
- No: (t, o, e) => {
33
+ Go: (t, o, e) => {
34
34
  if (t.buttons && t.buttons.length > 0) {
35
35
  const s = document.createElement("div");
36
36
  (s.className = "ab-message-buttons"), o.appendChild(s);
@@ -39,8 +39,8 @@ const xe = {
39
39
  const l = (s) => (a) => (
40
40
  t.tl(o, () => {
41
41
  logInAppMessageButtonClick(s, t),
42
- s.clickAction === Le.URI &&
43
- Q(s.uri || "", e || t.openTarget === ut.BLANK, a);
42
+ s.clickAction === ce.URI &&
43
+ Q(s.uri || "", e || t.openTarget === dt.BLANK, a);
44
44
  }),
45
45
  a.stopPropagation(),
46
46
  !1
@@ -55,13 +55,13 @@ const xe = {
55
55
  "" === e.text && (n = " "),
56
56
  a.appendChild(document.createTextNode(n)),
57
57
  t.Mo() ||
58
- ((a.style.backgroundColor = ke(e.backgroundColor)),
59
- (a.style.color = ke(e.textColor)),
60
- (a.style.borderColor = ke(e.borderColor))),
58
+ ((a.style.backgroundColor = ae(e.backgroundColor)),
59
+ (a.style.color = ae(e.textColor)),
60
+ (a.style.borderColor = ae(e.borderColor))),
61
61
  (a.onclick = l(e)),
62
62
  s.appendChild(a);
63
63
  }
64
64
  }
65
65
  },
66
66
  };
67
- export default xe;
67
+ export default ie;
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import je from "./in-app-message-manager-factory.js";
2
+ import se from "./in-app-message-manager-factory.js";
3
3
  export function getDeferredInAppMessage() {
4
- if (r.rr()) return je.ra().sa();
4
+ if (r.rr()) return se.ra().sa();
5
5
  }
@@ -5,7 +5,7 @@ import InAppMessageButton from "./models/in-app-message-button.js";
5
5
  import ModalMessage from "./models/modal-message.js";
6
6
  import SlideUpMessage from "./models/slide-up-message.js";
7
7
  import { logger as b } from "../../shared-lib/index.js";
8
- import { IamServerTypes as dt } from "./constants.js";
8
+ import { IamServerTypes as gt } from "./constants.js";
9
9
  export function newInAppMessageFromJson(e) {
10
10
  if (!e) return null;
11
11
  if (e.is_control) return ControlMessage.fromJson(e);
@@ -49,7 +49,7 @@ export function newInAppMessageFromJson(e) {
49
49
  D = e.language,
50
50
  E = e.image_alt;
51
51
  let G;
52
- if (o === dt.tE || o === dt.eE)
52
+ if (o === gt.tE || o === gt.eE)
53
53
  G = new ModalMessage(
54
54
  s,
55
55
  n,
@@ -82,7 +82,7 @@ export function newInAppMessageFromJson(e) {
82
82
  D,
83
83
  E,
84
84
  );
85
- else if (o === dt.oE)
85
+ else if (o === gt.oE)
86
86
  G = new FullScreenMessage(
87
87
  s,
88
88
  n,
@@ -116,7 +116,7 @@ export function newInAppMessageFromJson(e) {
116
116
  D,
117
117
  E,
118
118
  );
119
- else if (o === dt.RE)
119
+ else if (o === gt.RE)
120
120
  G = new SlideUpMessage(
121
121
  s,
122
122
  n,
@@ -144,7 +144,7 @@ export function newInAppMessageFromJson(e) {
144
144
  E,
145
145
  );
146
146
  else {
147
- if (o !== dt.ME && o !== dt.CE && o !== dt.DE)
147
+ if (o !== gt.ME && o !== gt.CE && o !== gt.DE)
148
148
  return void b.error("Ignoring message with unknown type " + o);
149
149
  {
150
150
  const o = e.message_fields;
@@ -152,7 +152,7 @@ export function newInAppMessageFromJson(e) {
152
152
  (G.trusted = e.trusted || !1);
153
153
  }
154
154
  }
155
- return (G.ko = o), G;
155
+ return (G.Oo = o), G;
156
156
  }
157
157
  export function buttonsFromSerializedInAppMessage(e) {
158
158
  const o = [];
@@ -1,16 +1,16 @@
1
1
  import ea from "./in-app-message-manager.js";
2
2
  import r from "../managers/braze-instance.js";
3
- const je = {
3
+ const se = {
4
4
  na: null,
5
5
  i: !1,
6
6
  ra: () => (
7
- je.t(), je.na || (je.na = new ea(r.m(), r.u(), r.p(), r.ir())), je.na
7
+ se.t(), se.na || (se.na = new ea(r.m(), r.u(), r.p(), r.ir())), se.na
8
8
  ),
9
9
  t: () => {
10
- je.i || (r.g(je), (je.i = !0));
10
+ se.i || (r.g(se), (se.i = !0));
11
11
  },
12
12
  destroy: () => {
13
- (je.na = null), (je.i = !1);
13
+ (se.na = null), (se.i = !1);
14
14
  },
15
15
  };
16
- export default je;
16
+ export default se;
@@ -5,28 +5,28 @@ import HtmlMessage from "./models/html-message.js";
5
5
  import InAppMessage from "./models/in-app-message.js";
6
6
  import InAppMessageButton from "./models/in-app-message-button.js";
7
7
  import v from "../common/event-logger.js";
8
- import { newInAppMessageFromJson as pt } from "./in-app-message-factory.js";
8
+ import { newInAppMessageFromJson as yt } from "./in-app-message-factory.js";
9
9
  import { randomInclusive as a } from "../util/math.js";
10
10
  import L from "../models/request-result.js";
11
11
  import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
12
12
  import f from "../managers/subscription-manager.js";
13
- import gt from "../triggers/models/trigger.js";
13
+ import vt from "../triggers/models/trigger.js";
14
14
  import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
15
15
  import {
16
- containsPushPrimerBrazeAction as jt,
17
- containsUnknownBrazeAction as yt,
16
+ containsPushPrimerBrazeAction as It,
17
+ containsUnknownBrazeAction as At,
18
18
  getDecodedBrazeAction as eo,
19
- ineligibleBrazeActionURLErrorMessage as vt,
20
- INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as bt,
19
+ ineligibleBrazeActionURLErrorMessage as Mt,
20
+ INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as Tt,
21
21
  } from "../util/braze-actions.js";
22
- import It from "../Push/utils/push-utils.js";
22
+ import Dt from "../Push/utils/push-utils.js";
23
23
  import h from "../util/request-header-utils.js";
24
24
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
25
25
  import { FullScreenMessage, ModalMessage, SlideUpMessage } from "./index.js";
26
26
  import {
27
- IamClickAction as Le,
28
- IamServerTypes as dt,
29
- IamTiming as At,
27
+ IamClickAction as ce,
28
+ IamServerTypes as gt,
29
+ IamTiming as kt,
30
30
  } from "./constants.js";
31
31
  export default class ea {
32
32
  constructor(t, e, s, i) {
@@ -40,24 +40,24 @@ export default class ea {
40
40
  (this.Ss = i),
41
41
  (this.In = new f()),
42
42
  r.S(this.In),
43
- (this.An = 1e3),
43
+ (this.Tn = 1e3),
44
44
  (this.Dn = 6e4),
45
+ (this.zn = null),
46
+ (this.Bn = null),
45
47
  (this._n = null),
46
- (this.qn = null),
47
- (this.xn = null),
48
- (this.Pn = {});
48
+ (this.qn = {});
49
49
  }
50
- En() {
50
+ Pn() {
51
51
  return this.In;
52
52
  }
53
- Gn(t) {
53
+ En(t) {
54
54
  return this.In.Ut(t);
55
55
  }
56
- Nn() {
57
- return this._n;
56
+ Gn() {
57
+ return this.zn;
58
58
  }
59
- Fn(t) {
60
- this._n = t;
59
+ Nn(t) {
60
+ this.zn = t;
61
61
  }
62
62
  Dt(t, e, s, i) {
63
63
  const r = new L();
@@ -126,53 +126,53 @@ export default class ea {
126
126
  const e = (t) => {
127
127
  if (!t) return;
128
128
  const e = eo(t);
129
- if (yt(e)) return vt(bt.Wn, "In-App Message");
130
- if (jt(e)) {
131
- const t = It.Yn();
132
- if (!t.Zn) return It._o(t.reason, "In-App Message");
129
+ if (At(e)) return Mt(Tt.Wn, "In-App Message");
130
+ if (It(e)) {
131
+ const t = Dt.Yn();
132
+ if (!t.Zn) return Dt.So(t.reason, "In-App Message");
133
133
  }
134
134
  };
135
135
  if (this.Un(t)) {
136
- const t = It.Yn();
137
- if (!t.Zn) return It._o(t.reason, "In-App Message");
136
+ const t = Dt.Yn();
137
+ if (!t.Zn) return Dt.So(t.reason, "In-App Message");
138
138
  }
139
139
  const s = t.buttons || [];
140
140
  let i;
141
141
  for (const t of s)
142
142
  if (
143
- t.clickAction === Le.URI &&
143
+ t.clickAction === ce.URI &&
144
144
  t.uri &&
145
145
  to.test(t.uri) &&
146
146
  ((i = e(t.uri)), i)
147
147
  )
148
148
  return i;
149
- return t.clickAction === Le.URI && t.uri && to.test(t.uri)
149
+ return t.clickAction === ce.URI && t.uri && to.test(t.uri)
150
150
  ? e(t.uri)
151
151
  : void 0;
152
152
  }
153
- Xo(t, e) {
154
- e !== this.xn && this.Yo(), (this.qn = t), (this.xn = e);
153
+ Ro(t, e) {
154
+ e !== this._n && this._o(), (this.Bn = t), (this._n = e);
155
155
  }
156
- Yo() {
157
- null != this.qn &&
158
- (clearTimeout(this.qn), (this.qn = null), (this.xn = null));
156
+ _o() {
157
+ null != this.Bn &&
158
+ (clearTimeout(this.Bn), (this.Bn = null), (this._n = null));
159
159
  }
160
- Zo(t, e, s, i) {
160
+ Po(t, e, s, i) {
161
161
  const r = this.B;
162
162
  if (!r) return;
163
- this.xn && t.triggerId !== this.xn && (this.Yo(), h.Ji(this.j, h.it.ta));
164
- const n = r.ia(!1),
163
+ this._n && t.triggerId !== this._n && (this._o(), h.Ji(this.j, h.it.Xo));
164
+ const n = r.Qo(!1),
165
165
  o = r.Z(n);
166
166
  (o.template = { trigger_id: t.triggerId, trigger_event_type: e }),
167
- null != s && (o.template.data = s.oa());
168
- const u = r.tt(o, h.it.ta);
167
+ null != s && (o.template.data = s.Uo());
168
+ const u = r.tt(o, h.it.Xo);
169
169
  r.et(
170
170
  o,
171
171
  (r = -1) => {
172
172
  const n = this.B;
173
173
  if (!n) return;
174
174
  const m = new Date().valueOf();
175
- h.nt(this.j, h.it.ta, m),
175
+ h.nt(this.j, h.it.Xo, m),
176
176
  -1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
177
177
  let p,
178
178
  c,
@@ -183,16 +183,16 @@ export default class ea {
183
183
  headers: u,
184
184
  lt: (e) => {
185
185
  if (!n.ut(o, e, u))
186
- return void ("function" == typeof t.la && t.la());
186
+ return void ("function" == typeof t.Vo && t.Vo());
187
187
  if ((n.ct(), null == e || null == e.templated_message)) return;
188
188
  const s = e.templated_message;
189
- if (s.type !== gt.ma.ua) return;
190
- const i = pt(s.data);
189
+ if (s.type !== vt.Yo.Wo) return;
190
+ const i = yt(s.data);
191
191
  if (null == i) return;
192
192
  const r = this.Vn(i);
193
193
  if (r)
194
- return b.error(r), void ("function" == typeof t.la && t.la());
195
- "function" == typeof t.pa && t.pa(i);
194
+ return b.error(r), void ("function" == typeof t.Vo && t.Vo());
195
+ "function" == typeof t.Zo && t.Zo(i);
196
196
  },
197
197
  error: (e) => {
198
198
  (g = !0),
@@ -200,21 +200,21 @@ export default class ea {
200
200
  (c = `getting user personalization for message ${t.triggerId}.`);
201
201
  },
202
202
  ft: (r, o) => {
203
- if (new Date().valueOf() - t.ha < t.ca) {
203
+ if (new Date().valueOf() - t.ta < t.ia) {
204
204
  let r = 0;
205
205
  if (g) {
206
- const e = Math.min(t.ca, this.Dn),
207
- s = this.An;
206
+ const e = Math.min(t.ia, this.Dn),
207
+ s = this.Tn;
208
208
  null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
209
209
  }
210
210
  n.yt(
211
211
  o,
212
212
  () => {
213
- this.Zo(t, e, s, r);
213
+ this.Po(t, e, s, r);
214
214
  },
215
- h.it.ta,
216
- (e) => this.Xo(e, t.triggerId),
217
- () => this.Yo(),
215
+ h.it.Xo,
216
+ (e) => this.Ro(e, t.triggerId),
217
+ () => this._o(),
218
218
  r,
219
219
  );
220
220
  }
@@ -222,17 +222,17 @@ export default class ea {
222
222
  },
223
223
  });
224
224
  },
225
- h.it.ta,
225
+ h.it.Xo,
226
226
  );
227
227
  }
228
228
  Xn(t) {
229
229
  if (null == t || "" === t) return !1;
230
230
  const e = new Date().valueOf(),
231
- s = this.Pn[t];
232
- return (null != s && e - s < At.aE) || ((this.Pn[t] = e), !1);
231
+ s = this.qn[t];
232
+ return (null != s && e - s < kt.aE) || ((this.qn[t] = e), !1);
233
233
  }
234
- ga() {
235
- this.Pn = {};
234
+ oa() {
235
+ this.qn = {};
236
236
  }
237
237
  Kn(t) {
238
238
  if (null == t.triggerId)
@@ -245,40 +245,40 @@ export default class ea {
245
245
  const e = {};
246
246
  return null != t.triggerId && (e.trigger_ids = [t.triggerId]), e;
247
247
  }
248
- jn(t) {
248
+ An(t) {
249
249
  return (
250
250
  !!this.j &&
251
251
  !(
252
252
  !(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
253
253
  t instanceof ControlMessage
254
254
  ) &&
255
- this.j.Pt(s.It.fa, t.qt())
255
+ this.j.Pt(s.It.la, t.qt())
256
256
  );
257
257
  }
258
258
  sa() {
259
259
  if (!this.j) return null;
260
- const t = this.j.St(s.It.fa);
260
+ const t = this.j.St(s.It.la);
261
261
  if (!t) return null;
262
262
  let e;
263
263
  switch (t.type) {
264
- case dt.oE:
265
- e = FullScreenMessage.da(t);
264
+ case gt.oE:
265
+ e = FullScreenMessage.ua(t);
266
266
  break;
267
- case dt.ME:
268
- case dt.CE:
269
- case dt.DE:
270
- e = HtmlMessage.da(t);
267
+ case gt.ME:
268
+ case gt.CE:
269
+ case gt.DE:
270
+ e = HtmlMessage.ua(t);
271
271
  break;
272
- case dt.tE:
273
- case dt.eE:
274
- e = ModalMessage.da(t);
272
+ case gt.tE:
273
+ case gt.eE:
274
+ e = ModalMessage.ua(t);
275
275
  break;
276
- case dt.RE:
277
- e = SlideUpMessage.da(t);
276
+ case gt.RE:
277
+ e = SlideUpMessage.ua(t);
278
278
  }
279
- return e && this.ja(), e;
279
+ return e && this.ma(), e;
280
280
  }
281
- ja() {
282
- this.j && this.j.Vt(s.It.fa);
281
+ ma() {
282
+ this.j && this.j.Vt(s.It.la);
283
283
  }
284
284
  }
@@ -2,7 +2,7 @@ import r from "../managers/braze-instance.js";
2
2
  import { IamStrings as mr } from "./constants.js";
3
3
  import InAppMessage from "./models/in-app-message.js";
4
4
  import InAppMessageButton from "./models/in-app-message-button.js";
5
- import je from "./in-app-message-manager-factory.js";
5
+ import se from "./in-app-message-manager-factory.js";
6
6
  import { logger as b } from "../../shared-lib/index.js";
7
7
  import ot from "../triggers/models/trigger-events.js";
8
8
  import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
@@ -12,7 +12,7 @@ export function logInAppMessageButtonClick(t, o) {
12
12
  if (!(t instanceof InAppMessageButton))
13
13
  return b.error("button must be an InAppMessageButton object"), !1;
14
14
  if (!(o instanceof InAppMessage)) return b.error(mr.EE), !1;
15
- const s = je.ra().Ln(t, o);
15
+ const s = se.ra().Ln(t, o);
16
16
  if (s.lt)
17
17
  for (let r = 0; r < s.Ce.length; r++)
18
18
  rt.o().Ee(
@@ -1,6 +1,6 @@
1
1
  import r from "../managers/braze-instance.js";
2
2
  import InAppMessage from "./models/in-app-message.js";
3
- import je from "./in-app-message-manager-factory.js";
3
+ import se from "./in-app-message-manager-factory.js";
4
4
  import { logInAppMessageImpression } from "./log-in-app-message-impression.js";
5
5
  import { IamStrings as mr } from "./constants.js";
6
6
  import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
@@ -9,7 +9,7 @@ import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-fac
9
9
  export function logInAppMessageClick(s) {
10
10
  if (!r.rr()) return !1;
11
11
  if (!(s instanceof InAppMessage)) return b.error(mr.EE), !1;
12
- const e = je.ra().Dt(s, p.Hn);
12
+ const e = se.ra().Dt(s, p.Hn);
13
13
  if (e) {
14
14
  s.sm() || logInAppMessageImpression(s);
15
15
  for (let r = 0; r < e.Ce.length; r++)