@braze/service-worker 6.7.0 → 6.7.1

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 (2) hide show
  1. package/package.json +1 -1
  2. package/service-worker.js +22 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/service-worker",
3
- "version": "6.7.0",
3
+ "version": "6.7.1",
4
4
  "description": "Braze service worker to be used with the Braze Web SDK.",
5
5
  "main": "service-worker.js",
6
6
  "scripts": {
package/service-worker.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*
2
- * Braze Web SDK v6.7.0
2
+ * Braze Web SDK v6.7.1
3
3
  * (c) Braze, Inc. 2026 - http://braze.com
4
4
  * License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
5
- * Compiled on 2026-04-16
5
+ * Compiled on 2026-04-17
6
6
  */
7
7
  const h = {
8
8
  A: function (a) {
@@ -30,12 +30,12 @@ const h = {
30
30
  },
31
31
  warn: function (a) {
32
32
  h.m &&
33
- ((a = "Braze SDK Warning: " + a + " (v6.7.0)"),
33
+ ((a = "Braze SDK Warning: " + a + " (v6.7.1)"),
34
34
  null != h.j ? h.j(a) : console.warn(a));
35
35
  },
36
36
  error: function (a) {
37
37
  h.m &&
38
- ((a = "Braze SDK Error: " + a + " (v6.7.0)"),
38
+ ((a = "Braze SDK Error: " + a + " (v6.7.1)"),
39
39
  null != h.j ? h.j(a) : console.error(a));
40
40
  },
41
41
  };
@@ -340,7 +340,7 @@ function D(a, b, e) {
340
340
  f.time = Math.floor(new Date().valueOf() / 1e3);
341
341
  f.device_id = e;
342
342
  f.api_key = a;
343
- f.sdk_version = "6.7.0";
343
+ f.sdk_version = "6.7.1";
344
344
  f.sdk_flavor = "amp";
345
345
  f.respond_with = { config: { config_time: 0 } };
346
346
  fetch(b + "/data/", {
@@ -383,11 +383,11 @@ function D(a, b, e) {
383
383
  function E(a, b, e, g, d, f, c, k, m) {
384
384
  return A().then(
385
385
  (p) =>
386
- new Promise(function (O, B) {
386
+ new Promise(function (P, B) {
387
387
  const t = {};
388
388
  t.device_id = e;
389
389
  t.api_key = a;
390
- t.sdk_version = "6.7.0";
390
+ t.sdk_version = "6.7.1";
391
391
  null != f && (t.sdk_flavor = f);
392
392
  var u = null;
393
393
  let H = null,
@@ -432,7 +432,7 @@ function E(a, b, e, g, d, f, c, k, m) {
432
432
  .then(function (n) {
433
433
  n.error && (h.error(k + " " + n.error), B());
434
434
  n.auth_error && (C(t, k, n.auth_error), B());
435
- n.error || n.auth_error || (h.info(c), O());
435
+ n.error || n.auth_error || (h.info(c), P());
436
436
  })
437
437
  .catch(function (n) {
438
438
  h.error(k + " " + n);
@@ -454,7 +454,7 @@ function F(a, b) {
454
454
  a.time = g;
455
455
  a.user_id = d.userId;
456
456
  f.events = [a];
457
- f.sdk_version = "6.7.0";
457
+ f.sdk_version = "6.7.1";
458
458
  g = {
459
459
  "Content-Type": "application/json",
460
460
  "X-Braze-Api-Key": f.api_key,
@@ -603,7 +603,7 @@ function N() {
603
603
  });
604
604
  });
605
605
  }
606
- function P() {
606
+ function O() {
607
607
  return self.registration.pushManager
608
608
  .getSubscription()
609
609
  .then(function (a) {
@@ -687,6 +687,11 @@ function Q(a, b) {
687
687
  }
688
688
  h.A(!0);
689
689
  function R(a) {
690
+ if (null == a) return !1;
691
+ a = a._ab;
692
+ return !0 === a || "true" === a;
693
+ }
694
+ function S(a) {
690
695
  if (null == a || 0 === Object.keys(a).length)
691
696
  return Promise.reject(
692
697
  "Server has no pending push message for this registration. Ignoring push event.",
@@ -698,7 +703,7 @@ function R(a) {
698
703
  f = { url: a.u, ab_ids: { cid: a.cid }, extra: a.e },
699
704
  c = a.ri;
700
705
  a.ab_push_fetch_test_triggers_key &&
701
- (h.info("Service worker 6.7.0 found trigger fetch key in push payload."),
706
+ (h.info("Service worker 6.7.1 found trigger fetch key in push payload."),
702
707
  (f.fetchTriggers = !0));
703
708
  var k = a.ab_cd;
704
709
  null != k &&
@@ -742,12 +747,10 @@ self.addEventListener("activate", function () {
742
747
  return self.clients.claim();
743
748
  });
744
749
  self.addEventListener("push", function (a) {
745
- h.info("Service worker 6.7.0 received push");
750
+ h.info("Service worker 6.7.1 received push");
746
751
  if (null != a.data && null != a.data.json) {
747
752
  const b = a.data.json();
748
- null != b && !0 === b._ab
749
- ? Q(a, R(b))
750
- : h.info("Service worker 6.7.0 ignoring non-Braze push");
753
+ R(b) ? Q(a, S(b)) : h.info("Service worker 6.7.1 ignoring non-Braze push");
751
754
  } else
752
755
  Q(
753
756
  a,
@@ -775,9 +778,9 @@ self.addEventListener("push", function (a) {
775
778
  })
776
779
  .then(function (c) {
777
780
  h.info("Retrieved push payload from server");
778
- null != c && !0 === c._ab
779
- ? b(R(c))
780
- : (h.info("Service worker 6.7.0 ignoring non-Braze push"), b());
781
+ R(c)
782
+ ? b(S(c))
783
+ : (h.info("Service worker 6.7.1 ignoring non-Braze push"), b());
781
784
  })
782
785
  .catch(function (c) {
783
786
  e(
@@ -892,7 +895,7 @@ self.addEventListener("message", function (a) {
892
895
  case "amp-web-push-subscribe":
893
896
  return N();
894
897
  case "amp-web-push-unsubscribe":
895
- return P();
898
+ return O();
896
899
  default:
897
900
  return Promise.resolve();
898
901
  }