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