@bitrix24/b24jssdk 0.2.3 → 0.3.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.2.3
2
+ * @version @bitrix24/b24jssdk v0.3.0
3
3
  * @copyright (c) 2025 Bitrix24
4
4
  * @licence MIT
5
5
  * @links https://github.com/bitrix24/b24jssdk - GitHub
@@ -9529,13 +9529,17 @@ ${this.stack}`;
9529
9529
 
9530
9530
  const DEFAULT_REQUEST_ID_HEADER_FIELD_NAME = "X-Request-ID";
9531
9531
  const DEFAULT_QUERY_STRING_PARAMETER_NAME = "bx24_request_id";
9532
- const DEFAULT_QUERY_STRING_SDK_PARAMETER_NAME = "bx24_sdk_ver";
9532
+ const DEFAULT_QUERY_STRING_SDK_VER_PARAMETER_NAME = "bx24_sdk_ver";
9533
+ const DEFAULT_QUERY_STRING_SDK_TYPE_PARAMETER_NAME = "bx24_sdk_type";
9533
9534
  class DefaultRequestIdGenerator {
9534
9535
  getQueryStringParameterName() {
9535
9536
  return DEFAULT_QUERY_STRING_PARAMETER_NAME;
9536
9537
  }
9537
9538
  getQueryStringSdkParameterName() {
9538
- return DEFAULT_QUERY_STRING_SDK_PARAMETER_NAME;
9539
+ return DEFAULT_QUERY_STRING_SDK_VER_PARAMETER_NAME;
9540
+ }
9541
+ getQueryStringSdkTypeParameterName() {
9542
+ return DEFAULT_QUERY_STRING_SDK_TYPE_PARAMETER_NAME;
9539
9543
  }
9540
9544
  generate() {
9541
9545
  return Text.getUuidRfc4122();
@@ -9558,6 +9562,7 @@ ${this.stack}`;
9558
9562
 
9559
9563
  const {toString} = Object.prototype;
9560
9564
  const {getPrototypeOf} = Object;
9565
+ const {iterator, toStringTag} = Symbol;
9561
9566
 
9562
9567
  const kindOf = (cache => thing => {
9563
9568
  const str = toString.call(thing);
@@ -9684,7 +9689,7 @@ ${this.stack}`;
9684
9689
  }
9685
9690
 
9686
9691
  const prototype = getPrototypeOf(val);
9687
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
9692
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
9688
9693
  };
9689
9694
 
9690
9695
  /**
@@ -10035,13 +10040,13 @@ ${this.stack}`;
10035
10040
  * @returns {void}
10036
10041
  */
10037
10042
  const forEachEntry = (obj, fn) => {
10038
- const generator = obj && obj[Symbol.iterator];
10043
+ const generator = obj && obj[iterator];
10039
10044
 
10040
- const iterator = generator.call(obj);
10045
+ const _iterator = generator.call(obj);
10041
10046
 
10042
10047
  let result;
10043
10048
 
10044
- while ((result = iterator.next()) && !result.done) {
10049
+ while ((result = _iterator.next()) && !result.done) {
10045
10050
  const pair = result.value;
10046
10051
  fn.call(obj, pair[0], pair[1]);
10047
10052
  }
@@ -10162,7 +10167,7 @@ ${this.stack}`;
10162
10167
  * @returns {boolean}
10163
10168
  */
10164
10169
  function isSpecCompliantForm(thing) {
10165
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
10170
+ return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
10166
10171
  }
10167
10172
 
10168
10173
  const toJSONObject = (obj) => {
@@ -10231,6 +10236,10 @@ ${this.stack}`;
10231
10236
 
10232
10237
  // *********************
10233
10238
 
10239
+
10240
+ const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
10241
+
10242
+
10234
10243
  const utils$1 = {
10235
10244
  isArray: isArray$3,
10236
10245
  isArrayBuffer,
@@ -10286,7 +10295,8 @@ ${this.stack}`;
10286
10295
  isAsyncFn,
10287
10296
  isThenable,
10288
10297
  setImmediate: _setImmediate,
10289
- asap
10298
+ asap,
10299
+ isIterable
10290
10300
  };
10291
10301
 
10292
10302
  /**
@@ -11267,10 +11277,18 @@ ${this.stack}`;
11267
11277
  setHeaders(header, valueOrRewrite);
11268
11278
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
11269
11279
  setHeaders(parseHeaders(header), valueOrRewrite);
11270
- } else if (utils$1.isHeaders(header)) {
11271
- for (const [key, value] of header.entries()) {
11272
- setHeader(value, key, rewrite);
11280
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
11281
+ let obj = {}, dest, key;
11282
+ for (const entry of header) {
11283
+ if (!utils$1.isArray(entry)) {
11284
+ throw TypeError('Object iterator must return a key-value pair');
11285
+ }
11286
+
11287
+ obj[key = entry[0]] = (dest = obj[key]) ?
11288
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
11273
11289
  }
11290
+
11291
+ setHeaders(obj, valueOrRewrite);
11274
11292
  } else {
11275
11293
  header != null && setHeader(valueOrRewrite, header, rewrite);
11276
11294
  }
@@ -11412,6 +11430,10 @@ ${this.stack}`;
11412
11430
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
11413
11431
  }
11414
11432
 
11433
+ getSetCookie() {
11434
+ return this.get("set-cookie") || [];
11435
+ }
11436
+
11415
11437
  get [Symbol.toStringTag]() {
11416
11438
  return 'AxiosHeaders';
11417
11439
  }
@@ -12447,7 +12469,7 @@ ${this.stack}`;
12447
12469
  } catch (err) {
12448
12470
  unsubscribe && unsubscribe();
12449
12471
 
12450
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
12472
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
12451
12473
  throw Object.assign(
12452
12474
  new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
12453
12475
  {
@@ -12607,7 +12629,7 @@ ${this.stack}`;
12607
12629
  });
12608
12630
  }
12609
12631
 
12610
- const VERSION$1 = "1.8.4";
12632
+ const VERSION$1 = "1.9.0";
12611
12633
 
12612
12634
  const validators$1 = {};
12613
12635
 
@@ -12715,7 +12737,7 @@ ${this.stack}`;
12715
12737
  */
12716
12738
  let Axios$1 = class Axios {
12717
12739
  constructor(instanceConfig) {
12718
- this.defaults = instanceConfig;
12740
+ this.defaults = instanceConfig || {};
12719
12741
  this.interceptors = {
12720
12742
  request: new InterceptorManager(),
12721
12743
  response: new InterceptorManager()
@@ -14063,7 +14085,7 @@ ${this.stack}`;
14063
14085
  #clientSideWarningMessage = "";
14064
14086
  constructor(baseURL, authActions, options) {
14065
14087
  const defaultHeaders = {
14066
- // 'X-Sdk': 'b24-js-sdk-v-0.2.3'
14088
+ // 'X-Sdk': 'b24-js-sdk-v-0.3.0'
14067
14089
  };
14068
14090
  this.#clientAxios = axios.create({
14069
14091
  baseURL,
@@ -14472,8 +14494,6 @@ ${this.stack}`;
14472
14494
  if (this.#logTag.length > 0) {
14473
14495
  result.logTag = this.#logTag;
14474
14496
  }
14475
- result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
14476
- result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.3";
14477
14497
  if (!!result.data && !!result.data.start) {
14478
14498
  delete result.data.start;
14479
14499
  }
@@ -14490,7 +14510,13 @@ ${this.stack}`;
14490
14510
  * @private
14491
14511
  */
14492
14512
  #prepareMethod(method) {
14493
- return `${encodeURIComponent(method)}.json`;
14513
+ const baseUrl = `${encodeURIComponent(method)}.json`;
14514
+ const queryParams = new URLSearchParams({
14515
+ [this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
14516
+ [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.3.0",
14517
+ [this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
14518
+ });
14519
+ return `${baseUrl}?${queryParams.toString()}`;
14494
14520
  }
14495
14521
  /**
14496
14522
  * @inheritDoc