@bitrix24/b24jssdk 0.3.0 → 0.4.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/dist/umd/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @version @bitrix24/b24jssdk v0.3.0
2
+ * @version @bitrix24/b24jssdk v0.4.0
3
3
  * @copyright (c) 2025 Bitrix24
4
4
  * @licence MIT
5
5
  * @links https://github.com/bitrix24/b24jssdk - GitHub
@@ -8539,8 +8539,18 @@
8539
8539
  }
8540
8540
 
8541
8541
  const _state = {};
8542
- let getRandomValues;
8543
- const randoms8 = new Uint8Array(16);
8542
+ function initRng() {
8543
+ const crypto = window.crypto || window.msCrypto;
8544
+ if (!crypto?.getRandomValues) {
8545
+ throw new Error("Web Crypto API not available");
8546
+ }
8547
+ return {
8548
+ rng: () => {
8549
+ const rnds8 = new Uint8Array(16);
8550
+ return crypto.getRandomValues(rnds8);
8551
+ }
8552
+ };
8553
+ }
8544
8554
  const byteToHex = [];
8545
8555
  for (let i = 0; i < 256; ++i) {
8546
8556
  byteToHex.push((i + 256).toString(16).slice(1));
@@ -8591,13 +8601,8 @@
8591
8601
  const buf = void 0;
8592
8602
  const offset = void 0;
8593
8603
  const now = Date.now();
8594
- if (!getRandomValues) {
8595
- if (typeof crypto === "undefined" || !crypto.getRandomValues) {
8596
- throw new Error("crypto.getRandomValues() not supported.");
8597
- }
8598
- getRandomValues = crypto.getRandomValues.bind(crypto);
8599
- }
8600
- const randoms = getRandomValues(randoms8);
8604
+ const { rng } = initRng();
8605
+ const randoms = rng();
8601
8606
  updateV7State(_state, now, randoms);
8602
8607
  const bytes = v7Bytes(
8603
8608
  randoms,
@@ -14085,7 +14090,7 @@ ${this.stack}`;
14085
14090
  #clientSideWarningMessage = "";
14086
14091
  constructor(baseURL, authActions, options) {
14087
14092
  const defaultHeaders = {
14088
- // 'X-Sdk': 'b24-js-sdk-v-0.3.0'
14093
+ // 'X-Sdk': 'b24-js-sdk-v-0.4.0'
14089
14094
  };
14090
14095
  this.#clientAxios = axios.create({
14091
14096
  baseURL,
@@ -14513,7 +14518,7 @@ ${this.stack}`;
14513
14518
  const baseUrl = `${encodeURIComponent(method)}.json`;
14514
14519
  const queryParams = new URLSearchParams({
14515
14520
  [this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
14516
- [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.3.0",
14521
+ [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.0",
14517
14522
  [this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
14518
14523
  });
14519
14524
  return `${baseUrl}?${queryParams.toString()}`;
@@ -23633,9 +23638,6 @@ ${this.stack}`;
23633
23638
  _debug = false;
23634
23639
  _connectionAttempt = 0;
23635
23640
  _connectionType = ConnectionType.WebSocket;
23636
- _reconnectTimeout = null;
23637
- _restartTimeout = null;
23638
- _restoreWebSocketTimeout = null;
23639
23641
  _skipStorageInit;
23640
23642
  _skipCheckRevision;
23641
23643
  _subscribers = {};
@@ -23667,6 +23669,9 @@ ${this.stack}`;
23667
23669
  */
23668
23670
  // private _notificationPopup: null = null
23669
23671
  // timers ////
23672
+ _reconnectTimeout = null;
23673
+ _restartTimeout = null;
23674
+ _restoreWebSocketTimeout = null;
23670
23675
  _checkInterval = null;
23671
23676
  _offlineTimeout = null;
23672
23677
  _watchUpdateTimeout = null;
@@ -24962,7 +24967,7 @@ ${this.stack}`;
24962
24967
  return;
24963
24968
  }
24964
24969
  this._restoreWebSocketTimeout = setTimeout(() => {
24965
- this._restoreWebSocketTimeout = 0;
24970
+ this._restoreWebSocketTimeout = null;
24966
24971
  this.restoreWebSocketConnection();
24967
24972
  }, RESTORE_WEBSOCKET_TIMEOUT * 1e3);
24968
24973
  }