@braze/service-worker 4.7.2 → 4.8.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 (2) hide show
  1. package/package.json +1 -1
  2. package/service-worker.js +18 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/service-worker",
3
- "version": "4.7.2",
3
+ "version": "4.8.0",
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 v4.7.2
2
+ * Braze Web SDK v4.8.0
3
3
  * (c) Braze, Inc. 2023 - http://braze.com
4
4
  * License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
5
- * Compiled on 2023-06-09
5
+ * Compiled on 2023-06-12
6
6
  */
7
7
  const k = {
8
8
  P: function(a) {
@@ -258,12 +258,12 @@ const y = {
258
258
  },
259
259
  warn: function(a) {
260
260
  y.o &&
261
- ((a = "Braze SDK Warning: " + a + " (v4.7.2)"),
261
+ ((a = "Braze SDK Warning: " + a + " (v4.8.0)"),
262
262
  null != y.j ? y.j(a) : console.warn(a));
263
263
  },
264
264
  error: function(a) {
265
265
  y.o &&
266
- ((a = "Braze SDK Error: " + a + " (v4.7.2)"),
266
+ ((a = "Braze SDK Error: " + a + " (v4.8.0)"),
267
267
  null != y.j ? y.j(a) : console.error(a));
268
268
  }
269
269
  };
@@ -351,12 +351,16 @@ function I(a, b, c) {
351
351
  d.time = Math.floor(new Date().valueOf() / 1e3);
352
352
  d.device_id = c;
353
353
  d.api_key = a;
354
- d.sdk_version = "4.7.2";
354
+ d.sdk_version = "4.8.0";
355
355
  d.sdk_flavor = "amp";
356
356
  d.respond_with = { config: { config_time: 0 } };
357
357
  fetch(b + "/data/", {
358
358
  method: "POST",
359
- headers: { "Content-type": "application/json", "X-Braze-Api-Key": a },
359
+ headers: {
360
+ "Content-type": "application/json",
361
+ "X-Braze-Api-Key": a,
362
+ "X-Braze-Last-Req-Ms-Ago": 72e5
363
+ },
360
364
  body: JSON.stringify(d)
361
365
  })
362
366
  .then(function(g) {
@@ -391,7 +395,7 @@ function J(a, b, c, f, e, d, g, h, m) {
391
395
  const u = {};
392
396
  u.device_id = c;
393
397
  u.api_key = a;
394
- u.sdk_version = "4.7.2";
398
+ u.sdk_version = "4.8.0";
395
399
  null != d && (u.sdk_flavor = d);
396
400
  var v = null;
397
401
  let K = null,
@@ -419,7 +423,8 @@ function J(a, b, c, f, e, d, g, h, m) {
419
423
  ];
420
424
  v = {
421
425
  "Content-type": "application/json",
422
- "X-Braze-Api-Key": u.api_key
426
+ "X-Braze-Api-Key": u.api_key,
427
+ "X-Braze-Last-Req-Ms-Ago": 72e5
423
428
  };
424
429
  n && m && (v["X-Braze-Auth-Signature"] = n);
425
430
  fetch(b + "/data/", {
@@ -457,10 +462,11 @@ function M(a, b) {
457
462
  a.time = e;
458
463
  a.user_id = d.userId;
459
464
  g.events = [a];
460
- g.sdk_version = "4.7.2";
465
+ g.sdk_version = "4.8.0";
461
466
  e = {
462
467
  "Content-Type": "application/json",
463
- "X-Braze-Api-Key": g.api_key
468
+ "X-Braze-Api-Key": g.api_key,
469
+ "X-Braze-Last-Req-Ms-Ago": 72e5
464
470
  };
465
471
  c && d.sdkAuthEnabled && (e["X-Braze-Auth-Signature"] = c);
466
472
  fetch(d.baseUrl + "/data/", {
@@ -701,7 +707,7 @@ function V(a) {
701
707
  d = { url: a.u, ab_ids: { cid: a.cid }, extra: a.e },
702
708
  g = a.ri;
703
709
  a.ab_push_fetch_test_triggers_key &&
704
- (E.info("Service worker 4.7.2 found trigger fetch key in push payload."),
710
+ (E.info("Service worker 4.8.0 found trigger fetch key in push payload."),
705
711
  (d.fetchTriggers = !0));
706
712
  var h = a.ab_cd;
707
713
  if (null != h) {
@@ -747,7 +753,7 @@ self.addEventListener("activate", function() {
747
753
  return self.clients.claim();
748
754
  });
749
755
  self.addEventListener("push", function(a) {
750
- E.info("Service worker 4.7.2 received push");
756
+ E.info("Service worker 4.8.0 received push");
751
757
  null != a.data && null != a.data.json
752
758
  ? U(a, V(a.data.json()))
753
759
  : U(