@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/umd/index.js
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
|
|
@@ -491,6 +491,24 @@
|
|
|
491
491
|
}
|
|
492
492
|
const Type = new TypeManager();
|
|
493
493
|
|
|
494
|
+
function pick$1(data, keys) {
|
|
495
|
+
const result = {};
|
|
496
|
+
for (const key of keys) {
|
|
497
|
+
result[key] = data[key];
|
|
498
|
+
}
|
|
499
|
+
return result;
|
|
500
|
+
}
|
|
501
|
+
function omit(data, keys) {
|
|
502
|
+
const result = { ...data };
|
|
503
|
+
for (const key of keys) {
|
|
504
|
+
delete result[key];
|
|
505
|
+
}
|
|
506
|
+
return result;
|
|
507
|
+
}
|
|
508
|
+
function isArrayOfArray(item) {
|
|
509
|
+
return Array.isArray(item[0]);
|
|
510
|
+
}
|
|
511
|
+
|
|
494
512
|
// these aren't really private, but nor are they really useful to document
|
|
495
513
|
|
|
496
514
|
/**
|
|
@@ -8928,6 +8946,7 @@
|
|
|
8928
8946
|
EnumCrmEntityType2["invoice"] = "CRM_SMART_INVOICE";
|
|
8929
8947
|
EnumCrmEntityType2["quote"] = "CRM_QUOTE";
|
|
8930
8948
|
EnumCrmEntityType2["requisite"] = "CRM_REQUISITE";
|
|
8949
|
+
EnumCrmEntityType2["order"] = "ORDER";
|
|
8931
8950
|
return EnumCrmEntityType2;
|
|
8932
8951
|
})(EnumCrmEntityType || {});
|
|
8933
8952
|
var EnumCrmEntityTypeId = /* @__PURE__ */ ((EnumCrmEntityTypeId2) => {
|
|
@@ -8940,8 +8959,54 @@
|
|
|
8940
8959
|
EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["invoice"] = 31] = "invoice";
|
|
8941
8960
|
EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["quote"] = 7] = "quote";
|
|
8942
8961
|
EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["requisite"] = 8] = "requisite";
|
|
8962
|
+
EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["order"] = 14] = "order";
|
|
8943
8963
|
return EnumCrmEntityTypeId2;
|
|
8944
8964
|
})(EnumCrmEntityTypeId || {});
|
|
8965
|
+
var EnumCrmEntityTypeShort = /* @__PURE__ */ ((EnumCrmEntityTypeShort2) => {
|
|
8966
|
+
EnumCrmEntityTypeShort2["undefined"] = "?";
|
|
8967
|
+
EnumCrmEntityTypeShort2["lead"] = "L";
|
|
8968
|
+
EnumCrmEntityTypeShort2["deal"] = "D";
|
|
8969
|
+
EnumCrmEntityTypeShort2["contact"] = "C";
|
|
8970
|
+
EnumCrmEntityTypeShort2["company"] = "CO";
|
|
8971
|
+
EnumCrmEntityTypeShort2["oldInvoice"] = "I";
|
|
8972
|
+
EnumCrmEntityTypeShort2["invoice"] = "SI";
|
|
8973
|
+
EnumCrmEntityTypeShort2["quote"] = "Q";
|
|
8974
|
+
EnumCrmEntityTypeShort2["requisite"] = "RQ";
|
|
8975
|
+
EnumCrmEntityTypeShort2["order"] = "O";
|
|
8976
|
+
return EnumCrmEntityTypeShort2;
|
|
8977
|
+
})(EnumCrmEntityTypeShort || {});
|
|
8978
|
+
|
|
8979
|
+
var ProductRowDiscountTypeId = /* @__PURE__ */ ((ProductRowDiscountTypeId2) => {
|
|
8980
|
+
ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["undefined"] = 0] = "undefined";
|
|
8981
|
+
ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["absolute"] = 1] = "absolute";
|
|
8982
|
+
ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["percentage"] = 2] = "percentage";
|
|
8983
|
+
return ProductRowDiscountTypeId2;
|
|
8984
|
+
})(ProductRowDiscountTypeId || {});
|
|
8985
|
+
|
|
8986
|
+
var CatalogProductType = /* @__PURE__ */ ((CatalogProductType2) => {
|
|
8987
|
+
CatalogProductType2[CatalogProductType2["undefined"] = 0] = "undefined";
|
|
8988
|
+
CatalogProductType2[CatalogProductType2["product"] = 1] = "product";
|
|
8989
|
+
CatalogProductType2[CatalogProductType2["service"] = 7] = "service";
|
|
8990
|
+
CatalogProductType2[CatalogProductType2["sku"] = 3] = "sku";
|
|
8991
|
+
CatalogProductType2[CatalogProductType2["skuEmpty"] = 6] = "skuEmpty";
|
|
8992
|
+
CatalogProductType2[CatalogProductType2["offer"] = 4] = "offer";
|
|
8993
|
+
CatalogProductType2[CatalogProductType2["offerEmpty"] = 5] = "offerEmpty";
|
|
8994
|
+
return CatalogProductType2;
|
|
8995
|
+
})(CatalogProductType || {});
|
|
8996
|
+
var CatalogProductImageType = /* @__PURE__ */ ((CatalogProductImageType2) => {
|
|
8997
|
+
CatalogProductImageType2["undefined"] = "UNDEFINED";
|
|
8998
|
+
CatalogProductImageType2["detail"] = "DETAIL_PICTURE";
|
|
8999
|
+
CatalogProductImageType2["preview"] = "PREVIEW_PICTURE";
|
|
9000
|
+
CatalogProductImageType2["morePhoto"] = "MORE_PHOTO";
|
|
9001
|
+
return CatalogProductImageType2;
|
|
9002
|
+
})(CatalogProductImageType || {});
|
|
9003
|
+
var CatalogRoundingRuleType = /* @__PURE__ */ ((CatalogRoundingRuleType2) => {
|
|
9004
|
+
CatalogRoundingRuleType2[CatalogRoundingRuleType2["undefined"] = 0] = "undefined";
|
|
9005
|
+
CatalogRoundingRuleType2[CatalogRoundingRuleType2["mathematical"] = 1] = "mathematical";
|
|
9006
|
+
CatalogRoundingRuleType2[CatalogRoundingRuleType2["roundingUp"] = 2] = "roundingUp";
|
|
9007
|
+
CatalogRoundingRuleType2[CatalogRoundingRuleType2["roundingDown"] = 4] = "roundingDown";
|
|
9008
|
+
return CatalogRoundingRuleType2;
|
|
9009
|
+
})(CatalogRoundingRuleType || {});
|
|
8945
9010
|
|
|
8946
9011
|
var LoadDataType = /* @__PURE__ */ ((LoadDataType2) => {
|
|
8947
9012
|
LoadDataType2["App"] = "app";
|
|
@@ -13997,9 +14062,16 @@ ${this.stack}`;
|
|
|
13997
14062
|
#isClientSideWarning = false;
|
|
13998
14063
|
#clientSideWarningMessage = "";
|
|
13999
14064
|
constructor(baseURL, authActions, options) {
|
|
14065
|
+
const defaultHeaders = {
|
|
14066
|
+
// 'X-Sdk': 'b24-js-sdk-v-0.2.2'
|
|
14067
|
+
};
|
|
14000
14068
|
this.#clientAxios = axios.create({
|
|
14001
14069
|
baseURL,
|
|
14002
|
-
|
|
14070
|
+
headers: {
|
|
14071
|
+
...defaultHeaders,
|
|
14072
|
+
...options ? options.headers : {}
|
|
14073
|
+
},
|
|
14074
|
+
...options && { ...options, headers: void 0 }
|
|
14003
14075
|
});
|
|
14004
14076
|
this.#authActions = authActions;
|
|
14005
14077
|
this.#restrictionManager = new RestrictionManager();
|
|
@@ -14401,7 +14473,7 @@ ${this.stack}`;
|
|
|
14401
14473
|
result.logTag = this.#logTag;
|
|
14402
14474
|
}
|
|
14403
14475
|
result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
|
|
14404
|
-
result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.
|
|
14476
|
+
result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.2";
|
|
14405
14477
|
if (!!result.data && !!result.data.start) {
|
|
14406
14478
|
delete result.data.start;
|
|
14407
14479
|
}
|
|
@@ -15563,11 +15635,13 @@ ${this.stack}`;
|
|
|
15563
15635
|
class MessageManager {
|
|
15564
15636
|
#appFrame;
|
|
15565
15637
|
#callbackPromises;
|
|
15638
|
+
#callbackSingletone;
|
|
15566
15639
|
_logger = null;
|
|
15567
15640
|
runCallbackHandler;
|
|
15568
15641
|
constructor(appFrame) {
|
|
15569
15642
|
this.#appFrame = appFrame;
|
|
15570
15643
|
this.#callbackPromises = /* @__PURE__ */ new Map();
|
|
15644
|
+
this.#callbackSingletone = /* @__PURE__ */ new Map();
|
|
15571
15645
|
this.runCallbackHandler = this._runCallback.bind(this);
|
|
15572
15646
|
}
|
|
15573
15647
|
setLogger(logger) {
|
|
@@ -15617,17 +15691,22 @@ ${this.stack}`;
|
|
|
15617
15691
|
timeoutId: null
|
|
15618
15692
|
};
|
|
15619
15693
|
const keyPromise = this.#setCallbackPromise(promiseHandler);
|
|
15694
|
+
const paramsSend = omit(params || {}, ["callBack", "isSafely", "safelyTime"]);
|
|
15695
|
+
const { callBack } = params || {};
|
|
15696
|
+
if (callBack) {
|
|
15697
|
+
this.#callbackSingletone.set(keyPromise, callBack);
|
|
15698
|
+
}
|
|
15620
15699
|
if (command.toString().includes(":")) {
|
|
15621
15700
|
cmd = {
|
|
15622
15701
|
method: command.toString(),
|
|
15623
|
-
params:
|
|
15702
|
+
params: paramsSend ?? "",
|
|
15624
15703
|
callback: keyPromise,
|
|
15625
15704
|
appSid: this.#appFrame.getAppSid()
|
|
15626
15705
|
};
|
|
15627
15706
|
} else {
|
|
15628
15707
|
cmd = command.toString();
|
|
15629
15708
|
const listParams = [
|
|
15630
|
-
params ? JSON.stringify(
|
|
15709
|
+
params ? JSON.stringify(paramsSend) : null,
|
|
15631
15710
|
keyPromise,
|
|
15632
15711
|
this.#appFrame.getAppSid()
|
|
15633
15712
|
];
|
|
@@ -15682,6 +15761,11 @@ ${this.stack}`;
|
|
|
15682
15761
|
}
|
|
15683
15762
|
this.#callbackPromises.delete(cmd.id);
|
|
15684
15763
|
promise.resolve(cmd.args);
|
|
15764
|
+
} else if (this.#callbackSingletone.has(cmd.id)) {
|
|
15765
|
+
const callBack = this.#callbackSingletone.get(cmd.id);
|
|
15766
|
+
if (callBack) {
|
|
15767
|
+
callBack.apply(globalThis, [cmd.args]);
|
|
15768
|
+
}
|
|
15685
15769
|
}
|
|
15686
15770
|
}
|
|
15687
15771
|
}
|
|
@@ -16408,15 +16492,17 @@ ${this.stack}`;
|
|
|
16408
16492
|
/**
|
|
16409
16493
|
* Set Up the Interface Event Handler
|
|
16410
16494
|
* @param {string} eventName
|
|
16495
|
+
* @param {(...args: any[]) => void} callBack
|
|
16411
16496
|
* @return {Promise<any>}
|
|
16412
16497
|
*
|
|
16413
16498
|
* @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-bind-event.html
|
|
16414
16499
|
*/
|
|
16415
|
-
async bindEvent(eventName) {
|
|
16500
|
+
async bindEvent(eventName, callBack) {
|
|
16416
16501
|
return this.#messageManager.send(
|
|
16417
|
-
MessageCommands.
|
|
16502
|
+
MessageCommands.placementBindEvent,
|
|
16418
16503
|
{
|
|
16419
16504
|
event: eventName,
|
|
16505
|
+
callBack,
|
|
16420
16506
|
isSafely: true
|
|
16421
16507
|
}
|
|
16422
16508
|
);
|
|
@@ -26062,6 +26148,9 @@ Data string: ${pullEvent}
|
|
|
26062
26148
|
exports.B24LangList = B24LangList;
|
|
26063
26149
|
exports.B24PullClientManager = PullClient;
|
|
26064
26150
|
exports.Browser = Browser;
|
|
26151
|
+
exports.CatalogProductImageType = CatalogProductImageType;
|
|
26152
|
+
exports.CatalogProductType = CatalogProductType;
|
|
26153
|
+
exports.CatalogRoundingRuleType = CatalogRoundingRuleType;
|
|
26065
26154
|
exports.CloseReasons = CloseReasons;
|
|
26066
26155
|
exports.ConnectionType = ConnectionType;
|
|
26067
26156
|
exports.DataType = DataType;
|
|
@@ -26069,6 +26158,7 @@ Data string: ${pullEvent}
|
|
|
26069
26158
|
exports.EnumAppStatus = EnumAppStatus;
|
|
26070
26159
|
exports.EnumCrmEntityType = EnumCrmEntityType;
|
|
26071
26160
|
exports.EnumCrmEntityTypeId = EnumCrmEntityTypeId;
|
|
26161
|
+
exports.EnumCrmEntityTypeShort = EnumCrmEntityTypeShort;
|
|
26072
26162
|
exports.ListRpcError = ListRpcError;
|
|
26073
26163
|
exports.LoadDataType = LoadDataType;
|
|
26074
26164
|
exports.LoggerBrowser = LoggerBrowser;
|
|
@@ -26079,6 +26169,7 @@ Data string: ${pullEvent}
|
|
|
26079
26169
|
exports.OptionsManager = OptionsManager$1;
|
|
26080
26170
|
exports.ParentManager = ParentManager;
|
|
26081
26171
|
exports.PlacementManager = PlacementManager;
|
|
26172
|
+
exports.ProductRowDiscountTypeId = ProductRowDiscountTypeId;
|
|
26082
26173
|
exports.PullStatus = PullStatus;
|
|
26083
26174
|
exports.RestrictionManagerParamsBase = RestrictionManagerParamsBase;
|
|
26084
26175
|
exports.RestrictionManagerParamsForEnterprise = RestrictionManagerParamsForEnterprise;
|
|
@@ -26095,6 +26186,9 @@ Data string: ${pullEvent}
|
|
|
26095
26186
|
exports.TypeOption = TypeOption;
|
|
26096
26187
|
exports.TypeSpecificUrl = TypeSpecificUrl;
|
|
26097
26188
|
exports.initializeB24Frame = initializeB24Frame;
|
|
26189
|
+
exports.isArrayOfArray = isArrayOfArray;
|
|
26190
|
+
exports.omit = omit;
|
|
26191
|
+
exports.pick = pick$1;
|
|
26098
26192
|
exports.useB24Helper = useB24Helper;
|
|
26099
26193
|
exports.useFormatter = useFormatter;
|
|
26100
26194
|
|