@braze/web-sdk 6.0.0 → 6.1.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 (147) hide show
  1. package/index.d.ts +103 -33
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +22 -22
  5. package/shared-lib/guid.js +3 -3
  6. package/shared-lib/indexed-db-adapter.js +19 -19
  7. package/shared-lib/logger.js +18 -18
  8. package/shared-lib/supported-options.js +15 -15
  9. package/src/Banner/banner-factory.js +2 -1
  10. package/src/Banner/banner-provider-factory.js +7 -7
  11. package/src/Banner/banner-provider.js +92 -98
  12. package/src/Banner/banner.js +21 -18
  13. package/src/Banner/display/banner-to-html.js +9 -9
  14. package/src/Banner/display/destroy-banner-html.js +2 -2
  15. package/src/Banner/display/detect-banner-impressions.js +2 -2
  16. package/src/Banner/get-all-banners.js +5 -5
  17. package/src/Banner/get-banner.js +7 -7
  18. package/src/Banner/log-banner-click.js +7 -7
  19. package/src/Banner/log-banner-impressions.js +9 -9
  20. package/src/Banner/request-banners-refresh.js +16 -20
  21. package/src/Banner/subscribe-to-banners-updates.js +7 -7
  22. package/src/Banner/ui/insert-banner.js +6 -6
  23. package/src/Card/card-manager-factory.js +7 -7
  24. package/src/Card/card-manager.js +35 -35
  25. package/src/Card/display/card-display.js +11 -11
  26. package/src/Card/log-card-dismissal.js +4 -4
  27. package/src/Card/log-content-card-click.js +4 -4
  28. package/src/Card/log-content-card-impressions.js +6 -6
  29. package/src/Card/models/captioned-image.js +21 -21
  30. package/src/Card/models/card.js +68 -68
  31. package/src/Card/models/classic-card.js +21 -21
  32. package/src/Card/models/control-card.js +11 -11
  33. package/src/Card/models/image-only.js +18 -18
  34. package/src/Card/util/card-factory.js +35 -35
  35. package/src/ContentCards/content-cards-provider-factory.js +13 -13
  36. package/src/ContentCards/content-cards-provider.js +136 -136
  37. package/src/ContentCards/get-cached-content-cards.js +2 -2
  38. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  39. package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
  40. package/src/ContentCards/ui/show-content-cards.js +7 -7
  41. package/src/Core/add-sdk-metadata.js +3 -3
  42. package/src/Core/change-user.js +7 -7
  43. package/src/Core/destroy.js +2 -2
  44. package/src/Core/disable-sdk.js +8 -8
  45. package/src/Core/enable-sdk.js +6 -6
  46. package/src/Core/get-device-id.js +4 -4
  47. package/src/Core/handle-braze-action.js +5 -5
  48. package/src/Core/is-disabled.js +1 -1
  49. package/src/Core/log-custom-event.js +10 -10
  50. package/src/Core/log-purchase.js +13 -13
  51. package/src/Core/open-session.js +10 -10
  52. package/src/Core/set-logger.js +2 -2
  53. package/src/Core/set-sdk-authentication-signature.js +2 -2
  54. package/src/Core/toggle-logging.js +2 -2
  55. package/src/Core/wipe-data.js +7 -7
  56. package/src/FeatureFlags/feature-flag-factory.js +10 -10
  57. package/src/FeatureFlags/feature-flag.js +20 -71
  58. package/src/FeatureFlags/feature-flags-provider-factory.js +12 -12
  59. package/src/FeatureFlags/feature-flags-provider.js +87 -87
  60. package/src/FeatureFlags/get-all-feature-flags.js +4 -4
  61. package/src/FeatureFlags/get-feature-flag.js +4 -4
  62. package/src/FeatureFlags/log-feature-flag-impression.js +9 -9
  63. package/src/FeatureFlags/refresh-feature-flags.js +2 -2
  64. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
  65. package/src/InAppMessage/defer-in-app-message.js +4 -4
  66. package/src/InAppMessage/display/html-message-to-html.js +10 -10
  67. package/src/InAppMessage/display/in-app-message-to-html.js +28 -28
  68. package/src/InAppMessage/display/modal-utils.js +7 -7
  69. package/src/InAppMessage/in-app-message-factory.js +15 -15
  70. package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
  71. package/src/InAppMessage/in-app-message-manager.js +100 -100
  72. package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
  73. package/src/InAppMessage/log-in-app-message-click.js +6 -6
  74. package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
  75. package/src/InAppMessage/log-in-app-message-impression.js +4 -4
  76. package/src/InAppMessage/models/control-message.js +4 -4
  77. package/src/InAppMessage/models/full-screen-message.js +35 -35
  78. package/src/InAppMessage/models/html-message.js +21 -21
  79. package/src/InAppMessage/models/in-app-message-button.js +5 -5
  80. package/src/InAppMessage/models/in-app-message.js +75 -75
  81. package/src/InAppMessage/models/modal-message.js +34 -34
  82. package/src/InAppMessage/models/slide-up-message.js +31 -31
  83. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  84. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  85. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  86. package/src/InAppMessage/ui/show-in-app-message.js +19 -19
  87. package/src/Push/push-manager-factory.js +9 -9
  88. package/src/Push/push-manager.js +118 -118
  89. package/src/Push/utils/push-utils.js +9 -9
  90. package/src/User/user-manager.js +20 -20
  91. package/src/User/user.js +44 -45
  92. package/src/common/base-provider.js +1 -1
  93. package/src/common/content-cards-display.js +18 -18
  94. package/src/common/event-logger.js +10 -10
  95. package/src/common/properties-base.js +56 -0
  96. package/src/l10n/l10n-manager-factory.js +7 -7
  97. package/src/l10n/l10n-manager.js +4 -4
  98. package/src/managers/auth-manager.js +32 -32
  99. package/src/managers/braze-instance.js +143 -143
  100. package/src/managers/device-manager.js +22 -22
  101. package/src/managers/network-manager.js +172 -168
  102. package/src/managers/server-config-manager.js +73 -73
  103. package/src/managers/session-manager.js +40 -40
  104. package/src/managers/storage-manager-factory.js +6 -6
  105. package/src/managers/storage-manager.js +97 -97
  106. package/src/managers/subscription-manager.js +12 -12
  107. package/src/managers/utils.js +1 -1
  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 +12 -12
  112. package/src/models/push-token.js +13 -13
  113. package/src/models/request-result.js +4 -4
  114. package/src/models/server-config.js +31 -31
  115. package/src/request-controller.js +159 -159
  116. package/src/triggers/models/custom-event-data.js +1 -1
  117. package/src/triggers/models/custom-event-property-data.js +2 -2
  118. package/src/triggers/models/filter-set.js +6 -6
  119. package/src/triggers/models/filter.js +26 -26
  120. package/src/triggers/models/in-app-message-click-data.js +1 -1
  121. package/src/triggers/models/purchase-data.js +1 -1
  122. package/src/triggers/models/purchase-property-data.js +2 -2
  123. package/src/triggers/models/push-click-data.js +1 -1
  124. package/src/triggers/models/trigger-condition.js +37 -37
  125. package/src/triggers/models/trigger-events.js +3 -3
  126. package/src/triggers/models/trigger.js +16 -16
  127. package/src/triggers/triggers-provider-factory.js +12 -12
  128. package/src/triggers/triggers-provider.js +61 -61
  129. package/src/ui/js/attach-css.js +1 -1
  130. package/src/ui/js/load-font-awesome.js +1 -1
  131. package/src/util/base-device-parser.js +1 -1
  132. package/src/util/braze-actions.js +6 -6
  133. package/src/util/browser-detector.js +20 -13
  134. package/src/util/client-hints-parser.js +6 -6
  135. package/src/util/code-utils.js +2 -2
  136. package/src/util/component-utils.js +1 -1
  137. package/src/util/deprecation-utils.js +2 -2
  138. package/src/util/device-constants.js +4 -4
  139. package/src/util/dom-utils.js +9 -9
  140. package/src/util/html-display-utils.js +7 -7
  141. package/src/util/key-codes.js +1 -1
  142. package/src/util/net.js +12 -12
  143. package/src/util/request-header-utils.js +22 -22
  144. package/src/util/string-utils.js +2 -2
  145. package/src/util/user-agent-parser.js +16 -16
  146. package/src/util/validation-utils.js +12 -12
  147. package/src/util/window-utils.js +2 -2
@@ -13,7 +13,7 @@ import {
13
13
  import { isURIJavascriptOrData as tt } 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
- import { logger as N } from "../../../shared-lib/index.js";
16
+ import { logger as E } from "../../../shared-lib/index.js";
17
17
  import { toRgba as ae } from "../../util/color-utils.js";
18
18
  import { isIFrame as At } from "../utils/in-app-message-utils.js";
19
19
  import fe from "../../l10n/l10n-manager-factory.js";
@@ -22,7 +22,7 @@ export function showInAppMessage(e, t, s) {
22
22
  if ((ss(), null == e)) return !1;
23
23
  if (e instanceof ControlMessage)
24
24
  return (
25
- N.info(
25
+ E.info(
26
26
  "User received control for a multivariate test, logging to Braze servers.",
27
27
  ),
28
28
  logInAppMessageImpression(e),
@@ -34,22 +34,22 @@ export function showInAppMessage(e, t, s) {
34
34
  const o = e instanceof HtmlMessage;
35
35
  if (o && !e.trusted && !r.tr())
36
36
  return (
37
- N.error(
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.vo())) {
42
+ if ((null == t && (t = document.body), e.Ve())) {
43
43
  if (t.querySelectorAll(".ab-modal-interactions").length > 0)
44
44
  return (
45
- N.info(
45
+ E.info(
46
46
  `Cannot show in-app message ${e.message} because another message is being shown.`,
47
47
  ),
48
48
  !1
49
49
  );
50
50
  }
51
51
  if (no.Uo()) {
52
- const t = no.No();
52
+ const t = no.$o();
53
53
  if (
54
54
  (t === pe.PORTRAIT &&
55
55
  e.orientation === InAppMessage.Orientation.LANDSCAPE) ||
@@ -62,7 +62,7 @@ export function showInAppMessage(e, t, s) {
62
62
  ? "portrait"
63
63
  : "landscape";
64
64
  return (
65
- N.info(
65
+ E.info(
66
66
  `Not showing ${o} in-app message ${e.message} because the screen is currently ${s}`,
67
67
  ),
68
68
  !1
@@ -81,7 +81,7 @@ export function showInAppMessage(e, t, s) {
81
81
  } else e.clickAction === InAppMessage.ClickAction.URI && (t = tt(e.uri));
82
82
  if (t)
83
83
  return (
84
- N.error(
84
+ E.error(
85
85
  'Javascript click actions are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these actions.',
86
86
  ),
87
87
  !1
@@ -92,14 +92,14 @@ 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.jo() && (i.id = e.htmlId),
96
- r.ee(z.Ko) && (i.style.zIndex = (r.ee(z.Ko) + 1).toString()),
95
+ e.Le() && (i.id = e.htmlId),
96
+ r.ee(z.Jo) && (i.style.zIndex = (r.ee(z.Jo) + 1).toString()),
97
97
  t.appendChild(i),
98
- e.lo())
98
+ e.Oe())
99
99
  ) {
100
100
  const t = document.createElement("style");
101
101
  (t.innerHTML = e.css),
102
- (t.id = e.do()),
102
+ (t.id = e.Ge()),
103
103
  null != r.ee(z.er) && t.setAttribute("nonce", r.ee(z.er)),
104
104
  document.getElementsByTagName("head")[0].appendChild(t);
105
105
  }
@@ -107,12 +107,12 @@ export function showInAppMessage(e, t, s) {
107
107
  a = le(
108
108
  e,
109
109
  (t) => {
110
- if (e.vo() && e.Po()) {
110
+ if (e.Ve() && e.Bo()) {
111
111
  const s = document.createElement("div");
112
112
  if (
113
113
  ((s.className = "ab-page-blocker"),
114
- e.lo() || (s.style.backgroundColor = ae(e.frameColor)),
115
- r.ee(z.Ko) && (s.style.zIndex = r.ee(z.Ko).toString()),
114
+ e.Oe() || (s.style.backgroundColor = ae(e.frameColor)),
115
+ r.ee(z.Jo) && (s.style.zIndex = r.ee(z.Jo).toString()),
116
116
  i.appendChild(s),
117
117
  !r.ee(z.Lh))
118
118
  ) {
@@ -159,13 +159,13 @@ export function showInAppMessage(e, t, s) {
159
159
  "function" == typeof s && s();
160
160
  },
161
161
  (e) => {
162
- N.info(e);
162
+ E.info(e);
163
163
  },
164
- r.ee(z.Qo),
165
- r.ee(z.Ko),
164
+ r.ee(z.Do),
165
+ r.ee(z.Jo),
166
166
  r.ee(z.er),
167
167
  t,
168
- fe.ea().Ro(),
168
+ fe.ea().So(),
169
169
  );
170
170
  return (o || n) && (i.appendChild(a), e.Ah(i)), !0;
171
171
  }
@@ -1,31 +1,31 @@
1
1
  import r, { OPTIONS as z } from "../managers/braze-instance.js";
2
2
  import na from "./push-manager.js";
3
3
  const ra = {
4
- l: !1,
4
+ i: !1,
5
5
  aa: null,
6
6
  ea: () => (
7
- ra.p(),
7
+ ra.t(),
8
8
  ra.aa ||
9
9
  (ra.aa = new na(
10
10
  r.gr(),
11
11
  r.ba(),
12
- r.ue(),
13
- r.Z(),
12
+ r.de(),
13
+ r.V(),
14
14
  r.ee(z.Ma),
15
15
  r.ee(z._a),
16
16
  r.ee(z.ka),
17
- r.v(),
17
+ r.l(),
18
18
  r.ee(z.qa),
19
19
  r.ee(z.Aa),
20
- r.j(),
20
+ r.p(),
21
21
  )),
22
22
  ra.aa
23
23
  ),
24
- p: () => {
25
- ra.l || (r.h(ra), (ra.l = !0));
24
+ t: () => {
25
+ ra.i || (r.g(ra), (ra.i = !0));
26
26
  },
27
27
  destroy: () => {
28
- (ra.aa = null), (ra.l = !1);
28
+ (ra.aa = null), (ra.i = !1);
29
29
  },
30
30
  };
31
31
  export default ra;
@@ -1,52 +1,52 @@
1
1
  import { isArray as D, isEqual as ii } from "../util/code-utils.js";
2
2
  import ti from "../models/push-token.js";
3
- import { logger as N, EncodingUtils as ei } from "../../shared-lib/index.js";
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
6
  import yt 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.sn = i),
11
- (this.on = t),
12
- (this.un = e),
13
- (this.an = r),
14
- (this.hn = n),
15
- (this.cn = o),
16
- (this.B = u),
17
- (this.fn = a),
18
- (this.ln = h),
19
- (this.C = c),
20
- (this.sn = i),
21
- (this.on = t),
22
- (this.un = e),
23
- (this.dn = s + "/safari/" + t),
24
- (this.an = r || "/service-worker.js"),
25
- (this.cn = o),
26
- (this.B = u),
27
- (this.fn = a || !1),
28
- (this.ln = h || !1),
29
- (this.C = c),
30
- (this.pn = yt.bn()),
31
- (this.yn = yt.mn());
10
+ (this.en = i),
11
+ (this.sn = t),
12
+ (this.on = e),
13
+ (this.un = r),
14
+ (this.an = n),
15
+ (this.hn = o),
16
+ (this.h = u),
17
+ (this.cn = a),
18
+ (this.fn = h),
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),
26
+ (this.h = u),
27
+ (this.cn = a || !1),
28
+ (this.fn = h || !1),
29
+ (this.j = c),
30
+ (this.dn = yt.pn()),
31
+ (this.bn = yt.yn());
32
32
  }
33
- gn() {
34
- return this.ln;
33
+ mn() {
34
+ return this.fn;
35
35
  }
36
- vn(i, t, e, s, r) {
36
+ gn(i, t, e, s, r) {
37
37
  i.unsubscribe()
38
38
  .then((i) => {
39
39
  i
40
- ? this.wn(t, e, s, r)
41
- : (N.error("Failed to unsubscribe device from push."),
40
+ ? this.vn(t, e, s, r)
41
+ : (E.error("Failed to unsubscribe device from push."),
42
42
  "function" == typeof r && r(!1));
43
43
  })
44
44
  .catch((i) => {
45
- N.error("Push unsubscription error: " + i),
45
+ E.error("Push unsubscription error: " + i),
46
46
  "function" == typeof r && r(!1);
47
47
  });
48
48
  }
49
- kn(i, t, e) {
49
+ wn(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.Pn &&
59
- -1 === i.endpoint.indexOf(e.Pn) &&
60
- (t = i.endpoint + "/" + e.Pn),
58
+ e.kn &&
59
+ -1 === i.endpoint.indexOf(e.kn) &&
60
+ (t = i.endpoint + "/" + e.kn),
61
61
  t
62
62
  );
63
63
  })(i);
@@ -71,7 +71,7 @@ export default class na {
71
71
  (n = btoa(String.fromCharCode.apply(null, i))),
72
72
  (o = btoa(String.fromCharCode.apply(null, t)));
73
73
  } catch (i) {
74
- N.error(si(i));
74
+ E.error(si(i));
75
75
  }
76
76
  const a = ((i) => {
77
77
  let t;
@@ -84,53 +84,53 @@ export default class na {
84
84
  .replace(/\//g, "_")
85
85
  : null;
86
86
  })(u);
87
- null === (s = this.sn) || void 0 === s || s.Dn(r, t, n, o, a),
87
+ null === (s = this.en) || void 0 === s || s.Pn(r, t, n, o, a),
88
88
  r && "function" == typeof e && e(r, n, o);
89
89
  }
90
- Sn() {
90
+ Dn() {
91
91
  var i;
92
- null === (i = this.sn) || void 0 === i || i.An(!0);
92
+ null === (i = this.en) || void 0 === i || i.Sn(!0);
93
93
  }
94
- jn(i, t) {
94
+ An(i, t) {
95
95
  var e;
96
- null === (e = this.sn) || void 0 === e || e.An(!1),
97
- N.info(i),
96
+ null === (e = this.en) || void 0 === e || e.Sn(!1),
97
+ E.info(i),
98
98
  "function" == typeof t && t(!1);
99
99
  }
100
- xn(i, t, e, s) {
100
+ jn(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.dn,
105
+ this.ln,
106
106
  i,
107
107
  {
108
- api_key: this.on,
108
+ api_key: this.sn,
109
109
  device_id:
110
- (null === (r = this.un) || void 0 === r ? void 0 : r.ve().id) ||
110
+ (null === (r = this.on) || void 0 === r ? void 0 : r.fe().id) ||
111
111
  "",
112
112
  },
113
113
  (t) => {
114
114
  "granted" === t.permission &&
115
- this.sn &&
116
- this.sn.setPushNotificationSubscriptionType(
115
+ this.en &&
116
+ this.en.setPushNotificationSubscriptionType(
117
117
  User.NotificationSubscriptionTypes.OPTED_IN,
118
118
  ),
119
- this.xn(i, t, e, s);
119
+ this.jn(i, t, e, s);
120
120
  },
121
121
  );
122
122
  } catch (i) {
123
- this.jn("Could not request permission for push: " + i, s);
123
+ this.An("Could not request permission for push: " + i, s);
124
124
  }
125
125
  else
126
126
  "denied" === t.permission
127
- ? this.jn(
127
+ ? this.An(
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
- (N.info("Device successfully subscribed to push."),
133
- this.kn(t.deviceToken, new Date(), e));
132
+ (E.info("Device successfully subscribed to push."),
133
+ this.wn(t.deviceToken, new Date(), e));
134
134
  }
135
135
  requestPermission(i, t, e) {
136
136
  const s = (s) => {
@@ -142,7 +142,7 @@ export default class na {
142
142
  case "denied":
143
143
  return void ("function" == typeof e && e());
144
144
  default:
145
- N.error("Received unexpected permission result " + s);
145
+ E.error("Received unexpected permission result " + s);
146
146
  }
147
147
  };
148
148
  let r = !1;
@@ -159,70 +159,70 @@ export default class na {
159
159
  : (r = !0);
160
160
  }
161
161
  }
162
- wn(i, t, e, s) {
162
+ vn(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
- N.info("Device successfully subscribed to push."),
169
- this.kn(i, new Date(), e);
168
+ E.info("Device successfully subscribed to push."),
169
+ this.wn(i, new Date(), e);
170
170
  })
171
171
  .catch((i) => {
172
172
  yt.isPushBlocked()
173
- ? (N.info("Permission for push notifications was denied."),
173
+ ? (E.info("Permission for push notifications was denied."),
174
174
  "function" == typeof s && s(!1))
175
- : (N.error("Push subscription failed: " + i),
175
+ : (E.error("Push subscription failed: " + i),
176
176
  "function" == typeof s && s(!0));
177
177
  });
178
178
  }
179
- Nn() {
180
- if (this.fn) return navigator.serviceWorker.getRegistration(this.an);
181
- const i = this.hn ? { scope: this.hn } : void 0;
182
- return navigator.serviceWorker.register(this.an, i).then(() =>
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(() =>
183
183
  navigator.serviceWorker.ready.then(
184
184
  (i) => (
185
185
  i &&
186
186
  "function" == typeof i.update &&
187
187
  i.update().catch((i) => {
188
- N.info("ServiceWorker update failed: " + i);
188
+ E.info("ServiceWorker update failed: " + i);
189
189
  }),
190
190
  i
191
191
  ),
192
192
  ),
193
193
  );
194
194
  }
195
- Un(i) {
196
- this.fn ||
197
- (i.unregister(), N.info("Service worker successfully unregistered."));
195
+ Nn(i) {
196
+ this.cn ||
197
+ (i.unregister(), E.info("Service worker successfully unregistered."));
198
198
  }
199
199
  subscribe(i, t) {
200
200
  if (!yt.isPushSupported())
201
- return N.info(na.Wn), void ("function" == typeof t && t(!1));
202
- if (this.pn) {
203
- if (!this.fn && null != window.location) {
204
- let i = this.an;
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;
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
210
  if (yt.isPushBlocked())
211
- return void this.jn(
211
+ return void this.An(
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.B && !this.B._n() && 0 === this.B.Et())
215
+ if (this.h && !this.h.Wn() && 0 === this.h.Ft())
216
216
  return (
217
- N.info(
217
+ E.info(
218
218
  "Waiting for VAPID key from server config before subscribing to push.",
219
219
  ),
220
- void this.B.Tn(() => {
220
+ void this.h._n(() => {
221
221
  this.subscribe(i, t);
222
222
  })
223
223
  );
224
224
  const e = () => {
225
- N.info("Permission for push notifications was denied."),
225
+ E.info("Permission for push notifications was denied."),
226
226
  "function" == typeof t && t(!1);
227
227
  },
228
228
  r = () => {
@@ -230,21 +230,21 @@ export default class na {
230
230
  yt.isPushBlocked() &&
231
231
  (i +=
232
232
  " The browser has automatically blocked further permission requests for a period (probably 1 week)."),
233
- N.info(i),
233
+ E.info(i),
234
234
  "function" == typeof t && t(!0);
235
235
  },
236
236
  n = yt.isPushPermissionGranted(),
237
237
  o = () => {
238
238
  !n &&
239
- this.sn &&
240
- this.sn.setPushNotificationSubscriptionType(
239
+ this.en &&
240
+ this.en.setPushNotificationSubscriptionType(
241
241
  User.NotificationSubscriptionTypes.OPTED_IN,
242
242
  ),
243
- this.Nn()
243
+ this.xn()
244
244
  .then((e) => {
245
245
  if (null == e)
246
246
  return (
247
- N.error(
247
+ E.error(
248
248
  "No service worker registration. Set the `manageServiceWorkerExternally` initialization option to false or ensure that your service worker is registered before calling registerPush.",
249
249
  ),
250
250
  void ("function" == typeof t && t(!0))
@@ -256,18 +256,18 @@ export default class na {
256
256
  let o = null;
257
257
  if (
258
258
  (null !=
259
- (null === (n = this.B) || void 0 === n
259
+ (null === (n = this.h) || void 0 === n
260
260
  ? void 0
261
- : n._n()) && (o = ei.In(this.B._n())),
261
+ : n.Wn()) && (o = ei.Tn(this.h.Wn())),
262
262
  r)
263
263
  ) {
264
264
  let n,
265
265
  u = null,
266
266
  a = null;
267
- if ((this.C && (n = this.C.ft(s.gt.Vn)), n && !D(n))) {
267
+ if ((this.j && (n = this.j.lt(s.ct.In)), n && !D(n))) {
268
268
  let i;
269
269
  try {
270
- i = ti.zn(n).qn;
270
+ i = ti.qn(n).Vn;
271
271
  } catch (t) {
272
272
  i = null;
273
273
  }
@@ -285,102 +285,102 @@ export default class na {
285
285
  r.options.applicationServerKey.byteLength > 0 &&
286
286
  !ii(o, new Uint8Array(r.options.applicationServerKey))
287
287
  ? (r.options.applicationServerKey.byteLength > 12
288
- ? N.info(
288
+ ? E.info(
289
289
  "Device was already subscribed to push using a different VAPID provider, creating new subscription.",
290
290
  )
291
- : N.info(
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.vn(r, e, o, i, t))
294
+ this.gn(r, e, o, i, t))
295
295
  : r.expirationTime &&
296
296
  new Date(r.expirationTime).valueOf() <=
297
297
  new Date().valueOf()
298
- ? (N.info(
298
+ ? (E.info(
299
299
  "Push subscription is expired, creating new subscription.",
300
300
  ),
301
- this.vn(r, e, o, i, t))
301
+ this.gn(r, e, o, i, t))
302
302
  : n && D(n)
303
- ? this.vn(r, e, o, i, t)
303
+ ? this.gn(r, e, o, i, t)
304
304
  : null == a
305
- ? (N.info(
305
+ ? (E.info(
306
306
  "No push subscription creation date found, creating new subscription.",
307
307
  ),
308
- this.vn(r, e, o, i, t))
308
+ this.gn(r, e, o, i, t))
309
309
  : a.valueOf() <= new Date().valueOf()
310
- ? (N.info(
310
+ ? (E.info(
311
311
  "Push subscription older than 6 months, creating new subscription.",
312
312
  ),
313
- this.vn(r, e, o, i, t))
314
- : (N.info(
313
+ this.gn(r, e, o, i, t))
314
+ : (E.info(
315
315
  "Device already subscribed to push, sending existing subscription to backend.",
316
316
  ),
317
- this.kn(r, u, i));
318
- } else this.wn(e, o, i, t);
317
+ this.wn(r, u, i));
318
+ } else this.vn(e, o, i, t);
319
319
  })
320
320
  .catch((i) => {
321
- N.error("Error checking current push subscriptions: " + i);
321
+ E.error("Error checking current push subscriptions: " + i);
322
322
  });
323
323
  })
324
324
  .catch((i) => {
325
- N.error("ServiceWorker registration failed: " + i);
325
+ E.error("ServiceWorker registration failed: " + i);
326
326
  });
327
327
  };
328
328
  this.requestPermission(o, r, e);
329
- } else if (this.yn) {
330
- if (null == this.cn || "" === this.cn)
329
+ } else if (this.bn) {
330
+ if (null == this.hn || "" === this.hn)
331
331
  return (
332
- N.error(
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.cn);
338
- this.xn(this.cn, e, i, t);
337
+ const e = window.safari.pushNotification.permission(this.hn);
338
+ this.jn(this.hn, e, i, t);
339
339
  }
340
340
  }
341
341
  unsubscribe(i, t) {
342
342
  if (!yt.isPushSupported())
343
- return N.info(na.Wn), void ("function" == typeof t && t());
344
- this.pn
345
- ? navigator.serviceWorker.getRegistration(this.an).then((e) => {
343
+ return E.info(na.Un), void ("function" == typeof t && t());
344
+ this.dn
345
+ ? navigator.serviceWorker.getRegistration(this.un).then((e) => {
346
346
  e
347
347
  ? e.pushManager
348
348
  .getSubscription()
349
349
  .then((s) => {
350
350
  s
351
- ? (this.Sn(),
351
+ ? (this.Dn(),
352
352
  s
353
353
  .unsubscribe()
354
354
  .then((s) => {
355
355
  s
356
- ? (N.info(
356
+ ? (E.info(
357
357
  "Device successfully unsubscribed from push.",
358
358
  ),
359
359
  "function" == typeof i && i())
360
- : (N.error(
360
+ : (E.error(
361
361
  "Failed to unsubscribe device from push.",
362
362
  ),
363
363
  "function" == typeof t && t()),
364
- this.Un(e);
364
+ this.Nn(e);
365
365
  })
366
366
  .catch((i) => {
367
- N.error("Push unsubscription error: " + i),
367
+ E.error("Push unsubscription error: " + i),
368
368
  "function" == typeof t && t();
369
369
  }))
370
- : (N.info("Device already unsubscribed from push."),
370
+ : (E.info("Device already unsubscribed from push."),
371
371
  "function" == typeof i && i());
372
372
  })
373
373
  .catch((i) => {
374
- N.error("Error unsubscribing from push: " + i),
374
+ E.error("Error unsubscribing from push: " + i),
375
375
  "function" == typeof t && t();
376
376
  })
377
- : (N.info("Device already unsubscribed from push."),
377
+ : (E.info("Device already unsubscribed from push."),
378
378
  "function" == typeof i && i());
379
379
  })
380
- : this.yn &&
381
- (this.Sn(),
382
- N.info("Device unsubscribed from push."),
380
+ : this.bn &&
381
+ (this.Dn(),
382
+ E.info("Device unsubscribed from push."),
383
383
  "function" == typeof i && i());
384
384
  }
385
385
  }
386
- na.Wn = "Push notifications are not supported in this browser.";
386
+ na.Un = "Push notifications are not supported in this browser.";
@@ -1,15 +1,15 @@
1
1
  const yt = {
2
- bn: () =>
2
+ pn: () =>
3
3
  "serviceWorker" in navigator &&
4
4
  "undefined" != typeof ServiceWorkerRegistration &&
5
5
  "showNotification" in ServiceWorkerRegistration.prototype &&
6
6
  "PushManager" in window,
7
- mn: () =>
7
+ yn: () =>
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.bn() || yt.mn(),
12
+ isPushSupported: () => yt.pn() || yt.yn(),
13
13
  isPushBlocked: () => {
14
14
  const o =
15
15
  yt.isPushSupported() &&
@@ -28,15 +28,15 @@ const yt = {
28
28
  null != window.Notification &&
29
29
  null != window.Notification.permission &&
30
30
  "granted" === window.Notification.permission,
31
- Ui: () =>
31
+ Qi: () =>
32
32
  yt.isPushBlocked()
33
- ? { Vi: !1, reason: "blocked" }
33
+ ? { Ui: !1, reason: "blocked" }
34
34
  : yt.isPushSupported()
35
35
  ? yt.isPushPermissionGranted()
36
- ? { Vi: !1, reason: "permissionGranted" }
37
- : { Vi: !0 }
38
- : { Vi: !1, reason: "unsupported" },
39
- Wi: (o, i) =>
36
+ ? { Ui: !1, reason: "permissionGranted" }
37
+ : { Ui: !0 }
38
+ : { Ui: !1, reason: "unsupported" },
39
+ Vi: (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