@bitrix24/b24jssdk 0.2.3 → 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/esm/index.d.mts +3 -3
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.mjs +60 -21
- package/dist/esm/index.mjs.map +1 -1
- package/dist/umd/index.js +63 -32
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +13 -13
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +20 -19
- package/dist/commonjs/index.cjs +0 -13705
- package/dist/commonjs/index.cjs.map +0 -1
- package/dist/commonjs/index.d.cts +0 -3209
- package/dist/commonjs/index.d.mts +0 -3209
- package/dist/commonjs/index.d.ts +0 -3209
package/dist/umd/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @version @bitrix24/b24jssdk v0.
|
|
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
|
-
|
|
8543
|
-
|
|
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
|
-
|
|
8595
|
-
|
|
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,
|
|
@@ -9529,13 +9534,17 @@ ${this.stack}`;
|
|
|
9529
9534
|
|
|
9530
9535
|
const DEFAULT_REQUEST_ID_HEADER_FIELD_NAME = "X-Request-ID";
|
|
9531
9536
|
const DEFAULT_QUERY_STRING_PARAMETER_NAME = "bx24_request_id";
|
|
9532
|
-
const
|
|
9537
|
+
const DEFAULT_QUERY_STRING_SDK_VER_PARAMETER_NAME = "bx24_sdk_ver";
|
|
9538
|
+
const DEFAULT_QUERY_STRING_SDK_TYPE_PARAMETER_NAME = "bx24_sdk_type";
|
|
9533
9539
|
class DefaultRequestIdGenerator {
|
|
9534
9540
|
getQueryStringParameterName() {
|
|
9535
9541
|
return DEFAULT_QUERY_STRING_PARAMETER_NAME;
|
|
9536
9542
|
}
|
|
9537
9543
|
getQueryStringSdkParameterName() {
|
|
9538
|
-
return
|
|
9544
|
+
return DEFAULT_QUERY_STRING_SDK_VER_PARAMETER_NAME;
|
|
9545
|
+
}
|
|
9546
|
+
getQueryStringSdkTypeParameterName() {
|
|
9547
|
+
return DEFAULT_QUERY_STRING_SDK_TYPE_PARAMETER_NAME;
|
|
9539
9548
|
}
|
|
9540
9549
|
generate() {
|
|
9541
9550
|
return Text.getUuidRfc4122();
|
|
@@ -9558,6 +9567,7 @@ ${this.stack}`;
|
|
|
9558
9567
|
|
|
9559
9568
|
const {toString} = Object.prototype;
|
|
9560
9569
|
const {getPrototypeOf} = Object;
|
|
9570
|
+
const {iterator, toStringTag} = Symbol;
|
|
9561
9571
|
|
|
9562
9572
|
const kindOf = (cache => thing => {
|
|
9563
9573
|
const str = toString.call(thing);
|
|
@@ -9684,7 +9694,7 @@ ${this.stack}`;
|
|
|
9684
9694
|
}
|
|
9685
9695
|
|
|
9686
9696
|
const prototype = getPrototypeOf(val);
|
|
9687
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(
|
|
9697
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
9688
9698
|
};
|
|
9689
9699
|
|
|
9690
9700
|
/**
|
|
@@ -10035,13 +10045,13 @@ ${this.stack}`;
|
|
|
10035
10045
|
* @returns {void}
|
|
10036
10046
|
*/
|
|
10037
10047
|
const forEachEntry = (obj, fn) => {
|
|
10038
|
-
const generator = obj && obj[
|
|
10048
|
+
const generator = obj && obj[iterator];
|
|
10039
10049
|
|
|
10040
|
-
const
|
|
10050
|
+
const _iterator = generator.call(obj);
|
|
10041
10051
|
|
|
10042
10052
|
let result;
|
|
10043
10053
|
|
|
10044
|
-
while ((result =
|
|
10054
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
10045
10055
|
const pair = result.value;
|
|
10046
10056
|
fn.call(obj, pair[0], pair[1]);
|
|
10047
10057
|
}
|
|
@@ -10162,7 +10172,7 @@ ${this.stack}`;
|
|
|
10162
10172
|
* @returns {boolean}
|
|
10163
10173
|
*/
|
|
10164
10174
|
function isSpecCompliantForm(thing) {
|
|
10165
|
-
return !!(thing && isFunction(thing.append) && thing[
|
|
10175
|
+
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
10166
10176
|
}
|
|
10167
10177
|
|
|
10168
10178
|
const toJSONObject = (obj) => {
|
|
@@ -10231,6 +10241,10 @@ ${this.stack}`;
|
|
|
10231
10241
|
|
|
10232
10242
|
// *********************
|
|
10233
10243
|
|
|
10244
|
+
|
|
10245
|
+
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
10246
|
+
|
|
10247
|
+
|
|
10234
10248
|
const utils$1 = {
|
|
10235
10249
|
isArray: isArray$3,
|
|
10236
10250
|
isArrayBuffer,
|
|
@@ -10286,7 +10300,8 @@ ${this.stack}`;
|
|
|
10286
10300
|
isAsyncFn,
|
|
10287
10301
|
isThenable,
|
|
10288
10302
|
setImmediate: _setImmediate,
|
|
10289
|
-
asap
|
|
10303
|
+
asap,
|
|
10304
|
+
isIterable
|
|
10290
10305
|
};
|
|
10291
10306
|
|
|
10292
10307
|
/**
|
|
@@ -11267,10 +11282,18 @@ ${this.stack}`;
|
|
|
11267
11282
|
setHeaders(header, valueOrRewrite);
|
|
11268
11283
|
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
11269
11284
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
11270
|
-
} else if (utils$1.
|
|
11271
|
-
|
|
11272
|
-
|
|
11285
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
11286
|
+
let obj = {}, dest, key;
|
|
11287
|
+
for (const entry of header) {
|
|
11288
|
+
if (!utils$1.isArray(entry)) {
|
|
11289
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
11290
|
+
}
|
|
11291
|
+
|
|
11292
|
+
obj[key = entry[0]] = (dest = obj[key]) ?
|
|
11293
|
+
(utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
|
|
11273
11294
|
}
|
|
11295
|
+
|
|
11296
|
+
setHeaders(obj, valueOrRewrite);
|
|
11274
11297
|
} else {
|
|
11275
11298
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
11276
11299
|
}
|
|
@@ -11412,6 +11435,10 @@ ${this.stack}`;
|
|
|
11412
11435
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
11413
11436
|
}
|
|
11414
11437
|
|
|
11438
|
+
getSetCookie() {
|
|
11439
|
+
return this.get("set-cookie") || [];
|
|
11440
|
+
}
|
|
11441
|
+
|
|
11415
11442
|
get [Symbol.toStringTag]() {
|
|
11416
11443
|
return 'AxiosHeaders';
|
|
11417
11444
|
}
|
|
@@ -12447,7 +12474,7 @@ ${this.stack}`;
|
|
|
12447
12474
|
} catch (err) {
|
|
12448
12475
|
unsubscribe && unsubscribe();
|
|
12449
12476
|
|
|
12450
|
-
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
12477
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
12451
12478
|
throw Object.assign(
|
|
12452
12479
|
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
12453
12480
|
{
|
|
@@ -12607,7 +12634,7 @@ ${this.stack}`;
|
|
|
12607
12634
|
});
|
|
12608
12635
|
}
|
|
12609
12636
|
|
|
12610
|
-
const VERSION$1 = "1.
|
|
12637
|
+
const VERSION$1 = "1.9.0";
|
|
12611
12638
|
|
|
12612
12639
|
const validators$1 = {};
|
|
12613
12640
|
|
|
@@ -12715,7 +12742,7 @@ ${this.stack}`;
|
|
|
12715
12742
|
*/
|
|
12716
12743
|
let Axios$1 = class Axios {
|
|
12717
12744
|
constructor(instanceConfig) {
|
|
12718
|
-
this.defaults = instanceConfig;
|
|
12745
|
+
this.defaults = instanceConfig || {};
|
|
12719
12746
|
this.interceptors = {
|
|
12720
12747
|
request: new InterceptorManager(),
|
|
12721
12748
|
response: new InterceptorManager()
|
|
@@ -14063,7 +14090,7 @@ ${this.stack}`;
|
|
|
14063
14090
|
#clientSideWarningMessage = "";
|
|
14064
14091
|
constructor(baseURL, authActions, options) {
|
|
14065
14092
|
const defaultHeaders = {
|
|
14066
|
-
// 'X-Sdk': 'b24-js-sdk-v-0.
|
|
14093
|
+
// 'X-Sdk': 'b24-js-sdk-v-0.4.0'
|
|
14067
14094
|
};
|
|
14068
14095
|
this.#clientAxios = axios.create({
|
|
14069
14096
|
baseURL,
|
|
@@ -14472,8 +14499,6 @@ ${this.stack}`;
|
|
|
14472
14499
|
if (this.#logTag.length > 0) {
|
|
14473
14500
|
result.logTag = this.#logTag;
|
|
14474
14501
|
}
|
|
14475
|
-
result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
|
|
14476
|
-
result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.3";
|
|
14477
14502
|
if (!!result.data && !!result.data.start) {
|
|
14478
14503
|
delete result.data.start;
|
|
14479
14504
|
}
|
|
@@ -14490,7 +14515,13 @@ ${this.stack}`;
|
|
|
14490
14515
|
* @private
|
|
14491
14516
|
*/
|
|
14492
14517
|
#prepareMethod(method) {
|
|
14493
|
-
|
|
14518
|
+
const baseUrl = `${encodeURIComponent(method)}.json`;
|
|
14519
|
+
const queryParams = new URLSearchParams({
|
|
14520
|
+
[this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
|
|
14521
|
+
[this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.0",
|
|
14522
|
+
[this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
14523
|
+
});
|
|
14524
|
+
return `${baseUrl}?${queryParams.toString()}`;
|
|
14494
14525
|
}
|
|
14495
14526
|
/**
|
|
14496
14527
|
* @inheritDoc
|
|
@@ -23607,9 +23638,6 @@ ${this.stack}`;
|
|
|
23607
23638
|
_debug = false;
|
|
23608
23639
|
_connectionAttempt = 0;
|
|
23609
23640
|
_connectionType = ConnectionType.WebSocket;
|
|
23610
|
-
_reconnectTimeout = null;
|
|
23611
|
-
_restartTimeout = null;
|
|
23612
|
-
_restoreWebSocketTimeout = null;
|
|
23613
23641
|
_skipStorageInit;
|
|
23614
23642
|
_skipCheckRevision;
|
|
23615
23643
|
_subscribers = {};
|
|
@@ -23641,6 +23669,9 @@ ${this.stack}`;
|
|
|
23641
23669
|
*/
|
|
23642
23670
|
// private _notificationPopup: null = null
|
|
23643
23671
|
// timers ////
|
|
23672
|
+
_reconnectTimeout = null;
|
|
23673
|
+
_restartTimeout = null;
|
|
23674
|
+
_restoreWebSocketTimeout = null;
|
|
23644
23675
|
_checkInterval = null;
|
|
23645
23676
|
_offlineTimeout = null;
|
|
23646
23677
|
_watchUpdateTimeout = null;
|
|
@@ -24936,7 +24967,7 @@ ${this.stack}`;
|
|
|
24936
24967
|
return;
|
|
24937
24968
|
}
|
|
24938
24969
|
this._restoreWebSocketTimeout = setTimeout(() => {
|
|
24939
|
-
this._restoreWebSocketTimeout =
|
|
24970
|
+
this._restoreWebSocketTimeout = null;
|
|
24940
24971
|
this.restoreWebSocketConnection();
|
|
24941
24972
|
}, RESTORE_WEBSOCKET_TIMEOUT * 1e3);
|
|
24942
24973
|
}
|