@bitrix24/b24jssdk 0.2.0 → 0.2.2
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 +101 -7
- package/dist/commonjs/index.cjs.map +1 -1
- package/dist/commonjs/index.d.cts +273 -5
- package/dist/commonjs/index.d.mts +273 -5
- package/dist/commonjs/index.d.ts +273 -5
- package/dist/esm/index.d.mts +273 -5
- package/dist/esm/index.d.ts +273 -5
- package/dist/esm/index.mjs +94 -8
- package/dist/esm/index.mjs.map +1 -1
- package/dist/umd/index.js +101 -7
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +16 -16
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/commonjs/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @version @bitrix24/b24jssdk v0.2.
|
|
2
|
+
* @version @bitrix24/b24jssdk v0.2.2
|
|
3
3
|
* @copyright (c) 2025 Bitrix24
|
|
4
4
|
* @licence MIT
|
|
5
5
|
* @links https://github.com/bitrix24/b24jssdk - GitHub
|
|
@@ -504,6 +504,24 @@ class TypeManager {
|
|
|
504
504
|
}
|
|
505
505
|
const Type = new TypeManager();
|
|
506
506
|
|
|
507
|
+
function pick(data, keys) {
|
|
508
|
+
const result = {};
|
|
509
|
+
for (const key of keys) {
|
|
510
|
+
result[key] = data[key];
|
|
511
|
+
}
|
|
512
|
+
return result;
|
|
513
|
+
}
|
|
514
|
+
function omit(data, keys) {
|
|
515
|
+
const result = { ...data };
|
|
516
|
+
for (const key of keys) {
|
|
517
|
+
delete result[key];
|
|
518
|
+
}
|
|
519
|
+
return result;
|
|
520
|
+
}
|
|
521
|
+
function isArrayOfArray(item) {
|
|
522
|
+
return Array.isArray(item[0]);
|
|
523
|
+
}
|
|
524
|
+
|
|
507
525
|
const _state = {};
|
|
508
526
|
let getRandomValues;
|
|
509
527
|
const randoms8 = new Uint8Array(16);
|
|
@@ -912,6 +930,7 @@ var EnumCrmEntityType = /* @__PURE__ */ ((EnumCrmEntityType2) => {
|
|
|
912
930
|
EnumCrmEntityType2["invoice"] = "CRM_SMART_INVOICE";
|
|
913
931
|
EnumCrmEntityType2["quote"] = "CRM_QUOTE";
|
|
914
932
|
EnumCrmEntityType2["requisite"] = "CRM_REQUISITE";
|
|
933
|
+
EnumCrmEntityType2["order"] = "ORDER";
|
|
915
934
|
return EnumCrmEntityType2;
|
|
916
935
|
})(EnumCrmEntityType || {});
|
|
917
936
|
var EnumCrmEntityTypeId = /* @__PURE__ */ ((EnumCrmEntityTypeId2) => {
|
|
@@ -924,8 +943,54 @@ var EnumCrmEntityTypeId = /* @__PURE__ */ ((EnumCrmEntityTypeId2) => {
|
|
|
924
943
|
EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["invoice"] = 31] = "invoice";
|
|
925
944
|
EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["quote"] = 7] = "quote";
|
|
926
945
|
EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["requisite"] = 8] = "requisite";
|
|
946
|
+
EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["order"] = 14] = "order";
|
|
927
947
|
return EnumCrmEntityTypeId2;
|
|
928
948
|
})(EnumCrmEntityTypeId || {});
|
|
949
|
+
var EnumCrmEntityTypeShort = /* @__PURE__ */ ((EnumCrmEntityTypeShort2) => {
|
|
950
|
+
EnumCrmEntityTypeShort2["undefined"] = "?";
|
|
951
|
+
EnumCrmEntityTypeShort2["lead"] = "L";
|
|
952
|
+
EnumCrmEntityTypeShort2["deal"] = "D";
|
|
953
|
+
EnumCrmEntityTypeShort2["contact"] = "C";
|
|
954
|
+
EnumCrmEntityTypeShort2["company"] = "CO";
|
|
955
|
+
EnumCrmEntityTypeShort2["oldInvoice"] = "I";
|
|
956
|
+
EnumCrmEntityTypeShort2["invoice"] = "SI";
|
|
957
|
+
EnumCrmEntityTypeShort2["quote"] = "Q";
|
|
958
|
+
EnumCrmEntityTypeShort2["requisite"] = "RQ";
|
|
959
|
+
EnumCrmEntityTypeShort2["order"] = "O";
|
|
960
|
+
return EnumCrmEntityTypeShort2;
|
|
961
|
+
})(EnumCrmEntityTypeShort || {});
|
|
962
|
+
|
|
963
|
+
var ProductRowDiscountTypeId = /* @__PURE__ */ ((ProductRowDiscountTypeId2) => {
|
|
964
|
+
ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["undefined"] = 0] = "undefined";
|
|
965
|
+
ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["absolute"] = 1] = "absolute";
|
|
966
|
+
ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["percentage"] = 2] = "percentage";
|
|
967
|
+
return ProductRowDiscountTypeId2;
|
|
968
|
+
})(ProductRowDiscountTypeId || {});
|
|
969
|
+
|
|
970
|
+
var CatalogProductType = /* @__PURE__ */ ((CatalogProductType2) => {
|
|
971
|
+
CatalogProductType2[CatalogProductType2["undefined"] = 0] = "undefined";
|
|
972
|
+
CatalogProductType2[CatalogProductType2["product"] = 1] = "product";
|
|
973
|
+
CatalogProductType2[CatalogProductType2["service"] = 7] = "service";
|
|
974
|
+
CatalogProductType2[CatalogProductType2["sku"] = 3] = "sku";
|
|
975
|
+
CatalogProductType2[CatalogProductType2["skuEmpty"] = 6] = "skuEmpty";
|
|
976
|
+
CatalogProductType2[CatalogProductType2["offer"] = 4] = "offer";
|
|
977
|
+
CatalogProductType2[CatalogProductType2["offerEmpty"] = 5] = "offerEmpty";
|
|
978
|
+
return CatalogProductType2;
|
|
979
|
+
})(CatalogProductType || {});
|
|
980
|
+
var CatalogProductImageType = /* @__PURE__ */ ((CatalogProductImageType2) => {
|
|
981
|
+
CatalogProductImageType2["undefined"] = "UNDEFINED";
|
|
982
|
+
CatalogProductImageType2["detail"] = "DETAIL_PICTURE";
|
|
983
|
+
CatalogProductImageType2["preview"] = "PREVIEW_PICTURE";
|
|
984
|
+
CatalogProductImageType2["morePhoto"] = "MORE_PHOTO";
|
|
985
|
+
return CatalogProductImageType2;
|
|
986
|
+
})(CatalogProductImageType || {});
|
|
987
|
+
var CatalogRoundingRuleType = /* @__PURE__ */ ((CatalogRoundingRuleType2) => {
|
|
988
|
+
CatalogRoundingRuleType2[CatalogRoundingRuleType2["undefined"] = 0] = "undefined";
|
|
989
|
+
CatalogRoundingRuleType2[CatalogRoundingRuleType2["mathematical"] = 1] = "mathematical";
|
|
990
|
+
CatalogRoundingRuleType2[CatalogRoundingRuleType2["roundingUp"] = 2] = "roundingUp";
|
|
991
|
+
CatalogRoundingRuleType2[CatalogRoundingRuleType2["roundingDown"] = 4] = "roundingDown";
|
|
992
|
+
return CatalogRoundingRuleType2;
|
|
993
|
+
})(CatalogRoundingRuleType || {});
|
|
929
994
|
|
|
930
995
|
var LoadDataType = /* @__PURE__ */ ((LoadDataType2) => {
|
|
931
996
|
LoadDataType2["App"] = "app";
|
|
@@ -1478,9 +1543,16 @@ class Http {
|
|
|
1478
1543
|
#isClientSideWarning = false;
|
|
1479
1544
|
#clientSideWarningMessage = "";
|
|
1480
1545
|
constructor(baseURL, authActions, options) {
|
|
1546
|
+
const defaultHeaders = {
|
|
1547
|
+
// 'X-Sdk': 'b24-js-sdk-v-0.2.2'
|
|
1548
|
+
};
|
|
1481
1549
|
this.#clientAxios = axios.create({
|
|
1482
1550
|
baseURL,
|
|
1483
|
-
|
|
1551
|
+
headers: {
|
|
1552
|
+
...defaultHeaders,
|
|
1553
|
+
...options ? options.headers : {}
|
|
1554
|
+
},
|
|
1555
|
+
...options && { ...options, headers: void 0 }
|
|
1484
1556
|
});
|
|
1485
1557
|
this.#authActions = authActions;
|
|
1486
1558
|
this.#restrictionManager = new RestrictionManager();
|
|
@@ -1882,7 +1954,7 @@ class Http {
|
|
|
1882
1954
|
result.logTag = this.#logTag;
|
|
1883
1955
|
}
|
|
1884
1956
|
result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
|
|
1885
|
-
result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.
|
|
1957
|
+
result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.2";
|
|
1886
1958
|
if (!!result.data && !!result.data.start) {
|
|
1887
1959
|
delete result.data.start;
|
|
1888
1960
|
}
|
|
@@ -3044,11 +3116,13 @@ var MessageCommands = /* @__PURE__ */ ((MessageCommands2) => {
|
|
|
3044
3116
|
class MessageManager {
|
|
3045
3117
|
#appFrame;
|
|
3046
3118
|
#callbackPromises;
|
|
3119
|
+
#callbackSingletone;
|
|
3047
3120
|
_logger = null;
|
|
3048
3121
|
runCallbackHandler;
|
|
3049
3122
|
constructor(appFrame) {
|
|
3050
3123
|
this.#appFrame = appFrame;
|
|
3051
3124
|
this.#callbackPromises = /* @__PURE__ */ new Map();
|
|
3125
|
+
this.#callbackSingletone = /* @__PURE__ */ new Map();
|
|
3052
3126
|
this.runCallbackHandler = this._runCallback.bind(this);
|
|
3053
3127
|
}
|
|
3054
3128
|
setLogger(logger) {
|
|
@@ -3098,17 +3172,22 @@ class MessageManager {
|
|
|
3098
3172
|
timeoutId: null
|
|
3099
3173
|
};
|
|
3100
3174
|
const keyPromise = this.#setCallbackPromise(promiseHandler);
|
|
3175
|
+
const paramsSend = omit(params || {}, ["callBack", "isSafely", "safelyTime"]);
|
|
3176
|
+
const { callBack } = params || {};
|
|
3177
|
+
if (callBack) {
|
|
3178
|
+
this.#callbackSingletone.set(keyPromise, callBack);
|
|
3179
|
+
}
|
|
3101
3180
|
if (command.toString().includes(":")) {
|
|
3102
3181
|
cmd = {
|
|
3103
3182
|
method: command.toString(),
|
|
3104
|
-
params:
|
|
3183
|
+
params: paramsSend ?? "",
|
|
3105
3184
|
callback: keyPromise,
|
|
3106
3185
|
appSid: this.#appFrame.getAppSid()
|
|
3107
3186
|
};
|
|
3108
3187
|
} else {
|
|
3109
3188
|
cmd = command.toString();
|
|
3110
3189
|
const listParams = [
|
|
3111
|
-
params ? JSON.stringify(
|
|
3190
|
+
params ? JSON.stringify(paramsSend) : null,
|
|
3112
3191
|
keyPromise,
|
|
3113
3192
|
this.#appFrame.getAppSid()
|
|
3114
3193
|
];
|
|
@@ -3163,6 +3242,11 @@ class MessageManager {
|
|
|
3163
3242
|
}
|
|
3164
3243
|
this.#callbackPromises.delete(cmd.id);
|
|
3165
3244
|
promise.resolve(cmd.args);
|
|
3245
|
+
} else if (this.#callbackSingletone.has(cmd.id)) {
|
|
3246
|
+
const callBack = this.#callbackSingletone.get(cmd.id);
|
|
3247
|
+
if (callBack) {
|
|
3248
|
+
callBack.apply(globalThis, [cmd.args]);
|
|
3249
|
+
}
|
|
3166
3250
|
}
|
|
3167
3251
|
}
|
|
3168
3252
|
}
|
|
@@ -3889,15 +3973,17 @@ class PlacementManager {
|
|
|
3889
3973
|
/**
|
|
3890
3974
|
* Set Up the Interface Event Handler
|
|
3891
3975
|
* @param {string} eventName
|
|
3976
|
+
* @param {(...args: any[]) => void} callBack
|
|
3892
3977
|
* @return {Promise<any>}
|
|
3893
3978
|
*
|
|
3894
3979
|
* @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-bind-event.html
|
|
3895
3980
|
*/
|
|
3896
|
-
async bindEvent(eventName) {
|
|
3981
|
+
async bindEvent(eventName, callBack) {
|
|
3897
3982
|
return this.#messageManager.send(
|
|
3898
|
-
MessageCommands.
|
|
3983
|
+
MessageCommands.placementBindEvent,
|
|
3899
3984
|
{
|
|
3900
3985
|
event: eventName,
|
|
3986
|
+
callBack,
|
|
3901
3987
|
isSafely: true
|
|
3902
3988
|
}
|
|
3903
3989
|
);
|
|
@@ -13543,6 +13629,9 @@ exports.B24Hook = B24Hook;
|
|
|
13543
13629
|
exports.B24LangList = B24LangList;
|
|
13544
13630
|
exports.B24PullClientManager = PullClient;
|
|
13545
13631
|
exports.Browser = Browser;
|
|
13632
|
+
exports.CatalogProductImageType = CatalogProductImageType;
|
|
13633
|
+
exports.CatalogProductType = CatalogProductType;
|
|
13634
|
+
exports.CatalogRoundingRuleType = CatalogRoundingRuleType;
|
|
13546
13635
|
exports.CloseReasons = CloseReasons;
|
|
13547
13636
|
exports.ConnectionType = ConnectionType;
|
|
13548
13637
|
exports.DataType = DataType;
|
|
@@ -13550,6 +13639,7 @@ exports.DialogManager = DialogManager;
|
|
|
13550
13639
|
exports.EnumAppStatus = EnumAppStatus;
|
|
13551
13640
|
exports.EnumCrmEntityType = EnumCrmEntityType;
|
|
13552
13641
|
exports.EnumCrmEntityTypeId = EnumCrmEntityTypeId;
|
|
13642
|
+
exports.EnumCrmEntityTypeShort = EnumCrmEntityTypeShort;
|
|
13553
13643
|
exports.ListRpcError = ListRpcError;
|
|
13554
13644
|
exports.LoadDataType = LoadDataType;
|
|
13555
13645
|
exports.LoggerBrowser = LoggerBrowser;
|
|
@@ -13560,6 +13650,7 @@ exports.MessageManager = MessageManager;
|
|
|
13560
13650
|
exports.OptionsManager = OptionsManager$1;
|
|
13561
13651
|
exports.ParentManager = ParentManager;
|
|
13562
13652
|
exports.PlacementManager = PlacementManager;
|
|
13653
|
+
exports.ProductRowDiscountTypeId = ProductRowDiscountTypeId;
|
|
13563
13654
|
exports.PullStatus = PullStatus;
|
|
13564
13655
|
exports.RestrictionManagerParamsBase = RestrictionManagerParamsBase;
|
|
13565
13656
|
exports.RestrictionManagerParamsForEnterprise = RestrictionManagerParamsForEnterprise;
|
|
@@ -13576,6 +13667,9 @@ exports.Type = Type;
|
|
|
13576
13667
|
exports.TypeOption = TypeOption;
|
|
13577
13668
|
exports.TypeSpecificUrl = TypeSpecificUrl;
|
|
13578
13669
|
exports.initializeB24Frame = initializeB24Frame;
|
|
13670
|
+
exports.isArrayOfArray = isArrayOfArray;
|
|
13671
|
+
exports.omit = omit;
|
|
13672
|
+
exports.pick = pick;
|
|
13579
13673
|
exports.useB24Helper = useB24Helper;
|
|
13580
13674
|
exports.useFormatter = useFormatter;
|
|
13581
13675
|
//# sourceMappingURL=index.cjs.map
|