@bitrix24/b24jssdk 0.1.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.
@@ -0,0 +1,3036 @@
1
+ import { DateTimeOptions, DateTime } from 'luxon';
2
+
3
+ declare enum LoggerType {
4
+ desktop = "desktop",
5
+ log = "log",
6
+ info = "info",
7
+ warn = "warn",
8
+ error = "error",
9
+ trace = "trace"
10
+ }
11
+ declare class LoggerBrowser {
12
+ #private;
13
+ static build(title: string, isDevelopment?: boolean): LoggerBrowser;
14
+ private constructor();
15
+ setConfig(types: Record<string | LoggerType, boolean>): void;
16
+ enable(type: LoggerType): boolean;
17
+ disable(type: LoggerType): boolean;
18
+ isEnabled(type: LoggerType): boolean;
19
+ desktop(...params: any[]): void;
20
+ log(...params: any[]): void;
21
+ info(...params: any[]): void;
22
+ warn(...params: any[]): void;
23
+ error(...params: any[]): void;
24
+ trace(...params: any[]): void;
25
+ }
26
+
27
+ /**
28
+ * String which is actually a number, like `'20.23'`
29
+ */
30
+ type NumberString = string;
31
+ /**
32
+ * Like `'2018-06-07T03:00:00+03:00'`
33
+ */
34
+ type ISODate = string;
35
+ type BoolString = 'Y' | 'N';
36
+ type GenderString = 'M' | 'F' | '';
37
+ type PlacementViewMode = 'view' | 'edit';
38
+ type Fields = {
39
+ readonly [key: string]: {
40
+ readonly type: string;
41
+ readonly isRequired: boolean;
42
+ readonly isReadOnly: boolean;
43
+ readonly isImmutable: boolean;
44
+ readonly isMultiple: boolean;
45
+ readonly isDynamic: boolean;
46
+ readonly title: string;
47
+ readonly upperName?: string;
48
+ };
49
+ };
50
+ type MultiField = {
51
+ readonly ID: NumberString;
52
+ readonly VALUE_TYPE: string;
53
+ readonly VALUE: string;
54
+ readonly TYPE_ID: string;
55
+ };
56
+ type MultiFieldArray = ReadonlyArray<Pick<MultiField, 'VALUE' | 'VALUE_TYPE'>>;
57
+ /**
58
+ * Describes the inline settings in UF
59
+ */
60
+ type UserFieldType = {
61
+ USER_TYPE_ID: string;
62
+ HANDLER: string;
63
+ TITLE: string;
64
+ DESCRIPTION: string;
65
+ OPTIONS?: {
66
+ height: number;
67
+ };
68
+ };
69
+ /**
70
+ * Data types
71
+ * @link https://apidocs.bitrix24.ru/api-reference/data-types.html
72
+ * @link https://dev.1c-bitrix.ru/rest_help/crm/dynamic/methodscrmitem/crm_item_fields.php
73
+ */
74
+ declare enum DataType {
75
+ undefined = "undefined",
76
+ any = "any",
77
+ integer = "integer",
78
+ boolean = "boolean",
79
+ double = "double",
80
+ date = "date",
81
+ datetime = "datetime",
82
+ string = "string",
83
+ text = "text",
84
+ file = "file",
85
+ array = "array",
86
+ object = "object",
87
+ user = "user",
88
+ location = "location",
89
+ crmCategory = "crm_category",
90
+ crmStatus = "crm_status",
91
+ crmCurrency = "crm_currency"
92
+ }
93
+
94
+ /**
95
+ * The `Type` class is designed to check and determine data types
96
+ *
97
+ * @see bitrix/js/main/core/src/lib/type.js
98
+ */
99
+ declare class TypeManager {
100
+ getTag(value: any): string;
101
+ /**
102
+ * Checks that value is string
103
+ * @param value
104
+ * @return {boolean}
105
+ *
106
+ * @memo get from pull.client.Utils
107
+ */
108
+ isString(value: any): boolean;
109
+ /**
110
+ * Returns true if a value is not empty string
111
+ * @param value
112
+ * @returns {boolean}
113
+ */
114
+ isStringFilled(value: any): boolean;
115
+ /**
116
+ * Checks that value is function
117
+ * @param value
118
+ * @return {boolean}
119
+ *
120
+ * @memo get from pull.client.Utils
121
+ */
122
+ isFunction(value: any): boolean;
123
+ /**
124
+ * Checks that value is object
125
+ * @param value
126
+ * @return {boolean}
127
+ */
128
+ isObject(value: any): boolean;
129
+ /**
130
+ * Checks that value is object like
131
+ * @param value
132
+ * @return {boolean}
133
+ */
134
+ isObjectLike(value: any): boolean;
135
+ /**
136
+ * Checks that value is plain object
137
+ * @param value
138
+ * @return {boolean}
139
+ */
140
+ isPlainObject(value: any): boolean;
141
+ isJsonRpcRequest(value: any): boolean;
142
+ isJsonRpcResponse(value: any): boolean;
143
+ /**
144
+ * Checks that value is boolean
145
+ * @param value
146
+ * @return {boolean}
147
+ */
148
+ isBoolean(value: any): boolean;
149
+ /**
150
+ * Checks that value is number
151
+ * @param value
152
+ * @return {boolean}
153
+ */
154
+ isNumber(value: any): boolean;
155
+ /**
156
+ * Checks that value is integer
157
+ * @param value
158
+ * @return {boolean}
159
+ */
160
+ isInteger(value: any): boolean;
161
+ /**
162
+ * Checks that value is float
163
+ * @param value
164
+ * @return {boolean}
165
+ */
166
+ isFloat(value: any): boolean;
167
+ /**
168
+ * Checks that value is nil
169
+ * @param value
170
+ * @return {boolean}
171
+ */
172
+ isNil(value: any): boolean;
173
+ /**
174
+ * Checks that value is array
175
+ * @param value
176
+ * @return {boolean}
177
+ */
178
+ isArray(value: any): boolean;
179
+ /**
180
+ * Returns true if a value is an array, and it has at least one element
181
+ * @param value
182
+ * @returns {boolean}
183
+ */
184
+ isArrayFilled(value: any): boolean;
185
+ /**
186
+ * Checks that value is array like
187
+ * @param value
188
+ * @return {boolean}
189
+ */
190
+ isArrayLike(value: any): boolean;
191
+ /**
192
+ * Checks that value is Date
193
+ * @param value
194
+ * @return {boolean}
195
+ */
196
+ isDate(value: any): boolean;
197
+ /**
198
+ * Checks that is DOM node
199
+ * @param value
200
+ * @return {boolean}
201
+ */
202
+ isDomNode(value: any): boolean;
203
+ /**
204
+ * Checks that value is element node
205
+ * @param value
206
+ * @return {boolean}
207
+ */
208
+ isElementNode(value: any): boolean;
209
+ /**
210
+ * Checks that value is text node
211
+ * @param value
212
+ * @return {boolean}
213
+ */
214
+ isTextNode(value: any): boolean;
215
+ /**
216
+ * Checks that value is Map
217
+ * @param value
218
+ * @return {boolean}
219
+ */
220
+ isMap(value: any): boolean;
221
+ /**
222
+ * Checks that value is Set
223
+ * @param value
224
+ * @return {boolean}
225
+ */
226
+ isSet(value: any): boolean;
227
+ /**
228
+ * Checks that value is WeakMap
229
+ * @param value
230
+ * @return {boolean}
231
+ */
232
+ isWeakMap(value: any): boolean;
233
+ /**
234
+ * Checks that value is WeakSet
235
+ * @param value
236
+ * @return {boolean}
237
+ */
238
+ isWeakSet(value: any): boolean;
239
+ /**
240
+ * Checks that value is prototype
241
+ * @param value
242
+ * @return {boolean}
243
+ */
244
+ isPrototype(value: any): boolean;
245
+ /**
246
+ * Checks that value is regexp
247
+ * @param value
248
+ * @return {boolean}
249
+ */
250
+ isRegExp(value: any): boolean;
251
+ /**
252
+ * Checks that value is null
253
+ * @param value
254
+ * @return {boolean}
255
+ */
256
+ isNull(value: any): boolean;
257
+ /**
258
+ * Checks that value is undefined
259
+ * @param value
260
+ * @return {boolean}
261
+ */
262
+ isUndefined(value: any): boolean;
263
+ /**
264
+ * Checks that value is ArrayBuffer
265
+ * @param value
266
+ * @return {boolean}
267
+ */
268
+ isArrayBuffer(value: any): boolean;
269
+ /**
270
+ * Checks that value is typed array
271
+ * @param value
272
+ * @return {boolean}
273
+ */
274
+ isTypedArray(value: any): boolean;
275
+ /**
276
+ * Checks that value is Blob
277
+ * @param value
278
+ * @return {boolean}
279
+ */
280
+ isBlob(value: any): boolean;
281
+ /**
282
+ * Checks that value is File
283
+ * @param value
284
+ * @return {boolean}
285
+ */
286
+ isFile(value: any): boolean;
287
+ /**
288
+ * Checks that value is FormData
289
+ * @param value
290
+ * @return {boolean}
291
+ */
292
+ isFormData(value: any): boolean;
293
+ clone(obj: any, bCopyObj?: boolean): any;
294
+ }
295
+ declare const Type: TypeManager;
296
+
297
+ /**
298
+ * The `Text` class provides a set of utility methods for working with text data.
299
+ * It includes functions for encoding and decoding HTML entities, generating random strings,
300
+ * converting values to different data types, and changing the case and format of strings
301
+ *
302
+ * @see bitrix/js/main/core/src/lib/text.js
303
+ */
304
+ declare class TextManager {
305
+ getRandom(length?: number): string;
306
+ /**
307
+ * Generates UUID
308
+ */
309
+ getUniqId(): string;
310
+ /**
311
+ * Generate uuid v7
312
+ * @return {string}
313
+ */
314
+ getUuidRfc4122(): string;
315
+ /**
316
+ * Encodes all unsafe entities
317
+ * @param {string} value
318
+ * @return {string}
319
+ */
320
+ encode(value: string): string;
321
+ /**
322
+ * Decodes all encoded entities
323
+ * @param {string} value
324
+ * @return {string}
325
+ */
326
+ decode(value: string): string;
327
+ toNumber(value: any): number;
328
+ toInteger(value: any): number;
329
+ toBoolean(value: any, trueValues?: string[]): boolean;
330
+ toCamelCase(str: string): string;
331
+ toPascalCase(str: string): string;
332
+ toKebabCase(str: string): string;
333
+ capitalize(str: string): string;
334
+ numberFormat(number: number, decimals?: number, decPoint?: string, thousandsSep?: string): string;
335
+ /**
336
+ * Convert string to DateTime from ISO 8601 or self template
337
+ *
338
+ * @param {string} dateString
339
+ * @param {string} template
340
+ * @param opts
341
+ * @returns {DateTime}
342
+ *
343
+ * @link https://moment.github.io/luxon/#/parsing?id=parsing-technical-formats
344
+ */
345
+ toDateTime(dateString: string, template?: string, opts?: DateTimeOptions): DateTime;
346
+ getDateForLog(): string;
347
+ buildQueryString(params: any): string;
348
+ }
349
+ declare const Text: TextManager;
350
+
351
+ /**
352
+ * @see bitrix/js/main/core/src/lib/browser.js
353
+ */
354
+ declare class BrowserManager {
355
+ isOpera(): boolean;
356
+ isIE(): boolean;
357
+ isIE6(): boolean;
358
+ isIE7(): boolean;
359
+ isIE8(): boolean;
360
+ isIE9(): boolean;
361
+ isIE10(): boolean;
362
+ isSafari(): boolean;
363
+ isFirefox(): boolean;
364
+ isChrome(): boolean;
365
+ detectIEVersion(): number;
366
+ isIE11(): boolean;
367
+ isMac(): boolean;
368
+ isWin(): boolean;
369
+ isLinux(): boolean;
370
+ isAndroid(): boolean;
371
+ isIPad(): boolean;
372
+ isIPhone(): boolean;
373
+ isIOS(): boolean;
374
+ isMobile(): boolean;
375
+ isRetina(): boolean;
376
+ isTouchDevice(): boolean;
377
+ isDoctype(target: any): boolean;
378
+ isLocalStorageSupported(): boolean;
379
+ detectAndroidVersion(): number;
380
+ }
381
+ declare const Browser: BrowserManager;
382
+
383
+ /**
384
+ * Interface defining the structure and methods of a Result object.
385
+ */
386
+ interface IResult {
387
+ /**
388
+ * Indicates whether the operation resulted in success (no errors).
389
+ */
390
+ isSuccess: boolean;
391
+ /**
392
+ * Sets the data associated with the result.
393
+ *
394
+ * @param data The data to be stored in the result.
395
+ * @returns The current Result object for chaining methods.
396
+ */
397
+ setData: (data: any) => IResult;
398
+ /**
399
+ * Retrieves the data associated with the result.
400
+ *
401
+ * @returns The data stored in the result, if any.
402
+ */
403
+ getData: () => any;
404
+ /**
405
+ * Adds an error message or Error object to the result.
406
+ *
407
+ * @param error The error message or Error object to be added.
408
+ * @returns The current Result object for chaining methods.
409
+ */
410
+ addError: (error: Error | string) => IResult;
411
+ /**
412
+ * Adds multiple errors to the result in a single call.
413
+ *
414
+ * @param errors An array of errors or strings that will be converted to errors.
415
+ * @returns The current Result object for chaining methods.
416
+ */
417
+ addErrors: (errors: (Error | string)[]) => IResult;
418
+ /**
419
+ * Retrieves an iterator for the errors collected in the result.
420
+ *
421
+ * @returns An iterator over the stored Error objects.
422
+ */
423
+ getErrors: () => IterableIterator<Error>;
424
+ /**
425
+ * Retrieves an array of error messages from the collected errors.
426
+ *
427
+ * @returns An array of strings representing the error messages.
428
+ */
429
+ getErrorMessages: () => string[];
430
+ /**
431
+ * Converts the Result object to a string.
432
+ *
433
+ * @returns {string} Returns a string representation of the result operation
434
+ */
435
+ toString: () => string;
436
+ }
437
+ /**
438
+ * A class representing an operation result with success/failure status, data, and errors.
439
+ * Similar to \Bitrix\Main\Result from Bitrix Framework.
440
+ * @link https://dev.1c-bitrix.ru/api_d7/bitrix/main/result/index.php
441
+ */
442
+ declare class Result implements IResult {
443
+ private _errorCollection;
444
+ protected _data: any;
445
+ constructor();
446
+ /**
447
+ * Getter for the `isSuccess` property.
448
+ * Checks if the `_errorCollection` is empty to determine success.
449
+ *
450
+ * @returns Whether the operation resulted in success (no errors).
451
+ */
452
+ get isSuccess(): boolean;
453
+ /**
454
+ * Sets the data associated with the result.
455
+ *
456
+ * @param data The data to be stored in the result.
457
+ * @returns The current Result object for chaining methods.
458
+ */
459
+ setData(data: any): Result;
460
+ /**
461
+ * Retrieves the data associated with the result.
462
+ *
463
+ * @returns The data stored in the result, if any.
464
+ */
465
+ getData(): any;
466
+ /**
467
+ * Adds an error message or Error object to the result.
468
+ *
469
+ * @param error The error message or Error object to be added.
470
+ * @returns The current Result object for chaining methods.
471
+ */
472
+ addError(error: Error | string): Result;
473
+ /**
474
+ * Adds multiple errors to the result in a single call.
475
+ *
476
+ * @param errors An array of errors or strings that will be converted to errors.
477
+ * @returns The current Result object for chaining methods.
478
+ */
479
+ addErrors(errors: (Error | string)[]): Result;
480
+ /**
481
+ * Retrieves an iterator for the errors collected in the result.
482
+ * @returns An iterator over the stored Error objects.
483
+ */
484
+ getErrors(): IterableIterator<Error>;
485
+ /**
486
+ * Retrieves an array of error messages from the collected errors.
487
+ *
488
+ * @returns An array of strings representing the error messages. Each string
489
+ * contains the message of a corresponding error object.
490
+ */
491
+ getErrorMessages(): string[];
492
+ /**
493
+ * Converts the Result object to a string.
494
+ *
495
+ * @returns {string} Returns a string representation of the result operation
496
+ */
497
+ toString(): string;
498
+ }
499
+
500
+ type PayloadTime = {
501
+ readonly start: number;
502
+ readonly finish: number;
503
+ readonly duration: number;
504
+ readonly processing: number;
505
+ readonly date_start: string;
506
+ readonly date_finish: string;
507
+ };
508
+ type GetPayload<P> = {
509
+ readonly result: P;
510
+ readonly time: PayloadTime;
511
+ };
512
+ type ListPayload<P> = {
513
+ readonly result: any | P[];
514
+ readonly error?: string;
515
+ readonly total: number;
516
+ readonly next?: number;
517
+ readonly time: PayloadTime;
518
+ };
519
+ type BatchPayload<C> = {
520
+ readonly result: {
521
+ readonly result: {
522
+ readonly [P in keyof C]?: C[P];
523
+ } | ReadonlyArray<C[keyof C]>;
524
+ readonly result_error: {
525
+ readonly [P in keyof C]?: string;
526
+ } | readonly string[];
527
+ readonly result_total: {
528
+ readonly [P in keyof C]?: number;
529
+ } | readonly number[];
530
+ readonly result_next: {
531
+ readonly [P in keyof C]?: number;
532
+ } | readonly number[];
533
+ readonly result_time: {
534
+ readonly [P in keyof C]?: PayloadTime;
535
+ } | readonly PayloadTime[];
536
+ };
537
+ readonly time: PayloadTime;
538
+ };
539
+ type Payload<P> = GetPayload<P> | ListPayload<P> | BatchPayload<P>;
540
+
541
+ type AjaxQuery = {
542
+ method: string;
543
+ params: {};
544
+ start: number;
545
+ };
546
+ type AjaxResultParams = {
547
+ error?: string | {
548
+ error: string;
549
+ error_description: string;
550
+ };
551
+ error_description?: string;
552
+ result: any;
553
+ next?: NumberString;
554
+ total?: NumberString;
555
+ };
556
+ /**
557
+ * Result of request to Rest Api
558
+ */
559
+ declare class AjaxResult extends Result implements IResult {
560
+ private readonly _status;
561
+ private readonly _query;
562
+ protected _data: AjaxResultParams;
563
+ constructor(answer: AjaxResultParams, query: AjaxQuery, status: number);
564
+ setData(data: any): Result;
565
+ getData(): Payload<unknown>;
566
+ isMore(): boolean;
567
+ getTotal(): number;
568
+ getStatus(): number;
569
+ getQuery(): AjaxQuery;
570
+ getNext(http: TypeHttp): Promise<false | AjaxResult>;
571
+ }
572
+
573
+ type TypeHttp = {
574
+ setLogger(logger: LoggerBrowser): void;
575
+ getLogger(): LoggerBrowser;
576
+ batch(calls: any[] | object, isHaltOnError: boolean): Promise<Result>;
577
+ call(method: string, params: object, start: number): Promise<AjaxResult>;
578
+ setRestrictionManagerParams(params: TypeRestrictionManagerParams): void;
579
+ getRestrictionManagerParams(): TypeRestrictionManagerParams;
580
+ setLogTag(logTag?: string): void;
581
+ clearLogTag(): void;
582
+ };
583
+ interface IRequestIdGenerator {
584
+ getRequestId(): string;
585
+ getHeaderFieldName(): string;
586
+ getQueryStringParameterName(): string;
587
+ getQueryStringSdkParameterName(): string;
588
+ }
589
+ type TypeRestrictionManagerParams = {
590
+ sleep: number;
591
+ speed: number;
592
+ amount: number;
593
+ };
594
+ declare const RestrictionManagerParamsBase: TypeRestrictionManagerParams;
595
+ /**
596
+ * @todo Need test
597
+ */
598
+ declare const RestrictionManagerParamsForEnterprise: TypeRestrictionManagerParams;
599
+
600
+ type TypeDescriptionError = {
601
+ readonly error: 'invalid_token' | 'expired_token' | string;
602
+ readonly error_description: string;
603
+ };
604
+ /**
605
+ * Parameters for hook
606
+ */
607
+ type B24HookParams = {
608
+ /**
609
+ * https://your-bitrix-portal.bitrix24.com
610
+ */
611
+ b24Url: string;
612
+ userId: number;
613
+ secret: string;
614
+ };
615
+ /**
616
+ * Parameters passed in the GET request from the B24 parent window to the application
617
+ */
618
+ type B24FrameQueryParams = {
619
+ DOMAIN: string | null | undefined;
620
+ PROTOCOL: boolean | null | undefined;
621
+ LANG: string | null | undefined;
622
+ APP_SID: string | null | undefined;
623
+ };
624
+ /**
625
+ * Parameters passed from the parent window when calling refreshAuth
626
+ */
627
+ type RefreshAuthData = {
628
+ AUTH_ID: string;
629
+ REFRESH_ID: string;
630
+ AUTH_EXPIRES: NumberString;
631
+ };
632
+ /**
633
+ * Parameters passed from the parent window when calling getInitData
634
+ */
635
+ type MessageInitData = RefreshAuthData & {
636
+ DOMAIN: string;
637
+ PROTOCOL: string;
638
+ PATH: string;
639
+ LANG: string;
640
+ MEMBER_ID: string;
641
+ IS_ADMIN: boolean;
642
+ APP_OPTIONS: Record<string, any>;
643
+ USER_OPTIONS: Record<string, any>;
644
+ PLACEMENT: string;
645
+ PLACEMENT_OPTIONS: Record<string, any>;
646
+ INSTALL: boolean;
647
+ FIRST_RUN: boolean;
648
+ };
649
+ /**
650
+ * Parameters for OAuth authorization
651
+ */
652
+ type AuthData = {
653
+ access_token: string;
654
+ refresh_token: string;
655
+ expires_in: number;
656
+ domain: string;
657
+ member_id: string;
658
+ };
659
+ /**
660
+ * Interface for updating authorization
661
+ */
662
+ interface AuthActions {
663
+ getAuthData: () => false | AuthData;
664
+ refreshAuth: () => Promise<AuthData>;
665
+ getUniq: (prefix: string) => string;
666
+ isAdmin: boolean;
667
+ }
668
+
669
+ type TypeB24 = {
670
+ /**
671
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-functions/bx24-init.html
672
+ */
673
+ readonly isInit: boolean;
674
+ init(): Promise<void>;
675
+ destroy(): void;
676
+ getLogger(): LoggerBrowser;
677
+ setLogger(logger: LoggerBrowser): void;
678
+ get auth(): AuthActions;
679
+ /**
680
+ * Get the account address BX24 ( https://name.bitrix24.com )
681
+ */
682
+ getTargetOrigin(): string;
683
+ /**
684
+ * Get the account address BX24 ( https://name.bitrix24.com/rest )
685
+ */
686
+ getTargetOriginWithPath(): string;
687
+ /**
688
+ * Calls a REST service method with the specified parameters
689
+ *
690
+ * @param {string} method
691
+ * @param {object} params
692
+ * @param {number} start
693
+ *
694
+ * @return {Promise}
695
+ *
696
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/how-to-call-rest-methods/bx24-call-method.html
697
+ */
698
+ callMethod(method: string, params?: object, start?: number): Promise<AjaxResult>;
699
+ /**
700
+ * Calls a REST service list method with the specified parameters
701
+ *
702
+ * @param {string} method Query method
703
+ * @param {object} params Request parameters
704
+ * @param {null|((progress: number) => void)} progress Processing steps
705
+ * @param {string} customKeyForResult Custom field indicating that the result will be a grouping key
706
+ * @return {Promise}
707
+ */
708
+ callListMethod(method: string, params?: object, progress?: null | ((progress: number) => void), customKeyForResult?: string | null): Promise<Result>;
709
+ /**
710
+ * Calls a REST service list method with the specified parameters and returns a generator object.
711
+ * Implements the fast algorithm described in {@see https://apidocs.bitrix24.com/api-reference/performance/huge-data.html}
712
+ *
713
+ * @param {string} method Query method
714
+ * @param {object} params Request parameters
715
+ * @param {string} idKey Entity ID field name ('ID' || 'id')
716
+ * @param {string} customKeyForResult Custom field indicating that the result will be a grouping key
717
+ *
718
+ * @return {AsyncGenerator} Generator
719
+ */
720
+ fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?: string | null): AsyncGenerator<any[]>;
721
+ /**
722
+ * Calls a batch request with a maximum number of commands of no more than 50
723
+ *
724
+ * @param {array|object} calls Request packet
725
+ * calls = [[method,params],[method,params]]
726
+ * calls = [{method:method,params:params},[method,params]]
727
+ * calls = {call_id:[method,params],...}
728
+ * @param {boolean} isHaltOnError Abort package execution when an error occurs
729
+ *
730
+ * @return {Promise} Promise
731
+ *
732
+ * @see https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/how-to-call-rest-methods/bx24-call-batch.html
733
+ */
734
+ callBatch(calls: Array<any> | object, isHaltOnError?: boolean): Promise<Result>;
735
+ /**
736
+ * Calls a batch request with any number of commands
737
+ *
738
+ * @param {array} calls Request packet
739
+ * calls = [[method,params],[method,params]]
740
+ * @param {boolean} isHaltOnError Abort package execution when an error occurs
741
+ *
742
+ * @return {Promise} Promise
743
+ *
744
+ * @see https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/how-to-call-rest-methods/bx24-call-batch.html
745
+ */
746
+ callBatchByChunk(calls: Array<any>, isHaltOnError: boolean): Promise<Result>;
747
+ /**
748
+ * Returns Http client for requests
749
+ */
750
+ getHttpClient(): TypeHttp;
751
+ };
752
+
753
+ /**
754
+ * User fields for scope:user_brief
755
+ * @link https://dev.1c-bitrix.ru/rest_help/users/index.php
756
+ */
757
+ type UserBrief = {
758
+ readonly [key: string]: string | boolean | null | readonly number[];
759
+ readonly ID: NumberString;
760
+ readonly XML_ID: string | null;
761
+ readonly ACTIVE: boolean;
762
+ readonly NAME: string | null;
763
+ readonly LAST_NAME: string | null;
764
+ readonly SECOND_NAME: string | null;
765
+ readonly TITLE: string | null;
766
+ readonly IS_ONLINE: BoolString;
767
+ readonly TIME_ZONE: string | null;
768
+ readonly TIME_ZONE_OFFSET: NumberString | null;
769
+ readonly TIMESTAMP_X: string;
770
+ readonly DATE_REGISTER: ISODate;
771
+ readonly PERSONAL_PROFESSION: string | null;
772
+ readonly PERSONAL_GENDER: GenderString;
773
+ readonly PERSONAL_BIRTHDAY: string | null;
774
+ readonly PERSONAL_PHOTO: string | null;
775
+ readonly PERSONAL_CITY: string | null;
776
+ readonly PERSONAL_STATE: string | null;
777
+ readonly PERSONAL_COUNTRY: string | null;
778
+ readonly WORK_POSITION: string | null;
779
+ readonly WORK_CITY: string | null;
780
+ readonly WORK_STATE: string | null;
781
+ readonly WORK_COUNTRY: string | null;
782
+ readonly LAST_ACTIVITY_DATE: string;
783
+ readonly UF_EMPLOYMENT_DATE: ISODate | string;
784
+ readonly UF_TIMEMAN: string | null;
785
+ readonly UF_SKILLS: string | null;
786
+ readonly UF_INTERESTS: string | null;
787
+ readonly UF_DEPARTMENT: readonly number[];
788
+ readonly UF_PHONE_INNER: NumberString | null;
789
+ };
790
+ /**
791
+ * User fields for scope:user_basic
792
+ */
793
+ type UserBasic = UserBrief & {
794
+ readonly EMAIL: string | null;
795
+ readonly PERSONAL_WWW: string | null;
796
+ readonly PERSONAL_ICQ: string | null;
797
+ readonly PERSONAL_PHONE: string | null;
798
+ readonly PERSONAL_FAX: string | null;
799
+ readonly PERSONAL_MOBILE: string | null;
800
+ readonly PERSONAL_PAGER: string | null;
801
+ readonly PERSONAL_STREET: string | null;
802
+ readonly PERSONAL_ZIP: string | null;
803
+ readonly WORK_COMPANY: string | null;
804
+ readonly WORK_PHONE: string | null;
805
+ readonly UF_SKILLS: string | null;
806
+ readonly UF_WEB_SITES: string | null;
807
+ readonly UF_XING: string | null;
808
+ readonly UF_LINKEDIN: string | null;
809
+ readonly UF_FACEBOOK: string | null;
810
+ readonly UF_TWITTER: string | null;
811
+ readonly UF_SKYPE: string | null;
812
+ readonly UF_DISTRICT: string | null;
813
+ readonly USER_TYPE: 'employee';
814
+ };
815
+
816
+ type StatusClose = {
817
+ isOpenAtNewWindow: boolean;
818
+ isClose: boolean;
819
+ };
820
+
821
+ /**
822
+ * CRM Entity Types
823
+ * @link https://dev.1c-bitrix.ru/rest_help/crm/constants.php
824
+ */
825
+ declare enum EnumCrmEntityType {
826
+ undefined = "UNDEFINED",
827
+ lead = "CRM_LEAD",
828
+ deal = "CRM_DEAL",
829
+ contact = "CRM_CONTACT",
830
+ company = "CRM_COMPANY",
831
+ oldInvoice = "CRM_INVOICE",
832
+ invoice = "CRM_SMART_INVOICE",
833
+ quote = "CRM_QUOTE",
834
+ requisite = "CRM_REQUISITE"
835
+ }
836
+ declare enum EnumCrmEntityTypeId {
837
+ undefined = 0,
838
+ lead = 1,
839
+ deal = 2,
840
+ contact = 3,
841
+ company = 4,
842
+ oldInvoice = 5,
843
+ invoice = 31,
844
+ quote = 7,
845
+ requisite = 8
846
+ }
847
+
848
+ /**
849
+ * UF embedding properties interface
850
+ *
851
+ * @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=99&LESSON_ID=8633
852
+ */
853
+ interface IPlacementUF {
854
+ /**
855
+ * UF ID
856
+ */
857
+ FIELD_NAME: string;
858
+ /**
859
+ * The identifier of the entity to which the field is bound
860
+ */
861
+ ENTITY_ID: EnumCrmEntityType;
862
+ /**
863
+ * The identifier of the entity element whose field value is being edited
864
+ */
865
+ ENTITY_VALUE_ID: NumberString;
866
+ /**
867
+ * The mode in which the field is called
868
+ */
869
+ MODE: PlacementViewMode;
870
+ /**
871
+ * Field Requirement Flag
872
+ */
873
+ MANDATORY: BoolString;
874
+ /**
875
+ * Field multiplicity flag
876
+ */
877
+ MULTIPLE: BoolString;
878
+ /**
879
+ * Current value of the field. For a multiple field, an array of values.
880
+ */
881
+ VALUE: any;
882
+ /**
883
+ * External field code
884
+ */
885
+ XML_ID: string;
886
+ }
887
+
888
+ declare enum LoadDataType {
889
+ App = "app",
890
+ Profile = "profile",
891
+ Currency = "currency",
892
+ AppOptions = "appOptions",
893
+ UserOptions = "userOptions"
894
+ }
895
+ type TypeUser = {
896
+ readonly isAdmin: boolean;
897
+ readonly id: null | number;
898
+ readonly lastName: null | string;
899
+ readonly name: null | string;
900
+ readonly gender: GenderString;
901
+ readonly photo: null | string;
902
+ readonly TimeZone: null | string;
903
+ readonly TimeZoneOffset: null | number;
904
+ };
905
+ declare const EnumAppStatus: {
906
+ readonly Free: "F";
907
+ readonly Demo: "D";
908
+ readonly Trial: "T";
909
+ readonly Paid: "P";
910
+ readonly Local: "L";
911
+ readonly Subscription: "S";
912
+ };
913
+ declare const StatusDescriptions: Record<typeof EnumAppStatus[keyof typeof EnumAppStatus], string>;
914
+ type TypeEnumAppStatus = keyof typeof EnumAppStatus;
915
+ /**
916
+ * @link https://dev.1c-bitrix.ru/rest_help/general/app_info.php
917
+ */
918
+ type TypeApp = {
919
+ /**
920
+ * Local application identifier on the portal
921
+ */
922
+ readonly id: number;
923
+ /**
924
+ * application code
925
+ */
926
+ readonly code: string;
927
+ /**
928
+ * installed version of the application
929
+ */
930
+ readonly version: number;
931
+ /**
932
+ * application status
933
+ */
934
+ readonly status: TypeEnumAppStatus;
935
+ /**
936
+ * application installed flag
937
+ */
938
+ readonly isInstalled: boolean;
939
+ };
940
+ /**
941
+ * @link https://dev.1c-bitrix.ru/rest_help/general/app_info.php
942
+ */
943
+ type TypePayment = {
944
+ /**
945
+ * flag indicating whether the paid period or trial period has expired
946
+ */
947
+ readonly isExpired: boolean;
948
+ /**
949
+ * number of days remaining until the end of the paid period or trial period
950
+ */
951
+ readonly days: number;
952
+ };
953
+ /**
954
+ * @link https://dev.1c-bitrix.ru/rest_help/general/app_info.php
955
+ */
956
+ type TypeLicense = {
957
+ /**
958
+ * language code designation
959
+ */
960
+ readonly languageId: null | string;
961
+ /**
962
+ * tariff designation with indication of the region as a prefix
963
+ */
964
+ readonly license: null | string;
965
+ /**
966
+ * internal tariff designation without indication of region
967
+ */
968
+ readonly licenseType: null | string;
969
+ /**
970
+ * past meaning of license
971
+ */
972
+ readonly licensePrevious: null | string;
973
+ /**
974
+ * Tariff designation without specifying the region.
975
+ */
976
+ readonly licenseFamily: null | string;
977
+ /**
978
+ * flag indicating whether it is a box (true) or a cloud (false)
979
+ */
980
+ readonly isSelfHosted: boolean;
981
+ };
982
+ declare const TypeSpecificUrl: {
983
+ readonly MainSettings: "MainSettings";
984
+ readonly UfList: "UfList";
985
+ readonly UfPage: "UfPage";
986
+ };
987
+ type TypeB24Form = {
988
+ readonly app_code: string;
989
+ readonly app_status: string;
990
+ readonly payment_expired: BoolString;
991
+ readonly days: number;
992
+ /**
993
+ * B24 tariff plan identifier (if cloud)
994
+ */
995
+ readonly b24_plan: string;
996
+ readonly c_name: string;
997
+ readonly c_last_name: string;
998
+ readonly hostname: string;
999
+ };
1000
+ type CurrencyFormat = {
1001
+ decimals: number;
1002
+ decPoint: string;
1003
+ formatString: string;
1004
+ fullName: string;
1005
+ isHideZero: boolean;
1006
+ thousandsSep?: string;
1007
+ thousandsVariant?: 'N' | 'D' | 'C' | 'S' | 'B' | 'OWN' | string;
1008
+ };
1009
+ type Currency = {
1010
+ amount: number;
1011
+ amountCnt: number;
1012
+ isBase: boolean;
1013
+ currencyCode: string;
1014
+ dateUpdate: DateTime;
1015
+ decimals: number;
1016
+ decPoint: string;
1017
+ formatString: string;
1018
+ fullName: string;
1019
+ lid: string;
1020
+ sort: number;
1021
+ thousandsSep?: string;
1022
+ lang: Record<string, CurrencyFormat>;
1023
+ };
1024
+ declare enum TypeOption {
1025
+ NotSet = "notSet",
1026
+ JsonArray = "jsonArray",
1027
+ JsonObject = "jsonObject",
1028
+ FloatVal = "float",
1029
+ IntegerVal = "integer",
1030
+ BoolYN = "boolYN",
1031
+ StringVal = "string"
1032
+ }
1033
+
1034
+ type TypePullMessage = {
1035
+ command: string;
1036
+ params: Record<string, any>;
1037
+ extra: Record<string, any>;
1038
+ };
1039
+ type TypePullClientMessageBody = {
1040
+ module_id: string;
1041
+ command: string;
1042
+ params: any;
1043
+ extra?: {
1044
+ revision_web?: number;
1045
+ sender?: {
1046
+ type: SenderType;
1047
+ };
1048
+ server_time_unix?: number;
1049
+ server_time_ago?: number;
1050
+ };
1051
+ };
1052
+ declare enum ConnectionType {
1053
+ Undefined = "undefined",
1054
+ WebSocket = "webSocket",
1055
+ LongPolling = "longPolling"
1056
+ }
1057
+ type TypeConnector = {
1058
+ setLogger(logger: LoggerBrowser): void;
1059
+ destroy(): void;
1060
+ connect(): void;
1061
+ disconnect(code: number, reason: string): void;
1062
+ send(buffer: ArrayBuffer | string): boolean;
1063
+ connected: boolean;
1064
+ connectionPath: string;
1065
+ };
1066
+ type ConnectorParent = {
1067
+ session: TypePullClientSession;
1068
+ getConnectionPath(connectionType: ConnectionType): string;
1069
+ getPublicationPath(): string;
1070
+ setLastMessageId(lastMessageId: string): void;
1071
+ isProtobufSupported(): boolean;
1072
+ isJsonRpc(): boolean;
1073
+ };
1074
+ type ConnectorCallbacks = {
1075
+ onOpen: () => void;
1076
+ onDisconnect: (response: {
1077
+ code: number;
1078
+ reason: string;
1079
+ }) => void;
1080
+ onError: (error: Error) => void;
1081
+ onMessage: (response: string | ArrayBuffer) => void;
1082
+ };
1083
+ type ConnectorConfig = {
1084
+ parent: ConnectorParent;
1085
+ onOpen?: () => void;
1086
+ onDisconnect?: (response: {
1087
+ code: number;
1088
+ reason: string;
1089
+ }) => void;
1090
+ onError?: (error: Error) => void;
1091
+ onMessage?: (response: string | ArrayBuffer) => void;
1092
+ };
1093
+ type StorageManagerParams = {
1094
+ userId?: number;
1095
+ siteId?: string;
1096
+ };
1097
+ type TypeStorageManager = {
1098
+ setLogger(logger: LoggerBrowser): void;
1099
+ getLogger(): LoggerBrowser;
1100
+ set(name: string, value: any): void;
1101
+ get(name: string, defaultValue: any): any;
1102
+ remove(name: string): void;
1103
+ compareKey(eventKey: string, userKey: string): boolean;
1104
+ };
1105
+ declare enum LsKeys {
1106
+ PullConfig = "bx-pull-config",
1107
+ WebsocketBlocked = "bx-pull-websocket-blocked",
1108
+ LongPollingBlocked = "bx-pull-longpolling-blocked",
1109
+ LoggingEnabled = "bx-pull-logging-enabled"
1110
+ }
1111
+ type SharedConfigCallbacks = {
1112
+ onWebSocketBlockChanged: (response: {
1113
+ isWebSocketBlocked: boolean;
1114
+ }) => void;
1115
+ };
1116
+ type SharedConfigParams = {
1117
+ storage?: TypeStorageManager;
1118
+ onWebSocketBlockChanged?: (response: {
1119
+ isWebSocketBlocked: boolean;
1120
+ }) => void;
1121
+ };
1122
+ declare enum PullStatus {
1123
+ Online = "online",
1124
+ Offline = "offline",
1125
+ Connecting = "connect"
1126
+ }
1127
+ declare enum SenderType {
1128
+ Unknown = 0,
1129
+ Client = 1,
1130
+ Backend = 2
1131
+ }
1132
+ declare enum SubscriptionType {
1133
+ Server = "server",
1134
+ Client = "client",
1135
+ Online = "online",
1136
+ Status = "status",
1137
+ Revision = "revision"
1138
+ }
1139
+ type TypeSubscriptionOptions = {
1140
+ /**
1141
+ * Subscription type
1142
+ */
1143
+ type?: SubscriptionType;
1144
+ /**
1145
+ * Name of the module
1146
+ */
1147
+ moduleId?: string;
1148
+ /**
1149
+ * Name of the command
1150
+ */
1151
+ command?: null | string;
1152
+ /**
1153
+ * Function, that will be called for incoming messages
1154
+ */
1155
+ callback: Function;
1156
+ };
1157
+ interface UserStatusCallback {
1158
+ (params: {
1159
+ userId: number;
1160
+ isOnline: boolean;
1161
+ }): void;
1162
+ }
1163
+ interface CommandHandlerFunctionV1 {
1164
+ (data: Record<string, any>, info?: {
1165
+ type: SubscriptionType;
1166
+ moduleId?: string;
1167
+ }): void;
1168
+ }
1169
+ interface CommandHandlerFunctionV2 {
1170
+ (params: Record<string, any>, extra: Record<string, any>, command: string, info?: {
1171
+ type: SubscriptionType;
1172
+ moduleId: string;
1173
+ }): void;
1174
+ }
1175
+ interface TypeSubscriptionCommandHandler {
1176
+ getModuleId: () => string;
1177
+ getSubscriptionType?: () => SubscriptionType;
1178
+ getMap?: () => Record<string, CommandHandlerFunctionV2>;
1179
+ [key: string]: CommandHandlerFunctionV2 | undefined;
1180
+ }
1181
+ type TypePullClientEmitConfig = {
1182
+ type: SubscriptionType;
1183
+ moduleId?: string;
1184
+ data?: Record<string, any>;
1185
+ };
1186
+ declare enum CloseReasons {
1187
+ NORMAL_CLOSURE = 1000,
1188
+ SERVER_DIE = 1001,
1189
+ CONFIG_REPLACED = 3000,
1190
+ CHANNEL_EXPIRED = 3001,
1191
+ SERVER_RESTARTED = 3002,
1192
+ CONFIG_EXPIRED = 3003,
1193
+ MANUAL = 3004,
1194
+ STUCK = 3005,
1195
+ WRONG_CHANNEL_ID = 4010
1196
+ }
1197
+ declare enum SystemCommands {
1198
+ CHANNEL_EXPIRE = "CHANNEL_EXPIRE",
1199
+ CONFIG_EXPIRE = "CONFIG_EXPIRE",
1200
+ SERVER_RESTART = "SERVER_RESTART"
1201
+ }
1202
+ declare enum ServerMode {
1203
+ Shared = "shared",
1204
+ Personal = "personal"
1205
+ }
1206
+ type RpcError = {
1207
+ code: number;
1208
+ message: string;
1209
+ };
1210
+ declare const ListRpcError: {
1211
+ readonly Parse: RpcError;
1212
+ readonly InvalidRequest: RpcError;
1213
+ readonly MethodNotFound: RpcError;
1214
+ readonly InvalidParams: RpcError;
1215
+ readonly Internal: RpcError;
1216
+ };
1217
+ type JsonRpcRequest = {
1218
+ method: string;
1219
+ params: any;
1220
+ id: number;
1221
+ };
1222
+ type RpcCommand = {
1223
+ jsonrpc: string;
1224
+ method: string;
1225
+ params: any;
1226
+ id: number;
1227
+ };
1228
+ type RpcRequest = RpcCommand & {};
1229
+ type RpcCommandResult = {
1230
+ jsonrpc?: string;
1231
+ id?: number;
1232
+ /**
1233
+ * @fix this TypeRpcResponseAwaiters.resolve(response)
1234
+ */
1235
+ result?: any;
1236
+ error?: RpcError;
1237
+ };
1238
+ declare enum RpcMethod {
1239
+ Publish = "publish",
1240
+ GetUsersLastSeen = "getUsersLastSeen",
1241
+ Ping = "ping",
1242
+ ListChannels = "listChannels",
1243
+ SubscribeStatusChange = "subscribeStatusChange",
1244
+ UnsubscribeStatusChange = "unsubscribeStatusChange"
1245
+ }
1246
+ type TypeRpcResponseAwaiters = {
1247
+ /**
1248
+ * @fix this RpcCommandResult.result
1249
+ */
1250
+ resolve: (response: any) => void;
1251
+ reject: (error: string | RpcError) => void;
1252
+ timeout: number;
1253
+ };
1254
+ type TypeJsonRpcConfig = {
1255
+ connector: TypeConnector;
1256
+ handlers: Record<string, (params: any) => RpcCommandResult>;
1257
+ };
1258
+ type TypePublicIdDescriptor = {
1259
+ id?: string;
1260
+ user_id?: NumberString;
1261
+ public_id?: string;
1262
+ signature?: string;
1263
+ start: ISODate;
1264
+ end: ISODate;
1265
+ type?: string;
1266
+ };
1267
+ type TypeChanel = {
1268
+ userId: number;
1269
+ publicId: string;
1270
+ signature: string;
1271
+ start: Date;
1272
+ end: Date;
1273
+ };
1274
+ type TypeChannelManagerParams = {
1275
+ b24: TypeB24;
1276
+ getPublicListMethod: string;
1277
+ };
1278
+ type TypePullClientSession = {
1279
+ mid: null | string;
1280
+ tag: null | string;
1281
+ time: null | number;
1282
+ history: any;
1283
+ lastMessageIds: string[];
1284
+ messageCount: number;
1285
+ };
1286
+ type TypeSessionEvent = {
1287
+ mid: string;
1288
+ tag?: string;
1289
+ time?: number;
1290
+ text: Record<string, any> | TypePullClientMessageBody;
1291
+ };
1292
+ type TypePullClientParams = {
1293
+ b24: TypeB24;
1294
+ skipCheckRevision?: boolean;
1295
+ restApplication?: string;
1296
+ siteId?: string;
1297
+ guestMode?: boolean;
1298
+ guestUserId?: number;
1299
+ userId?: number;
1300
+ serverEnabled?: boolean;
1301
+ configGetMethod?: string;
1302
+ getPublicListMethod?: string;
1303
+ skipStorageInit?: boolean;
1304
+ configTimestamp?: number;
1305
+ };
1306
+ type TypePullClientConfig = {
1307
+ /**
1308
+ * @fix this
1309
+ */
1310
+ clientId: null;
1311
+ api: {
1312
+ revision_mobile: number;
1313
+ revision_web: number;
1314
+ };
1315
+ channels: {
1316
+ private?: TypePublicIdDescriptor;
1317
+ shared?: TypePublicIdDescriptor;
1318
+ };
1319
+ publicChannels: Record<string, TypePublicIdDescriptor>;
1320
+ server: {
1321
+ timeShift: number;
1322
+ config_timestamp: number;
1323
+ long_polling: string;
1324
+ long_pooling_secure: string;
1325
+ mode: string;
1326
+ publish: string;
1327
+ publish_enabled: boolean;
1328
+ publish_secure: string;
1329
+ server_enabled: boolean;
1330
+ version: number;
1331
+ websocket: string;
1332
+ websocket_enabled: boolean;
1333
+ websocket_secure: string;
1334
+ };
1335
+ jwt: null | string;
1336
+ exp: number;
1337
+ };
1338
+ type TypePullClientMessageBatch = {
1339
+ userList?: number[];
1340
+ channelList?: (string | {
1341
+ publicId: string;
1342
+ signature: string;
1343
+ })[];
1344
+ body: TypePullClientMessageBody;
1345
+ expiry?: number;
1346
+ };
1347
+
1348
+ type AnswerError = {
1349
+ error: string;
1350
+ errorDescription: string;
1351
+ };
1352
+ type AjaxErrorParams = {
1353
+ status: number;
1354
+ answerError: AnswerError;
1355
+ cause?: Error;
1356
+ };
1357
+ /**
1358
+ * Error requesting RestApi
1359
+ */
1360
+ declare class AjaxError extends Error {
1361
+ cause: null | Error;
1362
+ private _status;
1363
+ private _answerError;
1364
+ constructor(params: AjaxErrorParams);
1365
+ get answerError(): AnswerError;
1366
+ get status(): number;
1367
+ set status(status: number);
1368
+ toString(): string;
1369
+ }
1370
+
1371
+ declare abstract class AbstractB24 implements TypeB24 {
1372
+ static readonly batchSize = 50;
1373
+ protected _isInit: boolean;
1374
+ protected _http: null | TypeHttp;
1375
+ protected _logger: null | LoggerBrowser;
1376
+ protected constructor();
1377
+ /**
1378
+ * @inheritDoc
1379
+ */
1380
+ get isInit(): boolean;
1381
+ init(): Promise<void>;
1382
+ destroy(): void;
1383
+ setLogger(logger: LoggerBrowser): void;
1384
+ getLogger(): LoggerBrowser;
1385
+ abstract get auth(): AuthActions;
1386
+ /**
1387
+ * @inheritDoc
1388
+ */
1389
+ abstract getTargetOrigin(): string;
1390
+ /**
1391
+ * @inheritDoc
1392
+ */
1393
+ abstract getTargetOriginWithPath(): string;
1394
+ /**
1395
+ * @inheritDoc
1396
+ */
1397
+ callMethod(method: string, params?: object, start?: number): Promise<AjaxResult>;
1398
+ /**
1399
+ * @inheritDoc
1400
+ */
1401
+ callListMethod(method: string, params?: object, progress?: null | ((progress: number) => void), customKeyForResult?: null | string): Promise<Result>;
1402
+ /**
1403
+ * @inheritDoc
1404
+ */
1405
+ fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?: null | string): AsyncGenerator<any[]>;
1406
+ /**
1407
+ * @inheritDoc
1408
+ */
1409
+ callBatch(calls: Array<any> | object, isHaltOnError?: boolean): Promise<Result>;
1410
+ chunkArray<T>(array: T[], chunkSize?: number): T[][];
1411
+ /**
1412
+ * @inheritDoc
1413
+ */
1414
+ callBatchByChunk(calls: Array<any>, isHaltOnError?: boolean): Promise<Result>;
1415
+ /**
1416
+ * @inheritDoc
1417
+ */
1418
+ getHttpClient(): TypeHttp;
1419
+ /**
1420
+ * Returns settings for http connection
1421
+ * @protected
1422
+ */
1423
+ protected _getHttpOptions(): null | object;
1424
+ /**
1425
+ * Generates an object not initialized error
1426
+ * @protected
1427
+ */
1428
+ protected _ensureInitialized(): void;
1429
+ }
1430
+
1431
+ /**
1432
+ * List of supported languages in B24.Cloud
1433
+ *
1434
+ * It is worth remembering that there will be 1-2 languages for the B24.Box
1435
+ */
1436
+ declare enum B24LangList {
1437
+ en = "en",
1438
+ de = "de",
1439
+ la = "la",
1440
+ br = "br",
1441
+ fr = "fr",
1442
+ it = "it",
1443
+ pl = "pl",
1444
+ ru = "ru",
1445
+ ua = "ua",
1446
+ tr = "tr",
1447
+ sc = "sc",
1448
+ tc = "tc",
1449
+ ja = "ja",
1450
+ vn = "vn",
1451
+ id = "id",
1452
+ ms = "ms",
1453
+ th = "th",
1454
+ ar = "ar"
1455
+ }
1456
+
1457
+ declare class FormatterNumbers {
1458
+ private static isInternalConstructing;
1459
+ private static instance;
1460
+ private _defLocale;
1461
+ private constructor();
1462
+ /**
1463
+ * @return FormatterNumbers
1464
+ */
1465
+ static getInstance(): FormatterNumbers;
1466
+ setDefLocale(locale: string): void;
1467
+ format(value: number, locale?: string): string;
1468
+ }
1469
+
1470
+ declare class IbanSpecification {
1471
+ /**
1472
+ * the code of the country
1473
+ */
1474
+ readonly countryCode: string;
1475
+ /**
1476
+ * the length of the IBAN
1477
+ */
1478
+ readonly length: number;
1479
+ /**
1480
+ * the structure of the underlying BBAN (for validation and formatting)
1481
+ */
1482
+ readonly structure: string;
1483
+ /**
1484
+ * an example valid IBAN
1485
+ */
1486
+ readonly example: string;
1487
+ private _cachedRegex;
1488
+ constructor(countryCode: string, length: number, structure: string, example: string);
1489
+ /**
1490
+ * Check if the passed iban is valid according to this specification.
1491
+ *
1492
+ * @param {String} iban the iban to validate
1493
+ * @returns {boolean} true if valid, false otherwise
1494
+ */
1495
+ isValid(iban: string): boolean;
1496
+ /**
1497
+ * Convert the passed IBAN to a country-specific BBAN.
1498
+ *
1499
+ * @param iban the IBAN to convert
1500
+ * @param separator the separator to use between BBAN blocks
1501
+ * @returns {string} the BBAN
1502
+ */
1503
+ toBBAN(iban: string, separator: string): string;
1504
+ /**
1505
+ * Convert the passed BBAN to an IBAN for this country specification.
1506
+ * Please note that <i>"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account"</i>.
1507
+ * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits
1508
+ *
1509
+ * @param bban the BBAN to convert to IBAN
1510
+ * @returns {string} the IBAN
1511
+ */
1512
+ fromBBAN(bban: string): string;
1513
+ /**
1514
+ * Check of the passed BBAN is valid.
1515
+ * This function only checks the format of the BBAN (length and matching the letetr/number specs) but does not
1516
+ * verify the check digit.
1517
+ *
1518
+ * @param bban the BBAN to validate
1519
+ * @returns {boolean} true if the passed bban is a valid BBAN according to this specification, false otherwise
1520
+ */
1521
+ isValidBBAN(bban: string): boolean;
1522
+ /**
1523
+ * Lazy-loaded regex (parse the structure and construct the regular expression the first time we need it for validation)
1524
+ */
1525
+ private _regex;
1526
+ /**
1527
+ * Parse the BBAN structure used to configure each IBAN Specification and returns a matching regular expression.
1528
+ * A structure is composed of blocks of 3 characters (one letter and 2 digits). Each block represents
1529
+ * a logical group in the typical representation of the BBAN. For each group, the letter indicates which characters
1530
+ * are allowed in this group and the following 2-digits number tells the length of the group.
1531
+ *
1532
+ * @param {string} structure the structure to parse
1533
+ * @returns {RegExp}
1534
+ */
1535
+ private _parseStructure;
1536
+ /**
1537
+ * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to
1538
+ * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616.
1539
+ *
1540
+ * @param {string} iban the IBAN
1541
+ * @returns {string} the prepared IBAN
1542
+ */
1543
+ private _iso13616Prepare;
1544
+ /**
1545
+ * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064.
1546
+ *
1547
+ * @param iban
1548
+ * @returns {number}
1549
+ */
1550
+ private _iso7064Mod9710;
1551
+ }
1552
+ declare class FormatterIban {
1553
+ private static isInternalConstructing;
1554
+ private static instance;
1555
+ private _countries;
1556
+ private constructor();
1557
+ /**
1558
+ * @return FormatterIban
1559
+ */
1560
+ static getInstance(): FormatterIban;
1561
+ addSpecification(IBAN: IbanSpecification): void;
1562
+ /**
1563
+ * Check if an IBAN is valid.
1564
+ *
1565
+ * @param {String} iban the IBAN to validate.
1566
+ * @returns {boolean} true if the passed IBAN is valid, false otherwise
1567
+ */
1568
+ isValid(iban: string): boolean;
1569
+ printFormat(iban: string, separator?: string): string;
1570
+ electronicFormat(iban: string): string;
1571
+ /**
1572
+ * Convert an IBAN to a BBAN.
1573
+ *
1574
+ * @param iban
1575
+ * @param {String} [separator] the separator to use between the blocks of the BBAN, defaults to ' '
1576
+ * @returns {string|*}
1577
+ */
1578
+ toBBAN(iban: string, separator?: string): string;
1579
+ /**
1580
+ * Convert the passed BBAN to an IBAN for this country specification.
1581
+ * Please note that <i>"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account"</i>.
1582
+ * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits
1583
+ *
1584
+ * @param countryCode the country of the BBAN
1585
+ * @param bban the BBAN to convert to IBAN
1586
+ * @returns {string} the IBAN
1587
+ */
1588
+ fromBBAN(countryCode: string, bban: string): string;
1589
+ /**
1590
+ * Check the validity of the passed BBAN.
1591
+ *
1592
+ * @param countryCode the country of the BBAN
1593
+ * @param bban the BBAN to check the validity of
1594
+ */
1595
+ isValidBBAN(countryCode: string, bban: string): boolean;
1596
+ private _isString;
1597
+ }
1598
+
1599
+ declare const useFormatter: () => {
1600
+ formatterNumber: FormatterNumbers;
1601
+ formatterIban: FormatterIban;
1602
+ };
1603
+
1604
+ /**
1605
+ * B24.Hook Manager.
1606
+ *
1607
+ * @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=99&LESSON_ID=8581&LESSON_PATH=8771.8583.8581
1608
+ */
1609
+ declare class B24Hook extends AbstractB24 implements TypeB24 {
1610
+ #private;
1611
+ constructor(b24HookParams: B24HookParams);
1612
+ setLogger(logger: LoggerBrowser): void;
1613
+ get auth(): AuthActions;
1614
+ /**
1615
+ * Get the account address BX24 ( https://name.bitrix24.com )
1616
+ */
1617
+ getTargetOrigin(): string;
1618
+ /**
1619
+ * Get the account address BX24 with Path ( https://name.bitrix24.com/rest/1/xxxxx )
1620
+ */
1621
+ getTargetOriginWithPath(): string;
1622
+ }
1623
+
1624
+ /**
1625
+ * Authorization Manager
1626
+ */
1627
+ declare class AuthHookManager implements AuthActions {
1628
+ #private;
1629
+ constructor(b24HookParams: B24HookParams);
1630
+ /**
1631
+ * @see Http.#prepareParams
1632
+ */
1633
+ getAuthData(): false | AuthData;
1634
+ refreshAuth(): Promise<AuthData>;
1635
+ getUniq(prefix: string): string;
1636
+ /**
1637
+ * Get the account address BX24 ( https://name.bitrix24.com )
1638
+ */
1639
+ getTargetOrigin(): string;
1640
+ /**
1641
+ * Get the account address BX24 with Path ( https://name.bitrix24.com/rest/1/xxxxx )
1642
+ */
1643
+ getTargetOriginWithPath(): string;
1644
+ /**
1645
+ * We believe that hooks are created only by the admin
1646
+ */
1647
+ get isAdmin(): boolean;
1648
+ }
1649
+
1650
+ /**
1651
+ * List of commands for the B24 parent window
1652
+ */
1653
+ declare enum MessageCommands {
1654
+ getInitData = "getInitData",
1655
+ setInstallFinish = "setInstallFinish",
1656
+ setInstall = "setInstall",
1657
+ refreshAuth = "refreshAuth",
1658
+ setAppOption = "setAppOption",
1659
+ setUserOption = "setUserOption",
1660
+ resizeWindow = "resizeWindow",
1661
+ reloadWindow = "reloadWindow",
1662
+ setTitle = "setTitle",
1663
+ setScroll = "setScroll",
1664
+ openApplication = "openApplication",
1665
+ closeApplication = "closeApplication",
1666
+ openPath = "openPath",
1667
+ imCallTo = "imCallTo",
1668
+ imPhoneTo = "imPhoneTo",
1669
+ imOpenMessenger = "imOpenMessenger",
1670
+ imOpenHistory = "imOpenHistory",
1671
+ selectUser = "selectUser",
1672
+ selectAccess = "selectAccess",
1673
+ selectCRM = "selectCRM",
1674
+ showAppForm = "showAppForm"
1675
+ }
1676
+
1677
+ /**
1678
+ * Application Frame Data Manager
1679
+ */
1680
+ declare class AppFrame {
1681
+ #private;
1682
+ constructor(queryParams: B24FrameQueryParams);
1683
+ /**
1684
+ * Initializes the data received from the parent window message.
1685
+ * @param data
1686
+ */
1687
+ initData(data: MessageInitData): AppFrame;
1688
+ /**
1689
+ * Returns the sid of the application relative to the parent window like this `9c33468728e1d2c8c97562475edfd96`
1690
+ */
1691
+ getAppSid(): string;
1692
+ /**
1693
+ * Get the account address BX24 ( https://name.bitrix24.com )
1694
+ */
1695
+ getTargetOrigin(): string;
1696
+ /**
1697
+ * Get the account address BX24 with Path ( https://name.bitrix24.com/rest )
1698
+ */
1699
+ getTargetOriginWithPath(): string;
1700
+ /**
1701
+ * Returns the localization of the B24 interface
1702
+ * @return {B24LangList} - default B24LangList.en
1703
+ *
1704
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-get-lang.html
1705
+ */
1706
+ getLang(): B24LangList;
1707
+ }
1708
+
1709
+ /**
1710
+ * Parent Window Request Parameters
1711
+ * @prop isSafely auto completion mode Promise.resolve()
1712
+ * @prop safelyTime after what time (900 ms) should it be automatically resolved Promise
1713
+ */
1714
+ interface SendParams {
1715
+ [index: string]: any;
1716
+ isSafely?: boolean;
1717
+ safelyTime?: number;
1718
+ }
1719
+ /**
1720
+ * Parent Window Communication Manager at B24
1721
+ */
1722
+ declare class MessageManager {
1723
+ #private;
1724
+ protected _logger: null | LoggerBrowser;
1725
+ private runCallbackHandler;
1726
+ constructor(appFrame: AppFrame);
1727
+ setLogger(logger: LoggerBrowser): void;
1728
+ getLogger(): LoggerBrowser;
1729
+ /**
1730
+ * Subscribe to the onMessage event of the parent window
1731
+ */
1732
+ subscribe(): void;
1733
+ /**
1734
+ * Unsubscribe from the onMessage event of the parent window
1735
+ */
1736
+ unsubscribe(): void;
1737
+ /**
1738
+ * Send message to parent window
1739
+ * The answer (if) we will get in _runCallback
1740
+ *
1741
+ * @param command
1742
+ * @param params
1743
+ */
1744
+ send(command: string | MessageCommands, params?: null | SendParams): Promise<any>;
1745
+ /**
1746
+ * Fulfilling a promise based on messages from the parent window
1747
+ *
1748
+ * @param event
1749
+ * @private
1750
+ */
1751
+ _runCallback(event: MessageEvent): void;
1752
+ }
1753
+
1754
+ /**
1755
+ * Parent window manager
1756
+ *
1757
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/
1758
+ */
1759
+ declare class ParentManager {
1760
+ #private;
1761
+ constructor(messageManager: MessageManager);
1762
+ /**
1763
+ * The method closes the open modal window with the application
1764
+ *
1765
+ * @return {Promise<void>}
1766
+ *
1767
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-close-application.html
1768
+ */
1769
+ closeApplication(): Promise<void>;
1770
+ /**
1771
+ * Sets the size of the frame containing the application to the size of the frame's content.
1772
+ *
1773
+ * @return {Promise<void>}
1774
+ *
1775
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-fit-window.html
1776
+ *
1777
+ * @memo in certain situations it may not be executed (placement of the main window after installing the application), in this case isSafely mode will work
1778
+ */
1779
+ fitWindow(): Promise<any>;
1780
+ /**
1781
+ * Sets the size of the frame containing the application to the size of the frame's content.
1782
+ *
1783
+ * @param {number} width
1784
+ * @param {number} height
1785
+ *
1786
+ * @return {Promise<void>}
1787
+ *
1788
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-resize-window.html
1789
+ *
1790
+ * @memo in certain situations it may not be executed, in this case isSafely mode will be triggered
1791
+ */
1792
+ resizeWindow(width: number, height: number): Promise<void>;
1793
+ /**
1794
+ * Automatically resize `document.body` of frame with application according to frame content dimensions
1795
+ * If you pass appNode, the height will be calculated relative to it
1796
+ *
1797
+ * @param {HTMLElement|null} appNode
1798
+ * @param {number} minHeight
1799
+ * @param {number} minWidth
1800
+ *
1801
+ * @return {Promise<void>}
1802
+ */
1803
+ resizeWindowAuto(appNode?: null | HTMLElement, minHeight?: number, minWidth?: number): Promise<void>;
1804
+ /**
1805
+ * This function returns the inner dimensions of the application frame
1806
+ *
1807
+ * @return {Promise<{scrollWidth: number; scrollHeight: number}>}
1808
+ *
1809
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-get-scroll-size.html
1810
+ */
1811
+ getScrollSize(): {
1812
+ scrollWidth: number;
1813
+ scrollHeight: number;
1814
+ };
1815
+ /**
1816
+ * Scrolls the parent window
1817
+ *
1818
+ * @param {number} scroll should specify the vertical scrollbar position (0 - scroll to the very top)
1819
+ * @return {Promise<void>}
1820
+ *
1821
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-scroll-parent-window.html
1822
+ */
1823
+ scrollParentWindow(scroll: number): Promise<void>;
1824
+ /**
1825
+ * Reload the page with the application (the whole page, not just the frame).
1826
+ *
1827
+ * @return {Promise<void>}
1828
+ *
1829
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-reload-window.html
1830
+ */
1831
+ reloadWindow(): Promise<void>;
1832
+ /**
1833
+ * Set Page Title
1834
+ *
1835
+ * @param {string} title
1836
+ *
1837
+ * @return {Promise<void>}
1838
+ *
1839
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-set-title.html
1840
+ */
1841
+ setTitle(title: string): Promise<void>;
1842
+ /**
1843
+ * Initiates a call via internal communication
1844
+ *
1845
+ * @param {number} userId The identifier of the account user
1846
+ * @param {boolean} isVideo true - video call, false - audio call. Optional parameter.
1847
+ *
1848
+ * @return {Promise<void>}
1849
+ *
1850
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-im-call-to.html
1851
+ */
1852
+ imCallTo(userId: number, isVideo?: boolean): Promise<void>;
1853
+ /**
1854
+ * Makes a call to the phone number
1855
+ *
1856
+ * @param {string} phone Phone number. The number can be in the format: `+44 20 1234 5678` or `x (xxx) xxx-xx-xx`
1857
+ *
1858
+ * @return {Promise<void>}
1859
+ *
1860
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-im-phone-to.html
1861
+ */
1862
+ imPhoneTo(phone: string): Promise<void>;
1863
+ /**
1864
+ * Opens the messenger window
1865
+ * userId or chatXXX - chat, where XXX is the chat identifier, which can simply be a number.
1866
+ * sgXXX - group chat, where XXX is the social network group number (the chat must be enabled in this group).
1867
+ *
1868
+ * XXXX** - open line, where XXX is the code obtained via the Rest method imopenlines.network.join.
1869
+ *
1870
+ * If nothing is passed, the chat interface will open with the last opened dialog.
1871
+ *
1872
+ * @param {number|`chat${number}`|`sg${number}`|`imol|${number}`|undefined} dialogId
1873
+ *
1874
+ * @return {Promise<void>}
1875
+ *
1876
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-im-open-messenger.html
1877
+ * @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=93&LESSON_ID=20152&LESSON_PATH=7657.7883.8025.20150.20152
1878
+ *
1879
+ */
1880
+ imOpenMessenger(dialogId: number | `chat${number}` | `sg${number}` | `imol|${number}` | undefined): Promise<void>;
1881
+ /**
1882
+ * Opens the history window
1883
+ * Identifier of the dialog:
1884
+ *
1885
+ * userId or chatXXX - chat, where XXX is the chat identifier, which can simply be a number.
1886
+ * imol|XXXX - open line, where XXX is the session number of the open line.
1887
+ *
1888
+ * @param {number|`chat${number}`|`imol|${number}`} dialogId
1889
+ *
1890
+ * @return {Promise<void>}
1891
+ *
1892
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-im-open-history.html
1893
+ */
1894
+ imOpenHistory(dialogId: number | `chat${number}` | `imol|${number}`): Promise<void>;
1895
+ }
1896
+
1897
+ /**
1898
+ * Manager for working with application settings via communication with the parent window
1899
+ *
1900
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/options/index.html
1901
+ */
1902
+ declare class OptionsManager$1 {
1903
+ #private;
1904
+ constructor(messageManager: MessageManager);
1905
+ /**
1906
+ * Initializes the data received from the parent window message.
1907
+ * @param data
1908
+ */
1909
+ initData(data: MessageInitData): OptionsManager$1;
1910
+ /**
1911
+ * Getting application option
1912
+ *
1913
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/options/bx24-app-option-get.html
1914
+ */
1915
+ appGet(option: string): any;
1916
+ /**
1917
+ * Updates application data through the parent window
1918
+ *
1919
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/options/bx24-app-option-set.html
1920
+ */
1921
+ appSet(option: string, value: any): Promise<void>;
1922
+ /**
1923
+ * Getting user option
1924
+ *
1925
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/options/bx24-user-option-get.html
1926
+ */
1927
+ userGet(option: string): any;
1928
+ /**
1929
+ * Updates user data through the parent window
1930
+ *
1931
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/options/bx24-user-option-set.html
1932
+ */
1933
+ userSet(option: string, value: any): Promise<void>;
1934
+ }
1935
+
1936
+ type SelectedUser = {
1937
+ /**
1938
+ * user identifier
1939
+ */
1940
+ id: NumberString;
1941
+ /**
1942
+ * formatted username
1943
+ */
1944
+ name: string;
1945
+ photo: string;
1946
+ position: string;
1947
+ url: string;
1948
+ /**
1949
+ * The flag indicates that the selected user is a subordinate of the current user
1950
+ */
1951
+ sub: boolean;
1952
+ /**
1953
+ * The flag indicates that the selected user is the manager of the current user
1954
+ */
1955
+ sup: boolean;
1956
+ };
1957
+ type SelectedAccess = {
1958
+ /**
1959
+ * access permission identifier. Examples of identifiers:
1960
+ * - U1 — user with identifier 1
1961
+ * - IU1 — employees with identifier 1
1962
+ * - DR2 — all department and subdepartment employees with identifier 2
1963
+ * - D6 — all department employees with identifier 6
1964
+ * - G2 — group with identifier 2 (all visitors)
1965
+ * - SG4 — social network group with identifier 4
1966
+ * - AU — all authorized users
1967
+ * - CR — current user
1968
+ */
1969
+ id: `AU` | `CR` | `U${number}` | `IU${number}` | `DR${number}` | `D${number}` | `G${number}` | `SG${number}`;
1970
+ /**
1971
+ * name of the access permission
1972
+ */
1973
+ name: string;
1974
+ };
1975
+ type SelectCRMParamsEntityType = 'lead' | 'contact' | 'company' | 'deal' | 'quote';
1976
+ type SelectCRMParamsValue = {
1977
+ lead?: number[];
1978
+ contact?: number[];
1979
+ company?: number[];
1980
+ deal?: number[];
1981
+ quote?: number[];
1982
+ };
1983
+ type SelectCRMParams = {
1984
+ /**
1985
+ * Which types of objects to display in the dialog. Possible values:
1986
+ * - lead — Leads
1987
+ * - contact — Contacts
1988
+ * - company — Companies
1989
+ * - deal — Deals
1990
+ * - quote — Estimates
1991
+ */
1992
+ entityType: SelectCRMParamsEntityType[];
1993
+ /**
1994
+ * Whether multiple objects can be selected. Default is `false`
1995
+ */
1996
+ multiple: boolean;
1997
+ /**
1998
+ * Which objects to initially add to the selected in the dialog. Works only if `multiple = true`
1999
+ */
2000
+ value?: SelectCRMParamsValue;
2001
+ };
2002
+ type SelectedCRMEntity = {
2003
+ id: string;
2004
+ type: SelectCRMParamsEntityType;
2005
+ place: string;
2006
+ title: string;
2007
+ desc: string;
2008
+ url: string;
2009
+ };
2010
+ type SelectedCRM = {
2011
+ lead?: (SelectedCRMEntity & {
2012
+ id: `L_${number}`;
2013
+ })[];
2014
+ contact?: (SelectedCRMEntity & {
2015
+ id: `C_${number}`;
2016
+ image: string;
2017
+ })[];
2018
+ company?: (SelectedCRMEntity & {
2019
+ id: `CO_${number}`;
2020
+ image: string;
2021
+ })[];
2022
+ deal?: (SelectedCRMEntity & {
2023
+ id: `D_${number}`;
2024
+ })[];
2025
+ quote?: (SelectedCRMEntity & {
2026
+ id: `Q_${number}`;
2027
+ })[];
2028
+ };
2029
+ /**
2030
+ * Select dialog manager
2031
+ *
2032
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-dialogues/index.html
2033
+ */
2034
+ declare class DialogManager {
2035
+ #private;
2036
+ constructor(messageManager: MessageManager);
2037
+ /**
2038
+ * Method displays the standard single user selection dialog
2039
+ * It only shows company employees
2040
+ *
2041
+ * @return {Promise<null|SelectedUser>}
2042
+ *
2043
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-dialogues/bx24-select-user.html
2044
+ */
2045
+ selectUser(): Promise<null | SelectedUser>;
2046
+ /**
2047
+ * Method displays the standard multiple user selection dialog
2048
+ * It only shows company employees
2049
+ *
2050
+ * @return {Promise<SelectedUser[]>}
2051
+ *
2052
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-dialogues/bx24-select-users.html
2053
+ */
2054
+ selectUsers(): Promise<SelectedUser[]>;
2055
+ /**
2056
+ * @deprecated
2057
+ * Method displays a standard access permission selection dialog
2058
+ *
2059
+ * @param {string[]} blockedAccessPermissions
2060
+ * @return {Promise<SelectedAccess[]>}
2061
+ *
2062
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-dialogues/bx24-select-access.html
2063
+ */
2064
+ selectAccess(blockedAccessPermissions?: string[]): Promise<SelectedAccess[]>;
2065
+ /**
2066
+ * @deprecated
2067
+ * Method invokes the system dialog for selecting a CRM entity
2068
+ *
2069
+ * @param {SelectCRMParams} params
2070
+ * @return {Promise<SelectedCRM>}
2071
+ *
2072
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-dialogues/bx24-select-crm.html
2073
+ */
2074
+ selectCRM(params?: SelectCRMParams): Promise<SelectedCRM>;
2075
+ }
2076
+
2077
+ /**
2078
+ * Sliders Manager
2079
+ */
2080
+ declare class SliderManager {
2081
+ #private;
2082
+ constructor(appFrame: AppFrame, messageManager: MessageManager);
2083
+ /**
2084
+ * Returns the URL relative to the domain name and path
2085
+ */
2086
+ getUrl(path?: string): URL;
2087
+ /**
2088
+ * Get the account address BX24
2089
+ */
2090
+ getTargetOrigin(): string;
2091
+ /**
2092
+ * When the method is called, a pop-up window with the application frame will be opened.
2093
+ *
2094
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-open-application.html
2095
+ */
2096
+ openSliderAppPage(params?: any): Promise<any>;
2097
+ /**
2098
+ * The method closes the open modal window with the application
2099
+ *
2100
+ * @return {Promise<void>}
2101
+ *
2102
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-close-application.html
2103
+ */
2104
+ closeSliderAppPage(): Promise<void>;
2105
+ /**
2106
+ * Opens the specified path inside the portal in the slider.
2107
+ * @param {URL} url
2108
+ * @param {number} width - Number in the range from 1640 to 1200, from 1200 to 950, from 950 to 900, from 900 ...
2109
+ * @return {Promise<StatusClose>}
2110
+ *
2111
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-open-path.html
2112
+ * @memo /^\/(crm\/(deal|lead|contact|company|type)|marketplace|company\/personal\/user\/[0-9]+|workgroups\/group\/[0-9]+)\//
2113
+ */
2114
+ openPath(url: URL, width?: number): Promise<StatusClose>;
2115
+ /**
2116
+ * @deprecated
2117
+ * @param params
2118
+ */
2119
+ showAppForm(params: any): Promise<void>;
2120
+ }
2121
+
2122
+ /**
2123
+ * Placement Manager
2124
+ *
2125
+ * @see https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/index.html
2126
+ * @see https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=99&CHAPTER_ID=02535&LESSON_PATH=8771.5380.2535
2127
+ */
2128
+ declare class PlacementManager {
2129
+ #private;
2130
+ constructor();
2131
+ /**
2132
+ * Initializes the data received from the parent window message.
2133
+ * @param data
2134
+ */
2135
+ initData(data: MessageInitData): PlacementManager;
2136
+ get title(): string;
2137
+ get isDefault(): boolean;
2138
+ get options(): any;
2139
+ get isSliderMode(): boolean;
2140
+ }
2141
+
2142
+ /**
2143
+ * B24 Manager. Replacement api.bitrix24.com
2144
+ *
2145
+ * @link https://api.bitrix24.com/api/v1/
2146
+ * @see /bitrix/js/rest/applayout.js
2147
+ */
2148
+ declare class B24Frame extends AbstractB24 implements TypeB24 {
2149
+ #private;
2150
+ constructor(queryParams: B24FrameQueryParams);
2151
+ setLogger(logger: LoggerBrowser): void;
2152
+ get isFirstRun(): boolean;
2153
+ get isInstallMode(): boolean;
2154
+ get parent(): ParentManager;
2155
+ get auth(): AuthActions;
2156
+ get slider(): SliderManager;
2157
+ get placement(): PlacementManager;
2158
+ get options(): OptionsManager$1;
2159
+ get dialog(): DialogManager;
2160
+ init(): Promise<void>;
2161
+ /**
2162
+ * Destructor.
2163
+ * Removes an event subscription
2164
+ */
2165
+ destroy(): void;
2166
+ /**
2167
+ * Signals that the installer or application setup has finished running.
2168
+ *
2169
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-functions/bx24-install-finish.html
2170
+ */
2171
+ installFinish(): Promise<any>;
2172
+ /**
2173
+ * Get the account address BX24 ( https://name.bitrix24.com )
2174
+ */
2175
+ getTargetOrigin(): string;
2176
+ /**
2177
+ * Get the account address BX24 with Path ( https://name.bitrix24.com/rest )
2178
+ */
2179
+ getTargetOriginWithPath(): string;
2180
+ /**
2181
+ * Returns the sid of the application relative to the parent window like this `9c33468728e1d2c8c97562475edfd96`
2182
+ */
2183
+ getAppSid(): string;
2184
+ /**
2185
+ * Returns the localization of the B24 interface
2186
+ *
2187
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-get-lang.html
2188
+ */
2189
+ getLang(): B24LangList;
2190
+ }
2191
+
2192
+ /**
2193
+ * Authorization Manager
2194
+ */
2195
+ declare class AuthManager implements AuthActions {
2196
+ #private;
2197
+ constructor(appFrame: AppFrame, messageManager: MessageManager);
2198
+ /**
2199
+ * Initializes the data received from the parent window message.
2200
+ * @param data
2201
+ */
2202
+ initData(data: MessageInitData): AuthManager;
2203
+ /**
2204
+ * Returns authorization data
2205
+ *
2206
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-functions/bx24-get-auth.html
2207
+ */
2208
+ getAuthData(): false | AuthData;
2209
+ /**
2210
+ * Updates authorization data through the parent window
2211
+ *
2212
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-functions/bx24-refresh-auth.html
2213
+ */
2214
+ refreshAuth(): Promise<AuthData>;
2215
+ getUniq(prefix: string): string;
2216
+ /**
2217
+ * Determines whether the current user has administrator rights
2218
+ *
2219
+ * @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/additional-functions/bx24-is-admin.html
2220
+ */
2221
+ get isAdmin(): boolean;
2222
+ }
2223
+
2224
+ declare abstract class AbstractHelper {
2225
+ protected _b24: TypeB24;
2226
+ protected _logger: null | LoggerBrowser;
2227
+ protected _data: any;
2228
+ constructor(b24: TypeB24);
2229
+ setLogger(logger: LoggerBrowser): void;
2230
+ getLogger(): LoggerBrowser;
2231
+ /**
2232
+ * Initializes the data received
2233
+ * @param data
2234
+ */
2235
+ initData(data: any): Promise<void>;
2236
+ abstract get data(): any;
2237
+ }
2238
+
2239
+ declare class ProfileManager extends AbstractHelper {
2240
+ protected _data: null | TypeUser;
2241
+ /**
2242
+ * @inheritDoc
2243
+ */
2244
+ initData(data: TypeUser): Promise<void>;
2245
+ get data(): TypeUser;
2246
+ }
2247
+
2248
+ declare class AppManager extends AbstractHelper {
2249
+ protected _data: null | TypeApp;
2250
+ /**
2251
+ * @inheritDoc
2252
+ */
2253
+ initData(data: TypeApp): Promise<void>;
2254
+ get data(): TypeApp;
2255
+ get statusCode(): string;
2256
+ }
2257
+
2258
+ declare class PaymentManager extends AbstractHelper {
2259
+ protected _data: null | TypePayment;
2260
+ /**
2261
+ * @inheritDoc
2262
+ */
2263
+ initData(data: TypePayment): Promise<void>;
2264
+ get data(): TypePayment;
2265
+ }
2266
+
2267
+ declare class LicenseManager extends AbstractHelper {
2268
+ protected _data: null | TypeLicense;
2269
+ /**
2270
+ * @inheritDoc
2271
+ */
2272
+ initData(data: TypeLicense): Promise<void>;
2273
+ get data(): TypeLicense;
2274
+ /**
2275
+ * Set RestrictionManager params by license
2276
+ * @link https://apidocs.bitrix24.com/api-reference/common/system/app-info.html
2277
+ */
2278
+ makeRestrictionManagerParams(): void;
2279
+ }
2280
+
2281
+ type CurrencyFormatInit = {
2282
+ DECIMALS: NumberString;
2283
+ DEC_POINT: string;
2284
+ FORMAT_STRING: string;
2285
+ FULL_NAME: string;
2286
+ HIDE_ZERO: BoolString;
2287
+ THOUSANDS_SEP?: string;
2288
+ THOUSANDS_VARIANT: string;
2289
+ };
2290
+ type CurrencyInit = {
2291
+ AMOUNT: NumberString;
2292
+ AMOUNT_CNT: NumberString;
2293
+ BASE: BoolString;
2294
+ CURRENCY: string;
2295
+ DATE_UPDATE: ISODate;
2296
+ DECIMALS: NumberString;
2297
+ DEC_POINT: string;
2298
+ FORMAT_STRING: string;
2299
+ FULL_NAME: string;
2300
+ LID: string;
2301
+ SORT: NumberString;
2302
+ THOUSANDS_SEP?: string;
2303
+ LANG?: Record<string, CurrencyFormatInit>;
2304
+ };
2305
+ type CurrencyInitData = {
2306
+ currencyBase: string;
2307
+ currencyList: CurrencyInit[];
2308
+ };
2309
+ type CurrencyData = {
2310
+ currencyBase: string;
2311
+ currencyList: Map<string, Currency>;
2312
+ };
2313
+ declare class CurrencyManager extends AbstractHelper {
2314
+ /**
2315
+ * @inheritDoc
2316
+ */
2317
+ initData(data: CurrencyInitData): Promise<void>;
2318
+ loadData(): Promise<void>;
2319
+ get data(): CurrencyData;
2320
+ setBaseCurrency(currencyBase: string): void;
2321
+ get baseCurrency(): string;
2322
+ setCurrencyList(list?: CurrencyInit[]): void;
2323
+ getCurrencyFullName(currencyCode: string, langCode: string): string;
2324
+ getCurrencyLiteral(currencyCode: string, langCode?: string): string;
2325
+ get currencyList(): string[];
2326
+ format(value: number, currencyCode: string, langCode: string): string;
2327
+ }
2328
+
2329
+ declare class OptionsManager extends AbstractHelper {
2330
+ protected _data: Map<string, any>;
2331
+ protected _type: 'app' | 'user';
2332
+ static getSupportTypes(): TypeOption[];
2333
+ static prepareArrayList(list: any): any[];
2334
+ constructor(b24: TypeB24, type: 'app' | 'user');
2335
+ get data(): Map<string, any>;
2336
+ reset(): void;
2337
+ /**
2338
+ * @inheritDoc
2339
+ */
2340
+ initData(data: any): Promise<void>;
2341
+ getJsonArray(key: string, defValue?: any[]): any[];
2342
+ getJsonObject(key: string, defValue?: Object): Object;
2343
+ getFloat(key: string, defValue?: number): number;
2344
+ getInteger(key: string, defValue?: number): number;
2345
+ getBoolYN(key: string, defValue?: boolean): boolean;
2346
+ getBoolNY(key: string, defValue?: boolean): boolean;
2347
+ getString(key: string, defValue?: string): string;
2348
+ getDate(key: string, defValue?: null | DateTime): null | DateTime;
2349
+ encode(value: any): string;
2350
+ decode(data: string, defaultValue: any): any;
2351
+ protected getMethodSave(): string;
2352
+ save(options: any, optionsPull?: {
2353
+ moduleId: string;
2354
+ command: string;
2355
+ params: any;
2356
+ }): Promise<Result>;
2357
+ }
2358
+
2359
+ /**
2360
+ * A universal class that is used to manage the initial application data
2361
+ */
2362
+ declare class B24HelperManager {
2363
+ private readonly _b24;
2364
+ protected _logger: null | LoggerBrowser;
2365
+ private _isInit;
2366
+ private _profile;
2367
+ private _app;
2368
+ private _payment;
2369
+ private _license;
2370
+ private _currency;
2371
+ private _appOptions;
2372
+ private _userOptions;
2373
+ private _b24PullClient;
2374
+ private _pullClientUnSubscribe;
2375
+ private _pullClientModuleId;
2376
+ constructor(b24: TypeB24);
2377
+ setLogger(logger: LoggerBrowser): void;
2378
+ getLogger(): LoggerBrowser;
2379
+ destroy(): void;
2380
+ loadData(dataTypes?: LoadDataType[]): Promise<void>;
2381
+ private parseUserData;
2382
+ private parseAppData;
2383
+ private parsePaymentData;
2384
+ private parseLicenseData;
2385
+ private parseCurrencyData;
2386
+ private parseOptionsData;
2387
+ get isInit(): boolean;
2388
+ get forB24Form(): TypeB24Form;
2389
+ /**
2390
+ * Get the account address BX24 ( https://name.bitrix24.com )
2391
+ */
2392
+ get hostName(): string;
2393
+ get profileInfo(): ProfileManager;
2394
+ get appInfo(): AppManager;
2395
+ get paymentInfo(): PaymentManager;
2396
+ get licenseInfo(): LicenseManager;
2397
+ get currency(): CurrencyManager;
2398
+ get appOptions(): OptionsManager;
2399
+ get userOptions(): OptionsManager;
2400
+ get isSelfHosted(): boolean;
2401
+ /**
2402
+ * Returns the increment step of fields of type ID
2403
+ * @memo in cloud step = 2 in box step = 1
2404
+ *
2405
+ * @returns {number}
2406
+ */
2407
+ get primaryKeyIncrementValue(): number;
2408
+ /**
2409
+ * Defines specific URLs for a Bitrix24 box or cloud
2410
+ */
2411
+ get b24SpecificUrl(): Record<keyof typeof TypeSpecificUrl, string>;
2412
+ usePullClient(prefix?: string, userId?: number): B24HelperManager;
2413
+ private initializePullClient;
2414
+ subscribePullClient(callback: (message: TypePullMessage) => void, moduleId?: string): B24HelperManager;
2415
+ startPullClient(): void;
2416
+ getModuleIdPullClient(): string;
2417
+ private _destroyPullClient;
2418
+ private ensureInitialized;
2419
+ }
2420
+
2421
+ declare const useB24Helper: () => {
2422
+ initB24Helper: ($b24: TypeB24, dataTypes?: LoadDataType[]) => Promise<B24HelperManager>;
2423
+ isInitB24Helper: () => boolean;
2424
+ destroyB24Helper: () => void;
2425
+ getB24Helper: () => B24HelperManager;
2426
+ usePullClient: () => void;
2427
+ useSubscribePullClient: (callback: (message: TypePullMessage) => void, moduleId?: string) => void;
2428
+ startPullClient: () => void;
2429
+ };
2430
+
2431
+ /**
2432
+ * @todo fix logic for _loggingEnabled
2433
+ */
2434
+ declare class PullClient implements ConnectorParent {
2435
+ private _logger;
2436
+ private _restClient;
2437
+ private _status;
2438
+ private _context;
2439
+ private readonly _guestMode;
2440
+ private readonly _guestUserId;
2441
+ private _userId;
2442
+ private _configGetMethod;
2443
+ private _getPublicListMethod;
2444
+ private _siteId;
2445
+ private _enabled;
2446
+ private _unloading;
2447
+ private _starting;
2448
+ private _debug;
2449
+ private _connectionAttempt;
2450
+ private _connectionType;
2451
+ private _reconnectTimeout;
2452
+ private _restartTimeout;
2453
+ private _restoreWebSocketTimeout;
2454
+ private _skipStorageInit;
2455
+ private _skipCheckRevision;
2456
+ private _subscribers;
2457
+ private _watchTagsQueue;
2458
+ private _watchUpdateInterval;
2459
+ private _watchForceUpdateInterval;
2460
+ private _configTimestamp;
2461
+ private _session;
2462
+ private _connectors;
2463
+ private _isSecure;
2464
+ private _config;
2465
+ private _storage;
2466
+ private _sharedConfig;
2467
+ private _channelManager;
2468
+ private _jsonRpcAdapter;
2469
+ /**
2470
+ * @depricate
2471
+ * @private
2472
+ */
2473
+ private _checkInterval;
2474
+ private _offlineTimeout;
2475
+ private _watchUpdateTimeout;
2476
+ private _pingWaitTimeout;
2477
+ private _isManualDisconnect;
2478
+ private _loggingEnabled;
2479
+ private _onPingTimeoutHandler;
2480
+ private _userStatusCallbacks;
2481
+ private _connectPromise;
2482
+ private _startingPromise;
2483
+ /**
2484
+ * @done
2485
+ * @param params
2486
+ */
2487
+ constructor(params: TypePullClientParams);
2488
+ setLogger(logger: LoggerBrowser): void;
2489
+ getLogger(): LoggerBrowser;
2490
+ destroy(): void;
2491
+ /**
2492
+ * @done
2493
+ * @private
2494
+ */
2495
+ private init;
2496
+ /**
2497
+ * @done
2498
+ */
2499
+ get connector(): null | TypeConnector;
2500
+ /**
2501
+ * @done
2502
+ */
2503
+ get status(): PullStatus;
2504
+ /**
2505
+ * @done
2506
+ * @param status
2507
+ */
2508
+ set status(status: PullStatus);
2509
+ get session(): TypePullClientSession;
2510
+ /**
2511
+ * @done
2512
+ * Creates a subscription to incoming messages.
2513
+ *
2514
+ * @param {TypeSubscriptionOptions | TypeSubscriptionCommandHandler} params
2515
+ * @returns {Function} - Unsubscribe callback function
2516
+ */
2517
+ subscribe(params: TypeSubscriptionOptions | TypeSubscriptionCommandHandler): Function;
2518
+ /**
2519
+ * @done
2520
+ * @param {TypeSubscriptionCommandHandler} handler
2521
+ * @returns {Function} - Unsubscribe callback function
2522
+ */
2523
+ private attachCommandHandler;
2524
+ /**
2525
+ * @done
2526
+ * @param config
2527
+ */
2528
+ start(config?: null | TypePullClientConfig & {
2529
+ skipReconnectToLastSession?: boolean;
2530
+ }): Promise<boolean>;
2531
+ /**
2532
+ * @done
2533
+ * @param disconnectCode
2534
+ * @param disconnectReason
2535
+ */
2536
+ restart(disconnectCode?: number | CloseReasons, disconnectReason?: string): void;
2537
+ /**
2538
+ * @done
2539
+ */
2540
+ stop(disconnectCode?: number | CloseReasons, disconnectReason?: string): void;
2541
+ /**
2542
+ * @done
2543
+ */
2544
+ reconnect(disconnectCode: number | CloseReasons, disconnectReason: string, delay?: number): void;
2545
+ /**
2546
+ * @done
2547
+ * @param lastMessageId
2548
+ */
2549
+ setLastMessageId(lastMessageId: string): void;
2550
+ /**
2551
+ * @done
2552
+ *
2553
+ * Send single message to the specified users.
2554
+ *
2555
+ * @param users User ids of the message receivers.
2556
+ * @param moduleId Name of the module to receive message,
2557
+ * @param command Command name.
2558
+ * @param {object} params Command parameters.
2559
+ * @param [expiry] Message expiry time in seconds.
2560
+ * @return {Promise}
2561
+ */
2562
+ sendMessage(users: number[], moduleId: string, command: string, params: any, expiry?: number): Promise<any>;
2563
+ /**
2564
+ * @done
2565
+ * Send single message to the specified public channels.
2566
+ *
2567
+ * @param publicChannels Public ids of the channels to receive message.
2568
+ * @param moduleId Name of the module to receive message,
2569
+ * @param command Command name.
2570
+ * @param {object} params Command parameters.
2571
+ * @param [expiry] Message expiry time in seconds.
2572
+ * @return {Promise}
2573
+ */
2574
+ sendMessageToChannels(publicChannels: string[], moduleId: string, command: string, params: any, expiry?: number): Promise<any>;
2575
+ /**
2576
+ * @done
2577
+ * @param debugFlag
2578
+ */
2579
+ capturePullEvent(debugFlag?: boolean): void;
2580
+ /**
2581
+ * @done
2582
+ * @param loggingFlag
2583
+ */
2584
+ enableLogging(loggingFlag?: boolean): void;
2585
+ /**
2586
+ * Returns list channels that the connection is subscribed to.
2587
+ *
2588
+ * @returns {Promise}
2589
+ */
2590
+ listChannels(): Promise<any>;
2591
+ /**
2592
+ * @done
2593
+ * Returns "last seen" time in seconds for the users. Result format: Object{userId: int}
2594
+ * If the user is currently connected - will return 0.
2595
+ * If the user if offline - will return diff between current timestamp and last seen timestamp in seconds.
2596
+ * If the user was never online - the record for user will be missing from the result object.
2597
+ *
2598
+ * @param {integer[]} userList List of user ids.
2599
+ * @returns {Promise}
2600
+ */
2601
+ getUsersLastSeen(userList: number[]): Promise<Record<number, number>>;
2602
+ /**
2603
+ * @done
2604
+ * Pings server. In case of success promise will be resolved, otherwise - rejected.
2605
+ *
2606
+ * @param {number} timeout Request timeout in seconds
2607
+ * @returns {Promise}
2608
+ */
2609
+ ping(timeout?: number): Promise<void>;
2610
+ /**
2611
+ * @done
2612
+ * @param userId {number}
2613
+ * @param callback {UserStatusCallback}
2614
+ * @returns {Promise}
2615
+ */
2616
+ subscribeUserStatusChange(userId: number, callback: UserStatusCallback): Promise<void>;
2617
+ /**
2618
+ * @done
2619
+ * @param {number} userId
2620
+ * @param {UserStatusCallback} callback
2621
+ * @returns {Promise}
2622
+ */
2623
+ unsubscribeUserStatusChange(userId: number, callback: UserStatusCallback): Promise<void>;
2624
+ /**
2625
+ * @done
2626
+ */
2627
+ getRevision(): number | null;
2628
+ /**
2629
+ * @done
2630
+ */
2631
+ getServerVersion(): number;
2632
+ /**
2633
+ * @done
2634
+ */
2635
+ getServerMode(): string | null;
2636
+ /**
2637
+ * @done
2638
+ */
2639
+ getConfig(): null | TypePullClientConfig;
2640
+ /**
2641
+ * @done
2642
+ */
2643
+ getDebugInfo(): any;
2644
+ /**
2645
+ * @process
2646
+ * @param connectionType
2647
+ */
2648
+ getConnectionPath(connectionType: ConnectionType): string;
2649
+ /**
2650
+ * @process
2651
+ */
2652
+ getPublicationPath(): string;
2653
+ /**
2654
+ * @done
2655
+ */
2656
+ isConnected(): boolean;
2657
+ /**
2658
+ * @done
2659
+ */
2660
+ isWebSocketSupported(): boolean;
2661
+ /**
2662
+ * @done
2663
+ */
2664
+ isWebSocketAllowed(): boolean;
2665
+ /**
2666
+ * @done
2667
+ */
2668
+ isWebSocketEnabled(): boolean;
2669
+ /**
2670
+ * @done
2671
+ */
2672
+ isPublishingSupported(): boolean;
2673
+ /**
2674
+ * @done
2675
+ */
2676
+ isPublishingEnabled(): boolean;
2677
+ /**
2678
+ * @done
2679
+ */
2680
+ isProtobufSupported(): boolean;
2681
+ /**
2682
+ * @done
2683
+ */
2684
+ isJsonRpc(): boolean;
2685
+ /**
2686
+ * @done
2687
+ */
2688
+ isSharedMode(): boolean;
2689
+ /**
2690
+ * @dones
2691
+ * @param {TypePullClientEmitConfig} params
2692
+ * @returns {boolean}
2693
+ */
2694
+ private emit;
2695
+ /**
2696
+ * @process
2697
+ *
2698
+ * @param message
2699
+ * @private
2700
+ */
2701
+ private broadcastMessage;
2702
+ /**
2703
+ * @process
2704
+ *
2705
+ * @param messages
2706
+ * @private
2707
+ */
2708
+ private broadcastMessages;
2709
+ /**
2710
+ * @done
2711
+ * Sends batch of messages to the multiple public channels.
2712
+ *
2713
+ * @param messageBatchList Array of messages to send.
2714
+ * @return void
2715
+ */
2716
+ private sendMessageBatch;
2717
+ /**
2718
+ * @done
2719
+ * @param messageBatchList
2720
+ * @param publicIds
2721
+ */
2722
+ private encodeMessageBatch;
2723
+ /**
2724
+ * @done
2725
+ * @memo fix return type
2726
+ * @param users
2727
+ * @param publicIds
2728
+ */
2729
+ private createMessageReceivers;
2730
+ /**
2731
+ * @done
2732
+ * @param userId
2733
+ * @param isOnline
2734
+ * @private
2735
+ */
2736
+ private emitUserStatusChange;
2737
+ /**
2738
+ * @done
2739
+ * @private
2740
+ */
2741
+ private restoreUserStatusSubscription;
2742
+ /**
2743
+ * @done
2744
+ *
2745
+ * @param logTag
2746
+ * @private
2747
+ */
2748
+ private loadConfig;
2749
+ /**
2750
+ * @done
2751
+ * @param config
2752
+ */
2753
+ private isConfigActual;
2754
+ /**
2755
+ * @done
2756
+ * @private
2757
+ */
2758
+ private startCheckConfig;
2759
+ /**
2760
+ * @done
2761
+ */
2762
+ private stopCheckConfig;
2763
+ /**
2764
+ * @done
2765
+ * @private
2766
+ */
2767
+ private checkConfig;
2768
+ /**
2769
+ * @done
2770
+ *
2771
+ * @param config
2772
+ * @param allowCaching
2773
+ * @private
2774
+ */
2775
+ private setConfig;
2776
+ /**
2777
+ * @done
2778
+ */
2779
+ private setPublicIds;
2780
+ /**
2781
+ * @done
2782
+ * @param serverRevision
2783
+ * @private
2784
+ */
2785
+ private checkRevision;
2786
+ /**
2787
+ * @done
2788
+ */
2789
+ private disconnect;
2790
+ /**
2791
+ * @done
2792
+ */
2793
+ private restoreWebSocketConnection;
2794
+ /**
2795
+ * @done
2796
+ * @param connectionDelay
2797
+ * @private
2798
+ */
2799
+ private scheduleReconnect;
2800
+ /**
2801
+ * @done
2802
+ * @private
2803
+ */
2804
+ private scheduleRestoreWebSocketConnection;
2805
+ /**
2806
+ * @done
2807
+ * @returns {Promise}
2808
+ */
2809
+ private connect;
2810
+ /**
2811
+ * @done
2812
+ * @param disconnectCode
2813
+ * @param disconnectReason
2814
+ * @param restartDelay
2815
+ * @private
2816
+ */
2817
+ private scheduleRestart;
2818
+ /**
2819
+ * @done
2820
+ *
2821
+ * @param messageFields
2822
+ * @private
2823
+ */
2824
+ private handleRpcIncomingMessage;
2825
+ /**
2826
+ * @done
2827
+ * @param events
2828
+ * @private
2829
+ */
2830
+ private handleIncomingEvents;
2831
+ /**
2832
+ * @done
2833
+ * @param event
2834
+ * @private
2835
+ */
2836
+ private updateSessionFromEvent;
2837
+ /**
2838
+ * @process
2839
+ *
2840
+ * @param command
2841
+ * @param message
2842
+ * @private
2843
+ */
2844
+ private handleInternalPullEvent;
2845
+ /**
2846
+ * @done
2847
+ * @param response
2848
+ * @private
2849
+ */
2850
+ private onIncomingMessage;
2851
+ /**
2852
+ * @done
2853
+ */
2854
+ private onLongPollingOpen;
2855
+ /**
2856
+ * @done
2857
+ * @param response
2858
+ * @private
2859
+ */
2860
+ private onLongPollingDisconnect;
2861
+ /**
2862
+ * @done
2863
+ * @param error
2864
+ */
2865
+ private onLongPollingError;
2866
+ /**
2867
+ * @done
2868
+ * @param response
2869
+ * @private
2870
+ */
2871
+ private onWebSocketBlockChanged;
2872
+ /**
2873
+ * @done
2874
+ */
2875
+ private onWebSocketOpen;
2876
+ /**
2877
+ * @done
2878
+ * @param response
2879
+ * @private
2880
+ */
2881
+ private onWebSocketDisconnect;
2882
+ /**
2883
+ * @done
2884
+ * @param error
2885
+ */
2886
+ private onWebSocketError;
2887
+ /**
2888
+ * @done
2889
+ * @param pullEvent
2890
+ * @private
2891
+ */
2892
+ private extractMessages;
2893
+ /**
2894
+ * @done
2895
+ * @param pullEvent
2896
+ * @private
2897
+ */
2898
+ private extractProtobufMessages;
2899
+ /**
2900
+ * @done
2901
+ * @param pullEvent
2902
+ * @private
2903
+ */
2904
+ private extractPlainTextMessages;
2905
+ /**
2906
+ * @done
2907
+ * Converts message id from byte[] to string
2908
+ * @param {Uint8Array} encodedId
2909
+ * @return {string}
2910
+ */
2911
+ private decodeId;
2912
+ /**
2913
+ * @done
2914
+ * Converts message id from hex-encoded string to byte[]
2915
+ * @param {string} id Hex-encoded string.
2916
+ * @return {Uint8Array}
2917
+ */
2918
+ private encodeId;
2919
+ /**
2920
+ * @done
2921
+ */
2922
+ private onOffline;
2923
+ /**
2924
+ * @done
2925
+ */
2926
+ private onOnline;
2927
+ /**
2928
+ * @done
2929
+ * @private
2930
+ */
2931
+ private onBeforeUnload;
2932
+ /**
2933
+ * @done
2934
+ * @param status
2935
+ * @param delay
2936
+ * @private
2937
+ */
2938
+ private sendPullStatusDelayed;
2939
+ /**
2940
+ * @done
2941
+ * @param status
2942
+ * @private
2943
+ */
2944
+ private sendPullStatus;
2945
+ /**
2946
+ * @done
2947
+ * @memo if private ?
2948
+ * @param tagId
2949
+ * @param force
2950
+ */
2951
+ private extendWatch;
2952
+ /**
2953
+ * @done
2954
+ * @param force
2955
+ * @private
2956
+ */
2957
+ private updateWatch;
2958
+ /**
2959
+ * @done
2960
+ * @param tagId
2961
+ * @private
2962
+ */
2963
+ private clearWatch;
2964
+ /**
2965
+ * @done
2966
+ * @private
2967
+ */
2968
+ private onJsonRpcPing;
2969
+ /**
2970
+ * @done
2971
+ * @private
2972
+ */
2973
+ private updatePingWaitTimeout;
2974
+ /**
2975
+ * @done
2976
+ * @private
2977
+ */
2978
+ private clearPingWaitTimeout;
2979
+ /**
2980
+ * @done
2981
+ * @private
2982
+ */
2983
+ private onPingTimeout;
2984
+ /**
2985
+ * @done
2986
+ * Returns reconnect delay in seconds
2987
+ *
2988
+ * @param attemptNumber
2989
+ * @return {number}
2990
+ */
2991
+ private getConnectionAttemptDelay;
2992
+ /**
2993
+ * @done
2994
+ * @param mid
2995
+ */
2996
+ private checkDuplicate;
2997
+ /**
2998
+ * @done
2999
+ */
3000
+ private trimDuplicates;
3001
+ /**
3002
+ * @done
3003
+ * @param message
3004
+ * @private
3005
+ */
3006
+ private logMessage;
3007
+ /**
3008
+ * @done
3009
+ * @param message
3010
+ * @param force
3011
+ * @private
3012
+ */
3013
+ private logToConsole;
3014
+ /**
3015
+ * @done
3016
+ * @param message
3017
+ * @private
3018
+ */
3019
+ private addMessageToStat;
3020
+ /**
3021
+ * @done
3022
+ *
3023
+ * @param text
3024
+ */
3025
+ private showNotification;
3026
+ /**
3027
+ * @done
3028
+ * @memo may be need use onCustomEvent
3029
+ * @memo wtf ? force
3030
+ */
3031
+ private onCustomEvent;
3032
+ }
3033
+
3034
+ declare function initializeB24Frame(): Promise<B24Frame>;
3035
+
3036
+ 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 };