@bitrix24/b24jssdk 0.4.8 → 0.4.10
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/esm/index.d.mts +37 -21
- package/dist/esm/index.d.ts +37 -21
- package/dist/esm/index.mjs +52 -17
- package/dist/esm/index.mjs.map +1 -1
- package/dist/umd/index.js +332 -224
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +19 -19
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +5 -5
package/dist/esm/index.d.mts
CHANGED
|
@@ -632,6 +632,26 @@ declare const RestrictionManagerParamsBase: TypeRestrictionManagerParams;
|
|
|
632
632
|
*/
|
|
633
633
|
declare const RestrictionManagerParamsForEnterprise: TypeRestrictionManagerParams;
|
|
634
634
|
|
|
635
|
+
/**
|
|
636
|
+
* Special cases of data passed to handlers
|
|
637
|
+
* @todo add docs
|
|
638
|
+
*/
|
|
639
|
+
interface HandlerAuthParams {
|
|
640
|
+
access_token: string;
|
|
641
|
+
expires: string;
|
|
642
|
+
expires_in: string;
|
|
643
|
+
scope: string;
|
|
644
|
+
domain: string;
|
|
645
|
+
server_endpoint: string;
|
|
646
|
+
status: string;
|
|
647
|
+
client_endpoint: string;
|
|
648
|
+
member_id: string;
|
|
649
|
+
user_id: string;
|
|
650
|
+
refresh_token: string;
|
|
651
|
+
application_token: string;
|
|
652
|
+
}
|
|
653
|
+
type PayloadOAuthToken = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'status' | 'user_id'>;
|
|
654
|
+
|
|
635
655
|
declare enum LoadDataType {
|
|
636
656
|
App = "app",
|
|
637
657
|
Profile = "profile",
|
|
@@ -864,6 +884,7 @@ interface B24OAuthParams {
|
|
|
864
884
|
status: typeof EnumAppStatus[keyof typeof EnumAppStatus];
|
|
865
885
|
issuer?: 'request' | 'store' | string;
|
|
866
886
|
}
|
|
887
|
+
type HandlerRefreshAuth = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'scope' | 'status' | 'domain'>;
|
|
867
888
|
/**
|
|
868
889
|
* Callback called when OAuth authorization is updated
|
|
869
890
|
*/
|
|
@@ -871,6 +892,10 @@ type CallbackRefreshAuth = (params: {
|
|
|
871
892
|
authData: AuthData;
|
|
872
893
|
b24OAuthParams: B24OAuthParams;
|
|
873
894
|
}) => Promise<void>;
|
|
895
|
+
/**
|
|
896
|
+
* Use for custom get new refresh token for OAuth
|
|
897
|
+
*/
|
|
898
|
+
type CustomRefreshAuth = () => Promise<HandlerRefreshAuth>;
|
|
874
899
|
/**
|
|
875
900
|
* Parameters passed from the parent window when calling refreshAuth
|
|
876
901
|
*/
|
|
@@ -1069,26 +1094,6 @@ type StatusClose = {
|
|
|
1069
1094
|
isClose: boolean;
|
|
1070
1095
|
};
|
|
1071
1096
|
|
|
1072
|
-
/**
|
|
1073
|
-
* Special cases of data passed to handlers
|
|
1074
|
-
* @todo add docs
|
|
1075
|
-
*/
|
|
1076
|
-
interface HandlerAuthParams {
|
|
1077
|
-
access_token: string;
|
|
1078
|
-
expires: string;
|
|
1079
|
-
expires_in: string;
|
|
1080
|
-
scope: string;
|
|
1081
|
-
domain: string;
|
|
1082
|
-
server_endpoint: string;
|
|
1083
|
-
status: string;
|
|
1084
|
-
client_endpoint: string;
|
|
1085
|
-
member_id: string;
|
|
1086
|
-
user_id: string;
|
|
1087
|
-
refresh_token: string;
|
|
1088
|
-
application_token: string;
|
|
1089
|
-
}
|
|
1090
|
-
type PayloadOAuthToken = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'status' | 'user_id'>;
|
|
1091
|
-
|
|
1092
1097
|
/**
|
|
1093
1098
|
* CRM Entity Types
|
|
1094
1099
|
* @link https://dev.1c-bitrix.ru/rest_help/crm/constants.php
|
|
@@ -2896,6 +2901,15 @@ declare class B24OAuth extends AbstractB24 implements TypeB24 {
|
|
|
2896
2901
|
* Removes Callback to receive updated authorization data
|
|
2897
2902
|
*/
|
|
2898
2903
|
removeCallbackRefreshAuth(): void;
|
|
2904
|
+
/**
|
|
2905
|
+
* Sets an asynchronous function for custom get new refresh token
|
|
2906
|
+
* @param cb
|
|
2907
|
+
*/
|
|
2908
|
+
setCustomRefreshAuth(cb: CustomRefreshAuth): void;
|
|
2909
|
+
/**
|
|
2910
|
+
* Removes function for custom get new refresh token
|
|
2911
|
+
*/
|
|
2912
|
+
removeCustomRefreshAuth(): void;
|
|
2899
2913
|
/**
|
|
2900
2914
|
* Disables warning about client-side query execution
|
|
2901
2915
|
*/
|
|
@@ -2925,6 +2939,8 @@ declare class AuthOAuthManager implements AuthActions {
|
|
|
2925
2939
|
refreshAuth(): Promise<AuthData>;
|
|
2926
2940
|
setCallbackRefreshAuth(cb: CallbackRefreshAuth): void;
|
|
2927
2941
|
removeCallbackRefreshAuth(): void;
|
|
2942
|
+
setCustomRefreshAuth(cb: CustomRefreshAuth): void;
|
|
2943
|
+
removeCustomRefreshAuth(): void;
|
|
2928
2944
|
getUniq(prefix: string): string;
|
|
2929
2945
|
/**
|
|
2930
2946
|
* Get the account address BX24 ( https://name.bitrix24.com )
|
|
@@ -3550,4 +3566,4 @@ declare class PullClient implements ConnectorParent {
|
|
|
3550
3566
|
declare function initializeB24Frame(): Promise<B24Frame>;
|
|
3551
3567
|
|
|
3552
3568
|
export { AbstractB24, AjaxError, AjaxResult, AppFrame, AuthHookManager, AuthManager, AuthOAuthManager, B24Frame, B24Hook, B24LangList, B24LocaleMap, B24OAuth, PullClient as B24PullClientManager, Browser, CatalogProductImageType, CatalogProductType, CatalogRoundingRuleType, CloseReasons, ConnectionType, DataType, DialogManager, EnumAppStatus, EnumBitrix24Edition, EnumBizprocBaseType, EnumBizprocDocumentType, 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$1 as Text, Type, TypeOption, TypeSpecificUrl, convertBizprocDocumentTypeToCrmEntityTypeId, getDocumentId, getDocumentType, getDocumentTypeForFilter, getEnumCrmEntityTypeShort, getEnumValue, initializeB24Frame, isArrayOfArray, omit, pick, useB24Helper, useFormatter };
|
|
3553
|
-
export type { ActivityConfig, ActivityHandlerParams, ActivityOrRobotConfig, ActivityProperty, ActivityPropertyType, AjaxErrorParams, AjaxQuery, AjaxResultParams, AnswerError, AuthActions, AuthData, B24FrameQueryParams, B24HookParams, B24OAuthParams, B24OAuthSecret, BatchPayload, BoolString, CallbackRefreshAuth, CatalogCatalog, CatalogExtra, CatalogLanguage, CatalogMeasure, CatalogPriceType, CatalogPriceTypeLang, CatalogProduct, CatalogProductImage, CatalogProductOffer, CatalogProductService, CatalogProductSku, CatalogRatio, CatalogRoundingRule, CatalogSection, CatalogStore, CatalogVat, CommandHandlerFunctionV1, CommandHandlerFunctionV2, ConnectorCallbacks, ConnectorConfig, ConnectorParent, CrmItemDelivery, CrmItemPayment, CrmItemProductRow, Currency, CurrencyFormat, EventHandlerParams, EventOnAppInstallHandlerParams, EventOnAppUnInstallHandlerParams, Fields, GenderString, GetPayload, HandlerAuthParams, IPlacementUF, IRequestIdGenerator, IResult, ISODate, JsonRpcRequest, ListPayload, MessageInitData, MultiField, MultiFieldArray, NumberString, Payload, PayloadOAuthToken, PayloadTime, PlacementViewMode, RefreshAuthData, RpcCommand, RpcCommandResult, RpcError, RpcRequest, SelectCRMParams, SelectCRMParamsEntityType, SelectCRMParamsValue, SelectedAccess, SelectedCRM, SelectedCRMEntity, SelectedUser, SendParams, SharedConfigCallbacks, SharedConfigParams, StatusClose, StorageManagerParams, TextType, TypeApp, TypeB24, TypeB24Form, TypeChanel, TypeChannelManagerParams, TypeConnector, TypeDescriptionError, TypeEnumAppStatus, TypeHttp, TypeJsonRpcConfig, TypeLicense, TypePayment, TypePublicIdDescriptor, TypePullClientConfig, TypePullClientEmitConfig, TypePullClientMessageBatch, TypePullClientMessageBody, TypePullClientParams, TypePullClientSession, TypePullMessage, TypeRestrictionManagerParams, TypeRpcResponseAwaiters, TypeSessionEvent, TypeStorageManager, TypeSubscriptionCommandHandler, TypeSubscriptionOptions, TypeUser, UserBasic, UserBrief, UserFieldType, UserStatusCallback };
|
|
3569
|
+
export type { ActivityConfig, ActivityHandlerParams, ActivityOrRobotConfig, ActivityProperty, ActivityPropertyType, AjaxErrorParams, AjaxQuery, AjaxResultParams, AnswerError, AuthActions, AuthData, B24FrameQueryParams, B24HookParams, B24OAuthParams, B24OAuthSecret, BatchPayload, BoolString, CallbackRefreshAuth, CatalogCatalog, CatalogExtra, CatalogLanguage, CatalogMeasure, CatalogPriceType, CatalogPriceTypeLang, CatalogProduct, CatalogProductImage, CatalogProductOffer, CatalogProductService, CatalogProductSku, CatalogRatio, CatalogRoundingRule, CatalogSection, CatalogStore, CatalogVat, CommandHandlerFunctionV1, CommandHandlerFunctionV2, ConnectorCallbacks, ConnectorConfig, ConnectorParent, CrmItemDelivery, CrmItemPayment, CrmItemProductRow, Currency, CurrencyFormat, CustomRefreshAuth, EventHandlerParams, EventOnAppInstallHandlerParams, EventOnAppUnInstallHandlerParams, Fields, GenderString, GetPayload, HandlerAuthParams, HandlerRefreshAuth, IPlacementUF, IRequestIdGenerator, IResult, ISODate, JsonRpcRequest, ListPayload, MessageInitData, MultiField, MultiFieldArray, NumberString, Payload, PayloadOAuthToken, PayloadTime, PlacementViewMode, RefreshAuthData, RpcCommand, RpcCommandResult, RpcError, RpcRequest, SelectCRMParams, SelectCRMParamsEntityType, SelectCRMParamsValue, SelectedAccess, SelectedCRM, SelectedCRMEntity, SelectedUser, SendParams, SharedConfigCallbacks, SharedConfigParams, StatusClose, StorageManagerParams, TextType, TypeApp, TypeB24, TypeB24Form, TypeChanel, TypeChannelManagerParams, TypeConnector, TypeDescriptionError, TypeEnumAppStatus, TypeHttp, TypeJsonRpcConfig, TypeLicense, TypePayment, TypePublicIdDescriptor, TypePullClientConfig, TypePullClientEmitConfig, TypePullClientMessageBatch, TypePullClientMessageBody, TypePullClientParams, TypePullClientSession, TypePullMessage, TypeRestrictionManagerParams, TypeRpcResponseAwaiters, TypeSessionEvent, TypeStorageManager, TypeSubscriptionCommandHandler, TypeSubscriptionOptions, TypeUser, UserBasic, UserBrief, UserFieldType, UserStatusCallback };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -632,6 +632,26 @@ declare const RestrictionManagerParamsBase: TypeRestrictionManagerParams;
|
|
|
632
632
|
*/
|
|
633
633
|
declare const RestrictionManagerParamsForEnterprise: TypeRestrictionManagerParams;
|
|
634
634
|
|
|
635
|
+
/**
|
|
636
|
+
* Special cases of data passed to handlers
|
|
637
|
+
* @todo add docs
|
|
638
|
+
*/
|
|
639
|
+
interface HandlerAuthParams {
|
|
640
|
+
access_token: string;
|
|
641
|
+
expires: string;
|
|
642
|
+
expires_in: string;
|
|
643
|
+
scope: string;
|
|
644
|
+
domain: string;
|
|
645
|
+
server_endpoint: string;
|
|
646
|
+
status: string;
|
|
647
|
+
client_endpoint: string;
|
|
648
|
+
member_id: string;
|
|
649
|
+
user_id: string;
|
|
650
|
+
refresh_token: string;
|
|
651
|
+
application_token: string;
|
|
652
|
+
}
|
|
653
|
+
type PayloadOAuthToken = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'status' | 'user_id'>;
|
|
654
|
+
|
|
635
655
|
declare enum LoadDataType {
|
|
636
656
|
App = "app",
|
|
637
657
|
Profile = "profile",
|
|
@@ -864,6 +884,7 @@ interface B24OAuthParams {
|
|
|
864
884
|
status: typeof EnumAppStatus[keyof typeof EnumAppStatus];
|
|
865
885
|
issuer?: 'request' | 'store' | string;
|
|
866
886
|
}
|
|
887
|
+
type HandlerRefreshAuth = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'scope' | 'status' | 'domain'>;
|
|
867
888
|
/**
|
|
868
889
|
* Callback called when OAuth authorization is updated
|
|
869
890
|
*/
|
|
@@ -871,6 +892,10 @@ type CallbackRefreshAuth = (params: {
|
|
|
871
892
|
authData: AuthData;
|
|
872
893
|
b24OAuthParams: B24OAuthParams;
|
|
873
894
|
}) => Promise<void>;
|
|
895
|
+
/**
|
|
896
|
+
* Use for custom get new refresh token for OAuth
|
|
897
|
+
*/
|
|
898
|
+
type CustomRefreshAuth = () => Promise<HandlerRefreshAuth>;
|
|
874
899
|
/**
|
|
875
900
|
* Parameters passed from the parent window when calling refreshAuth
|
|
876
901
|
*/
|
|
@@ -1069,26 +1094,6 @@ type StatusClose = {
|
|
|
1069
1094
|
isClose: boolean;
|
|
1070
1095
|
};
|
|
1071
1096
|
|
|
1072
|
-
/**
|
|
1073
|
-
* Special cases of data passed to handlers
|
|
1074
|
-
* @todo add docs
|
|
1075
|
-
*/
|
|
1076
|
-
interface HandlerAuthParams {
|
|
1077
|
-
access_token: string;
|
|
1078
|
-
expires: string;
|
|
1079
|
-
expires_in: string;
|
|
1080
|
-
scope: string;
|
|
1081
|
-
domain: string;
|
|
1082
|
-
server_endpoint: string;
|
|
1083
|
-
status: string;
|
|
1084
|
-
client_endpoint: string;
|
|
1085
|
-
member_id: string;
|
|
1086
|
-
user_id: string;
|
|
1087
|
-
refresh_token: string;
|
|
1088
|
-
application_token: string;
|
|
1089
|
-
}
|
|
1090
|
-
type PayloadOAuthToken = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'status' | 'user_id'>;
|
|
1091
|
-
|
|
1092
1097
|
/**
|
|
1093
1098
|
* CRM Entity Types
|
|
1094
1099
|
* @link https://dev.1c-bitrix.ru/rest_help/crm/constants.php
|
|
@@ -2896,6 +2901,15 @@ declare class B24OAuth extends AbstractB24 implements TypeB24 {
|
|
|
2896
2901
|
* Removes Callback to receive updated authorization data
|
|
2897
2902
|
*/
|
|
2898
2903
|
removeCallbackRefreshAuth(): void;
|
|
2904
|
+
/**
|
|
2905
|
+
* Sets an asynchronous function for custom get new refresh token
|
|
2906
|
+
* @param cb
|
|
2907
|
+
*/
|
|
2908
|
+
setCustomRefreshAuth(cb: CustomRefreshAuth): void;
|
|
2909
|
+
/**
|
|
2910
|
+
* Removes function for custom get new refresh token
|
|
2911
|
+
*/
|
|
2912
|
+
removeCustomRefreshAuth(): void;
|
|
2899
2913
|
/**
|
|
2900
2914
|
* Disables warning about client-side query execution
|
|
2901
2915
|
*/
|
|
@@ -2925,6 +2939,8 @@ declare class AuthOAuthManager implements AuthActions {
|
|
|
2925
2939
|
refreshAuth(): Promise<AuthData>;
|
|
2926
2940
|
setCallbackRefreshAuth(cb: CallbackRefreshAuth): void;
|
|
2927
2941
|
removeCallbackRefreshAuth(): void;
|
|
2942
|
+
setCustomRefreshAuth(cb: CustomRefreshAuth): void;
|
|
2943
|
+
removeCustomRefreshAuth(): void;
|
|
2928
2944
|
getUniq(prefix: string): string;
|
|
2929
2945
|
/**
|
|
2930
2946
|
* Get the account address BX24 ( https://name.bitrix24.com )
|
|
@@ -3550,4 +3566,4 @@ declare class PullClient implements ConnectorParent {
|
|
|
3550
3566
|
declare function initializeB24Frame(): Promise<B24Frame>;
|
|
3551
3567
|
|
|
3552
3568
|
export { AbstractB24, AjaxError, AjaxResult, AppFrame, AuthHookManager, AuthManager, AuthOAuthManager, B24Frame, B24Hook, B24LangList, B24LocaleMap, B24OAuth, PullClient as B24PullClientManager, Browser, CatalogProductImageType, CatalogProductType, CatalogRoundingRuleType, CloseReasons, ConnectionType, DataType, DialogManager, EnumAppStatus, EnumBitrix24Edition, EnumBizprocBaseType, EnumBizprocDocumentType, 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$1 as Text, Type, TypeOption, TypeSpecificUrl, convertBizprocDocumentTypeToCrmEntityTypeId, getDocumentId, getDocumentType, getDocumentTypeForFilter, getEnumCrmEntityTypeShort, getEnumValue, initializeB24Frame, isArrayOfArray, omit, pick, useB24Helper, useFormatter };
|
|
3553
|
-
export type { ActivityConfig, ActivityHandlerParams, ActivityOrRobotConfig, ActivityProperty, ActivityPropertyType, AjaxErrorParams, AjaxQuery, AjaxResultParams, AnswerError, AuthActions, AuthData, B24FrameQueryParams, B24HookParams, B24OAuthParams, B24OAuthSecret, BatchPayload, BoolString, CallbackRefreshAuth, CatalogCatalog, CatalogExtra, CatalogLanguage, CatalogMeasure, CatalogPriceType, CatalogPriceTypeLang, CatalogProduct, CatalogProductImage, CatalogProductOffer, CatalogProductService, CatalogProductSku, CatalogRatio, CatalogRoundingRule, CatalogSection, CatalogStore, CatalogVat, CommandHandlerFunctionV1, CommandHandlerFunctionV2, ConnectorCallbacks, ConnectorConfig, ConnectorParent, CrmItemDelivery, CrmItemPayment, CrmItemProductRow, Currency, CurrencyFormat, EventHandlerParams, EventOnAppInstallHandlerParams, EventOnAppUnInstallHandlerParams, Fields, GenderString, GetPayload, HandlerAuthParams, IPlacementUF, IRequestIdGenerator, IResult, ISODate, JsonRpcRequest, ListPayload, MessageInitData, MultiField, MultiFieldArray, NumberString, Payload, PayloadOAuthToken, PayloadTime, PlacementViewMode, RefreshAuthData, RpcCommand, RpcCommandResult, RpcError, RpcRequest, SelectCRMParams, SelectCRMParamsEntityType, SelectCRMParamsValue, SelectedAccess, SelectedCRM, SelectedCRMEntity, SelectedUser, SendParams, SharedConfigCallbacks, SharedConfigParams, StatusClose, StorageManagerParams, TextType, TypeApp, TypeB24, TypeB24Form, TypeChanel, TypeChannelManagerParams, TypeConnector, TypeDescriptionError, TypeEnumAppStatus, TypeHttp, TypeJsonRpcConfig, TypeLicense, TypePayment, TypePublicIdDescriptor, TypePullClientConfig, TypePullClientEmitConfig, TypePullClientMessageBatch, TypePullClientMessageBody, TypePullClientParams, TypePullClientSession, TypePullMessage, TypeRestrictionManagerParams, TypeRpcResponseAwaiters, TypeSessionEvent, TypeStorageManager, TypeSubscriptionCommandHandler, TypeSubscriptionOptions, TypeUser, UserBasic, UserBrief, UserFieldType, UserStatusCallback };
|
|
3569
|
+
export type { ActivityConfig, ActivityHandlerParams, ActivityOrRobotConfig, ActivityProperty, ActivityPropertyType, AjaxErrorParams, AjaxQuery, AjaxResultParams, AnswerError, AuthActions, AuthData, B24FrameQueryParams, B24HookParams, B24OAuthParams, B24OAuthSecret, BatchPayload, BoolString, CallbackRefreshAuth, CatalogCatalog, CatalogExtra, CatalogLanguage, CatalogMeasure, CatalogPriceType, CatalogPriceTypeLang, CatalogProduct, CatalogProductImage, CatalogProductOffer, CatalogProductService, CatalogProductSku, CatalogRatio, CatalogRoundingRule, CatalogSection, CatalogStore, CatalogVat, CommandHandlerFunctionV1, CommandHandlerFunctionV2, ConnectorCallbacks, ConnectorConfig, ConnectorParent, CrmItemDelivery, CrmItemPayment, CrmItemProductRow, Currency, CurrencyFormat, CustomRefreshAuth, EventHandlerParams, EventOnAppInstallHandlerParams, EventOnAppUnInstallHandlerParams, Fields, GenderString, GetPayload, HandlerAuthParams, HandlerRefreshAuth, IPlacementUF, IRequestIdGenerator, IResult, ISODate, JsonRpcRequest, ListPayload, MessageInitData, MultiField, MultiFieldArray, NumberString, Payload, PayloadOAuthToken, PayloadTime, PlacementViewMode, RefreshAuthData, RpcCommand, RpcCommandResult, RpcError, RpcRequest, SelectCRMParams, SelectCRMParamsEntityType, SelectCRMParamsValue, SelectedAccess, SelectedCRM, SelectedCRMEntity, SelectedUser, SendParams, SharedConfigCallbacks, SharedConfigParams, StatusClose, StorageManagerParams, TextType, TypeApp, TypeB24, TypeB24Form, TypeChanel, TypeChannelManagerParams, TypeConnector, TypeDescriptionError, TypeEnumAppStatus, TypeHttp, TypeJsonRpcConfig, TypeLicense, TypePayment, TypePublicIdDescriptor, TypePullClientConfig, TypePullClientEmitConfig, TypePullClientMessageBatch, TypePullClientMessageBody, TypePullClientParams, TypePullClientSession, TypePullMessage, TypeRestrictionManagerParams, TypeRpcResponseAwaiters, TypeSessionEvent, TypeStorageManager, TypeSubscriptionCommandHandler, TypeSubscriptionOptions, TypeUser, UserBasic, UserBrief, UserFieldType, UserStatusCallback };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @version @bitrix24/b24jssdk v0.4.
|
|
2
|
+
* @version @bitrix24/b24jssdk v0.4.10
|
|
3
3
|
* @copyright (c) 2025 Bitrix24
|
|
4
4
|
* @licence MIT
|
|
5
5
|
* @links https://github.com/bitrix24/b24jssdk - GitHub
|
|
@@ -1683,7 +1683,7 @@ class Http {
|
|
|
1683
1683
|
#clientSideWarningMessage = "";
|
|
1684
1684
|
constructor(baseURL, authActions, options) {
|
|
1685
1685
|
const defaultHeaders = {
|
|
1686
|
-
// 'X-Sdk': 'b24-js-sdk-v-0.4.
|
|
1686
|
+
// 'X-Sdk': 'b24-js-sdk-v-0.4.10'
|
|
1687
1687
|
};
|
|
1688
1688
|
this.#clientAxios = axios.create({
|
|
1689
1689
|
baseURL,
|
|
@@ -2111,9 +2111,12 @@ class Http {
|
|
|
2111
2111
|
*/
|
|
2112
2112
|
#prepareMethod(method) {
|
|
2113
2113
|
const baseUrl = `${encodeURIComponent(method)}.json`;
|
|
2114
|
+
if (method.includes("task.")) {
|
|
2115
|
+
return `${baseUrl}`;
|
|
2116
|
+
}
|
|
2114
2117
|
const queryParams = new URLSearchParams({
|
|
2115
2118
|
[this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
|
|
2116
|
-
[this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.
|
|
2119
|
+
[this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.10",
|
|
2117
2120
|
[this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
2118
2121
|
});
|
|
2119
2122
|
return `${baseUrl}?${queryParams.toString()}`;
|
|
@@ -3388,6 +3391,8 @@ class MessageManager {
|
|
|
3388
3391
|
cmd = command.toString();
|
|
3389
3392
|
if (params?.isRawValue !== true && paramsSend) {
|
|
3390
3393
|
paramsSend = JSON.stringify(paramsSend);
|
|
3394
|
+
} else if (params?.isRawValue === true && paramsSend && Type.isPlainObject(paramsSend) && paramsSend["value"]) {
|
|
3395
|
+
paramsSend = paramsSend["value"];
|
|
3391
3396
|
}
|
|
3392
3397
|
const listParams = [
|
|
3393
3398
|
paramsSend || "",
|
|
@@ -4389,6 +4394,7 @@ class RefreshTokenError extends AjaxError {
|
|
|
4389
4394
|
class AuthOAuthManager {
|
|
4390
4395
|
#clientAxios;
|
|
4391
4396
|
#callbackRefreshAuth = null;
|
|
4397
|
+
#customRefreshAuth = null;
|
|
4392
4398
|
#authOptions;
|
|
4393
4399
|
#oAuthSecret;
|
|
4394
4400
|
#authExpires = 0;
|
|
@@ -4432,24 +4438,32 @@ class AuthOAuthManager {
|
|
|
4432
4438
|
*/
|
|
4433
4439
|
async refreshAuth() {
|
|
4434
4440
|
try {
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4441
|
+
let payload = void 0;
|
|
4442
|
+
if (this.#customRefreshAuth) {
|
|
4443
|
+
payload = await this.#customRefreshAuth();
|
|
4444
|
+
} else {
|
|
4445
|
+
const response = await this.#clientAxios.get(
|
|
4446
|
+
"/oauth/token/",
|
|
4447
|
+
{
|
|
4448
|
+
params: {
|
|
4449
|
+
grant_type: "refresh_token",
|
|
4450
|
+
client_id: this.#oAuthSecret.clientId,
|
|
4451
|
+
client_secret: this.#oAuthSecret.clientSecret,
|
|
4452
|
+
refresh_token: this.#authOptions.refreshToken
|
|
4453
|
+
}
|
|
4443
4454
|
}
|
|
4455
|
+
);
|
|
4456
|
+
if (response.data.error) {
|
|
4457
|
+
throw new Error(`Token update error: ${response.data.error}`);
|
|
4444
4458
|
}
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4459
|
+
if (response.status !== 200) {
|
|
4460
|
+
throw new Error(`Token update error status code: ${response.status}`);
|
|
4461
|
+
}
|
|
4462
|
+
payload = response.data;
|
|
4448
4463
|
}
|
|
4449
|
-
if (
|
|
4450
|
-
throw new Error(
|
|
4464
|
+
if (!payload) {
|
|
4465
|
+
throw new Error("Unable to obtain authorization update data");
|
|
4451
4466
|
}
|
|
4452
|
-
const payload = response.data;
|
|
4453
4467
|
this.#authOptions.accessToken = payload.access_token;
|
|
4454
4468
|
this.#authOptions.refreshToken = payload.refresh_token;
|
|
4455
4469
|
this.#authOptions.expires = Number.parseInt(payload.expires || "0");
|
|
@@ -4500,6 +4514,12 @@ class AuthOAuthManager {
|
|
|
4500
4514
|
removeCallbackRefreshAuth() {
|
|
4501
4515
|
this.#callbackRefreshAuth = null;
|
|
4502
4516
|
}
|
|
4517
|
+
setCustomRefreshAuth(cb) {
|
|
4518
|
+
this.#customRefreshAuth = cb;
|
|
4519
|
+
}
|
|
4520
|
+
removeCustomRefreshAuth() {
|
|
4521
|
+
this.#customRefreshAuth = null;
|
|
4522
|
+
}
|
|
4503
4523
|
// endregion ////
|
|
4504
4524
|
getUniq(prefix) {
|
|
4505
4525
|
return [prefix, this.#authOptions.memberId || ""].join("_");
|
|
@@ -4579,6 +4599,21 @@ class B24OAuth extends AbstractB24 {
|
|
|
4579
4599
|
this._ensureInitialized();
|
|
4580
4600
|
this.#authOAuthManager.removeCallbackRefreshAuth();
|
|
4581
4601
|
}
|
|
4602
|
+
/**
|
|
4603
|
+
* Sets an asynchronous function for custom get new refresh token
|
|
4604
|
+
* @param cb
|
|
4605
|
+
*/
|
|
4606
|
+
setCustomRefreshAuth(cb) {
|
|
4607
|
+
this._ensureInitialized();
|
|
4608
|
+
this.#authOAuthManager.setCustomRefreshAuth(cb);
|
|
4609
|
+
}
|
|
4610
|
+
/**
|
|
4611
|
+
* Removes function for custom get new refresh token
|
|
4612
|
+
*/
|
|
4613
|
+
removeCustomRefreshAuth() {
|
|
4614
|
+
this._ensureInitialized();
|
|
4615
|
+
this.#authOAuthManager.removeCustomRefreshAuth();
|
|
4616
|
+
}
|
|
4582
4617
|
// endregion ////
|
|
4583
4618
|
// region Core ////
|
|
4584
4619
|
/**
|