@bitrix24/b24jssdk 0.2.2 → 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/commonjs/index.cjs +49 -11
- package/dist/commonjs/index.cjs.map +1 -1
- package/dist/commonjs/index.d.cts +9 -0
- package/dist/commonjs/index.d.mts +9 -0
- package/dist/commonjs/index.d.ts +9 -0
- package/dist/esm/index.d.mts +9 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.mjs +49 -11
- package/dist/esm/index.mjs.map +1 -1
- package/dist/umd/index.js +79 -23
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +14 -14
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +5 -6
|
@@ -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
|
/**
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -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
|
/**
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -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
|
/**
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -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
|
/**
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @version @bitrix24/b24jssdk v0.
|
|
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
|
|
@@ -1498,13 +1498,17 @@ class RestrictionManager {
|
|
|
1498
1498
|
|
|
1499
1499
|
const DEFAULT_REQUEST_ID_HEADER_FIELD_NAME = "X-Request-ID";
|
|
1500
1500
|
const DEFAULT_QUERY_STRING_PARAMETER_NAME = "bx24_request_id";
|
|
1501
|
-
const
|
|
1501
|
+
const DEFAULT_QUERY_STRING_SDK_VER_PARAMETER_NAME = "bx24_sdk_ver";
|
|
1502
|
+
const DEFAULT_QUERY_STRING_SDK_TYPE_PARAMETER_NAME = "bx24_sdk_type";
|
|
1502
1503
|
class DefaultRequestIdGenerator {
|
|
1503
1504
|
getQueryStringParameterName() {
|
|
1504
1505
|
return DEFAULT_QUERY_STRING_PARAMETER_NAME;
|
|
1505
1506
|
}
|
|
1506
1507
|
getQueryStringSdkParameterName() {
|
|
1507
|
-
return
|
|
1508
|
+
return DEFAULT_QUERY_STRING_SDK_VER_PARAMETER_NAME;
|
|
1509
|
+
}
|
|
1510
|
+
getQueryStringSdkTypeParameterName() {
|
|
1511
|
+
return DEFAULT_QUERY_STRING_SDK_TYPE_PARAMETER_NAME;
|
|
1508
1512
|
}
|
|
1509
1513
|
generate() {
|
|
1510
1514
|
return Text.getUuidRfc4122();
|
|
@@ -1529,7 +1533,7 @@ class Http {
|
|
|
1529
1533
|
#clientSideWarningMessage = "";
|
|
1530
1534
|
constructor(baseURL, authActions, options) {
|
|
1531
1535
|
const defaultHeaders = {
|
|
1532
|
-
// 'X-Sdk': 'b24-js-sdk-v-0.
|
|
1536
|
+
// 'X-Sdk': 'b24-js-sdk-v-0.3.0'
|
|
1533
1537
|
};
|
|
1534
1538
|
this.#clientAxios = axios.create({
|
|
1535
1539
|
baseURL,
|
|
@@ -1938,8 +1942,6 @@ class Http {
|
|
|
1938
1942
|
if (this.#logTag.length > 0) {
|
|
1939
1943
|
result.logTag = this.#logTag;
|
|
1940
1944
|
}
|
|
1941
|
-
result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
|
|
1942
|
-
result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.2";
|
|
1943
1945
|
if (!!result.data && !!result.data.start) {
|
|
1944
1946
|
delete result.data.start;
|
|
1945
1947
|
}
|
|
@@ -1956,7 +1958,13 @@ class Http {
|
|
|
1956
1958
|
* @private
|
|
1957
1959
|
*/
|
|
1958
1960
|
#prepareMethod(method) {
|
|
1959
|
-
|
|
1961
|
+
const baseUrl = `${encodeURIComponent(method)}.json`;
|
|
1962
|
+
const queryParams = new URLSearchParams({
|
|
1963
|
+
[this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
|
|
1964
|
+
[this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.3.0",
|
|
1965
|
+
[this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
1966
|
+
});
|
|
1967
|
+
return `${baseUrl}?${queryParams.toString()}`;
|
|
1960
1968
|
}
|
|
1961
1969
|
/**
|
|
1962
1970
|
* @inheritDoc
|
|
@@ -3157,22 +3165,28 @@ class MessageManager {
|
|
|
3157
3165
|
timeoutId: null
|
|
3158
3166
|
};
|
|
3159
3167
|
const keyPromise = this.#setCallbackPromise(promiseHandler);
|
|
3160
|
-
|
|
3161
|
-
const
|
|
3168
|
+
let paramsSend = null;
|
|
3169
|
+
const optionsSend = omit(params || {}, ["singleOption", "callBack", "isSafely", "safelyTime"]);
|
|
3170
|
+
const { callBack, singleOption } = params || {};
|
|
3162
3171
|
if (callBack) {
|
|
3163
3172
|
this.#callbackSingletone.set(keyPromise, callBack);
|
|
3164
3173
|
}
|
|
3174
|
+
if (singleOption) {
|
|
3175
|
+
paramsSend = singleOption;
|
|
3176
|
+
} else if (Object.keys(optionsSend).length > 0) {
|
|
3177
|
+
paramsSend = { ...optionsSend };
|
|
3178
|
+
}
|
|
3165
3179
|
if (command.toString().includes(":")) {
|
|
3166
3180
|
cmd = {
|
|
3167
3181
|
method: command.toString(),
|
|
3168
|
-
params: paramsSend
|
|
3182
|
+
params: paramsSend || "",
|
|
3169
3183
|
callback: keyPromise,
|
|
3170
3184
|
appSid: this.#appFrame.getAppSid()
|
|
3171
3185
|
};
|
|
3172
3186
|
} else {
|
|
3173
3187
|
cmd = command.toString();
|
|
3174
3188
|
const listParams = [
|
|
3175
|
-
|
|
3189
|
+
paramsSend ? JSON.stringify(paramsSend) : "",
|
|
3176
3190
|
keyPromise,
|
|
3177
3191
|
this.#appFrame.getAppSid()
|
|
3178
3192
|
];
|
|
@@ -3990,6 +4004,30 @@ class PlacementManager {
|
|
|
3990
4004
|
}
|
|
3991
4005
|
);
|
|
3992
4006
|
}
|
|
4007
|
+
/**
|
|
4008
|
+
* Set Up the Interface Event Handler
|
|
4009
|
+
* @param {string} command
|
|
4010
|
+
* @param {null | string | Record<string, any>} parameters
|
|
4011
|
+
* @param {(...args: any[]) => void} callBack
|
|
4012
|
+
*
|
|
4013
|
+
* @return {Promise<any>}
|
|
4014
|
+
*/
|
|
4015
|
+
async callCustomBind(command, parameters = null, callBack) {
|
|
4016
|
+
let options = {};
|
|
4017
|
+
if (Type.isString(parameters)) {
|
|
4018
|
+
options["singleOption"] = parameters;
|
|
4019
|
+
} else if (Type.isObjectLike(parameters)) {
|
|
4020
|
+
options = { ...parameters };
|
|
4021
|
+
}
|
|
4022
|
+
return this.#messageManager.send(
|
|
4023
|
+
command,
|
|
4024
|
+
{
|
|
4025
|
+
...options,
|
|
4026
|
+
callBack,
|
|
4027
|
+
isSafely: true
|
|
4028
|
+
}
|
|
4029
|
+
);
|
|
4030
|
+
}
|
|
3993
4031
|
}
|
|
3994
4032
|
|
|
3995
4033
|
class B24Frame extends AbstractB24 {
|