@bitrix24/b24jssdk 0.3.0 → 0.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.
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.1
3
3
  * @copyright (c) 2025 Bitrix24
4
4
  * @licence MIT
5
5
  * @links https://github.com/bitrix24/b24jssdk - GitHub
@@ -8539,8 +8539,27 @@
8539
8539
  }
8540
8540
 
8541
8541
  const _state = {};
8542
- let getRandomValues;
8543
- const randoms8 = new Uint8Array(16);
8542
+ function getCrypto() {
8543
+ if (typeof window !== "undefined" && window.crypto) {
8544
+ return window.crypto;
8545
+ }
8546
+ if (typeof globalThis.crypto !== "undefined") {
8547
+ return globalThis.crypto;
8548
+ }
8549
+ throw new Error("Crypto API not available");
8550
+ }
8551
+ function initRng() {
8552
+ const crypto = getCrypto();
8553
+ if (!crypto?.getRandomValues) {
8554
+ throw new Error("Crypto API not available");
8555
+ }
8556
+ return {
8557
+ rng: () => {
8558
+ const rnds8 = new Uint8Array(16);
8559
+ return crypto.getRandomValues(rnds8);
8560
+ }
8561
+ };
8562
+ }
8544
8563
  const byteToHex = [];
8545
8564
  for (let i = 0; i < 256; ++i) {
8546
8565
  byteToHex.push((i + 256).toString(16).slice(1));
@@ -8591,13 +8610,8 @@
8591
8610
  const buf = void 0;
8592
8611
  const offset = void 0;
8593
8612
  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);
8613
+ const { rng } = initRng();
8614
+ const randoms = rng();
8601
8615
  updateV7State(_state, now, randoms);
8602
8616
  const bytes = v7Bytes(
8603
8617
  randoms,
@@ -14085,7 +14099,7 @@ ${this.stack}`;
14085
14099
  #clientSideWarningMessage = "";
14086
14100
  constructor(baseURL, authActions, options) {
14087
14101
  const defaultHeaders = {
14088
- // 'X-Sdk': 'b24-js-sdk-v-0.3.0'
14102
+ // 'X-Sdk': 'b24-js-sdk-v-0.4.1'
14089
14103
  };
14090
14104
  this.#clientAxios = axios.create({
14091
14105
  baseURL,
@@ -14513,7 +14527,7 @@ ${this.stack}`;
14513
14527
  const baseUrl = `${encodeURIComponent(method)}.json`;
14514
14528
  const queryParams = new URLSearchParams({
14515
14529
  [this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
14516
- [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.3.0",
14530
+ [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.1",
14517
14531
  [this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
14518
14532
  });
14519
14533
  return `${baseUrl}?${queryParams.toString()}`;
@@ -23633,9 +23647,6 @@ ${this.stack}`;
23633
23647
  _debug = false;
23634
23648
  _connectionAttempt = 0;
23635
23649
  _connectionType = ConnectionType.WebSocket;
23636
- _reconnectTimeout = null;
23637
- _restartTimeout = null;
23638
- _restoreWebSocketTimeout = null;
23639
23650
  _skipStorageInit;
23640
23651
  _skipCheckRevision;
23641
23652
  _subscribers = {};
@@ -23667,6 +23678,9 @@ ${this.stack}`;
23667
23678
  */
23668
23679
  // private _notificationPopup: null = null
23669
23680
  // timers ////
23681
+ _reconnectTimeout = null;
23682
+ _restartTimeout = null;
23683
+ _restoreWebSocketTimeout = null;
23670
23684
  _checkInterval = null;
23671
23685
  _offlineTimeout = null;
23672
23686
  _watchUpdateTimeout = null;
@@ -24962,7 +24976,7 @@ ${this.stack}`;
24962
24976
  return;
24963
24977
  }
24964
24978
  this._restoreWebSocketTimeout = setTimeout(() => {
24965
- this._restoreWebSocketTimeout = 0;
24979
+ this._restoreWebSocketTimeout = null;
24966
24980
  this.restoreWebSocketConnection();
24967
24981
  }, RESTORE_WEBSOCKET_TIMEOUT * 1e3);
24968
24982
  }