pusher-js 7.4.0 → 7.4.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Pusher JavaScript Library v7.4.0
2
+ * Pusher JavaScript Library v7.4.1
3
3
  * https://pusher.com/
4
4
  *
5
5
  * Copyright 2020, Pusher
@@ -2995,7 +2995,7 @@ var ScriptReceivers = new ScriptReceiverFactory('_pusher_script_', 'Pusher.Scrip
2995
2995
 
2996
2996
  // CONCATENATED MODULE: ./src/core/defaults.ts
2997
2997
  var Defaults = {
2998
- VERSION: "7.4.0",
2998
+ VERSION: "7.4.1",
2999
2999
  PROTOCOL: 7,
3000
3000
  wsPort: 80,
3001
3001
  wssPort: 443,
@@ -3287,7 +3287,7 @@ var ajax = function (context, query, authOptions, authRequestType, callback) {
3287
3287
  suffix = url_store.buildLogSuffix('authenticationEndpoint');
3288
3288
  break;
3289
3289
  case AuthRequestType.ChannelAuthorization:
3290
- suffix = "Clients must be authenticated to join private or presence channels. " + url_store.buildLogSuffix('authorizationEndpoint');
3290
+ suffix = "Clients must be authorized to join private or presence channels. " + url_store.buildLogSuffix('authorizationEndpoint');
3291
3291
  break;
3292
3292
  }
3293
3293
  callback(new HTTPAuthError(xhr.status, "Unable to retrieve auth string from " + authRequestType.toString() + " endpoint - " +
@@ -4876,10 +4876,11 @@ var presence_channel_extends = (undefined && undefined.__extends) || (function (
4876
4876
  };
4877
4877
  })();
4878
4878
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
4879
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4879
4880
  return new (P || (P = Promise))(function (resolve, reject) {
4880
4881
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4881
4882
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
4882
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
4883
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4883
4884
  step((generator = generator.apply(thisArg, _arguments || [])).next());
4884
4885
  });
4885
4886
  };
@@ -6277,7 +6278,7 @@ function replaceHost(url, hostname) {
6277
6278
  return urlParts[1] + hostname + urlParts[3];
6278
6279
  }
6279
6280
  function randomNumber(max) {
6280
- return Math.floor(Math.random() * max);
6281
+ return runtime.randomInt(max);
6281
6282
  }
6282
6283
  function randomString(length) {
6283
6284
  var result = [];
@@ -6523,6 +6524,14 @@ var Runtime = {
6523
6524
  else if (window.detachEvent !== undefined) {
6524
6525
  window.detachEvent('onunload', listener);
6525
6526
  }
6527
+ },
6528
+ randomInt: function (max) {
6529
+ var random = function () {
6530
+ var crypto = window.crypto || window['msCrypto'];
6531
+ var random = crypto.getRandomValues(new Uint32Array(1))[0];
6532
+ return random / Math.pow(2, 32);
6533
+ };
6534
+ return Math.floor(random() * max);
6526
6535
  }
6527
6536
  };
6528
6537
  /* harmony default export */ var runtime = (Runtime);
@@ -6902,7 +6911,7 @@ function getEnableStatsConfig(opts) {
6902
6911
  return false;
6903
6912
  }
6904
6913
  function buildUserAuthenticator(opts) {
6905
- var userAuthentication = __assign({}, defaults.userAuthentication, opts.userAuthentication);
6914
+ var userAuthentication = __assign(__assign({}, defaults.userAuthentication), opts.userAuthentication);
6906
6915
  if ('customHandler' in userAuthentication &&
6907
6916
  userAuthentication['customHandler'] != null) {
6908
6917
  return userAuthentication['customHandler'];
@@ -6912,7 +6921,7 @@ function buildUserAuthenticator(opts) {
6912
6921
  function buildChannelAuth(opts, pusher) {
6913
6922
  var channelAuthorization;
6914
6923
  if ('channelAuthorization' in opts) {
6915
- channelAuthorization = __assign({}, defaults.channelAuthorization, opts.channelAuthorization);
6924
+ channelAuthorization = __assign(__assign({}, defaults.channelAuthorization), opts.channelAuthorization);
6916
6925
  }
6917
6926
  else {
6918
6927
  channelAuthorization = {
@@ -7131,7 +7140,7 @@ var pusher_Pusher = (function () {
7131
7140
  this.config = getConfig(options, this);
7132
7141
  this.channels = factory.createChannels();
7133
7142
  this.global_emitter = new dispatcher();
7134
- this.sessionID = Math.floor(Math.random() * 1000000000);
7143
+ this.sessionID = runtime.randomInt(1000000000);
7135
7144
  this.timeline = new timeline_timeline(this.key, this.sessionID, {
7136
7145
  cluster: this.config.cluster,
7137
7146
  features: Pusher.getClientFeatures(),