@braze/web-sdk 4.9.0 → 5.0.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 (111) hide show
  1. package/index.d.ts +2204 -2230
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +1 -1
  4. package/shared-lib/event-types.js +9 -9
  5. package/shared-lib/indexed-db-adapter.js +13 -13
  6. package/shared-lib/logger.js +2 -2
  7. package/shared-lib/supported-options.js +8 -8
  8. package/src/Card/models/captioned-image.js +19 -19
  9. package/src/Card/models/card.js +95 -94
  10. package/src/Card/models/classic-card.js +19 -19
  11. package/src/Card/models/control-card.js +9 -9
  12. package/src/Card/models/image-only.js +21 -22
  13. package/src/Card/models/index.js +0 -1
  14. package/src/Card/util/card-factory.js +39 -39
  15. package/src/ContentCards/content-cards-provider.js +114 -114
  16. package/src/ContentCards/get-cached-content-cards.js +1 -1
  17. package/src/ContentCards/index.js +0 -1
  18. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  19. package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
  20. package/src/ContentCards/ui/hide-content-cards.js +2 -2
  21. package/src/ContentCards/ui/show-content-cards.js +14 -14
  22. package/src/Core/add-sdk-metadata.js +2 -2
  23. package/src/Core/change-user.js +2 -2
  24. package/src/Core/disable-sdk.js +4 -4
  25. package/src/Core/enable-sdk.js +4 -4
  26. package/src/Core/get-device-id.js +9 -7
  27. package/src/Core/handle-braze-action.js +14 -14
  28. package/src/Core/is-disabled.js +2 -2
  29. package/src/Core/open-session.js +5 -5
  30. package/src/Core/set-sdk-authentication-signature.js +2 -2
  31. package/src/Core/wipe-data.js +4 -4
  32. package/src/FeatureFlags/feature-flag-factory.js +10 -10
  33. package/src/FeatureFlags/feature-flag.js +7 -7
  34. package/src/FeatureFlags/feature-flags-provider.js +50 -50
  35. package/src/FeatureFlags/get-all-feature-flags.js +1 -1
  36. package/src/FeatureFlags/get-feature-flag.js +3 -5
  37. package/src/Feed/feed-provider-factory.js +8 -8
  38. package/src/Feed/feed-provider.js +15 -15
  39. package/src/Feed/get-cached-feed.js +2 -2
  40. package/src/Feed/request-feed-refresh.js +2 -2
  41. package/src/Feed/subscribe-to-feed-updates.js +2 -2
  42. package/src/Feed/ui/hide-feed.js +2 -2
  43. package/src/Feed/ui/show-feed.js +13 -13
  44. package/src/InAppMessage/display/html-message-to-html.js +11 -12
  45. package/src/InAppMessage/display/in-app-message-to-html.js +15 -15
  46. package/src/InAppMessage/display/modal-utils.js +8 -8
  47. package/src/InAppMessage/in-app-message-factory.js +4 -4
  48. package/src/InAppMessage/in-app-message-manager.js +38 -38
  49. package/src/InAppMessage/models/full-screen-message.js +31 -31
  50. package/src/InAppMessage/models/html-message.js +16 -16
  51. package/src/InAppMessage/models/in-app-message-button.js +5 -5
  52. package/src/InAppMessage/models/in-app-message.js +46 -46
  53. package/src/InAppMessage/models/modal-message.js +30 -30
  54. package/src/InAppMessage/models/slide-up-message.js +26 -26
  55. package/src/InAppMessage/ui/show-in-app-message.js +9 -9
  56. package/src/Push/is-push-blocked.js +2 -2
  57. package/src/Push/is-push-permission-granted.js +2 -2
  58. package/src/Push/is-push-supported.js +2 -2
  59. package/src/Push/push-manager.js +31 -31
  60. package/src/Push/utils/push-utils.js +9 -9
  61. package/src/User/user-manager.js +8 -8
  62. package/src/User/user.js +38 -37
  63. package/src/common/base-feed.js +15 -14
  64. package/src/common/base-provider.js +1 -1
  65. package/src/common/event-logger.js +2 -2
  66. package/src/common/feed-display.js +32 -32
  67. package/src/l10n/l10n-manager-factory.js +9 -9
  68. package/src/managers/auth-manager.js +6 -6
  69. package/src/managers/braze-instance.js +84 -92
  70. package/src/managers/device-manager.js +9 -9
  71. package/src/managers/network-manager.js +72 -69
  72. package/src/managers/server-config-manager.js +13 -13
  73. package/src/managers/session-manager.js +9 -9
  74. package/src/managers/storage-manager-factory.js +11 -11
  75. package/src/managers/storage-manager.js +110 -110
  76. package/src/managers/subscription-manager.js +3 -3
  77. package/src/models/backend-errors.js +5 -5
  78. package/src/models/braze-event.js +7 -7
  79. package/src/models/identifier.js +1 -1
  80. package/src/models/push-token.js +1 -1
  81. package/src/models/server-config.js +6 -6
  82. package/src/request-controller.js +129 -125
  83. package/src/triggers/models/custom-event-data.js +1 -1
  84. package/src/triggers/models/custom-event-property-data.js +6 -6
  85. package/src/triggers/models/filter-set.js +8 -8
  86. package/src/triggers/models/filter.js +31 -31
  87. package/src/triggers/models/in-app-message-click-data.js +1 -1
  88. package/src/triggers/models/purchase-data.js +1 -1
  89. package/src/triggers/models/purchase-property-data.js +4 -4
  90. package/src/triggers/models/push-click-data.js +3 -3
  91. package/src/triggers/models/trigger-condition.js +30 -30
  92. package/src/triggers/models/trigger-events.js +1 -1
  93. package/src/triggers/models/trigger.js +32 -32
  94. package/src/triggers/triggers-provider.js +55 -55
  95. package/src/ui/js/attach-css.js +1 -1
  96. package/src/ui/js/feed-css.js +5 -5
  97. package/src/ui/js/iam-css.js +4 -4
  98. package/src/ui/js/load-font-awesome.js +1 -1
  99. package/src/util/braze-actions.js +4 -4
  100. package/src/util/browser-detector.js +11 -11
  101. package/src/util/client-hints-parser.js +5 -5
  102. package/src/util/component-utils.js +2 -2
  103. package/src/util/date-utils.js +2 -2
  104. package/src/util/device-constants.js +4 -5
  105. package/src/util/dom-utils.js +5 -5
  106. package/src/util/net.js +1 -1
  107. package/src/util/request-header-utils.js +17 -17
  108. package/src/util/user-agent-parser.js +11 -16
  109. package/src/util/validation-utils.js +9 -9
  110. package/src/Card/models/banner.js +0 -31
  111. package/src/ContentCards/log-content-cards-displayed.js +0 -5
@@ -1,10 +1,10 @@
1
1
  import e, { OPTIONS as L } from "../../managers/braze-instance.js";
2
- import V from "../../util/browser-detector.js";
2
+ import Q from "../../util/browser-detector.js";
3
3
  import {
4
4
  clickElement as Et,
5
5
  supportsPassive as Tt,
6
6
  } from "../../util/dom-utils.js";
7
- import { KeyCodes as lt } from "../../util/key-codes.js";
7
+ import { KeyCodes as at } from "../../util/key-codes.js";
8
8
  import E from "../../managers/subscription-manager.js";
9
9
  import { isIFrame as It } from "../utils/in-app-message-utils.js";
10
10
  export default class InAppMessage {
@@ -106,21 +106,21 @@ export default class InAppMessage {
106
106
  (this.oh = !1),
107
107
  (this.Me = null),
108
108
  (this.ke = null),
109
- (this.ht = new E()),
109
+ (this.Et = new E()),
110
110
  (this.rh = new E()),
111
111
  (this.Te = InAppMessage.TextAlignment.CENTER);
112
112
  }
113
113
  subscribeToClickedEvent(t) {
114
- return this.ht.lt(t);
114
+ return this.Et.It(t);
115
115
  }
116
116
  subscribeToDismissedEvent(t) {
117
- return this.rh.lt(t);
117
+ return this.rh.It(t);
118
118
  }
119
119
  removeSubscription(t) {
120
- this.ht.removeSubscription(t), this.rh.removeSubscription(t);
120
+ this.Et.removeSubscription(t), this.rh.removeSubscription(t);
121
121
  }
122
122
  removeAllSubscriptions() {
123
- this.ht.removeAllSubscriptions(), this.rh.removeAllSubscriptions();
123
+ this.Et.removeAllSubscriptions(), this.rh.removeAllSubscriptions();
124
124
  }
125
125
  closeMessage() {
126
126
  this.ye(this.Me);
@@ -147,10 +147,10 @@ export default class InAppMessage {
147
147
  return this.Th;
148
148
  }
149
149
  p(t) {
150
- return !this.do && ((this.do = !0), this.ht.Et(), !0);
150
+ return !this.do && ((this.do = !0), this.Et.Dt(), !0);
151
151
  }
152
152
  F() {
153
- return !this.oh && ((this.oh = !0), this.rh.Et(), !0);
153
+ return !this.oh && ((this.oh = !0), this.rh.Dt(), !0);
154
154
  }
155
155
  hide(t) {
156
156
  if (t && t.parentNode) {
@@ -187,7 +187,7 @@ export default class InAppMessage {
187
187
  const t = document.getElementById(i);
188
188
  t && t.parentNode && t.parentNode.removeChild(t);
189
189
  }
190
- null != e && "Safari" === V.browser && (e.scrollTop = E),
190
+ null != e && "Safari" === Q.browser && (e.scrollTop = E),
191
191
  s ? s() : this.F();
192
192
  };
193
193
  h ? setTimeout(n, InAppMessage.Oh) : n(), this.ke && this.ke.focus();
@@ -224,7 +224,7 @@ export default class InAppMessage {
224
224
  }
225
225
  static Lh(t) {
226
226
  if (
227
- t.keyCode === lt._h &&
227
+ t.keyCode === at._h &&
228
228
  !e.nn(L.mh) &&
229
229
  document.querySelectorAll(".ab-modal-interactions").length > 0
230
230
  ) {
@@ -256,39 +256,39 @@ export default class InAppMessage {
256
256
  }),
257
257
  (this.nh = !0));
258
258
  }
259
- ss(t) {
259
+ tt(t) {
260
260
  const s = {};
261
261
  return t
262
- ? ((s[InAppMessage.hs.ea] = this.message),
263
- (s[InAppMessage.hs.ra] = this.messageAlignment),
264
- (s[InAppMessage.hs.Sh] = this.slideFrom),
265
- (s[InAppMessage.hs.xs] = this.extras),
266
- (s[InAppMessage.hs.sa] = this.triggerId),
267
- (s[InAppMessage.hs.ta] = this.clickAction),
268
- (s[InAppMessage.hs.URI] = this.uri),
269
- (s[InAppMessage.hs.ia] = this.openTarget),
270
- (s[InAppMessage.hs.oa] = this.dismissType),
271
- (s[InAppMessage.hs.pa] = this.duration),
272
- (s[InAppMessage.hs.ma] = this.icon),
273
- (s[InAppMessage.hs.os] = this.imageUrl),
274
- (s[InAppMessage.hs.na] = this.imageStyle),
275
- (s[InAppMessage.hs.ua] = this.iconColor),
276
- (s[InAppMessage.hs.ca] = this.iconBackgroundColor),
277
- (s[InAppMessage.hs.fa] = this.backgroundColor),
278
- (s[InAppMessage.hs.da] = this.textColor),
279
- (s[InAppMessage.hs.la] = this.closeButtonColor),
280
- (s[InAppMessage.hs.ga] = this.animateIn),
281
- (s[InAppMessage.hs.ja] = this.animateOut),
282
- (s[InAppMessage.hs.xa] = this.header),
283
- (s[InAppMessage.hs.za] = this.headerAlignment),
284
- (s[InAppMessage.hs.ha] = this.headerTextColor),
285
- (s[InAppMessage.hs.va] = this.frameColor),
286
- (s[InAppMessage.hs.wa] = this.buttons),
287
- (s[InAppMessage.hs.ya] = this.cropType),
288
- (s[InAppMessage.hs.Sa] = this.orientation),
289
- (s[InAppMessage.hs.ba] = this.htmlId),
290
- (s[InAppMessage.hs.CSS] = this.css),
291
- (s[InAppMessage.hs.ts] = t),
262
+ ? ((s[InAppMessage.it.ea] = this.message),
263
+ (s[InAppMessage.it.ra] = this.messageAlignment),
264
+ (s[InAppMessage.it.Sh] = this.slideFrom),
265
+ (s[InAppMessage.it.jt] = this.extras),
266
+ (s[InAppMessage.it.sa] = this.triggerId),
267
+ (s[InAppMessage.it.ta] = this.clickAction),
268
+ (s[InAppMessage.it.URI] = this.uri),
269
+ (s[InAppMessage.it.ia] = this.openTarget),
270
+ (s[InAppMessage.it.oa] = this.dismissType),
271
+ (s[InAppMessage.it.pa] = this.duration),
272
+ (s[InAppMessage.it.ma] = this.icon),
273
+ (s[InAppMessage.it.nt] = this.imageUrl),
274
+ (s[InAppMessage.it.na] = this.imageStyle),
275
+ (s[InAppMessage.it.ua] = this.iconColor),
276
+ (s[InAppMessage.it.ca] = this.iconBackgroundColor),
277
+ (s[InAppMessage.it.fa] = this.backgroundColor),
278
+ (s[InAppMessage.it.da] = this.textColor),
279
+ (s[InAppMessage.it.la] = this.closeButtonColor),
280
+ (s[InAppMessage.it.ga] = this.animateIn),
281
+ (s[InAppMessage.it.ja] = this.animateOut),
282
+ (s[InAppMessage.it.xa] = this.header),
283
+ (s[InAppMessage.it.za] = this.headerAlignment),
284
+ (s[InAppMessage.it.ha] = this.headerTextColor),
285
+ (s[InAppMessage.it.va] = this.frameColor),
286
+ (s[InAppMessage.it.wa] = this.buttons),
287
+ (s[InAppMessage.it.ya] = this.cropType),
288
+ (s[InAppMessage.it.Sa] = this.orientation),
289
+ (s[InAppMessage.it.ba] = this.htmlId),
290
+ (s[InAppMessage.it.CSS] = this.css),
291
+ (s[InAppMessage.it.st] = t),
292
292
  s)
293
293
  : s;
294
294
  }
@@ -347,11 +347,11 @@ export default class InAppMessage {
347
347
  (InAppMessage.ah = "ab-show"),
348
348
  (InAppMessage.Ih = "ab-hide"),
349
349
  (InAppMessage.lh = "ab-pause-scrolling"),
350
- (InAppMessage.hs = {
350
+ (InAppMessage.it = {
351
351
  ea: "m",
352
352
  ra: "ma",
353
353
  Sh: "sf",
354
- xs: "e",
354
+ jt: "e",
355
355
  sa: "ti",
356
356
  ta: "ca",
357
357
  URI: "u",
@@ -359,7 +359,7 @@ export default class InAppMessage {
359
359
  oa: "dt",
360
360
  pa: "d",
361
361
  ma: "i",
362
- os: "iu",
362
+ nt: "iu",
363
363
  na: "is",
364
364
  ua: "ic",
365
365
  ca: "ibc",
@@ -377,6 +377,6 @@ export default class InAppMessage {
377
377
  Sa: "o",
378
378
  ba: "hi",
379
379
  CSS: "css",
380
- ts: "type",
380
+ st: "type",
381
381
  vo: "messageFields",
382
382
  });
@@ -63,39 +63,39 @@ export default class ModalMessage extends InAppMessage {
63
63
  ),
64
64
  (this.Te = InAppMessage.TextAlignment.CENTER);
65
65
  }
66
- ss() {
67
- return super.ss(ModalMessage.es);
66
+ tt() {
67
+ return super.tt(ModalMessage.et);
68
68
  }
69
69
  static an(e) {
70
70
  return new ModalMessage(
71
- e[InAppMessage.hs.ea],
72
- e[InAppMessage.hs.ra],
73
- e[InAppMessage.hs.xs],
74
- e[InAppMessage.hs.sa],
75
- e[InAppMessage.hs.ta],
76
- e[InAppMessage.hs.URI],
77
- e[InAppMessage.hs.ia],
78
- e[InAppMessage.hs.oa],
79
- e[InAppMessage.hs.pa],
80
- e[InAppMessage.hs.ma],
81
- e[InAppMessage.hs.os],
82
- e[InAppMessage.hs.na],
83
- e[InAppMessage.hs.ua],
84
- e[InAppMessage.hs.ca],
85
- e[InAppMessage.hs.fa],
86
- e[InAppMessage.hs.da],
87
- e[InAppMessage.hs.la],
88
- e[InAppMessage.hs.ga],
89
- e[InAppMessage.hs.ja],
90
- e[InAppMessage.hs.xa],
91
- e[InAppMessage.hs.za],
92
- e[InAppMessage.hs.ha],
93
- e[InAppMessage.hs.va],
94
- pe(e[InAppMessage.hs.wa]),
95
- e[InAppMessage.hs.ya],
96
- e[InAppMessage.hs.ba],
97
- e[InAppMessage.hs.CSS],
71
+ e[InAppMessage.it.ea],
72
+ e[InAppMessage.it.ra],
73
+ e[InAppMessage.it.jt],
74
+ e[InAppMessage.it.sa],
75
+ e[InAppMessage.it.ta],
76
+ e[InAppMessage.it.URI],
77
+ e[InAppMessage.it.ia],
78
+ e[InAppMessage.it.oa],
79
+ e[InAppMessage.it.pa],
80
+ e[InAppMessage.it.ma],
81
+ e[InAppMessage.it.nt],
82
+ e[InAppMessage.it.na],
83
+ e[InAppMessage.it.ua],
84
+ e[InAppMessage.it.ca],
85
+ e[InAppMessage.it.fa],
86
+ e[InAppMessage.it.da],
87
+ e[InAppMessage.it.la],
88
+ e[InAppMessage.it.ga],
89
+ e[InAppMessage.it.ja],
90
+ e[InAppMessage.it.xa],
91
+ e[InAppMessage.it.za],
92
+ e[InAppMessage.it.ha],
93
+ e[InAppMessage.it.va],
94
+ pe(e[InAppMessage.it.wa]),
95
+ e[InAppMessage.it.ya],
96
+ e[InAppMessage.it.ba],
97
+ e[InAppMessage.it.CSS],
98
98
  );
99
99
  }
100
100
  }
101
- ModalMessage.es = InAppMessage.qe.un;
101
+ ModalMessage.et = InAppMessage.qe.un;
@@ -1,5 +1,5 @@
1
1
  import InAppMessage from "./in-app-message.js";
2
- import { DOMUtils as ue } from "../../util/dom-utils.js";
2
+ import { DOMUtils as de } from "../../util/dom-utils.js";
3
3
  export default class SlideUpMessage extends InAppMessage {
4
4
  constructor(e, t, s, o, i, r, n, d, a, u, p, m, c, l, v, x, f, h, g, I, M) {
5
5
  (x = x || InAppMessage.th.Mh),
@@ -46,39 +46,39 @@ export default class SlideUpMessage extends InAppMessage {
46
46
  }
47
47
  Ah(e) {
48
48
  const t = e.getElementsByClassName("ab-in-app-message")[0];
49
- ue.no(t, !0, !0) ||
49
+ de.no(t, !0, !0) ||
50
50
  (this.slideFrom === InAppMessage.SlideFrom.TOP
51
51
  ? (t.style.top = "0px")
52
52
  : (t.style.bottom = "0px")),
53
53
  super.Ah(e);
54
54
  }
55
- ss() {
56
- return super.ss(SlideUpMessage.es);
55
+ tt() {
56
+ return super.tt(SlideUpMessage.et);
57
57
  }
58
58
  static an(e) {
59
59
  return new SlideUpMessage(
60
- e[InAppMessage.hs.ea],
61
- e[InAppMessage.hs.ra],
62
- e[InAppMessage.hs.Sh],
63
- e[InAppMessage.hs.xs],
64
- e[InAppMessage.hs.sa],
65
- e[InAppMessage.hs.ta],
66
- e[InAppMessage.hs.URI],
67
- e[InAppMessage.hs.ia],
68
- e[InAppMessage.hs.oa],
69
- e[InAppMessage.hs.pa],
70
- e[InAppMessage.hs.ma],
71
- e[InAppMessage.hs.os],
72
- e[InAppMessage.hs.ua],
73
- e[InAppMessage.hs.ca],
74
- e[InAppMessage.hs.fa],
75
- e[InAppMessage.hs.da],
76
- e[InAppMessage.hs.la],
77
- e[InAppMessage.hs.ga],
78
- e[InAppMessage.hs.ja],
79
- e[InAppMessage.hs.ba],
80
- e[InAppMessage.hs.CSS],
60
+ e[InAppMessage.it.ea],
61
+ e[InAppMessage.it.ra],
62
+ e[InAppMessage.it.Sh],
63
+ e[InAppMessage.it.jt],
64
+ e[InAppMessage.it.sa],
65
+ e[InAppMessage.it.ta],
66
+ e[InAppMessage.it.URI],
67
+ e[InAppMessage.it.ia],
68
+ e[InAppMessage.it.oa],
69
+ e[InAppMessage.it.pa],
70
+ e[InAppMessage.it.ma],
71
+ e[InAppMessage.it.nt],
72
+ e[InAppMessage.it.ua],
73
+ e[InAppMessage.it.ca],
74
+ e[InAppMessage.it.fa],
75
+ e[InAppMessage.it.da],
76
+ e[InAppMessage.it.la],
77
+ e[InAppMessage.it.ga],
78
+ e[InAppMessage.it.ja],
79
+ e[InAppMessage.it.ba],
80
+ e[InAppMessage.it.CSS],
81
81
  );
82
82
  }
83
83
  }
84
- SlideUpMessage.es = InAppMessage.qe.pn;
84
+ SlideUpMessage.et = InAppMessage.qe.pn;
@@ -5,17 +5,17 @@ import InAppMessage from "../models/in-app-message.js";
5
5
  import SlideUpMessage from "../models/slide-up-message.js";
6
6
  import se from "../in-app-message-manager-factory.js";
7
7
  import me from "../display/get-animation-effect.js";
8
- import de from "../display/in-app-message-to-html.js";
8
+ import ce from "../display/in-app-message-to-html.js";
9
9
  import { logInAppMessageImpression } from "../log-in-app-message-impression.js";
10
10
  import {
11
11
  ORIENTATION as fe,
12
- WindowUtils as Z,
12
+ WindowUtils as Y,
13
13
  } from "../../util/window-utils.js";
14
14
  import { isURIJavascriptOrData as N } from "../../util/url-utils.js";
15
- import { KeyCodes as lt } from "../../util/key-codes.js";
15
+ import { KeyCodes as at } from "../../util/key-codes.js";
16
16
  import { setupInAppMessageUI as ss } from "../../ui/js/index.js";
17
17
  import r from "../../../shared-lib/braze-shared-lib.js";
18
- import { toRgba as le } from "../../util/color-utils.js";
18
+ import { toRgba as ie } from "../../util/color-utils.js";
19
19
  import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../../common/constants.js";
20
20
  import { isIFrame as It } from "../utils/in-app-message-utils.js";
21
21
  export function showInAppMessage(s, t, o) {
@@ -52,8 +52,8 @@ export function showInAppMessage(s, t, o) {
52
52
  !1
53
53
  );
54
54
  }
55
- if (Z.ao()) {
56
- const e = Z.mo();
55
+ if (Y.ao()) {
56
+ const e = Y.mo();
57
57
  if (
58
58
  (e === fe.PORTRAIT &&
59
59
  s.orientation === InAppMessage.Orientation.LANDSCAPE) ||
@@ -110,7 +110,7 @@ export function showInAppMessage(s, t, o) {
110
110
  document.getElementsByTagName("head")[0].appendChild(t);
111
111
  }
112
112
  const m = s instanceof SlideUpMessage,
113
- l = de(
113
+ l = ce(
114
114
  s,
115
115
  () => {
116
116
  import("../../Feed/ui/show-feed.js").then((s) => {
@@ -122,7 +122,7 @@ export function showInAppMessage(s, t, o) {
122
122
  const o = document.createElement("div");
123
123
  if (
124
124
  ((o.className = "ab-page-blocker"),
125
- s.Ae() || (o.style.backgroundColor = le(s.frameColor)),
125
+ s.Ae() || (o.style.backgroundColor = ie(s.frameColor)),
126
126
  e.nn(L.lo) && (o.style.zIndex = e.nn(L.lo).toString()),
127
127
  a.appendChild(o),
128
128
  !e.nn(L.mh))
@@ -159,7 +159,7 @@ export function showInAppMessage(s, t, o) {
159
159
  It(t) &&
160
160
  t.contentWindow &&
161
161
  t.contentWindow.addEventListener("keydown", function (s) {
162
- s.keyCode === lt._h && e.closeMessage();
162
+ s.keyCode === at._h && e.closeMessage();
163
163
  });
164
164
  }
165
165
  logInAppMessageImpression(s),
@@ -1,5 +1,5 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import jt from "./utils/push-utils.js";
2
+ import vt from "./utils/push-utils.js";
3
3
  export function isPushBlocked() {
4
- if (e.rr()) return jt.isPushBlocked();
4
+ if (e.rr()) return vt.isPushBlocked();
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import jt from "./utils/push-utils.js";
2
+ import vt from "./utils/push-utils.js";
3
3
  export function isPushPermissionGranted() {
4
- if (e.rr()) return jt.isPushPermissionGranted();
4
+ if (e.rr()) return vt.isPushPermissionGranted();
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import jt from "./utils/push-utils.js";
2
+ import vt from "./utils/push-utils.js";
3
3
  export function isPushSupported() {
4
- if (e.rr()) return jt.isPushSupported();
4
+ if (e.rr()) return vt.isPushSupported();
5
5
  }
@@ -3,8 +3,8 @@ import ti from "../models/push-token.js";
3
3
  import r from "../../shared-lib/braze-shared-lib.js";
4
4
  import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
5
5
  import { User } from "../User/index.js";
6
- import { WindowUtils as Z } from "../util/window-utils.js";
7
- import jt from "./utils/push-utils.js";
6
+ import { WindowUtils as Y } from "../util/window-utils.js";
7
+ import vt from "./utils/push-utils.js";
8
8
  import { getErrorMessage as ei } from "../util/error-utils.js";
9
9
  export default class ea {
10
10
  constructor(i, t, e, s, r, n, o, u, h, a) {
@@ -13,7 +13,7 @@ export default class ea {
13
13
  (this.fn = e),
14
14
  (this.dn = r),
15
15
  (this.bn = n),
16
- (this.wt = o),
16
+ (this.yt = o),
17
17
  (this.yn = u),
18
18
  (this.gn = h),
19
19
  (this.u = a),
@@ -23,12 +23,12 @@ export default class ea {
23
23
  (this.wn = s + "/safari/" + t),
24
24
  (this.dn = r || "/service-worker.js"),
25
25
  (this.bn = n),
26
- (this.wt = o),
26
+ (this.yt = o),
27
27
  (this.yn = u || !1),
28
28
  (this.gn = h || !1),
29
29
  (this.u = a),
30
- (this.vn = jt.kn()),
31
- (this.Pn = jt.Dn());
30
+ (this.vn = vt.kn()),
31
+ (this.Pn = vt.Dn());
32
32
  }
33
33
  Sn() {
34
34
  return this.gn;
@@ -60,19 +60,19 @@ export default class ea {
60
60
  t
61
61
  );
62
62
  })(i);
63
- let r = null,
64
- n = null;
65
- const o = i;
66
- if (null != o.getKey)
63
+ let n = null,
64
+ o = null;
65
+ const u = i;
66
+ if (null != u.getKey)
67
67
  try {
68
- const i = Array.from(new Uint8Array(o.getKey("p256dh"))),
69
- t = Array.from(new Uint8Array(o.getKey("auth")));
70
- (r = btoa(String.fromCharCode.apply(null, i))),
71
- (n = btoa(String.fromCharCode.apply(null, t)));
68
+ const i = Array.from(new Uint8Array(u.getKey("p256dh"))),
69
+ t = Array.from(new Uint8Array(u.getKey("auth")));
70
+ (n = btoa(String.fromCharCode.apply(null, i))),
71
+ (o = btoa(String.fromCharCode.apply(null, t)));
72
72
  } catch (i) {
73
- if ("invalid arguments" !== ei(i)) throw i;
73
+ r.j.error(ei(i));
74
74
  }
75
- const u = ((i) => {
75
+ const h = ((i) => {
76
76
  let t;
77
77
  return i.options &&
78
78
  (t = i.options.applicationServerKey) &&
@@ -82,9 +82,9 @@ export default class ea {
82
82
  .replace(/\+/g, "-")
83
83
  .replace(/\//g, "_")
84
84
  : null;
85
- })(o);
86
- this.hn && this.hn._n(s, t, r, n, u),
87
- s && "function" == typeof e && e(s, r, n);
85
+ })(u);
86
+ this.hn && this.hn._n(s, t, n, o, h),
87
+ s && "function" == typeof e && e(s, n, o);
88
88
  }
89
89
  xn() {
90
90
  this.hn && this.hn.Nn(!0);
@@ -160,7 +160,7 @@ export default class ea {
160
160
  this.Un(i, new Date(), e);
161
161
  })
162
162
  .catch((i) => {
163
- jt.isPushBlocked()
163
+ vt.isPushBlocked()
164
164
  ? (r.j.info("Permission for push notifications was denied."),
165
165
  "function" == typeof s && s(!1))
166
166
  : (r.j.error("Push subscription failed: " + i),
@@ -188,7 +188,7 @@ export default class ea {
188
188
  (i.unregister(), r.j.info("Service worker successfully unregistered."));
189
189
  }
190
190
  subscribe(t, e) {
191
- if (!jt.isPushSupported())
191
+ if (!vt.isPushSupported())
192
192
  return r.j.info(ea.qn), void ("function" == typeof e && e(!1));
193
193
  if (this.vn) {
194
194
  if (!this.yn && null != window.location) {
@@ -198,7 +198,7 @@ export default class ea {
198
198
  -1 === i.indexOf(window.location.protocol) &&
199
199
  (i = window.location.protocol + "//" + i);
200
200
  const t = i.substr(0, i.lastIndexOf("/") + 1);
201
- if (0 !== Z.Cn().indexOf(t))
201
+ if (0 !== Y.Cn().indexOf(t))
202
202
  return (
203
203
  r.j.error(
204
204
  "Cannot subscribe to push from a path higher than the service worker location (tried to subscribe from " +
@@ -210,17 +210,17 @@ export default class ea {
210
210
  void ("function" == typeof e && e(!0))
211
211
  );
212
212
  }
213
- if (jt.isPushBlocked())
213
+ if (vt.isPushBlocked())
214
214
  return void this.Tn(
215
215
  "Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
216
216
  e,
217
217
  );
218
- if (this.wt && !this.wt.En() && 0 === this.wt.li())
218
+ if (this.yt && !this.yt.En() && 0 === this.yt.li())
219
219
  return (
220
220
  r.j.info(
221
221
  "Waiting for VAPID key from server config before subscribing to push.",
222
222
  ),
223
- void this.wt.Rn(() => {
223
+ void this.yt.Rn(() => {
224
224
  this.subscribe(t, e);
225
225
  })
226
226
  );
@@ -230,13 +230,13 @@ export default class ea {
230
230
  },
231
231
  n = () => {
232
232
  let i = "Permission for push notifications was ignored.";
233
- jt.isPushBlocked() &&
233
+ vt.isPushBlocked() &&
234
234
  (i +=
235
235
  " The browser has automatically blocked further permission requests for a period (probably 1 week)."),
236
236
  r.j.info(i),
237
237
  "function" == typeof e && e(!0);
238
238
  },
239
- o = jt.isPushPermissionGranted(),
239
+ o = vt.isPushPermissionGranted(),
240
240
  u = () => {
241
241
  !o &&
242
242
  this.hn &&
@@ -257,9 +257,9 @@ export default class ea {
257
257
  .then((n) => {
258
258
  let o = null;
259
259
  if (
260
- (this.wt &&
261
- null != this.wt.En() &&
262
- (o = r.On.Fn(this.wt.En())),
260
+ (this.yt &&
261
+ null != this.yt.En() &&
262
+ (o = r.On.Fn(this.yt.En())),
263
263
  n)
264
264
  ) {
265
265
  let u,
@@ -342,7 +342,7 @@ export default class ea {
342
342
  }
343
343
  }
344
344
  unsubscribe(i, t) {
345
- if (!jt.isPushSupported())
345
+ if (!vt.isPushSupported())
346
346
  return r.j.info(ea.qn), void ("function" == typeof t && t());
347
347
  this.vn
348
348
  ? navigator.serviceWorker.getRegistration().then((e) => {
@@ -1,4 +1,4 @@
1
- const jt = {
1
+ const vt = {
2
2
  kn: () =>
3
3
  "serviceWorker" in navigator &&
4
4
  "undefined" != typeof ServiceWorkerRegistration &&
@@ -9,28 +9,28 @@ const jt = {
9
9
  "pushNotification" in window.safari &&
10
10
  "function" == typeof window.safari.pushNotification.permission &&
11
11
  "function" == typeof window.safari.pushNotification.requestPermission,
12
- isPushSupported: () => jt.kn() || jt.Dn(),
12
+ isPushSupported: () => vt.kn() || vt.Dn(),
13
13
  isPushBlocked: () => {
14
14
  const i =
15
- jt.isPushSupported() &&
15
+ vt.isPushSupported() &&
16
16
  "Notification" in window &&
17
17
  null != window.Notification &&
18
18
  null != window.Notification.permission &&
19
19
  "denied" === window.Notification.permission,
20
20
  n =
21
- jt.isPushSupported() &&
21
+ vt.isPushSupported() &&
22
22
  (!("Notification" in window) || null == window.Notification);
23
23
  return i || n;
24
24
  },
25
25
  isPushPermissionGranted: () =>
26
- jt.isPushSupported() &&
26
+ vt.isPushSupported() &&
27
27
  "Notification" in window &&
28
28
  null != window.Notification &&
29
29
  null != window.Notification.permission &&
30
30
  "granted" === window.Notification.permission,
31
31
  Gr: () =>
32
- !jt.isPushBlocked() &&
33
- jt.isPushSupported() &&
34
- !jt.isPushPermissionGranted(),
32
+ !vt.isPushBlocked() &&
33
+ vt.isPushSupported() &&
34
+ !vt.isPushPermissionGranted(),
35
35
  };
36
- export default jt;
36
+ export default vt;
@@ -6,7 +6,7 @@ import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
6
6
  import { User } from "../User/index.js";
7
7
  export default class bt {
8
8
  constructor(t, s) {
9
- (this.wt = t), (this.u = s), (this.wt = t), (this.u = s);
9
+ (this.yt = t), (this.u = s), (this.yt = t), (this.u = s);
10
10
  }
11
11
  getUserId() {
12
12
  const t = this.u.tu(i.eu.su);
@@ -24,7 +24,7 @@ export default class bt {
24
24
  this.u.uu(i.eu.su, new _t(t)), s && this.u.ou(t);
25
25
  }
26
26
  setCustomUserAttribute(t, s) {
27
- if (this.wt.hu(t))
27
+ if (this.yt.hu(t))
28
28
  return (
29
29
  r.j.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1
30
30
  );
@@ -52,10 +52,10 @@ export default class bt {
52
52
  this.nu("custom_push_public_key", e, !1, !0),
53
53
  this.nu("custom_push_user_auth", u, !1, !0),
54
54
  this.nu("custom_push_vapid_public_key", o, !1, !0);
55
- const h = r.zt.Ft,
56
- n = new r.xt(h, r.j),
55
+ const h = r.ts.Zt,
56
+ n = new r.es(h, r.j),
57
57
  l = new ti(t, s, e, u, o);
58
- this.u.D(i.k.Bn, l.ss()), n.setItem(h.Jt.cu, h.ie, !0);
58
+ this.u.D(i.k.Bn, l.tt()), n.setItem(h.rs.cu, h.ie, !0);
59
59
  }
60
60
  Nn(t) {
61
61
  if (
@@ -65,9 +65,9 @@ export default class bt {
65
65
  this.nu("custom_push_vapid_public_key", null, !1, !0),
66
66
  t)
67
67
  ) {
68
- const t = r.zt.Ft,
69
- s = new r.xt(t, r.j);
70
- this.u.D(i.k.Bn, !1), s.setItem(t.Jt.cu, t.ie, !1);
68
+ const t = r.ts.Zt,
69
+ s = new r.es(t, r.j);
70
+ this.u.D(i.k.Bn, !1), s.setItem(t.rs.cu, t.ie, !1);
71
71
  }
72
72
  }
73
73
  }