@braze/service-worker 6.6.0 → 6.7.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.
- package/package.json +1 -1
- package/service-worker.js +53 -48
package/package.json
CHANGED
package/service-worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Braze Web SDK v6.
|
|
2
|
+
* Braze Web SDK v6.7.0
|
|
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-
|
|
5
|
+
* Compiled on 2026-04-16
|
|
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.
|
|
33
|
+
((a = "Braze SDK Warning: " + a + " (v6.7.0)"),
|
|
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.
|
|
38
|
+
((a = "Braze SDK Error: " + a + " (v6.7.0)"),
|
|
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.
|
|
343
|
+
f.sdk_version = "6.7.0";
|
|
344
344
|
f.sdk_flavor = "amp";
|
|
345
345
|
f.respond_with = { config: { config_time: 0 } };
|
|
346
346
|
fetch(b + "/data/", {
|
|
@@ -387,7 +387,7 @@ function E(a, b, e, g, d, f, c, k, m) {
|
|
|
387
387
|
const t = {};
|
|
388
388
|
t.device_id = e;
|
|
389
389
|
t.api_key = a;
|
|
390
|
-
t.sdk_version = "6.
|
|
390
|
+
t.sdk_version = "6.7.0";
|
|
391
391
|
null != f && (t.sdk_flavor = f);
|
|
392
392
|
var u = null;
|
|
393
393
|
let H = null,
|
|
@@ -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.
|
|
457
|
+
f.sdk_version = "6.7.0";
|
|
458
458
|
g = {
|
|
459
459
|
"Content-Type": "application/json",
|
|
460
460
|
"X-Braze-Api-Key": f.api_key,
|
|
@@ -698,7 +698,7 @@ function R(a) {
|
|
|
698
698
|
f = { url: a.u, ab_ids: { cid: a.cid }, extra: a.e },
|
|
699
699
|
c = a.ri;
|
|
700
700
|
a.ab_push_fetch_test_triggers_key &&
|
|
701
|
-
(h.info("Service worker 6.
|
|
701
|
+
(h.info("Service worker 6.7.0 found trigger fetch key in push payload."),
|
|
702
702
|
(f.fetchTriggers = !0));
|
|
703
703
|
var k = a.ab_cd;
|
|
704
704
|
null != k &&
|
|
@@ -742,47 +742,52 @@ self.addEventListener("activate", function () {
|
|
|
742
742
|
return self.clients.claim();
|
|
743
743
|
});
|
|
744
744
|
self.addEventListener("push", function (a) {
|
|
745
|
-
h.info("Service worker 6.
|
|
746
|
-
null != a.data && null != a.data.json
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
? c.json()
|
|
767
|
-
: (h.error(
|
|
768
|
-
"Unable to retrieve push payload from server: " +
|
|
769
|
-
c.status,
|
|
770
|
-
),
|
|
771
|
-
Promise.reject());
|
|
772
|
-
})
|
|
773
|
-
.then(function (c) {
|
|
774
|
-
h.info("Retrieved push payload from server");
|
|
775
|
-
b(R(c));
|
|
776
|
-
})
|
|
777
|
-
.catch(function (c) {
|
|
778
|
-
e(
|
|
779
|
-
"Unable to retrieve push payload from server or user has opt-out: " +
|
|
780
|
-
c,
|
|
781
|
-
);
|
|
745
|
+
h.info("Service worker 6.7.0 received push");
|
|
746
|
+
if (null != a.data && null != a.data.json) {
|
|
747
|
+
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");
|
|
751
|
+
} else
|
|
752
|
+
Q(
|
|
753
|
+
a,
|
|
754
|
+
new Promise(function (b, e) {
|
|
755
|
+
w(new x(), y.g.o, function (g, d) {
|
|
756
|
+
const f = d.data;
|
|
757
|
+
z()
|
|
758
|
+
.then(function () {
|
|
759
|
+
return fetch(d.baseUrl + "/web_push/", {
|
|
760
|
+
method: "POST",
|
|
761
|
+
headers: {
|
|
762
|
+
"Content-type": "application/json",
|
|
763
|
+
"X-Braze-Api-Key": f.api_key,
|
|
764
|
+
},
|
|
765
|
+
body: JSON.stringify(f),
|
|
782
766
|
});
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
767
|
+
})
|
|
768
|
+
.then(function (c) {
|
|
769
|
+
return c.ok
|
|
770
|
+
? c.json()
|
|
771
|
+
: (h.error(
|
|
772
|
+
"Unable to retrieve push payload from server: " + c.status,
|
|
773
|
+
),
|
|
774
|
+
Promise.reject());
|
|
775
|
+
})
|
|
776
|
+
.then(function (c) {
|
|
777
|
+
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
|
+
})
|
|
782
|
+
.catch(function (c) {
|
|
783
|
+
e(
|
|
784
|
+
"Unable to retrieve push payload from server or user has opt-out: " +
|
|
785
|
+
c,
|
|
786
|
+
);
|
|
787
|
+
});
|
|
788
|
+
});
|
|
789
|
+
}),
|
|
790
|
+
);
|
|
786
791
|
});
|
|
787
792
|
self.addEventListener("notificationclick", function (a) {
|
|
788
793
|
if (
|