@braze/web-sdk 6.3.0 → 6.4.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 (132) hide show
  1. package/index.d.ts +35 -3
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +23 -23
  5. package/shared-lib/guid.js +25 -6
  6. package/shared-lib/indexed-db-adapter.js +7 -7
  7. package/shared-lib/logger.js +2 -2
  8. package/shared-lib/supported-options.js +22 -21
  9. package/src/Banner/display/banner-to-html.js +2 -2
  10. package/src/Banner/display/detect-banner-impressions.js +7 -7
  11. package/src/Banner/index.js +2 -0
  12. package/src/Banner/request-banners-refresh.js +6 -6
  13. package/src/Banner/ui/insert-banner.js +4 -4
  14. package/src/Card/card-manager-factory.js +5 -5
  15. package/src/Card/card-manager.js +4 -4
  16. package/src/Card/display/card-display.js +7 -7
  17. package/src/Card/log-card-dismissal.js +3 -3
  18. package/src/Card/log-content-card-click.js +3 -3
  19. package/src/Card/log-content-card-impressions.js +6 -6
  20. package/src/Card/models/card.js +7 -7
  21. package/src/Card/util/card-factory.js +6 -6
  22. package/src/ContentCards/content-cards-provider-factory.js +14 -10
  23. package/src/ContentCards/content-cards-provider.js +28 -28
  24. package/src/ContentCards/content-cards.js +4 -4
  25. package/src/ContentCards/get-cached-content-cards.js +2 -2
  26. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  27. package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
  28. package/src/ContentCards/ui/show-content-cards.js +8 -8
  29. package/src/Core/add-sdk-metadata.js +2 -2
  30. package/src/Core/change-user.js +5 -5
  31. package/src/Core/disable-sdk.js +3 -3
  32. package/src/Core/enable-sdk.js +3 -3
  33. package/src/Core/get-user.js +1 -1
  34. package/src/Core/is-disabled.js +1 -1
  35. package/src/Core/log-custom-event.js +9 -9
  36. package/src/Core/log-purchase.js +7 -7
  37. package/src/Core/open-session.js +11 -11
  38. package/src/Core/set-sdk-authentication-signature.js +2 -2
  39. package/src/Core/wipe-data.js +5 -5
  40. package/src/DUST/dust-provider-factory.js +20 -0
  41. package/src/DUST/dust-provider.js +288 -0
  42. package/src/DUST/index.js +3 -0
  43. package/src/DUST/subscribe-to-dust.js +24 -0
  44. package/src/DUST/types.js +1 -0
  45. package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
  46. package/src/FeatureFlags/feature-flags-provider.js +38 -38
  47. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  48. package/src/FeatureFlags/get-feature-flag.js +3 -3
  49. package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
  50. package/src/FeatureFlags/refresh-feature-flags.js +5 -5
  51. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
  52. package/src/InAppMessage/defer-in-app-message.js +1 -1
  53. package/src/InAppMessage/display/html-message-to-html.js +5 -5
  54. package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
  55. package/src/InAppMessage/display/modal-utils.js +5 -5
  56. package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
  57. package/src/InAppMessage/in-app-message-factory.js +4 -4
  58. package/src/InAppMessage/in-app-message-manager.js +80 -80
  59. package/src/InAppMessage/log-in-app-message-button-click.js +5 -5
  60. package/src/InAppMessage/log-in-app-message-click.js +5 -5
  61. package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
  62. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  63. package/src/InAppMessage/models/control-message.js +1 -1
  64. package/src/InAppMessage/models/full-screen-message.js +12 -12
  65. package/src/InAppMessage/models/html-message.js +14 -14
  66. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  67. package/src/InAppMessage/models/in-app-message.js +119 -121
  68. package/src/InAppMessage/models/modal-message.js +12 -12
  69. package/src/InAppMessage/models/slide-up-message.js +21 -21
  70. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  71. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  72. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  73. package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +18 -0
  74. package/src/InAppMessage/ui/show-in-app-message.js +24 -24
  75. package/src/Push/is-push-blocked.js +2 -2
  76. package/src/Push/is-push-permission-granted.js +2 -2
  77. package/src/Push/is-push-supported.js +2 -2
  78. package/src/Push/push-manager-factory.js +8 -8
  79. package/src/Push/push-manager.js +90 -90
  80. package/src/Push/utils/push-utils.js +17 -17
  81. package/src/User/user-manager.js +12 -12
  82. package/src/User/user.js +48 -48
  83. package/src/common/constants.js +1 -0
  84. package/src/common/content-cards-display.js +20 -20
  85. package/src/common/event-logger.js +4 -4
  86. package/src/common/properties-base.js +16 -16
  87. package/src/l10n/l10n-manager-factory.js +2 -2
  88. package/src/l10n/l10n-manager.js +1 -1
  89. package/src/managers/auth-manager.js +29 -29
  90. package/src/managers/braze-instance.js +141 -133
  91. package/src/managers/device-manager.js +18 -18
  92. package/src/managers/network-manager.js +139 -139
  93. package/src/managers/server-config-manager.js +99 -82
  94. package/src/managers/session-manager.js +32 -32
  95. package/src/managers/storage-manager-factory.js +8 -8
  96. package/src/managers/storage-manager.js +76 -74
  97. package/src/managers/subscription-manager.js +10 -10
  98. package/src/models/backend-errors.js +5 -5
  99. package/src/models/braze-event.js +9 -9
  100. package/src/models/device.js +2 -2
  101. package/src/models/identifier.js +12 -12
  102. package/src/models/push-token.js +12 -12
  103. package/src/models/request-result.js +1 -1
  104. package/src/models/server-config.js +38 -34
  105. package/src/request-controller.js +136 -134
  106. package/src/triggers/models/custom-event-data.js +4 -4
  107. package/src/triggers/models/custom-event-property-data.js +5 -5
  108. package/src/triggers/models/filter-set.js +8 -8
  109. package/src/triggers/models/filter.js +30 -30
  110. package/src/triggers/models/in-app-message-click-data.js +1 -1
  111. package/src/triggers/models/purchase-data.js +1 -1
  112. package/src/triggers/models/purchase-property-data.js +2 -2
  113. package/src/triggers/models/push-click-data.js +1 -1
  114. package/src/triggers/models/trigger-condition.js +36 -36
  115. package/src/triggers/models/trigger-events.js +2 -2
  116. package/src/triggers/models/trigger.js +15 -15
  117. package/src/triggers/triggers-provider-factory.js +3 -3
  118. package/src/triggers/triggers-provider.js +25 -25
  119. package/src/ui/js/attach-css.js +3 -3
  120. package/src/ui/js/load-font-awesome.js +2 -2
  121. package/src/util/base-device-parser.js +3 -3
  122. package/src/util/braze-actions.js +3 -3
  123. package/src/util/browser-detector.js +13 -13
  124. package/src/util/client-hints-parser.js +6 -6
  125. package/src/util/component-utils.js +1 -1
  126. package/src/util/dom-utils.js +10 -10
  127. package/src/util/key-codes.js +1 -1
  128. package/src/util/net.js +1 -1
  129. package/src/util/request-header-utils.js +22 -22
  130. package/src/util/user-agent-parser.js +14 -14
  131. package/src/util/validation-utils.js +14 -13
  132. package/src/util/window-utils.js +1 -1
@@ -0,0 +1,18 @@
1
+ import { PAUSE_SCROLLING_CLASS as It } from "../../common/constants.js";
2
+ export function removeAllVisibleInAppMessages() {
3
+ const o = document.querySelectorAll(".ab-iam-root");
4
+ for (let t = 0; t < o.length; t++) {
5
+ const n = o[t];
6
+ if (n.id) {
7
+ const o = n.id + "-css",
8
+ t = document.getElementById(o);
9
+ t && t.parentNode && t.parentNode.removeChild(t);
10
+ }
11
+ n.parentNode && n.parentNode.removeChild(n);
12
+ }
13
+ const t = document.getElementsByClassName(It);
14
+ for (let o = 0; o < t.length; o++) {
15
+ const n = t[o].classList;
16
+ n.contains(It) && n.remove(It);
17
+ }
18
+ }
@@ -1,4 +1,4 @@
1
- import r, { OPTIONS as z } from "../../managers/braze-instance.js";
1
+ import r, { OPTIONS as q } from "../../managers/braze-instance.js";
2
2
  import ControlMessage from "../models/control-message.js";
3
3
  import HtmlMessage from "../models/html-message.js";
4
4
  import InAppMessage from "../models/in-app-message.js";
@@ -10,7 +10,7 @@ import {
10
10
  ORIENTATION as pe,
11
11
  WindowUtils as no,
12
12
  } from "../../util/window-utils.js";
13
- import { isURIJavascriptOrData as tt } from "../../util/url-utils.js";
13
+ import { isURIJavascriptOrData as Z } from "../../util/url-utils.js";
14
14
  import { KeyCodes as ie } from "../../util/key-codes.js";
15
15
  import { setupInAppMessageUI as ss } from "../../ui/js/index.js";
16
16
  import { logger as E } from "../../../shared-lib/index.js";
@@ -30,16 +30,16 @@ export function showInAppMessage(e, t, s) {
30
30
  );
31
31
  if (!(e instanceof InAppMessage)) return !1;
32
32
  if (e.constructor === InAppMessage) return !1;
33
- e._h();
33
+ e.mh();
34
34
  const o = e instanceof HtmlMessage;
35
- if (o && !e.trusted && !r.tr())
35
+ if (o && !e.trusted && !r.nr())
36
36
  return (
37
37
  E.error(
38
38
  'HTML in-app messages are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these messages.',
39
39
  ),
40
40
  !1
41
41
  );
42
- if ((null == t && (t = document.body), e.Ve())) {
42
+ if ((null == t && (t = document.body), e.We())) {
43
43
  if (t.querySelectorAll(".ab-modal-interactions").length > 0)
44
44
  return (
45
45
  E.info(
@@ -69,16 +69,16 @@ export function showInAppMessage(e, t, s) {
69
69
  );
70
70
  }
71
71
  }
72
- if (!r.tr()) {
72
+ if (!r.nr()) {
73
73
  let t = !1;
74
74
  if (e.buttons && e.buttons.length > 0) {
75
75
  const s = e.buttons;
76
76
  for (let e = 0; e < s.length; e++)
77
77
  if (s[e].clickAction === InAppMessage.ClickAction.URI) {
78
78
  const o = s[e].uri;
79
- t = tt(o);
79
+ t = Z(o);
80
80
  }
81
- } else e.clickAction === InAppMessage.ClickAction.URI && (t = tt(e.uri));
81
+ } else e.clickAction === InAppMessage.ClickAction.URI && (t = Z(e.uri));
82
82
  if (t)
83
83
  return (
84
84
  E.error(
@@ -92,37 +92,37 @@ export function showInAppMessage(e, t, s) {
92
92
  ((i.className = "ab-iam-root v3"),
93
93
  (i.className += me(e)),
94
94
  e.language && !o && (i.lang = e.language),
95
- e.Le() && (i.id = e.htmlId),
96
- r.ee(z.Jo) && (i.style.zIndex = (r.ee(z.Jo) + 1).toString()),
95
+ e.Pe() && (i.id = e.htmlId),
96
+ r.ee(q.Jo) && (i.style.zIndex = (r.ee(q.Jo) + 1).toString()),
97
97
  t.appendChild(i),
98
98
  e.Oe())
99
99
  ) {
100
100
  const t = document.createElement("style");
101
101
  (t.innerHTML = e.css),
102
- (t.id = e.Ge()),
103
- null != r.ee(z.er) && t.setAttribute("nonce", r.ee(z.er)),
102
+ (t.id = e.He()),
103
+ null != r.ee(q.er) && t.setAttribute("nonce", r.ee(q.er)),
104
104
  document.getElementsByTagName("head")[0].appendChild(t);
105
105
  }
106
106
  const n = e instanceof SlideUpMessage,
107
107
  a = le(
108
108
  e,
109
109
  (t) => {
110
- if (e.Ve() && e.Bo()) {
110
+ if (e.We() && e.Po()) {
111
111
  const s = document.createElement("div");
112
112
  if (
113
113
  ((s.className = "ab-page-blocker"),
114
114
  e.Oe() || (s.style.backgroundColor = ae(e.frameColor)),
115
- r.ee(z.Jo) && (s.style.zIndex = r.ee(z.Jo).toString()),
115
+ r.ee(q.Jo) && (s.style.zIndex = r.ee(q.Jo).toString()),
116
116
  i.appendChild(s),
117
- !r.ee(z.Lh))
117
+ !r.ee(q.Oh))
118
118
  ) {
119
119
  const o = new Date().valueOf();
120
120
  s.onclick = (s) => {
121
- new Date().valueOf() - o > InAppMessage.Ph &&
121
+ new Date().valueOf() - o > InAppMessage.bh &&
122
122
  (e.ll(t), s.stopPropagation());
123
123
  };
124
124
  }
125
- i.appendChild(t), t.focus(), e.Ah(i);
125
+ i.appendChild(t), t.focus(), e.ah(i);
126
126
  } else if (n) {
127
127
  const s = document.querySelectorAll(".ab-slideup");
128
128
  let o = null;
@@ -143,12 +143,12 @@ export function showInAppMessage(e, t, s) {
143
143
  o.offsetTop),
144
144
  (t.style.bottom = Math.max(e, 0) + "px");
145
145
  }
146
- } else if (o && !r.ee(z.Lh)) {
146
+ } else if (o && !r.ee(q.Oh)) {
147
147
  const s = e;
148
148
  At(t) &&
149
149
  t.contentWindow &&
150
150
  t.contentWindow.addEventListener("keydown", function (e) {
151
- e.keyCode === ie.Oh && s.closeMessage();
151
+ e.keyCode === ie.Ih && s.closeMessage();
152
152
  });
153
153
  }
154
154
  logInAppMessageImpression(e),
@@ -161,11 +161,11 @@ export function showInAppMessage(e, t, s) {
161
161
  (e) => {
162
162
  E.info(e);
163
163
  },
164
- r.ee(z.Do),
165
- r.ee(z.Jo),
166
- r.ee(z.er),
164
+ r.ee(q.To),
165
+ r.ee(q.Jo),
166
+ r.ee(q.er),
167
167
  t,
168
- fe.ea().So(),
168
+ fe.ea().Ho(),
169
169
  );
170
- return (o || n) && (i.appendChild(a), e.Ah(i)), !0;
170
+ return (o || n) && (i.appendChild(a), e.ah(i)), !0;
171
171
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import yt from "./utils/push-utils.js";
2
+ import vt from "./utils/push-utils.js";
3
3
  export function isPushBlocked() {
4
- if (r.rr()) return yt.isPushBlocked();
4
+ if (r.rr()) return vt.isPushBlocked();
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import yt from "./utils/push-utils.js";
2
+ import vt from "./utils/push-utils.js";
3
3
  export function isPushPermissionGranted() {
4
- if (r.rr()) return yt.isPushPermissionGranted();
4
+ if (r.rr()) return vt.isPushPermissionGranted();
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import yt from "./utils/push-utils.js";
2
+ import vt from "./utils/push-utils.js";
3
3
  export function isPushSupported() {
4
- if (r.rr()) return yt.isPushSupported();
4
+ if (r.rr()) return vt.isPushSupported();
5
5
  }
@@ -1,4 +1,4 @@
1
- import r, { OPTIONS as z } from "../managers/braze-instance.js";
1
+ import r, { OPTIONS as q } from "../managers/braze-instance.js";
2
2
  import na from "./push-manager.js";
3
3
  const ra = {
4
4
  i: !1,
@@ -7,16 +7,16 @@ const ra = {
7
7
  ra.t(),
8
8
  ra.aa ||
9
9
  (ra.aa = new na(
10
- r.gr(),
11
- r.ba(),
10
+ r.br(),
11
+ r.Ma(),
12
12
  r.de(),
13
13
  r.V(),
14
- r.ee(z.Ma),
15
- r.ee(z._a),
16
- r.ee(z.ka),
14
+ r.ee(q._a),
15
+ r.ee(q.Aa),
16
+ r.ee(q.Ba),
17
17
  r.l(),
18
- r.ee(z.qa),
19
- r.ee(z.Aa),
18
+ r.ee(q.Ca),
19
+ r.ee(q.Da),
20
20
  r.p(),
21
21
  )),
22
22
  ra.aa
@@ -1,43 +1,43 @@
1
- import { isArray as D, isEqual as ii } from "../util/code-utils.js";
1
+ import { isArray as z, isEqual as ii } from "../util/code-utils.js";
2
2
  import ti from "../models/push-token.js";
3
3
  import { logger as E, EncodingUtils as ei } from "../../shared-lib/index.js";
4
4
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
5
5
  import { User } from "../User/index.js";
6
- import yt from "./utils/push-utils.js";
6
+ import vt from "./utils/push-utils.js";
7
7
  import { getErrorMessage as si } from "../util/error-utils.js";
8
8
  export default class na {
9
9
  constructor(i, t, e, s, r, n, o, u, a, h, c) {
10
- (this.en = i),
11
- (this.sn = t),
12
- (this.on = e),
13
- (this.un = r),
14
- (this.an = n),
15
- (this.hn = o),
10
+ (this.wn = i),
11
+ (this.Pn = t),
12
+ (this.Dn = e),
13
+ (this.Sn = r),
14
+ (this.xn = n),
15
+ (this.Nn = o),
16
16
  (this.h = u),
17
- (this.cn = a),
18
- (this.fn = h),
17
+ (this.Un = a),
18
+ (this.Wn = h),
19
19
  (this.j = c),
20
- (this.en = i),
21
- (this.sn = t),
22
- (this.on = e),
23
- (this.ln = s + "/safari/" + t),
24
- (this.un = r || "/service-worker.js"),
25
- (this.hn = o),
20
+ (this.wn = i),
21
+ (this.Pn = t),
22
+ (this.Dn = e),
23
+ (this._n = s + "/safari/" + t),
24
+ (this.Sn = r || "/service-worker.js"),
25
+ (this.Nn = o),
26
26
  (this.h = u),
27
- (this.cn = a || !1),
28
- (this.fn = h || !1),
27
+ (this.Un = a || !1),
28
+ (this.Wn = h || !1),
29
29
  (this.j = c),
30
- (this.dn = yt.pn()),
31
- (this.bn = yt.yn());
30
+ (this.Vn = vt.qn()),
31
+ (this.zn = vt.En());
32
32
  }
33
- mn() {
34
- return this.fn;
33
+ Rn() {
34
+ return this.Wn;
35
35
  }
36
- gn(i, t, e, s, r) {
36
+ Cn(i, t, e, s, r) {
37
37
  i.unsubscribe()
38
38
  .then((i) => {
39
39
  i
40
- ? this.vn(t, e, s, r)
40
+ ? this.Fn(t, e, s, r)
41
41
  : (E.error("Failed to unsubscribe device from push."),
42
42
  "function" == typeof r && r(!1));
43
43
  })
@@ -46,7 +46,7 @@ export default class na {
46
46
  "function" == typeof r && r(!1);
47
47
  });
48
48
  }
49
- wn(i, t, e) {
49
+ On(i, t, e) {
50
50
  var s;
51
51
  const r = ((i) => {
52
52
  if ("string" == typeof i) return i;
@@ -55,9 +55,9 @@ export default class na {
55
55
  let t = i.endpoint;
56
56
  const e = i;
57
57
  return (
58
- e.kn &&
59
- -1 === i.endpoint.indexOf(e.kn) &&
60
- (t = i.endpoint + "/" + e.kn),
58
+ e.Bn &&
59
+ -1 === i.endpoint.indexOf(e.Bn) &&
60
+ (t = i.endpoint + "/" + e.Bn),
61
61
  t
62
62
  );
63
63
  })(i);
@@ -84,53 +84,53 @@ export default class na {
84
84
  .replace(/\//g, "_")
85
85
  : null;
86
86
  })(u);
87
- null === (s = this.en) || void 0 === s || s.Pn(r, t, n, o, a),
87
+ null === (s = this.wn) || void 0 === s || s.Yn(r, t, n, o, a),
88
88
  r && "function" == typeof e && e(r, n, o);
89
89
  }
90
- Dn() {
90
+ Gn() {
91
91
  var i;
92
- null === (i = this.en) || void 0 === i || i.Sn(!0);
92
+ null === (i = this.wn) || void 0 === i || i.Hn(!0);
93
93
  }
94
- An(i, t) {
94
+ Jn(i, t) {
95
95
  var e;
96
- null === (e = this.en) || void 0 === e || e.Sn(!1),
96
+ null === (e = this.wn) || void 0 === e || e.Hn(!1),
97
97
  E.info(i),
98
98
  "function" == typeof t && t(!1);
99
99
  }
100
- jn(i, t, e, s) {
100
+ Kn(i, t, e, s) {
101
101
  var r;
102
102
  if ("default" === t.permission)
103
103
  try {
104
104
  window.safari.pushNotification.requestPermission(
105
- this.ln,
105
+ this._n,
106
106
  i,
107
107
  {
108
- api_key: this.sn,
108
+ api_key: this.Pn,
109
109
  device_id:
110
- (null === (r = this.on) || void 0 === r ? void 0 : r.fe().id) ||
110
+ (null === (r = this.Dn) || void 0 === r ? void 0 : r.fe().id) ||
111
111
  "",
112
112
  },
113
113
  (t) => {
114
114
  "granted" === t.permission &&
115
- this.en &&
116
- this.en.setPushNotificationSubscriptionType(
115
+ this.wn &&
116
+ this.wn.setPushNotificationSubscriptionType(
117
117
  User.NotificationSubscriptionTypes.OPTED_IN,
118
118
  ),
119
- this.jn(i, t, e, s);
119
+ this.Kn(i, t, e, s);
120
120
  },
121
121
  );
122
122
  } catch (i) {
123
- this.An("Could not request permission for push: " + i, s);
123
+ this.Jn("Could not request permission for push: " + i, s);
124
124
  }
125
125
  else
126
126
  "denied" === t.permission
127
- ? this.An(
127
+ ? this.Jn(
128
128
  "The user has blocked notifications from this site, or Safari push is not configured in the Braze dashboard.",
129
129
  s,
130
130
  )
131
131
  : "granted" === t.permission &&
132
132
  (E.info("Device successfully subscribed to push."),
133
- this.wn(t.deviceToken, new Date(), e));
133
+ this.On(t.deviceToken, new Date(), e));
134
134
  }
135
135
  requestPermission(i, t, e) {
136
136
  const s = (s) => {
@@ -159,27 +159,27 @@ export default class na {
159
159
  : (r = !0);
160
160
  }
161
161
  }
162
- vn(i, t, e, s) {
162
+ Fn(i, t, e, s) {
163
163
  const r = { userVisibleOnly: !0 };
164
164
  null != t && (r.applicationServerKey = t),
165
165
  i.pushManager
166
166
  .subscribe(r)
167
167
  .then((i) => {
168
168
  E.info("Device successfully subscribed to push."),
169
- this.wn(i, new Date(), e);
169
+ this.On(i, new Date(), e);
170
170
  })
171
171
  .catch((i) => {
172
- yt.isPushBlocked()
172
+ vt.isPushBlocked()
173
173
  ? (E.info("Permission for push notifications was denied."),
174
174
  "function" == typeof s && s(!1))
175
175
  : (E.error("Push subscription failed: " + i),
176
176
  "function" == typeof s && s(!0));
177
177
  });
178
178
  }
179
- xn() {
180
- if (this.cn) return navigator.serviceWorker.getRegistration(this.un);
181
- const i = this.an ? { scope: this.an } : void 0;
182
- return navigator.serviceWorker.register(this.un, i).then(() =>
179
+ Ln() {
180
+ if (this.Un) return navigator.serviceWorker.getRegistration(this.Sn);
181
+ const i = this.xn ? { scope: this.xn } : void 0;
182
+ return navigator.serviceWorker.register(this.Sn, i).then(() =>
183
183
  navigator.serviceWorker.ready.then(
184
184
  (i) => (
185
185
  i &&
@@ -192,32 +192,32 @@ export default class na {
192
192
  ),
193
193
  );
194
194
  }
195
- Nn(i) {
196
- this.cn ||
195
+ Qn(i) {
196
+ this.Un ||
197
197
  (i.unregister(), E.info("Service worker successfully unregistered."));
198
198
  }
199
199
  subscribe(i, t) {
200
- if (!yt.isPushSupported())
201
- return E.info(na.Un), void ("function" == typeof t && t(!1));
202
- if (this.dn) {
203
- if (!this.cn && null != window.location) {
204
- let i = this.un;
200
+ if (!vt.isPushSupported())
201
+ return E.info(na.Xn), void ("function" == typeof t && t(!1));
202
+ if (this.Vn) {
203
+ if (!this.Un && null != window.location) {
204
+ let i = this.Sn;
205
205
  -1 === i.indexOf(window.location.host) &&
206
206
  (i = window.location.host + i),
207
207
  -1 === i.indexOf(window.location.protocol) &&
208
208
  (i = window.location.protocol + "//" + i);
209
209
  }
210
- if (yt.isPushBlocked())
211
- return void this.An(
210
+ if (vt.isPushBlocked())
211
+ return void this.Jn(
212
212
  "Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
213
213
  t,
214
214
  );
215
- if (this.h && !this.h.Wn() && 0 === this.h.Ft())
215
+ if (this.h && !this.h.Zn() && 0 === this.h.Ft())
216
216
  return (
217
217
  E.info(
218
218
  "Waiting for VAPID key from server config before subscribing to push.",
219
219
  ),
220
- void this.h._n(() => {
220
+ void this.h.$n(() => {
221
221
  this.subscribe(i, t);
222
222
  })
223
223
  );
@@ -227,20 +227,20 @@ export default class na {
227
227
  },
228
228
  r = () => {
229
229
  let i = "Permission for push notifications was ignored.";
230
- yt.isPushBlocked() &&
230
+ vt.isPushBlocked() &&
231
231
  (i +=
232
232
  " The browser has automatically blocked further permission requests for a period (probably 1 week)."),
233
233
  E.info(i),
234
234
  "function" == typeof t && t(!0);
235
235
  },
236
- n = yt.isPushPermissionGranted(),
236
+ n = vt.isPushPermissionGranted(),
237
237
  o = () => {
238
238
  !n &&
239
- this.en &&
240
- this.en.setPushNotificationSubscriptionType(
239
+ this.wn &&
240
+ this.wn.setPushNotificationSubscriptionType(
241
241
  User.NotificationSubscriptionTypes.OPTED_IN,
242
242
  ),
243
- this.xn()
243
+ this.Ln()
244
244
  .then((e) => {
245
245
  if (null == e)
246
246
  return (
@@ -258,16 +258,16 @@ export default class na {
258
258
  (null !=
259
259
  (null === (n = this.h) || void 0 === n
260
260
  ? void 0
261
- : n.Wn()) && (o = ei.Tn(this.h.Wn())),
261
+ : n.Zn()) && (o = ei.No(this.h.Zn())),
262
262
  r)
263
263
  ) {
264
264
  let n,
265
265
  u = null,
266
266
  a = null;
267
- if ((this.j && (n = this.j.lt(s.ct.In)), n && !D(n))) {
267
+ if ((this.j && (n = this.j.lt(s.ct.Wo)), n && !z(n))) {
268
268
  let i;
269
269
  try {
270
- i = ti.qn(n).Vn;
270
+ i = ti.Vo(n)._o;
271
271
  } catch (t) {
272
272
  i = null;
273
273
  }
@@ -291,31 +291,31 @@ export default class na {
291
291
  : E.info(
292
292
  "Attempting to upgrade a gcm_sender_id-based push registration to VAPID - depending on the browser this may or may not result in the same gcm_sender_id-based subscription.",
293
293
  ),
294
- this.gn(r, e, o, i, t))
294
+ this.Cn(r, e, o, i, t))
295
295
  : r.expirationTime &&
296
296
  new Date(r.expirationTime).valueOf() <=
297
297
  new Date().valueOf()
298
298
  ? (E.info(
299
299
  "Push subscription is expired, creating new subscription.",
300
300
  ),
301
- this.gn(r, e, o, i, t))
302
- : n && D(n)
303
- ? this.gn(r, e, o, i, t)
301
+ this.Cn(r, e, o, i, t))
302
+ : n && z(n)
303
+ ? this.Cn(r, e, o, i, t)
304
304
  : null == a
305
305
  ? (E.info(
306
306
  "No push subscription creation date found, creating new subscription.",
307
307
  ),
308
- this.gn(r, e, o, i, t))
308
+ this.Cn(r, e, o, i, t))
309
309
  : a.valueOf() <= new Date().valueOf()
310
310
  ? (E.info(
311
311
  "Push subscription older than 6 months, creating new subscription.",
312
312
  ),
313
- this.gn(r, e, o, i, t))
313
+ this.Cn(r, e, o, i, t))
314
314
  : (E.info(
315
315
  "Device already subscribed to push, sending existing subscription to backend.",
316
316
  ),
317
- this.wn(r, u, i));
318
- } else this.vn(e, o, i, t);
317
+ this.On(r, u, i));
318
+ } else this.Fn(e, o, i, t);
319
319
  })
320
320
  .catch((i) => {
321
321
  E.error("Error checking current push subscriptions: " + i);
@@ -326,29 +326,29 @@ export default class na {
326
326
  });
327
327
  };
328
328
  this.requestPermission(o, r, e);
329
- } else if (this.bn) {
330
- if (null == this.hn || "" === this.hn)
329
+ } else if (this.zn) {
330
+ if (null == this.Nn || "" === this.Nn)
331
331
  return (
332
332
  E.error(
333
333
  "You must supply the safariWebsitePushId initialization option in order to use registerPush on Safari",
334
334
  ),
335
335
  void ("function" == typeof t && t(!0))
336
336
  );
337
- const e = window.safari.pushNotification.permission(this.hn);
338
- this.jn(this.hn, e, i, t);
337
+ const e = window.safari.pushNotification.permission(this.Nn);
338
+ this.Kn(this.Nn, e, i, t);
339
339
  }
340
340
  }
341
341
  unsubscribe(i, t) {
342
- if (!yt.isPushSupported())
343
- return E.info(na.Un), void ("function" == typeof t && t());
344
- this.dn
345
- ? navigator.serviceWorker.getRegistration(this.un).then((e) => {
342
+ if (!vt.isPushSupported())
343
+ return E.info(na.Xn), void ("function" == typeof t && t());
344
+ this.Vn
345
+ ? navigator.serviceWorker.getRegistration(this.Sn).then((e) => {
346
346
  e
347
347
  ? e.pushManager
348
348
  .getSubscription()
349
349
  .then((s) => {
350
350
  s
351
- ? (this.Dn(),
351
+ ? (this.Gn(),
352
352
  s
353
353
  .unsubscribe()
354
354
  .then((s) => {
@@ -361,7 +361,7 @@ export default class na {
361
361
  "Failed to unsubscribe device from push.",
362
362
  ),
363
363
  "function" == typeof t && t()),
364
- this.Nn(e);
364
+ this.Qn(e);
365
365
  })
366
366
  .catch((i) => {
367
367
  E.error("Push unsubscription error: " + i),
@@ -377,10 +377,10 @@ export default class na {
377
377
  : (E.info("Device already unsubscribed from push."),
378
378
  "function" == typeof i && i());
379
379
  })
380
- : this.bn &&
381
- (this.Dn(),
380
+ : this.zn &&
381
+ (this.Gn(),
382
382
  E.info("Device unsubscribed from push."),
383
383
  "function" == typeof i && i());
384
384
  }
385
385
  }
386
- na.Un = "Push notifications are not supported in this browser.";
386
+ na.Xn = "Push notifications are not supported in this browser.";
@@ -1,46 +1,46 @@
1
- const yt = {
2
- pn: () =>
1
+ const vt = {
2
+ qn: () =>
3
3
  "serviceWorker" in navigator &&
4
4
  "undefined" != typeof ServiceWorkerRegistration &&
5
5
  "showNotification" in ServiceWorkerRegistration.prototype &&
6
6
  "PushManager" in window,
7
- yn: () =>
7
+ En: () =>
8
8
  "safari" in window &&
9
9
  "pushNotification" in window.safari &&
10
10
  "function" == typeof window.safari.pushNotification.permission &&
11
11
  "function" == typeof window.safari.pushNotification.requestPermission,
12
- isPushSupported: () => yt.pn() || yt.yn(),
12
+ isPushSupported: () => vt.qn() || vt.En(),
13
13
  isPushBlocked: () => {
14
14
  const o =
15
- yt.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
  i =
21
- yt.isPushSupported() &&
21
+ vt.isPushSupported() &&
22
22
  (!("Notification" in window) || null == window.Notification);
23
23
  return o || i;
24
24
  },
25
25
  isPushPermissionGranted: () =>
26
- yt.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
- Qi: () =>
32
- yt.isPushBlocked()
33
- ? { Ui: !1, reason: "blocked" }
34
- : yt.isPushSupported()
35
- ? yt.isPushPermissionGranted()
36
- ? { Ui: !1, reason: "permissionGranted" }
37
- : { Ui: !0 }
38
- : { Ui: !1, reason: "unsupported" },
39
- Vi: (o, i) =>
31
+ en: () =>
32
+ vt.isPushBlocked()
33
+ ? { sn: !1, reason: "blocked" }
34
+ : vt.isPushSupported()
35
+ ? vt.isPushPermissionGranted()
36
+ ? { sn: !1, reason: "permissionGranted" }
37
+ : { sn: !0 }
38
+ : { sn: !1, reason: "unsupported" },
39
+ on: (o, i) =>
40
40
  "blocked" === o
41
41
  ? `${i} containing a push prompt is not being shown because the user has already declined push permission prompt.`
42
42
  : "unsupported" === o
43
43
  ? `${i} containing a push prompt is not being shown because the browser doesn't support push notifications.`
44
44
  : `${i} containing a push prompt is not being shown because the user has already accepted the permission prompt.`,
45
45
  };
46
- export default yt;
46
+ export default vt;