@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.
@@ -35,6 +35,7 @@ type ISODate = string;
35
35
  type BoolString = 'Y' | 'N';
36
36
  type GenderString = 'M' | 'F' | '';
37
37
  type PlacementViewMode = 'view' | 'edit';
38
+ type TextType = 'text' | 'html';
38
39
  type Fields = {
39
40
  readonly [key: string]: {
40
41
  readonly type: string;
@@ -294,6 +295,10 @@ declare class TypeManager {
294
295
  }
295
296
  declare const Type: TypeManager;
296
297
 
298
+ declare function pick<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Pick<Data, Keys>;
299
+ declare function omit<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Omit<Data, Keys>;
300
+ declare function isArrayOfArray<A>(item: A[] | A[][]): item is A[][];
301
+
297
302
  /**
298
303
  * The `Text` class provides a set of utility methods for working with text data.
299
304
  * It includes functions for encoding and decoding HTML entities, generating random strings,
@@ -835,7 +840,8 @@ declare enum EnumCrmEntityType {
835
840
  oldInvoice = "CRM_INVOICE",
836
841
  invoice = "CRM_SMART_INVOICE",
837
842
  quote = "CRM_QUOTE",
838
- requisite = "CRM_REQUISITE"
843
+ requisite = "CRM_REQUISITE",
844
+ order = "ORDER"
839
845
  }
840
846
  declare enum EnumCrmEntityTypeId {
841
847
  undefined = 0,
@@ -846,7 +852,266 @@ declare enum EnumCrmEntityTypeId {
846
852
  oldInvoice = 5,
847
853
  invoice = 31,
848
854
  quote = 7,
849
- requisite = 8
855
+ requisite = 8,
856
+ order = 14
857
+ }
858
+ declare enum EnumCrmEntityTypeShort {
859
+ undefined = "?",
860
+ lead = "L",
861
+ deal = "D",
862
+ contact = "C",
863
+ company = "CO",
864
+ oldInvoice = "I",
865
+ invoice = "SI",
866
+ quote = "Q",
867
+ requisite = "RQ",
868
+ order = "O"
869
+ }
870
+
871
+ /**
872
+ * Data Types and Object Structure in the REST API Catalog
873
+ * @link https://apidocs.bitrix24.com/api-reference/catalog/data-types.html
874
+ */
875
+ declare enum CatalogProductType {
876
+ undefined = 0,
877
+ product = 1,
878
+ service = 7,
879
+ sku = 3,
880
+ skuEmpty = 6,
881
+ offer = 4,
882
+ offerEmpty = 5
883
+ }
884
+ declare enum CatalogProductImageType {
885
+ undefined = "UNDEFINED",
886
+ detail = "DETAIL_PICTURE",
887
+ preview = "PREVIEW_PICTURE",
888
+ morePhoto = "MORE_PHOTO"
889
+ }
890
+ declare enum CatalogRoundingRuleType {
891
+ undefined = 0,
892
+ mathematical = 1,
893
+ roundingUp = 2,
894
+ roundingDown = 4
895
+ }
896
+ interface CatalogCatalog {
897
+ id: number;
898
+ iblockId: number;
899
+ iblockTypeId: string | 'CRM_PRODUCT_CATALOG';
900
+ lid: string;
901
+ name: string;
902
+ productIblockId?: number;
903
+ skuPropertyId?: number;
904
+ subscription?: BoolString;
905
+ vatId: number;
906
+ }
907
+ interface BaseProduct {
908
+ id: number;
909
+ iblockId: number;
910
+ sort: number;
911
+ name: string;
912
+ active: BoolString;
913
+ available: BoolString;
914
+ code: string;
915
+ xmlId: string;
916
+ barcodeMulti: BoolString;
917
+ bundle: BoolString;
918
+ canBuyZero?: BoolString;
919
+ type: number;
920
+ vatId: number;
921
+ vatIncluded: BoolString;
922
+ weight?: number;
923
+ height?: number;
924
+ length?: number;
925
+ width?: number;
926
+ createdBy: number;
927
+ modifiedBy: number;
928
+ dateActiveFrom?: ISODate;
929
+ dateActiveTo?: ISODate;
930
+ dateCreate: ISODate;
931
+ timestampX: ISODate;
932
+ iblockSectionId?: number;
933
+ measure?: number;
934
+ previewText?: string;
935
+ previewTextType?: TextType;
936
+ detailText?: string;
937
+ detailTextType?: TextType;
938
+ previewPicture?: object;
939
+ detailPicture?: object;
940
+ subscribe: 'Y' | 'N' | 'D';
941
+ quantityTrace: 'Y' | 'N' | 'D';
942
+ purchasingCurrency: string;
943
+ purchasingPrice: number;
944
+ quantity: number;
945
+ quantityReserved: number;
946
+ [key: string]: any;
947
+ }
948
+ interface CatalogProduct extends BaseProduct {
949
+ type: CatalogProductType.product;
950
+ }
951
+ interface CatalogProductSku extends BaseProduct {
952
+ type: CatalogProductType.sku | CatalogProductType.skuEmpty;
953
+ }
954
+ interface CatalogProductOffer extends BaseProduct {
955
+ type: CatalogProductType.offer | CatalogProductType.offerEmpty;
956
+ }
957
+ interface CatalogProductService extends Omit<BaseProduct, 'quantityReserved' | 'quantity' | 'purchasingPrice' | 'purchasingCurrency' | 'quantityTrace' | 'subscribe' | 'weight' | 'height' | 'length' | 'width' | 'canBuyZero' | 'barcodeMulti'> {
958
+ type: CatalogProductType.service;
959
+ }
960
+ interface CatalogSection {
961
+ id: number;
962
+ xmlId: string;
963
+ code: string;
964
+ iblockId: number;
965
+ sort: number;
966
+ iblockSectionId: number;
967
+ name: string;
968
+ active: BoolString;
969
+ description: string;
970
+ descriptionType: TextType;
971
+ }
972
+ interface CatalogProductImage {
973
+ id: number;
974
+ name: string;
975
+ productId: number;
976
+ type: typeof CatalogProductImageType[keyof typeof CatalogProductImageType];
977
+ createTime?: ISODate;
978
+ downloadUrl?: string;
979
+ detailUrl?: string;
980
+ }
981
+ interface CatalogStore {
982
+ id: number;
983
+ code: string;
984
+ xmlId: string;
985
+ sort: number;
986
+ address: string;
987
+ title: string;
988
+ active: BoolString;
989
+ description?: string;
990
+ gpsN: number;
991
+ gpsS: number;
992
+ imageId: object;
993
+ dateModify: ISODate;
994
+ dateCreate: ISODate;
995
+ userId: number;
996
+ modifiedBy: number;
997
+ phone: string;
998
+ email: string;
999
+ schedule: string;
1000
+ issuingCenter: BoolString;
1001
+ }
1002
+ interface CatalogMeasure {
1003
+ id: number;
1004
+ code: string;
1005
+ isDefault: BoolString;
1006
+ measureTitle: string;
1007
+ symbol: string;
1008
+ symbolIntl: string;
1009
+ symbolLetterIntl: string;
1010
+ }
1011
+ interface CatalogRatio {
1012
+ id: number;
1013
+ productId: number;
1014
+ ratio: number;
1015
+ isDefault: BoolString;
1016
+ }
1017
+ interface CatalogPriceType {
1018
+ id: number;
1019
+ xmlId: string;
1020
+ sort: number;
1021
+ name: string;
1022
+ base: BoolString;
1023
+ createdBy: number;
1024
+ modifiedBy: number;
1025
+ dateCreate: ISODate;
1026
+ timestampX: ISODate;
1027
+ }
1028
+ interface CatalogVat {
1029
+ id: number;
1030
+ name: string;
1031
+ active: BoolString;
1032
+ rate: number;
1033
+ sort: number;
1034
+ timestampX: ISODate;
1035
+ }
1036
+ interface CatalogPriceTypeLang {
1037
+ id: number;
1038
+ catalogGroupId: number;
1039
+ name: string;
1040
+ lang: string;
1041
+ }
1042
+ interface CatalogLanguage {
1043
+ lid: string;
1044
+ name: string;
1045
+ active: BoolString;
1046
+ }
1047
+ interface CatalogRoundingRule {
1048
+ id: number;
1049
+ catalogGroupId: number;
1050
+ price: number;
1051
+ roundType: typeof CatalogRoundingRuleType[keyof typeof CatalogRoundingRuleType];
1052
+ roundPrecision: number;
1053
+ createdBy: number;
1054
+ modifiedBy: number;
1055
+ dateCreate: ISODate;
1056
+ dateModify: ISODate;
1057
+ }
1058
+ interface CatalogExtra {
1059
+ id: number;
1060
+ name: string;
1061
+ percentage: number;
1062
+ }
1063
+
1064
+ declare enum ProductRowDiscountTypeId {
1065
+ undefined = 0,
1066
+ absolute = 1,
1067
+ percentage = 2
1068
+ }
1069
+ interface CrmItemProductRow {
1070
+ id: number;
1071
+ ownerId: number;
1072
+ ownerType: typeof EnumCrmEntityTypeShort[keyof typeof EnumCrmEntityTypeShort];
1073
+ productId: number;
1074
+ productName: string;
1075
+ sort: number;
1076
+ price: number;
1077
+ priceAccount: number;
1078
+ priceExclusive: number;
1079
+ priceNetto: number;
1080
+ priceBrutto: number;
1081
+ customized: BoolString;
1082
+ quantity: number;
1083
+ measureCode: string;
1084
+ measureName: string;
1085
+ taxRate: number | null;
1086
+ taxIncluded: BoolString;
1087
+ discountRate: number;
1088
+ discountSum: number;
1089
+ discountTypeId: typeof ProductRowDiscountTypeId[keyof typeof ProductRowDiscountTypeId];
1090
+ xmlId: string;
1091
+ type: typeof CatalogProductType[keyof typeof CatalogProductType];
1092
+ storeId: number;
1093
+ }
1094
+
1095
+ interface CrmItemDelivery {
1096
+ id: number;
1097
+ accountNumber: string;
1098
+ deducted: BoolString;
1099
+ dateDeducted?: ISODate;
1100
+ deliveryId: number;
1101
+ deliveryName: string;
1102
+ priceDelivery: number;
1103
+ }
1104
+
1105
+ interface CrmItemPayment {
1106
+ id: number;
1107
+ accountNumber: string;
1108
+ paid: BoolString;
1109
+ datePaid?: ISODate;
1110
+ empPaidId?: number;
1111
+ sum: number;
1112
+ currency: string;
1113
+ paySystemId: number;
1114
+ paySystemName: string;
850
1115
  }
851
1116
 
852
1117
  /**
@@ -1785,11 +2050,13 @@ declare class AppFrame {
1785
2050
  * Parent Window Request Parameters
1786
2051
  * @prop isSafely auto completion mode Promise.resolve()
1787
2052
  * @prop safelyTime after what time (900 ms) should it be automatically resolved Promise
2053
+ * @prop callBack for placement event
1788
2054
  */
1789
2055
  interface SendParams {
1790
2056
  [index: string]: any;
1791
2057
  isSafely?: boolean;
1792
2058
  safelyTime?: number;
2059
+ callBack?: (...args: any[]) => void;
1793
2060
  }
1794
2061
  /**
1795
2062
  * Parent Window Communication Manager at B24
@@ -1797,7 +2064,7 @@ interface SendParams {
1797
2064
  declare class MessageManager {
1798
2065
  #private;
1799
2066
  protected _logger: null | LoggerBrowser;
1800
- private runCallbackHandler;
2067
+ private readonly runCallbackHandler;
1801
2068
  constructor(appFrame: AppFrame);
1802
2069
  setLogger(logger: LoggerBrowser): void;
1803
2070
  getLogger(): LoggerBrowser;
@@ -2223,11 +2490,12 @@ declare class PlacementManager {
2223
2490
  /**
2224
2491
  * Set Up the Interface Event Handler
2225
2492
  * @param {string} eventName
2493
+ * @param {(...args: any[]) => void} callBack
2226
2494
  * @return {Promise<any>}
2227
2495
  *
2228
2496
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-bind-event.html
2229
2497
  */
2230
- bindEvent(eventName: string): Promise<any>;
2498
+ bindEvent(eventName: string, callBack: (...args: any[]) => void): Promise<any>;
2231
2499
  /**
2232
2500
  * Call the Registered Interface Command
2233
2501
  * @param {string} command
@@ -2929,4 +3197,4 @@ declare class PullClient implements ConnectorParent {
2929
3197
 
2930
3198
  declare function initializeB24Frame(): Promise<B24Frame>;
2931
3199
 
2932
- export { AbstractB24, AjaxError, type AjaxErrorParams, type AjaxQuery, AjaxResult, type AjaxResultParams, type AnswerError, AppFrame, type AuthActions, type AuthData, AuthHookManager, AuthManager, B24Frame, type B24FrameQueryParams, B24Hook, type B24HookParams, B24LangList, PullClient as B24PullClientManager, type BatchPayload, type BoolString, Browser, CloseReasons, type CommandHandlerFunctionV1, type CommandHandlerFunctionV2, ConnectionType, type ConnectorCallbacks, type ConnectorConfig, type ConnectorParent, type Currency, type CurrencyFormat, DataType, DialogManager, EnumAppStatus, EnumCrmEntityType, EnumCrmEntityTypeId, type Fields, type GenderString, type GetPayload, type IPlacementUF, type IRequestIdGenerator, type IResult, type ISODate, type JsonRpcRequest, type ListPayload, ListRpcError, LoadDataType, LoggerBrowser, LoggerType, LsKeys, MessageCommands, type MessageInitData, MessageManager, type MultiField, type MultiFieldArray, type NumberString, OptionsManager$1 as OptionsManager, ParentManager, type Payload, type PayloadTime, PlacementManager, type PlacementViewMode, PullStatus, type RefreshAuthData, RestrictionManagerParamsBase, RestrictionManagerParamsForEnterprise, Result, type RpcCommand, type RpcCommandResult, type RpcError, RpcMethod, type RpcRequest, type SelectCRMParams, type SelectCRMParamsEntityType, type SelectCRMParamsValue, type SelectedAccess, type SelectedCRM, type SelectedCRMEntity, type SelectedUser, type SendParams, SenderType, ServerMode, type SharedConfigCallbacks, type SharedConfigParams, SliderManager, type StatusClose, StatusDescriptions, type StorageManagerParams, SubscriptionType, SystemCommands, Text, Type, type TypeApp, type TypeB24, type TypeB24Form, type TypeChanel, type TypeChannelManagerParams, type TypeConnector, type TypeDescriptionError, type TypeEnumAppStatus, type TypeHttp, type TypeJsonRpcConfig, type TypeLicense, TypeOption, type TypePayment, type TypePublicIdDescriptor, type TypePullClientConfig, type TypePullClientEmitConfig, type TypePullClientMessageBatch, type TypePullClientMessageBody, type TypePullClientParams, type TypePullClientSession, type TypePullMessage, type TypeRestrictionManagerParams, type TypeRpcResponseAwaiters, type TypeSessionEvent, TypeSpecificUrl, type TypeStorageManager, type TypeSubscriptionCommandHandler, type TypeSubscriptionOptions, type TypeUser, type UserBasic, type UserBrief, type UserFieldType, type UserStatusCallback, initializeB24Frame, useB24Helper, useFormatter };
3200
+ export { AbstractB24, AjaxError, type AjaxErrorParams, type AjaxQuery, AjaxResult, type AjaxResultParams, type AnswerError, AppFrame, type AuthActions, type AuthData, AuthHookManager, AuthManager, B24Frame, type B24FrameQueryParams, B24Hook, type B24HookParams, B24LangList, PullClient as B24PullClientManager, type BatchPayload, type BoolString, Browser, type CatalogCatalog, type CatalogExtra, type CatalogLanguage, type CatalogMeasure, type CatalogPriceType, type CatalogPriceTypeLang, type CatalogProduct, type CatalogProductImage, CatalogProductImageType, type CatalogProductOffer, type CatalogProductService, type CatalogProductSku, CatalogProductType, type CatalogRatio, type CatalogRoundingRule, CatalogRoundingRuleType, type CatalogSection, type CatalogStore, type CatalogVat, CloseReasons, type CommandHandlerFunctionV1, type CommandHandlerFunctionV2, ConnectionType, type ConnectorCallbacks, type ConnectorConfig, type ConnectorParent, type CrmItemDelivery, type CrmItemPayment, type CrmItemProductRow, type Currency, type CurrencyFormat, DataType, DialogManager, EnumAppStatus, EnumCrmEntityType, EnumCrmEntityTypeId, EnumCrmEntityTypeShort, type Fields, type GenderString, type GetPayload, type IPlacementUF, type IRequestIdGenerator, type IResult, type ISODate, type JsonRpcRequest, type ListPayload, ListRpcError, LoadDataType, LoggerBrowser, LoggerType, LsKeys, MessageCommands, type MessageInitData, MessageManager, type MultiField, type MultiFieldArray, type NumberString, OptionsManager$1 as OptionsManager, ParentManager, type Payload, type PayloadTime, PlacementManager, type PlacementViewMode, ProductRowDiscountTypeId, PullStatus, type RefreshAuthData, RestrictionManagerParamsBase, RestrictionManagerParamsForEnterprise, Result, type RpcCommand, type RpcCommandResult, type RpcError, RpcMethod, type RpcRequest, type SelectCRMParams, type SelectCRMParamsEntityType, type SelectCRMParamsValue, type SelectedAccess, type SelectedCRM, type SelectedCRMEntity, type SelectedUser, type SendParams, SenderType, ServerMode, type SharedConfigCallbacks, type SharedConfigParams, SliderManager, type StatusClose, StatusDescriptions, type StorageManagerParams, SubscriptionType, SystemCommands, Text, type TextType, Type, type TypeApp, type TypeB24, type TypeB24Form, type TypeChanel, type TypeChannelManagerParams, type TypeConnector, type TypeDescriptionError, type TypeEnumAppStatus, type TypeHttp, type TypeJsonRpcConfig, type TypeLicense, TypeOption, type TypePayment, type TypePublicIdDescriptor, type TypePullClientConfig, type TypePullClientEmitConfig, type TypePullClientMessageBatch, type TypePullClientMessageBody, type TypePullClientParams, type TypePullClientSession, type TypePullMessage, type TypeRestrictionManagerParams, type TypeRpcResponseAwaiters, type TypeSessionEvent, TypeSpecificUrl, type TypeStorageManager, type TypeSubscriptionCommandHandler, type TypeSubscriptionOptions, type TypeUser, type UserBasic, type UserBrief, type UserFieldType, type UserStatusCallback, initializeB24Frame, isArrayOfArray, omit, pick, useB24Helper, useFormatter };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @version @bitrix24/b24jssdk v0.2.0
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
@@ -489,6 +489,24 @@ class TypeManager {
489
489
  }
490
490
  const Type = new TypeManager();
491
491
 
492
+ function pick(data, keys) {
493
+ const result = {};
494
+ for (const key of keys) {
495
+ result[key] = data[key];
496
+ }
497
+ return result;
498
+ }
499
+ function omit(data, keys) {
500
+ const result = { ...data };
501
+ for (const key of keys) {
502
+ delete result[key];
503
+ }
504
+ return result;
505
+ }
506
+ function isArrayOfArray(item) {
507
+ return Array.isArray(item[0]);
508
+ }
509
+
492
510
  const _state = {};
493
511
  let getRandomValues;
494
512
  const randoms8 = new Uint8Array(16);
@@ -897,6 +915,7 @@ var EnumCrmEntityType = /* @__PURE__ */ ((EnumCrmEntityType2) => {
897
915
  EnumCrmEntityType2["invoice"] = "CRM_SMART_INVOICE";
898
916
  EnumCrmEntityType2["quote"] = "CRM_QUOTE";
899
917
  EnumCrmEntityType2["requisite"] = "CRM_REQUISITE";
918
+ EnumCrmEntityType2["order"] = "ORDER";
900
919
  return EnumCrmEntityType2;
901
920
  })(EnumCrmEntityType || {});
902
921
  var EnumCrmEntityTypeId = /* @__PURE__ */ ((EnumCrmEntityTypeId2) => {
@@ -909,8 +928,54 @@ var EnumCrmEntityTypeId = /* @__PURE__ */ ((EnumCrmEntityTypeId2) => {
909
928
  EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["invoice"] = 31] = "invoice";
910
929
  EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["quote"] = 7] = "quote";
911
930
  EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["requisite"] = 8] = "requisite";
931
+ EnumCrmEntityTypeId2[EnumCrmEntityTypeId2["order"] = 14] = "order";
912
932
  return EnumCrmEntityTypeId2;
913
933
  })(EnumCrmEntityTypeId || {});
934
+ var EnumCrmEntityTypeShort = /* @__PURE__ */ ((EnumCrmEntityTypeShort2) => {
935
+ EnumCrmEntityTypeShort2["undefined"] = "?";
936
+ EnumCrmEntityTypeShort2["lead"] = "L";
937
+ EnumCrmEntityTypeShort2["deal"] = "D";
938
+ EnumCrmEntityTypeShort2["contact"] = "C";
939
+ EnumCrmEntityTypeShort2["company"] = "CO";
940
+ EnumCrmEntityTypeShort2["oldInvoice"] = "I";
941
+ EnumCrmEntityTypeShort2["invoice"] = "SI";
942
+ EnumCrmEntityTypeShort2["quote"] = "Q";
943
+ EnumCrmEntityTypeShort2["requisite"] = "RQ";
944
+ EnumCrmEntityTypeShort2["order"] = "O";
945
+ return EnumCrmEntityTypeShort2;
946
+ })(EnumCrmEntityTypeShort || {});
947
+
948
+ var ProductRowDiscountTypeId = /* @__PURE__ */ ((ProductRowDiscountTypeId2) => {
949
+ ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["undefined"] = 0] = "undefined";
950
+ ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["absolute"] = 1] = "absolute";
951
+ ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["percentage"] = 2] = "percentage";
952
+ return ProductRowDiscountTypeId2;
953
+ })(ProductRowDiscountTypeId || {});
954
+
955
+ var CatalogProductType = /* @__PURE__ */ ((CatalogProductType2) => {
956
+ CatalogProductType2[CatalogProductType2["undefined"] = 0] = "undefined";
957
+ CatalogProductType2[CatalogProductType2["product"] = 1] = "product";
958
+ CatalogProductType2[CatalogProductType2["service"] = 7] = "service";
959
+ CatalogProductType2[CatalogProductType2["sku"] = 3] = "sku";
960
+ CatalogProductType2[CatalogProductType2["skuEmpty"] = 6] = "skuEmpty";
961
+ CatalogProductType2[CatalogProductType2["offer"] = 4] = "offer";
962
+ CatalogProductType2[CatalogProductType2["offerEmpty"] = 5] = "offerEmpty";
963
+ return CatalogProductType2;
964
+ })(CatalogProductType || {});
965
+ var CatalogProductImageType = /* @__PURE__ */ ((CatalogProductImageType2) => {
966
+ CatalogProductImageType2["undefined"] = "UNDEFINED";
967
+ CatalogProductImageType2["detail"] = "DETAIL_PICTURE";
968
+ CatalogProductImageType2["preview"] = "PREVIEW_PICTURE";
969
+ CatalogProductImageType2["morePhoto"] = "MORE_PHOTO";
970
+ return CatalogProductImageType2;
971
+ })(CatalogProductImageType || {});
972
+ var CatalogRoundingRuleType = /* @__PURE__ */ ((CatalogRoundingRuleType2) => {
973
+ CatalogRoundingRuleType2[CatalogRoundingRuleType2["undefined"] = 0] = "undefined";
974
+ CatalogRoundingRuleType2[CatalogRoundingRuleType2["mathematical"] = 1] = "mathematical";
975
+ CatalogRoundingRuleType2[CatalogRoundingRuleType2["roundingUp"] = 2] = "roundingUp";
976
+ CatalogRoundingRuleType2[CatalogRoundingRuleType2["roundingDown"] = 4] = "roundingDown";
977
+ return CatalogRoundingRuleType2;
978
+ })(CatalogRoundingRuleType || {});
914
979
 
915
980
  var LoadDataType = /* @__PURE__ */ ((LoadDataType2) => {
916
981
  LoadDataType2["App"] = "app";
@@ -1463,9 +1528,16 @@ class Http {
1463
1528
  #isClientSideWarning = false;
1464
1529
  #clientSideWarningMessage = "";
1465
1530
  constructor(baseURL, authActions, options) {
1531
+ const defaultHeaders = {
1532
+ // 'X-Sdk': 'b24-js-sdk-v-0.2.2'
1533
+ };
1466
1534
  this.#clientAxios = axios.create({
1467
1535
  baseURL,
1468
- ...options
1536
+ headers: {
1537
+ ...defaultHeaders,
1538
+ ...options ? options.headers : {}
1539
+ },
1540
+ ...options && { ...options, headers: void 0 }
1469
1541
  });
1470
1542
  this.#authActions = authActions;
1471
1543
  this.#restrictionManager = new RestrictionManager();
@@ -1867,7 +1939,7 @@ class Http {
1867
1939
  result.logTag = this.#logTag;
1868
1940
  }
1869
1941
  result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
1870
- result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.0";
1942
+ result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.2.2";
1871
1943
  if (!!result.data && !!result.data.start) {
1872
1944
  delete result.data.start;
1873
1945
  }
@@ -3029,11 +3101,13 @@ var MessageCommands = /* @__PURE__ */ ((MessageCommands2) => {
3029
3101
  class MessageManager {
3030
3102
  #appFrame;
3031
3103
  #callbackPromises;
3104
+ #callbackSingletone;
3032
3105
  _logger = null;
3033
3106
  runCallbackHandler;
3034
3107
  constructor(appFrame) {
3035
3108
  this.#appFrame = appFrame;
3036
3109
  this.#callbackPromises = /* @__PURE__ */ new Map();
3110
+ this.#callbackSingletone = /* @__PURE__ */ new Map();
3037
3111
  this.runCallbackHandler = this._runCallback.bind(this);
3038
3112
  }
3039
3113
  setLogger(logger) {
@@ -3083,17 +3157,22 @@ class MessageManager {
3083
3157
  timeoutId: null
3084
3158
  };
3085
3159
  const keyPromise = this.#setCallbackPromise(promiseHandler);
3160
+ const paramsSend = omit(params || {}, ["callBack", "isSafely", "safelyTime"]);
3161
+ const { callBack } = params || {};
3162
+ if (callBack) {
3163
+ this.#callbackSingletone.set(keyPromise, callBack);
3164
+ }
3086
3165
  if (command.toString().includes(":")) {
3087
3166
  cmd = {
3088
3167
  method: command.toString(),
3089
- params: params ?? "",
3168
+ params: paramsSend ?? "",
3090
3169
  callback: keyPromise,
3091
3170
  appSid: this.#appFrame.getAppSid()
3092
3171
  };
3093
3172
  } else {
3094
3173
  cmd = command.toString();
3095
3174
  const listParams = [
3096
- params ? JSON.stringify(params) : null,
3175
+ params ? JSON.stringify(paramsSend) : null,
3097
3176
  keyPromise,
3098
3177
  this.#appFrame.getAppSid()
3099
3178
  ];
@@ -3148,6 +3227,11 @@ class MessageManager {
3148
3227
  }
3149
3228
  this.#callbackPromises.delete(cmd.id);
3150
3229
  promise.resolve(cmd.args);
3230
+ } else if (this.#callbackSingletone.has(cmd.id)) {
3231
+ const callBack = this.#callbackSingletone.get(cmd.id);
3232
+ if (callBack) {
3233
+ callBack.apply(globalThis, [cmd.args]);
3234
+ }
3151
3235
  }
3152
3236
  }
3153
3237
  }
@@ -3874,15 +3958,17 @@ class PlacementManager {
3874
3958
  /**
3875
3959
  * Set Up the Interface Event Handler
3876
3960
  * @param {string} eventName
3961
+ * @param {(...args: any[]) => void} callBack
3877
3962
  * @return {Promise<any>}
3878
3963
  *
3879
3964
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-bind-event.html
3880
3965
  */
3881
- async bindEvent(eventName) {
3966
+ async bindEvent(eventName, callBack) {
3882
3967
  return this.#messageManager.send(
3883
- MessageCommands.getInterface,
3968
+ MessageCommands.placementBindEvent,
3884
3969
  {
3885
3970
  event: eventName,
3971
+ callBack,
3886
3972
  isSafely: true
3887
3973
  }
3888
3974
  );
@@ -13517,5 +13603,5 @@ async function initializeB24Frame() {
13517
13603
  });
13518
13604
  }
13519
13605
 
13520
- export { AbstractB24, AjaxError, AjaxResult, AppFrame, AuthHookManager, AuthManager, B24Frame, B24Hook, B24LangList, PullClient as B24PullClientManager, Browser, CloseReasons, ConnectionType, DataType, DialogManager, EnumAppStatus, EnumCrmEntityType, EnumCrmEntityTypeId, ListRpcError, LoadDataType, LoggerBrowser, LoggerType, LsKeys, MessageCommands, MessageManager, OptionsManager$1 as OptionsManager, ParentManager, PlacementManager, PullStatus, RestrictionManagerParamsBase, RestrictionManagerParamsForEnterprise, Result, RpcMethod, SenderType, ServerMode, SliderManager, StatusDescriptions, SubscriptionType, SystemCommands, Text, Type, TypeOption, TypeSpecificUrl, initializeB24Frame, useB24Helper, useFormatter };
13606
+ export { AbstractB24, AjaxError, AjaxResult, AppFrame, AuthHookManager, AuthManager, B24Frame, B24Hook, B24LangList, PullClient as B24PullClientManager, Browser, CatalogProductImageType, CatalogProductType, CatalogRoundingRuleType, CloseReasons, ConnectionType, DataType, DialogManager, EnumAppStatus, EnumCrmEntityType, EnumCrmEntityTypeId, EnumCrmEntityTypeShort, ListRpcError, LoadDataType, LoggerBrowser, LoggerType, LsKeys, MessageCommands, MessageManager, OptionsManager$1 as OptionsManager, ParentManager, PlacementManager, ProductRowDiscountTypeId, PullStatus, RestrictionManagerParamsBase, RestrictionManagerParamsForEnterprise, Result, RpcMethod, SenderType, ServerMode, SliderManager, StatusDescriptions, SubscriptionType, SystemCommands, Text, Type, TypeOption, TypeSpecificUrl, initializeB24Frame, isArrayOfArray, omit, pick, useB24Helper, useFormatter };
13521
13607
  //# sourceMappingURL=index.mjs.map