@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.
@@ -2825,9 +2825,6 @@ declare class PullClient implements ConnectorParent {
2825
2825
  private _debug;
2826
2826
  private _connectionAttempt;
2827
2827
  private _connectionType;
2828
- private _reconnectTimeout;
2829
- private _restartTimeout;
2830
- private _restoreWebSocketTimeout;
2831
2828
  private _skipStorageInit;
2832
2829
  private _skipCheckRevision;
2833
2830
  private _subscribers;
@@ -2846,6 +2843,9 @@ declare class PullClient implements ConnectorParent {
2846
2843
  /**
2847
2844
  * @depricate
2848
2845
  */
2846
+ private _reconnectTimeout;
2847
+ private _restartTimeout;
2848
+ private _restoreWebSocketTimeout;
2849
2849
  private _checkInterval;
2850
2850
  private _offlineTimeout;
2851
2851
  private _watchUpdateTimeout;
@@ -2825,9 +2825,6 @@ declare class PullClient implements ConnectorParent {
2825
2825
  private _debug;
2826
2826
  private _connectionAttempt;
2827
2827
  private _connectionType;
2828
- private _reconnectTimeout;
2829
- private _restartTimeout;
2830
- private _restoreWebSocketTimeout;
2831
2828
  private _skipStorageInit;
2832
2829
  private _skipCheckRevision;
2833
2830
  private _subscribers;
@@ -2846,6 +2843,9 @@ declare class PullClient implements ConnectorParent {
2846
2843
  /**
2847
2844
  * @depricate
2848
2845
  */
2846
+ private _reconnectTimeout;
2847
+ private _restartTimeout;
2848
+ private _restoreWebSocketTimeout;
2849
2849
  private _checkInterval;
2850
2850
  private _offlineTimeout;
2851
2851
  private _watchUpdateTimeout;
@@ -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
@@ -508,8 +508,27 @@ function isArrayOfArray(item) {
508
508
  }
509
509
 
510
510
  const _state = {};
511
- let getRandomValues;
512
- const randoms8 = new Uint8Array(16);
511
+ function getCrypto() {
512
+ if (typeof window !== "undefined" && window.crypto) {
513
+ return window.crypto;
514
+ }
515
+ if (typeof globalThis.crypto !== "undefined") {
516
+ return globalThis.crypto;
517
+ }
518
+ throw new Error("Crypto API not available");
519
+ }
520
+ function initRng() {
521
+ const crypto = getCrypto();
522
+ if (!crypto?.getRandomValues) {
523
+ throw new Error("Crypto API not available");
524
+ }
525
+ return {
526
+ rng: () => {
527
+ const rnds8 = new Uint8Array(16);
528
+ return crypto.getRandomValues(rnds8);
529
+ }
530
+ };
531
+ }
513
532
  const byteToHex = [];
514
533
  for (let i = 0; i < 256; ++i) {
515
534
  byteToHex.push((i + 256).toString(16).slice(1));
@@ -560,13 +579,8 @@ function uuidv7() {
560
579
  const buf = void 0;
561
580
  const offset = void 0;
562
581
  const now = Date.now();
563
- if (!getRandomValues) {
564
- if (typeof crypto === "undefined" || !crypto.getRandomValues) {
565
- throw new Error("crypto.getRandomValues() not supported.");
566
- }
567
- getRandomValues = crypto.getRandomValues.bind(crypto);
568
- }
569
- const randoms = getRandomValues(randoms8);
582
+ const { rng } = initRng();
583
+ const randoms = rng();
570
584
  updateV7State(_state, now, randoms);
571
585
  const bytes = v7Bytes(
572
586
  randoms,
@@ -1533,7 +1547,7 @@ class Http {
1533
1547
  #clientSideWarningMessage = "";
1534
1548
  constructor(baseURL, authActions, options) {
1535
1549
  const defaultHeaders = {
1536
- // 'X-Sdk': 'b24-js-sdk-v-0.3.0'
1550
+ // 'X-Sdk': 'b24-js-sdk-v-0.4.1'
1537
1551
  };
1538
1552
  this.#clientAxios = axios.create({
1539
1553
  baseURL,
@@ -1961,7 +1975,7 @@ class Http {
1961
1975
  const baseUrl = `${encodeURIComponent(method)}.json`;
1962
1976
  const queryParams = new URLSearchParams({
1963
1977
  [this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
1964
- [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.3.0",
1978
+ [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.1",
1965
1979
  [this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
1966
1980
  });
1967
1981
  return `${baseUrl}?${queryParams.toString()}`;
@@ -11081,9 +11095,6 @@ class PullClient {
11081
11095
  _debug = false;
11082
11096
  _connectionAttempt = 0;
11083
11097
  _connectionType = ConnectionType.WebSocket;
11084
- _reconnectTimeout = null;
11085
- _restartTimeout = null;
11086
- _restoreWebSocketTimeout = null;
11087
11098
  _skipStorageInit;
11088
11099
  _skipCheckRevision;
11089
11100
  _subscribers = {};
@@ -11115,6 +11126,9 @@ class PullClient {
11115
11126
  */
11116
11127
  // private _notificationPopup: null = null
11117
11128
  // timers ////
11129
+ _reconnectTimeout = null;
11130
+ _restartTimeout = null;
11131
+ _restoreWebSocketTimeout = null;
11118
11132
  _checkInterval = null;
11119
11133
  _offlineTimeout = null;
11120
11134
  _watchUpdateTimeout = null;
@@ -12410,7 +12424,7 @@ class PullClient {
12410
12424
  return;
12411
12425
  }
12412
12426
  this._restoreWebSocketTimeout = setTimeout(() => {
12413
- this._restoreWebSocketTimeout = 0;
12427
+ this._restoreWebSocketTimeout = null;
12414
12428
  this.restoreWebSocketConnection();
12415
12429
  }, RESTORE_WEBSOCKET_TIMEOUT * 1e3);
12416
12430
  }