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