@bitrix24/b24jssdk 0.2.2 → 0.2.3

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.
@@ -2505,6 +2505,15 @@ declare class PlacementManager {
2505
2505
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
2506
2506
  */
2507
2507
  call(command: string, parameters?: Record<string, any>): Promise<any>;
2508
+ /**
2509
+ * Set Up the Interface Event Handler
2510
+ * @param {string} command
2511
+ * @param {null | string | Record<string, any>} parameters
2512
+ * @param {(...args: any[]) => void} callBack
2513
+ *
2514
+ * @return {Promise<any>}
2515
+ */
2516
+ callCustomBind(command: string, parameters: (null | string | Record<string, any>) | undefined, callBack: (...args: any[]) => void): Promise<any>;
2508
2517
  }
2509
2518
 
2510
2519
  /**
@@ -2505,6 +2505,15 @@ declare class PlacementManager {
2505
2505
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
2506
2506
  */
2507
2507
  call(command: string, parameters?: Record<string, any>): Promise<any>;
2508
+ /**
2509
+ * Set Up the Interface Event Handler
2510
+ * @param {string} command
2511
+ * @param {null | string | Record<string, any>} parameters
2512
+ * @param {(...args: any[]) => void} callBack
2513
+ *
2514
+ * @return {Promise<any>}
2515
+ */
2516
+ callCustomBind(command: string, parameters: (null | string | Record<string, any>) | undefined, callBack: (...args: any[]) => void): Promise<any>;
2508
2517
  }
2509
2518
 
2510
2519
  /**
@@ -2505,6 +2505,15 @@ declare class PlacementManager {
2505
2505
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
2506
2506
  */
2507
2507
  call(command: string, parameters?: Record<string, any>): Promise<any>;
2508
+ /**
2509
+ * Set Up the Interface Event Handler
2510
+ * @param {string} command
2511
+ * @param {null | string | Record<string, any>} parameters
2512
+ * @param {(...args: any[]) => void} callBack
2513
+ *
2514
+ * @return {Promise<any>}
2515
+ */
2516
+ callCustomBind(command: string, parameters: (null | string | Record<string, any>) | undefined, callBack: (...args: any[]) => void): Promise<any>;
2508
2517
  }
2509
2518
 
2510
2519
  /**
@@ -2505,6 +2505,15 @@ declare class PlacementManager {
2505
2505
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
2506
2506
  */
2507
2507
  call(command: string, parameters?: Record<string, any>): Promise<any>;
2508
+ /**
2509
+ * Set Up the Interface Event Handler
2510
+ * @param {string} command
2511
+ * @param {null | string | Record<string, any>} parameters
2512
+ * @param {(...args: any[]) => void} callBack
2513
+ *
2514
+ * @return {Promise<any>}
2515
+ */
2516
+ callCustomBind(command: string, parameters: (null | string | Record<string, any>) | undefined, callBack: (...args: any[]) => void): Promise<any>;
2508
2517
  }
2509
2518
 
2510
2519
  /**
@@ -2505,6 +2505,15 @@ declare class PlacementManager {
2505
2505
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
2506
2506
  */
2507
2507
  call(command: string, parameters?: Record<string, any>): Promise<any>;
2508
+ /**
2509
+ * Set Up the Interface Event Handler
2510
+ * @param {string} command
2511
+ * @param {null | string | Record<string, any>} parameters
2512
+ * @param {(...args: any[]) => void} callBack
2513
+ *
2514
+ * @return {Promise<any>}
2515
+ */
2516
+ callCustomBind(command: string, parameters: (null | string | Record<string, any>) | undefined, callBack: (...args: any[]) => void): Promise<any>;
2508
2517
  }
2509
2518
 
2510
2519
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @version @bitrix24/b24jssdk v0.2.2
2
+ * @version @bitrix24/b24jssdk v0.2.3
3
3
  * @copyright (c) 2025 Bitrix24
4
4
  * @licence MIT
5
5
  * @links https://github.com/bitrix24/b24jssdk - GitHub
@@ -1529,7 +1529,7 @@ class Http {
1529
1529
  #clientSideWarningMessage = "";
1530
1530
  constructor(baseURL, authActions, options) {
1531
1531
  const defaultHeaders = {
1532
- // 'X-Sdk': 'b24-js-sdk-v-0.2.2'
1532
+ // 'X-Sdk': 'b24-js-sdk-v-0.2.3'
1533
1533
  };
1534
1534
  this.#clientAxios = axios.create({
1535
1535
  baseURL,
@@ -1939,7 +1939,7 @@ class Http {
1939
1939
  result.logTag = this.#logTag;
1940
1940
  }
1941
1941
  result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
1942
- result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.2";
1942
+ result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.3";
1943
1943
  if (!!result.data && !!result.data.start) {
1944
1944
  delete result.data.start;
1945
1945
  }
@@ -3157,22 +3157,28 @@ class MessageManager {
3157
3157
  timeoutId: null
3158
3158
  };
3159
3159
  const keyPromise = this.#setCallbackPromise(promiseHandler);
3160
- const paramsSend = omit(params || {}, ["callBack", "isSafely", "safelyTime"]);
3161
- const { callBack } = params || {};
3160
+ let paramsSend = null;
3161
+ const optionsSend = omit(params || {}, ["singleOption", "callBack", "isSafely", "safelyTime"]);
3162
+ const { callBack, singleOption } = params || {};
3162
3163
  if (callBack) {
3163
3164
  this.#callbackSingletone.set(keyPromise, callBack);
3164
3165
  }
3166
+ if (singleOption) {
3167
+ paramsSend = singleOption;
3168
+ } else if (Object.keys(optionsSend).length > 0) {
3169
+ paramsSend = { ...optionsSend };
3170
+ }
3165
3171
  if (command.toString().includes(":")) {
3166
3172
  cmd = {
3167
3173
  method: command.toString(),
3168
- params: paramsSend ?? "",
3174
+ params: paramsSend || "",
3169
3175
  callback: keyPromise,
3170
3176
  appSid: this.#appFrame.getAppSid()
3171
3177
  };
3172
3178
  } else {
3173
3179
  cmd = command.toString();
3174
3180
  const listParams = [
3175
- params ? JSON.stringify(paramsSend) : null,
3181
+ paramsSend ? JSON.stringify(paramsSend) : "",
3176
3182
  keyPromise,
3177
3183
  this.#appFrame.getAppSid()
3178
3184
  ];
@@ -3990,6 +3996,30 @@ class PlacementManager {
3990
3996
  }
3991
3997
  );
3992
3998
  }
3999
+ /**
4000
+ * Set Up the Interface Event Handler
4001
+ * @param {string} command
4002
+ * @param {null | string | Record<string, any>} parameters
4003
+ * @param {(...args: any[]) => void} callBack
4004
+ *
4005
+ * @return {Promise<any>}
4006
+ */
4007
+ async callCustomBind(command, parameters = null, callBack) {
4008
+ let options = {};
4009
+ if (Type.isString(parameters)) {
4010
+ options["singleOption"] = parameters;
4011
+ } else if (Type.isObjectLike(parameters)) {
4012
+ options = { ...parameters };
4013
+ }
4014
+ return this.#messageManager.send(
4015
+ command,
4016
+ {
4017
+ ...options,
4018
+ callBack,
4019
+ isSafely: true
4020
+ }
4021
+ );
4022
+ }
3993
4023
  }
3994
4024
 
3995
4025
  class B24Frame extends AbstractB24 {