@bitrix24/b24jssdk 1.0.6 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-AI.md +28 -3
- package/dist/esm/_virtual/_commonjsHelpers.mjs +1 -1
- package/dist/esm/_virtual/protobuf.mjs +1 -1
- package/dist/esm/_virtual/protobuf2.mjs +1 -1
- package/dist/esm/core/abstract-b24.mjs +1 -1
- package/dist/esm/core/actions/abstract-action.mjs +1 -1
- package/dist/esm/core/actions/abstract-batch.mjs +1 -1
- package/dist/esm/core/actions/manager.mjs +1 -1
- package/dist/esm/core/actions/v2/batch-by-chunk.mjs +1 -1
- package/dist/esm/core/actions/v2/batch.mjs +1 -1
- package/dist/esm/core/actions/v2/call-list.mjs +1 -1
- package/dist/esm/core/actions/v2/call.mjs +1 -1
- package/dist/esm/core/actions/v2/fetch-list.mjs +1 -1
- package/dist/esm/core/actions/v2/manager-v2.mjs +1 -1
- package/dist/esm/core/actions/v3/batch-by-chunk.mjs +1 -1
- package/dist/esm/core/actions/v3/batch.mjs +1 -1
- package/dist/esm/core/actions/v3/call-list.mjs +1 -1
- package/dist/esm/core/actions/v3/call.mjs +1 -1
- package/dist/esm/core/actions/v3/fetch-list.mjs +1 -1
- package/dist/esm/core/actions/v3/manager-v3.mjs +1 -1
- package/dist/esm/core/http/abstract-http.mjs +2 -2
- package/dist/esm/core/http/ajax-error.mjs +1 -1
- package/dist/esm/core/http/ajax-result.mjs +44 -4
- package/dist/esm/core/http/ajax-result.mjs.map +1 -1
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs +1 -1
- package/dist/esm/core/http/limiters/manager.mjs +70 -38
- package/dist/esm/core/http/limiters/manager.mjs.map +1 -1
- package/dist/esm/core/http/limiters/operating-limiter.mjs +1 -1
- package/dist/esm/core/http/limiters/params-factory.mjs +3 -2
- package/dist/esm/core/http/limiters/params-factory.mjs.map +1 -1
- package/dist/esm/core/http/limiters/rate-limiter.mjs +1 -1
- package/dist/esm/core/http/v2.mjs +2 -2
- package/dist/esm/core/http/v3.mjs +2 -2
- package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +1 -1
- package/dist/esm/core/interaction/batch/parse-row.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +2 -2
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs.map +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +16 -9
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs.map +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +1 -1
- package/dist/esm/core/interaction/batch/v2.mjs +1 -1
- package/dist/esm/core/interaction/batch/v3.mjs +1 -1
- package/dist/esm/core/language/list.mjs +1 -1
- package/dist/esm/core/request-id-generator.mjs +1 -1
- package/dist/esm/core/result.mjs +1 -1
- package/dist/esm/core/sdk-error.mjs +1 -1
- package/dist/esm/core/tools/abstract-tool.mjs +1 -1
- package/dist/esm/core/tools/healthcheck.mjs +1 -1
- package/dist/esm/core/tools/manager.mjs +1 -1
- package/dist/esm/core/tools/ping.mjs +1 -1
- package/dist/esm/core/version-manager.mjs +1 -1
- package/dist/esm/frame/auth.mjs +1 -1
- package/dist/esm/frame/b24.mjs +1 -1
- package/dist/esm/frame/dialog.mjs +45 -5
- package/dist/esm/frame/dialog.mjs.map +1 -1
- package/dist/esm/frame/frame.mjs +1 -1
- package/dist/esm/frame/message/commands.mjs +1 -1
- package/dist/esm/frame/message/controller.mjs +1 -1
- package/dist/esm/frame/options.mjs +1 -1
- package/dist/esm/frame/parent.mjs +1 -1
- package/dist/esm/frame/placement.mjs +32 -9
- package/dist/esm/frame/placement.mjs.map +1 -1
- package/dist/esm/frame/slider.mjs +1 -1
- package/dist/esm/helper/abstract-helper.mjs +1 -1
- package/dist/esm/helper/app-manager.mjs +1 -1
- package/dist/esm/helper/currency-manager.mjs +1 -1
- package/dist/esm/helper/helper-manager.mjs +1 -1
- package/dist/esm/helper/license-manager.mjs +1 -1
- package/dist/esm/helper/options-manager.mjs +1 -1
- package/dist/esm/helper/payment-manager.mjs +1 -1
- package/dist/esm/helper/profile-manager.mjs +1 -1
- package/dist/esm/helper/use-b24-helper.mjs +1 -1
- package/dist/esm/hook/auth.mjs +1 -1
- package/dist/esm/hook/b24.mjs +1 -1
- package/dist/esm/index.d.mts +174 -11
- package/dist/esm/index.d.ts +174 -11
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/loader-b24frame.mjs +1 -1
- package/dist/esm/logger/abstract-logger.mjs +1 -1
- package/dist/esm/logger/browser.mjs +1 -1
- package/dist/esm/logger/formatter/abstract-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/json-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/line-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/telegram-formatter.mjs +1 -1
- package/dist/esm/logger/handler/abstract-handler.mjs +1 -1
- package/dist/esm/logger/handler/consola-adapter.mjs +1 -1
- package/dist/esm/logger/handler/console-handler.mjs +1 -1
- package/dist/esm/logger/handler/console-v2-handler.mjs +1 -1
- package/dist/esm/logger/handler/memory-handler.mjs +1 -1
- package/dist/esm/logger/handler/stream-handler.mjs +1 -1
- package/dist/esm/logger/handler/telegram-handler.mjs +1 -1
- package/dist/esm/logger/handler/winston-adapter.mjs +1 -1
- package/dist/esm/logger/logger-factory.mjs +1 -1
- package/dist/esm/logger/logger.mjs +1 -1
- package/dist/esm/logger/null-logger.mjs +1 -1
- package/dist/esm/logger/processor/memory-usage-processor.mjs +1 -1
- package/dist/esm/logger/processor/pid-processor.mjs +1 -1
- package/dist/esm/oauth/auth.mjs +1 -1
- package/dist/esm/oauth/b24.mjs +1 -1
- package/dist/esm/oauth/refresh-token-error.mjs +1 -1
- package/dist/esm/pullClient/abstract-connector.mjs +1 -1
- package/dist/esm/pullClient/channel-manager.mjs +1 -1
- package/dist/esm/pullClient/channel-manager.mjs.map +1 -1
- package/dist/esm/pullClient/client.mjs +1 -1
- package/dist/esm/pullClient/errors.mjs +1 -1
- package/dist/esm/pullClient/json-rpc.mjs +1 -1
- package/dist/esm/pullClient/long-polling-connector.mjs +1 -1
- package/dist/esm/pullClient/protobuf/index.mjs +1 -1
- package/dist/esm/pullClient/protobuf/model.mjs +1 -1
- package/dist/esm/pullClient/protobuf/protobuf.mjs +1 -1
- package/dist/esm/pullClient/shared-config.mjs +1 -1
- package/dist/esm/pullClient/storage-manager.mjs +1 -1
- package/dist/esm/pullClient/web-socket-connector.mjs +1 -1
- package/dist/esm/tools/browser.mjs +1 -1
- package/dist/esm/tools/environment.mjs +1 -1
- package/dist/esm/tools/formatters/iban.mjs +1 -1
- package/dist/esm/tools/formatters/numbers.mjs +1 -1
- package/dist/esm/tools/index.mjs +1 -1
- package/dist/esm/tools/scroll-size.mjs +1 -1
- package/dist/esm/tools/text.mjs +1 -1
- package/dist/esm/tools/type.mjs +1 -1
- package/dist/esm/tools/use-formatters.mjs +1 -1
- package/dist/esm/tools/uuidv7.mjs +1 -1
- package/dist/esm/types/b24-helper.mjs +1 -1
- package/dist/esm/types/b24.mjs +1 -1
- package/dist/esm/types/bizproc/index.mjs +1 -1
- package/dist/esm/types/catalog/index.mjs +1 -1
- package/dist/esm/types/common.mjs +1 -1
- package/dist/esm/types/crm/entity-type.mjs +1 -1
- package/dist/esm/types/crm/productrow.mjs +1 -1
- package/dist/esm/types/logger.mjs +1 -1
- package/dist/esm/types/pull.mjs +1 -1
- package/dist/umd/index.js +209 -66
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +19 -19
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package @bitrix24/b24jssdk
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.1.1
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -58,19 +58,59 @@ class DialogManager {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Invokes the system dialog for selecting CRM entities
|
|
62
|
+
* (leads, contacts, companies, deals, quotes).
|
|
62
63
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
64
|
+
* The resolved `SelectedCRM` object contains a separate bucket per
|
|
65
|
+
* entity type. Each present bucket is a real `Array`, so consumers can
|
|
66
|
+
* use `.length`, `.map()`, `for..of`, etc. directly. Buckets for entity
|
|
67
|
+
* types that were not selected (or not requested via `entityType`) are
|
|
68
|
+
* left `undefined` rather than being set to an empty array.
|
|
69
|
+
*
|
|
70
|
+
* Note: the parent window historically returned each bucket as a
|
|
71
|
+
* `Record<string, SelectedCRMEntity>` (e.g. `{ 0: {...}, 1: {...} }`).
|
|
72
|
+
* The SDK normalizes that response to a real array before returning it.
|
|
73
|
+
*
|
|
74
|
+
* @param {SelectCRMParams} [params] - Filter and behavior options.
|
|
75
|
+
* - `entityType`: which entity types are shown in the dialog.
|
|
76
|
+
* - `multiple`: allow multiple selection (default `false`).
|
|
77
|
+
* - `value`: pre-selected entities (only applied when `multiple` is `true`).
|
|
78
|
+
* @return {Promise<SelectedCRM>} Resolves to an object whose properties
|
|
79
|
+
* (`lead`, `contact`, `company`, `deal`, `quote`) are arrays of
|
|
80
|
+
* {@link SelectedCRMEntity} objects.
|
|
65
81
|
*
|
|
66
82
|
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-crm.html
|
|
67
83
|
*/
|
|
68
84
|
async selectCRM(params) {
|
|
69
|
-
|
|
85
|
+
const response = await this.#messageManager.send(MessageCommands.selectCRM, {
|
|
70
86
|
entityType: params?.entityType,
|
|
71
87
|
multiple: params?.multiple,
|
|
72
88
|
value: params?.value
|
|
73
89
|
});
|
|
90
|
+
const result = {};
|
|
91
|
+
if (!response) {
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
const toArray = /* @__PURE__ */ __name((bucket) => {
|
|
95
|
+
if (bucket === void 0 || bucket === null) {
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
if (Array.isArray(bucket)) {
|
|
99
|
+
return bucket;
|
|
100
|
+
}
|
|
101
|
+
return Object.values(bucket);
|
|
102
|
+
}, "toArray");
|
|
103
|
+
const lead = toArray(response.lead);
|
|
104
|
+
if (lead) result.lead = lead;
|
|
105
|
+
const contact = toArray(response.contact);
|
|
106
|
+
if (contact) result.contact = contact;
|
|
107
|
+
const company = toArray(response.company);
|
|
108
|
+
if (company) result.company = company;
|
|
109
|
+
const deal = toArray(response.deal);
|
|
110
|
+
if (deal) result.deal = deal;
|
|
111
|
+
const quote = toArray(response.quote);
|
|
112
|
+
if (quote) result.quote = quote;
|
|
113
|
+
return result;
|
|
74
114
|
}
|
|
75
115
|
}
|
|
76
116
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.mjs","sources":["../../../src/frame/dialog.ts"],"sourcesContent":["import type { MessageManager } from './message'\nimport { MessageCommands } from './message'\nimport type { NumberString } from '../types/common'\n\nexport type SelectedUser = {\n /**\n * user identifier\n */\n id: NumberString\n\n /**\n * formatted username\n */\n name: string\n\n photo: string\n\n position: string\n\n url: string\n\n /**\n * The flag indicates that the selected user is a subordinate of the current user\n */\n sub: boolean\n\n /**\n * The flag indicates that the selected user is the manager of the current user\n */\n sup: boolean\n}\n\nexport type SelectedAccess = {\n /**\n * access permission identifier. Examples of identifiers:\n * - U1 — user with identifier 1\n * - IU1 — employees with identifier 1\n * - DR2 — all department and subdepartment employees with identifier 2\n * - D6 — all department employees with identifier 6\n * - G2 — group with identifier 2 (all visitors)\n * - SG4 — social network group with identifier 4\n * - AU — all authorized users\n * - CR — current user\n */\n id:\n | `AU`\n | `CR`\n | `U${number}`\n | `IU${number}`\n | `DR${number}`\n | `D${number}`\n | `G${number}`\n | `SG${number}`\n\n /**\n * name of the access permission\n */\n name: string\n}\n\nexport type SelectCRMParamsEntityType\n = | 'lead'\n | 'contact'\n | 'company'\n | 'deal'\n | 'quote'\n\nexport type SelectCRMParamsValue = {\n lead?: number[]\n contact?: number[]\n company?: number[]\n deal?: number[]\n quote?: number[]\n}\n\nexport type SelectCRMParams = {\n /**\n * Which types of objects to display in the dialog. Possible values:\n * - lead — Leads\n * - contact — Contacts\n * - company — Companies\n * - deal — Deals\n * - quote — Estimates\n */\n entityType: SelectCRMParamsEntityType[]\n\n /**\n * Whether multiple objects can be selected. Default is `false`\n */\n multiple: boolean\n\n /**\n * Which objects to initially add to the selected in the dialog. Works only if `multiple = true`\n */\n value?: SelectCRMParamsValue\n}\n\nexport type SelectedCRMEntity = {\n id: string\n type: SelectCRMParamsEntityType\n place: string\n title: string\n desc: string\n url: string\n}\n\nexport type SelectedCRM = {\n lead?: (SelectedCRMEntity & { id: `L_${number}` })[]\n contact?: (SelectedCRMEntity & { id: `C_${number}`, image: string })[]\n company?: (SelectedCRMEntity & { id: `CO_${number}`, image: string })[]\n deal?: (SelectedCRMEntity & { id: `D_${number}` })[]\n quote?: (SelectedCRMEntity & { id: `Q_${number}` })[]\n}\n\n/**\n * Select dialog manager\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/index.html\n */\nexport class DialogManager {\n #messageManager: MessageManager\n\n constructor(messageManager: MessageManager) {\n this.#messageManager = messageManager\n }\n\n /**\n * Method displays the standard single user selection dialog\n * It only shows company employees\n *\n * @return {Promise<null|SelectedUser>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-user.html\n */\n async selectUser(): Promise<null | SelectedUser> {\n return this.#messageManager.send(MessageCommands.selectUser, {\n mult: false\n })\n }\n\n /**\n * Method displays the standard multiple user selection dialog\n * It only shows company employees\n *\n * @return {Promise<SelectedUser[]>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-users.html\n */\n async selectUsers(): Promise<SelectedUser[]> {\n return this.#messageManager.send(MessageCommands.selectUser, {\n mult: true\n })\n }\n\n /**\n * Method displays a standard access permission selection dialog\n *\n * @param {string[]} blockedAccessPermissions\n * @return {Promise<SelectedAccess[]>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-access.html\n */\n async selectAccess(\n blockedAccessPermissions: string[] = []\n ): Promise<SelectedAccess[]> {\n return this.#messageManager.send(MessageCommands.selectAccess, {\n value: blockedAccessPermissions\n })\n }\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"dialog.mjs","sources":["../../../src/frame/dialog.ts"],"sourcesContent":["import type { MessageManager } from './message'\nimport { MessageCommands } from './message'\nimport type { NumberString } from '../types/common'\n\nexport type SelectedUser = {\n /**\n * user identifier\n */\n id: NumberString\n\n /**\n * formatted username\n */\n name: string\n\n photo: string\n\n position: string\n\n url: string\n\n /**\n * The flag indicates that the selected user is a subordinate of the current user\n */\n sub: boolean\n\n /**\n * The flag indicates that the selected user is the manager of the current user\n */\n sup: boolean\n}\n\nexport type SelectedAccess = {\n /**\n * access permission identifier. Examples of identifiers:\n * - U1 — user with identifier 1\n * - IU1 — employees with identifier 1\n * - DR2 — all department and subdepartment employees with identifier 2\n * - D6 — all department employees with identifier 6\n * - G2 — group with identifier 2 (all visitors)\n * - SG4 — social network group with identifier 4\n * - AU — all authorized users\n * - CR — current user\n */\n id:\n | `AU`\n | `CR`\n | `U${number}`\n | `IU${number}`\n | `DR${number}`\n | `D${number}`\n | `G${number}`\n | `SG${number}`\n\n /**\n * name of the access permission\n */\n name: string\n}\n\nexport type SelectCRMParamsEntityType\n = | 'lead'\n | 'contact'\n | 'company'\n | 'deal'\n | 'quote'\n\nexport type SelectCRMParamsValue = {\n lead?: number[]\n contact?: number[]\n company?: number[]\n deal?: number[]\n quote?: number[]\n}\n\nexport type SelectCRMParams = {\n /**\n * Which types of objects to display in the dialog. Possible values:\n * - lead — Leads\n * - contact — Contacts\n * - company — Companies\n * - deal — Deals\n * - quote — Estimates\n */\n entityType: SelectCRMParamsEntityType[]\n\n /**\n * Whether multiple objects can be selected. Default is `false`\n */\n multiple: boolean\n\n /**\n * Which objects to initially add to the selected in the dialog. Works only if `multiple = true`\n */\n value?: SelectCRMParamsValue\n}\n\nexport type SelectedCRMEntity = {\n id: string\n type: SelectCRMParamsEntityType\n place: string\n title: string\n desc: string\n url: string\n}\n\nexport type SelectedCRM = {\n lead?: (SelectedCRMEntity & { id: `L_${number}` })[]\n contact?: (SelectedCRMEntity & { id: `C_${number}`, image: string })[]\n company?: (SelectedCRMEntity & { id: `CO_${number}`, image: string })[]\n deal?: (SelectedCRMEntity & { id: `D_${number}` })[]\n quote?: (SelectedCRMEntity & { id: `Q_${number}` })[]\n}\n\n/**\n * Select dialog manager\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/index.html\n */\nexport class DialogManager {\n #messageManager: MessageManager\n\n constructor(messageManager: MessageManager) {\n this.#messageManager = messageManager\n }\n\n /**\n * Method displays the standard single user selection dialog\n * It only shows company employees\n *\n * @return {Promise<null|SelectedUser>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-user.html\n */\n async selectUser(): Promise<null | SelectedUser> {\n return this.#messageManager.send(MessageCommands.selectUser, {\n mult: false\n })\n }\n\n /**\n * Method displays the standard multiple user selection dialog\n * It only shows company employees\n *\n * @return {Promise<SelectedUser[]>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-users.html\n */\n async selectUsers(): Promise<SelectedUser[]> {\n return this.#messageManager.send(MessageCommands.selectUser, {\n mult: true\n })\n }\n\n /**\n * Method displays a standard access permission selection dialog\n *\n * @param {string[]} blockedAccessPermissions\n * @return {Promise<SelectedAccess[]>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-access.html\n */\n async selectAccess(\n blockedAccessPermissions: string[] = []\n ): Promise<SelectedAccess[]> {\n return this.#messageManager.send(MessageCommands.selectAccess, {\n value: blockedAccessPermissions\n })\n }\n\n /**\n * Invokes the system dialog for selecting CRM entities\n * (leads, contacts, companies, deals, quotes).\n *\n * The resolved `SelectedCRM` object contains a separate bucket per\n * entity type. Each present bucket is a real `Array`, so consumers can\n * use `.length`, `.map()`, `for..of`, etc. directly. Buckets for entity\n * types that were not selected (or not requested via `entityType`) are\n * left `undefined` rather than being set to an empty array.\n *\n * Note: the parent window historically returned each bucket as a\n * `Record<string, SelectedCRMEntity>` (e.g. `{ 0: {...}, 1: {...} }`).\n * The SDK normalizes that response to a real array before returning it.\n *\n * @param {SelectCRMParams} [params] - Filter and behavior options.\n * - `entityType`: which entity types are shown in the dialog.\n * - `multiple`: allow multiple selection (default `false`).\n * - `value`: pre-selected entities (only applied when `multiple` is `true`).\n * @return {Promise<SelectedCRM>} Resolves to an object whose properties\n * (`lead`, `contact`, `company`, `deal`, `quote`) are arrays of\n * {@link SelectedCRMEntity} objects.\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-crm.html\n */\n async selectCRM(params?: SelectCRMParams): Promise<SelectedCRM> {\n const response = await this.#messageManager.send(MessageCommands.selectCRM, {\n entityType: params?.entityType,\n multiple: params?.multiple,\n value: params?.value\n }) as Partial<Record<SelectCRMParamsEntityType, unknown>> | null | undefined\n\n // The parent window returns each entity bucket as a Record<string, SelectedCRMEntity>\n // (e.g. { 0: {...}, 1: {...} }) rather than a real array. Normalize to arrays so\n // the runtime shape matches the documented `SelectedCRM` types.\n const result: SelectedCRM = {}\n if (!response) {\n return result\n }\n\n const toArray = <T>(bucket: unknown): T[] | undefined => {\n if (bucket === undefined || bucket === null) {\n return undefined\n }\n if (Array.isArray(bucket)) {\n return bucket as T[]\n }\n return Object.values(bucket as Record<string, T>)\n }\n\n const lead = toArray<SelectedCRMEntity & { id: `L_${number}` }>(response.lead)\n if (lead) result.lead = lead\n\n const contact = toArray<SelectedCRMEntity & { id: `C_${number}`, image: string }>(response.contact)\n if (contact) result.contact = contact\n\n const company = toArray<SelectedCRMEntity & { id: `CO_${number}`, image: string }>(response.company)\n if (company) result.company = company\n\n const deal = toArray<SelectedCRMEntity & { id: `D_${number}` }>(response.deal)\n if (deal) result.deal = deal\n\n const quote = toArray<SelectedCRMEntity & { id: `Q_${number}` }>(response.quote)\n if (quote) result.quote = quote\n\n return result\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAuHO,MAAM,aAAA,CAAc;AAAA,EAvH3B;AAuH2B,IAAA,MAAA,CAAA,IAAA,EAAA,eAAA,CAAA;AAAA;AAAA,EACzB,eAAA;AAAA,EAEA,YAAY,cAAA,EAAgC;AAC1C,IAAA,IAAA,CAAK,eAAA,GAAkB,cAAA;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,UAAA,GAA2C;AAC/C,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,UAAA,EAAY;AAAA,MAC3D,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,WAAA,GAAuC;AAC3C,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,UAAA,EAAY;AAAA,MAC3D,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,YAAA,CACJ,wBAAA,GAAqC,EAAC,EACX;AAC3B,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,YAAA,EAAc;AAAA,MAC7D,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BA,MAAM,UAAU,MAAA,EAAgD;AAC9D,IAAA,MAAM,WAAW,MAAM,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,gBAAgB,SAAA,EAAW;AAAA,MAC1E,YAAY,MAAA,EAAQ,UAAA;AAAA,MACpB,UAAU,MAAA,EAAQ,QAAA;AAAA,MAClB,OAAO,MAAA,EAAQ;AAAA,KAChB,CAAA;AAKD,IAAA,MAAM,SAAsB,EAAC;AAC7B,IAAA,IAAI,CAAC,QAAA,EAAU;AACb,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,OAAA,2BAAc,MAAA,KAAqC;AACvD,MAAA,IAAI,MAAA,KAAW,MAAA,IAAa,MAAA,KAAW,IAAA,EAAM;AAC3C,QAAA,OAAO,MAAA;AAAA,MACT;AACA,MAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG;AACzB,QAAA,OAAO,MAAA;AAAA,MACT;AACA,MAAA,OAAO,MAAA,CAAO,OAAO,MAA2B,CAAA;AAAA,IAClD,CAAA,EARgB,SAAA,CAAA;AAUhB,IAAA,MAAM,IAAA,GAAO,OAAA,CAAmD,QAAA,CAAS,IAAI,CAAA;AAC7E,IAAA,IAAI,IAAA,SAAa,IAAA,GAAO,IAAA;AAExB,IAAA,MAAM,OAAA,GAAU,OAAA,CAAkE,QAAA,CAAS,OAAO,CAAA;AAClG,IAAA,IAAI,OAAA,SAAgB,OAAA,GAAU,OAAA;AAE9B,IAAA,MAAM,OAAA,GAAU,OAAA,CAAmE,QAAA,CAAS,OAAO,CAAA;AACnG,IAAA,IAAI,OAAA,SAAgB,OAAA,GAAU,OAAA;AAE9B,IAAA,MAAM,IAAA,GAAO,OAAA,CAAmD,QAAA,CAAS,IAAI,CAAA;AAC7E,IAAA,IAAI,IAAA,SAAa,IAAA,GAAO,IAAA;AAExB,IAAA,MAAM,KAAA,GAAQ,OAAA,CAAmD,QAAA,CAAS,KAAK,CAAA;AAC/E,IAAA,IAAI,KAAA,SAAc,KAAA,GAAQ,KAAA;AAE1B,IAAA,OAAO,MAAA;AAAA,EACT;AACF;;;;"}
|
package/dist/esm/frame/frame.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package @bitrix24/b24jssdk
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.1.1
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -82,22 +82,45 @@ class PlacementManager {
|
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
+
async call(command, parameters = {}) {
|
|
86
|
+
if (command === "setValue" && !Type.isString(parameters?.["value"])) {
|
|
87
|
+
throw new TypeError(
|
|
88
|
+
"placement.call('setValue', { value }) expects `value` to be a JSON-serialized string. Use placement.setValue(value) to serialize automatically, or call JSON.stringify yourself."
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return this.#messageManager.send(
|
|
92
|
+
command,
|
|
93
|
+
{
|
|
94
|
+
...parameters,
|
|
95
|
+
isSafely: true,
|
|
96
|
+
isRawValue: ["setValue"].includes(command)
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
85
100
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
101
|
+
* Set Value for the Current Embedding Location
|
|
102
|
+
*
|
|
103
|
+
* Convenience wrapper around `placement.call('setValue', ...)` that handles
|
|
104
|
+
* JSON serialization. Pass any value (string, number, boolean, object, array)
|
|
105
|
+
* — it will be serialized via `JSON.stringify` before being sent to the
|
|
106
|
+
* parent window, which performs `JSON.parse` on receipt.
|
|
107
|
+
*
|
|
108
|
+
* @param { unknown } value Any JSON-serializable value
|
|
89
109
|
* @return { Promise<any> }
|
|
90
110
|
*
|
|
91
111
|
* @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
|
|
92
|
-
*
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* await b24.placement.setValue('test')
|
|
115
|
+
* await b24.placement.setValue({ id: 1, title: 'demo' })
|
|
93
116
|
*/
|
|
94
|
-
async
|
|
117
|
+
async setValue(value) {
|
|
95
118
|
return this.#messageManager.send(
|
|
96
|
-
|
|
119
|
+
"setValue",
|
|
97
120
|
{
|
|
98
|
-
|
|
121
|
+
value: JSON.stringify(value),
|
|
99
122
|
isSafely: true,
|
|
100
|
-
isRawValue:
|
|
123
|
+
isRawValue: true
|
|
101
124
|
}
|
|
102
125
|
);
|
|
103
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement.mjs","sources":["../../../src/frame/placement.ts"],"sourcesContent":["import type { MessageManager } from './message'\nimport type { MessageInitData } from '../types/auth'\nimport { MessageCommands } from './message'\nimport { Type } from '../tools/type'\n\n/**\n * Placement Manager\n *\n * @see https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/index.html\n */\nexport class PlacementManager {\n #messageManager: MessageManager\n #placement: string = ''\n #options: object = {}\n\n constructor(messageManager: MessageManager) {\n this.#messageManager = messageManager\n }\n\n /**\n * Initializes the data received from the parent window message.\n * @param data\n */\n initData(data: MessageInitData): PlacementManager {\n this.#placement = data.PLACEMENT || 'DEFAULT'\n this.#options = Object.freeze(data.PLACEMENT_OPTIONS)\n\n return this\n }\n\n /**\n * Symlink on `placement`\n * For backward compatibility\n */\n get title(): string {\n return this.#placement\n }\n\n get placement(): string {\n return this.#placement\n }\n\n get isDefault(): boolean {\n return this.placement === 'DEFAULT'\n }\n\n get options(): any {\n return this.#options\n }\n\n get isSliderMode(): boolean {\n return this.options?.IFRAME === 'Y'\n }\n\n /**\n * Get Information About the JS Interface of the Current Embedding Location\n *\n * @return {Promise<any>}\n *\n * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-get-interface.html\n */\n async getInterface(): Promise<any> {\n return this.#messageManager.send(\n MessageCommands.getInterface,\n {\n isSafely: true\n }\n )\n }\n\n /**\n * Set Up the Interface Event Handler\n * @param {string} eventName\n * @param {(...args: any[]) => void} callBack\n * @return {Promise<any>}\n *\n * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-bind-event.html\n */\n async bindEvent(\n eventName: string,\n callBack: (...args: any[]) => void\n ): Promise<any> {\n return this.#messageManager.send(\n MessageCommands.placementBindEvent,\n {\n event: eventName,\n callBack,\n isSafely: true\n }\n )\n }\n\n /**\n * Call the Registered Interface Command\n * @
|
|
1
|
+
{"version":3,"file":"placement.mjs","sources":["../../../src/frame/placement.ts"],"sourcesContent":["import type { MessageManager } from './message'\nimport type { MessageInitData } from '../types/auth'\nimport { MessageCommands } from './message'\nimport { Type } from '../tools/type'\n\n/**\n * Placement Manager\n *\n * @see https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/index.html\n */\nexport class PlacementManager {\n #messageManager: MessageManager\n #placement: string = ''\n #options: object = {}\n\n constructor(messageManager: MessageManager) {\n this.#messageManager = messageManager\n }\n\n /**\n * Initializes the data received from the parent window message.\n * @param data\n */\n initData(data: MessageInitData): PlacementManager {\n this.#placement = data.PLACEMENT || 'DEFAULT'\n this.#options = Object.freeze(data.PLACEMENT_OPTIONS)\n\n return this\n }\n\n /**\n * Symlink on `placement`\n * For backward compatibility\n */\n get title(): string {\n return this.#placement\n }\n\n get placement(): string {\n return this.#placement\n }\n\n get isDefault(): boolean {\n return this.placement === 'DEFAULT'\n }\n\n get options(): any {\n return this.#options\n }\n\n get isSliderMode(): boolean {\n return this.options?.IFRAME === 'Y'\n }\n\n /**\n * Get Information About the JS Interface of the Current Embedding Location\n *\n * @return {Promise<any>}\n *\n * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-get-interface.html\n */\n async getInterface(): Promise<any> {\n return this.#messageManager.send(\n MessageCommands.getInterface,\n {\n isSafely: true\n }\n )\n }\n\n /**\n * Set Up the Interface Event Handler\n * @param {string} eventName\n * @param {(...args: any[]) => void} callBack\n * @return {Promise<any>}\n *\n * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-bind-event.html\n */\n async bindEvent(\n eventName: string,\n callBack: (...args: any[]) => void\n ): Promise<any> {\n return this.#messageManager.send(\n MessageCommands.placementBindEvent,\n {\n event: eventName,\n callBack,\n isSafely: true\n }\n )\n }\n\n /**\n * Call the Registered Interface Command\n *\n * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html\n *\n * @memo The `setValue` command is special: the parent window calls `JSON.parse(value)`\n * on the received payload, so `value` MUST be a JSON-serialized string\n * (e.g. `JSON.stringify('test')` or `JSON.stringify({ a: 1 })`).\n * Prefer {@link PlacementManager.setValue} which serializes for you.\n *\n * @throws {TypeError} when `command === 'setValue'` and `parameters.value` is not a string.\n */\n async call(command: 'setValue', parameters: { value: string }): Promise<any>\n async call(command: string, parameters?: Record<string, any>): Promise<any>\n async call(command: string, parameters: Record<string, any> = {}): Promise<any> {\n if (command === 'setValue' && !Type.isString(parameters?.['value'])) {\n throw new TypeError(\n 'placement.call(\\'setValue\\', { value }) expects `value` to be a JSON-serialized string. '\n + 'Use placement.setValue(value) to serialize automatically, or call JSON.stringify yourself.'\n )\n }\n\n return this.#messageManager.send(\n command,\n {\n ...parameters,\n isSafely: true,\n isRawValue: ['setValue'].includes(command)\n }\n )\n }\n\n /**\n * Set Value for the Current Embedding Location\n *\n * Convenience wrapper around `placement.call('setValue', ...)` that handles\n * JSON serialization. Pass any value (string, number, boolean, object, array)\n * — it will be serialized via `JSON.stringify` before being sent to the\n * parent window, which performs `JSON.parse` on receipt.\n *\n * @param { unknown } value Any JSON-serializable value\n * @return { Promise<any> }\n *\n * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html\n *\n * @example\n * await b24.placement.setValue('test')\n * await b24.placement.setValue({ id: 1, title: 'demo' })\n */\n async setValue(value: unknown): Promise<any> {\n return this.#messageManager.send(\n 'setValue',\n {\n value: JSON.stringify(value),\n isSafely: true,\n isRawValue: true\n }\n )\n }\n\n /**\n * Set Up the Interface Event Handler\n * @param {string} command\n * @param {null | string | Record<string, any>} parameters\n * @param {(...args: any[]) => void} callBack\n *\n * @return {Promise<any>}\n */\n async callCustomBind(\n command: string,\n parameters: null | string | Record<string, any> = null,\n callBack: (...args: any[]) => void\n ): Promise<any> {\n let options: Record<string, any> = {}\n if (Type.isString(parameters)) {\n options['singleOption'] = parameters\n } else if (Type.isObjectLike(parameters)) {\n options = { ...(parameters as object) }\n }\n\n return this.#messageManager.send(\n command,\n {\n ...options,\n callBack,\n isSafely: true\n }\n )\n }\n}\n"],"names":[],"mappings":"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"}
|
package/dist/esm/hook/auth.mjs
CHANGED
package/dist/esm/hook/b24.mjs
CHANGED
package/dist/esm/index.d.mts
CHANGED
|
@@ -1324,6 +1324,51 @@ interface RestrictionParams {
|
|
|
1324
1324
|
* Default: 1_000
|
|
1325
1325
|
*/
|
|
1326
1326
|
retryDelay?: number;
|
|
1327
|
+
/**
|
|
1328
|
+
* Whether to retry on transport-level errors (`NETWORK_ERROR`, `REQUEST_TIMEOUT`).
|
|
1329
|
+
*
|
|
1330
|
+
* Default: `true` — preserves the historical retry behaviour.
|
|
1331
|
+
*
|
|
1332
|
+
* Set to `false` for **non-idempotent** calls (e.g. `crm.documentgenerator.document.add`,
|
|
1333
|
+
* any `*.add` that creates an entity, file uploads). When the request times out
|
|
1334
|
+
* client-side, the server may still have processed it successfully — retrying then
|
|
1335
|
+
* creates duplicates. With `retryOnNetworkError: false` the SDK immediately throws
|
|
1336
|
+
* `NETWORK_ERROR` / `REQUEST_TIMEOUT` instead of retrying.
|
|
1337
|
+
*
|
|
1338
|
+
* For long-running heavy operations also raise the axios timeout:
|
|
1339
|
+
* ```ts
|
|
1340
|
+
* const clientAxios = $b24.getHttpClient(ApiVersion.v2).ajaxClient
|
|
1341
|
+
* clientAxios.defaults.timeout = 120_000
|
|
1342
|
+
* ```
|
|
1343
|
+
*/
|
|
1344
|
+
retryOnNetworkError?: boolean;
|
|
1345
|
+
/**
|
|
1346
|
+
* Additional error codes that must be thrown as exceptions immediately,
|
|
1347
|
+
* without any retry. Merged with the SDK's built-in hard list — you can
|
|
1348
|
+
* only **add** codes, not remove built-ins (auth / fatal codes are always hard).
|
|
1349
|
+
*
|
|
1350
|
+
* Use this for business-specific or custom REST methods whose error codes
|
|
1351
|
+
* the SDK doesn't know about (otherwise the SDK treats unknown codes as
|
|
1352
|
+
* transient and retries them with backoff).
|
|
1353
|
+
*
|
|
1354
|
+
* @example
|
|
1355
|
+
* ```ts
|
|
1356
|
+
* await $b24.setRestrictionManagerParams({
|
|
1357
|
+
* ...ParamsFactory.getDefault(),
|
|
1358
|
+
* hardErrorCodes: ['DOCUMENT_GENERATOR_ALREADY_IN_QUEUE', 'MY_APP_BAD_PAYLOAD']
|
|
1359
|
+
* })
|
|
1360
|
+
* ```
|
|
1361
|
+
*/
|
|
1362
|
+
hardErrorCodes?: string[];
|
|
1363
|
+
/**
|
|
1364
|
+
* Additional error codes that should be returned inside `AjaxResult` as a
|
|
1365
|
+
* soft error instead of thrown. Merged with the SDK's built-in soft list.
|
|
1366
|
+
*
|
|
1367
|
+
* Use this when your application expects to inspect a specific REST error
|
|
1368
|
+
* code as part of normal control flow (e.g. validation errors from a
|
|
1369
|
+
* custom v3 endpoint).
|
|
1370
|
+
*/
|
|
1371
|
+
softErrorCodes?: string[];
|
|
1327
1372
|
}
|
|
1328
1373
|
/**
|
|
1329
1374
|
* Limiter operation statistics
|
|
@@ -2534,7 +2579,21 @@ type BatchPayload<C> = {
|
|
|
2534
2579
|
readonly time: PayloadTime;
|
|
2535
2580
|
};
|
|
2536
2581
|
type Payload<P> = TypeDescriptionErrorV3 | TypeDescriptionError | GetPayload<P> | ListPayload<P> | BatchPayload<P>;
|
|
2537
|
-
|
|
2582
|
+
/**
|
|
2583
|
+
* Public shape of a successful REST response, as exposed by `AjaxResult.getData()`.
|
|
2584
|
+
*
|
|
2585
|
+
* The Bitrix24 REST API always wraps a success response in `{ result, time }` —
|
|
2586
|
+
* this is true for both `restApi:v2` and `restApi:v3`. Any v2-only envelope
|
|
2587
|
+
* fields (`next`, `total`) are intentionally NOT part of this type: they have
|
|
2588
|
+
* no `restApi:v3` counterpart, and the SDK's `actions.v{2,3}.{callList,fetchList}`
|
|
2589
|
+
* helpers handle pagination internally so consumers never need to read them.
|
|
2590
|
+
*
|
|
2591
|
+
* @see GetPayload
|
|
2592
|
+
*/
|
|
2593
|
+
type SuccessPayload<P> = {
|
|
2594
|
+
readonly result: P;
|
|
2595
|
+
readonly time: PayloadTime;
|
|
2596
|
+
};
|
|
2538
2597
|
|
|
2539
2598
|
type AjaxQuery = Readonly<{
|
|
2540
2599
|
method: string;
|
|
@@ -2561,9 +2620,35 @@ declare class AjaxResult<T = unknown> extends Result<Payload<T>> implements IRes
|
|
|
2561
2620
|
getData(): undefined | SuccessPayload<T>;
|
|
2562
2621
|
/**
|
|
2563
2622
|
* Alias for isMore
|
|
2623
|
+
*
|
|
2624
|
+
* @deprecated Will be removed in `2.0.0`. Tied to the `restApi:v2` envelope
|
|
2625
|
+
* field `next`, which `restApi:v3` does not return. Use the SDK's list
|
|
2626
|
+
* helpers — they hide pagination entirely:
|
|
2627
|
+
* - `restApi:v2`: {@link CallListV2.make `b24.actions.v2.callList.make`} or {@link FetchListV2.make `b24.actions.v2.fetchList.make`}
|
|
2628
|
+
* - `restApi:v3`: {@link CallListV3.make `b24.actions.v3.callList.make`} or {@link FetchListV3.make `b24.actions.v3.fetchList.make`}
|
|
2629
|
+
*
|
|
2630
|
+
* @removed 2.0.0
|
|
2564
2631
|
*/
|
|
2565
2632
|
hasMore(): boolean;
|
|
2633
|
+
/**
|
|
2634
|
+
* @deprecated Will be removed in `2.0.0`. Tied to the `restApi:v2` envelope
|
|
2635
|
+
* field `next`, which `restApi:v3` does not return. Use the SDK's list
|
|
2636
|
+
* helpers — they hide pagination entirely:
|
|
2637
|
+
* - `restApi:v2`: {@link CallListV2.make `b24.actions.v2.callList.make`} or {@link FetchListV2.make `b24.actions.v2.fetchList.make`}
|
|
2638
|
+
* - `restApi:v3`: {@link CallListV3.make `b24.actions.v3.callList.make`} or {@link FetchListV3.make `b24.actions.v3.fetchList.make`}
|
|
2639
|
+
*
|
|
2640
|
+
* @removed 2.0.0
|
|
2641
|
+
*/
|
|
2566
2642
|
isMore(): boolean;
|
|
2643
|
+
/**
|
|
2644
|
+
* @deprecated Will be removed in `2.0.0`. Tied to the `restApi:v2` envelope
|
|
2645
|
+
* field `total`, which `restApi:v3` does not return. For `restApi:v3` the
|
|
2646
|
+
* SDK exposes element counts via the `aggregate` action (`count` /
|
|
2647
|
+
* `countDistinct`); for `restApi:v2` use the list helpers, which iterate
|
|
2648
|
+
* without exposing `total`.
|
|
2649
|
+
*
|
|
2650
|
+
* @removed 2.0.0
|
|
2651
|
+
*/
|
|
2567
2652
|
getTotal(): number;
|
|
2568
2653
|
getStatus(): number;
|
|
2569
2654
|
getQuery(): Readonly<AjaxQuery>;
|
|
@@ -2571,9 +2656,25 @@ declare class AjaxResult<T = unknown> extends Result<Payload<T>> implements IRes
|
|
|
2571
2656
|
* Alias for getNext
|
|
2572
2657
|
* @param http
|
|
2573
2658
|
*
|
|
2574
|
-
* @
|
|
2659
|
+
* @deprecated Will be removed in `2.0.0`. `restApi:v3` does not support
|
|
2660
|
+
* `getNext()` (the v2 envelope field `next` does not exist). Use the SDK's
|
|
2661
|
+
* list helpers instead — they hide pagination entirely:
|
|
2662
|
+
* - `restApi:v2`: {@link CallListV2.make `b24.actions.v2.callList.make`} or {@link FetchListV2.make `b24.actions.v2.fetchList.make`}
|
|
2663
|
+
* - `restApi:v3`: {@link CallListV3.make `b24.actions.v3.callList.make`} or {@link FetchListV3.make `b24.actions.v3.fetchList.make`}
|
|
2664
|
+
*
|
|
2665
|
+
* @removed 2.0.0
|
|
2575
2666
|
*/
|
|
2576
2667
|
fetchNext(http: TypeHttp): Promise<AjaxResult<T> | null>;
|
|
2668
|
+
/**
|
|
2669
|
+
* @deprecated Will be removed in `2.0.0`. Throws on `restApi:v3` because the
|
|
2670
|
+
* v2 envelope field `next` is not part of the v3 protocol. Use the SDK's
|
|
2671
|
+
* list helpers instead — they hide pagination entirely:
|
|
2672
|
+
* - `restApi:v2`: {@link CallListV2.make `b24.actions.v2.callList.make`} or {@link FetchListV2.make `b24.actions.v2.fetchList.make`}
|
|
2673
|
+
* - `restApi:v3`: {@link CallListV3.make `b24.actions.v3.callList.make`} or {@link FetchListV3.make `b24.actions.v3.fetchList.make`}
|
|
2674
|
+
*
|
|
2675
|
+
* @throws {SdkError} `JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3` when called against a `restApi:v3` HTTP client. This throw is preserved until `2.0.0`.
|
|
2676
|
+
* @removed 2.0.0
|
|
2677
|
+
*/
|
|
2577
2678
|
getNext(http: TypeHttp): Promise<AjaxResult<T> | false>;
|
|
2578
2679
|
setData(): never;
|
|
2579
2680
|
}
|
|
@@ -3904,11 +4005,33 @@ declare class RestrictionManager {
|
|
|
3904
4005
|
updateStats(requestId: string, method: string, timeData: any): Promise<void>;
|
|
3905
4006
|
handleError(requestId: string, method: string, params: any, error: any, attempt: number): Promise<number>;
|
|
3906
4007
|
/**
|
|
3907
|
-
*
|
|
4008
|
+
* Built-in hard error codes (always throw, never retry).
|
|
4009
|
+
*
|
|
4010
|
+
* Includes authorization and fatal codes that must never be silently retried.
|
|
4011
|
+
* Use `RestrictionParams.hardErrorCodes` to extend this list with custom codes.
|
|
4012
|
+
*/
|
|
4013
|
+
static readonly BUILT_IN_HARD_ERROR_CODES: readonly string[];
|
|
4014
|
+
/**
|
|
4015
|
+
* Built-in soft error codes (returned as `AjaxResult` with error, never thrown).
|
|
4016
|
+
*
|
|
4017
|
+
* Use `RestrictionParams.softErrorCodes` to extend this list with custom codes.
|
|
4018
|
+
*/
|
|
4019
|
+
static readonly BUILT_IN_SOFT_ERROR_CODES: readonly string[];
|
|
4020
|
+
/**
|
|
4021
|
+
* Codes that cause the SDK to throw immediately.
|
|
4022
|
+
*
|
|
4023
|
+
* Composed of:
|
|
4024
|
+
* - `BUILT_IN_HARD_ERROR_CODES` (always included)
|
|
4025
|
+
* - `NETWORK_ERROR` and `REQUEST_TIMEOUT` when `retryOnNetworkError === false`
|
|
4026
|
+
* - `RestrictionParams.hardErrorCodes` (user-provided extensions)
|
|
3908
4027
|
*/
|
|
3909
4028
|
get exceptionCodeForHard(): string[];
|
|
3910
4029
|
/**
|
|
3911
|
-
*
|
|
4030
|
+
* Codes returned as `AjaxResult` with an `AjaxError` payload instead of thrown.
|
|
4031
|
+
*
|
|
4032
|
+
* Composed of:
|
|
4033
|
+
* - `BUILT_IN_SOFT_ERROR_CODES` (always included)
|
|
4034
|
+
* - `RestrictionParams.softErrorCodes` (user-provided extensions)
|
|
3912
4035
|
*/
|
|
3913
4036
|
get exceptionCodeForSoft(): string[];
|
|
3914
4037
|
incrementError(method: string): void;
|
|
@@ -4898,10 +5021,26 @@ declare class DialogManager {
|
|
|
4898
5021
|
*/
|
|
4899
5022
|
selectAccess(blockedAccessPermissions?: string[]): Promise<SelectedAccess[]>;
|
|
4900
5023
|
/**
|
|
4901
|
-
*
|
|
5024
|
+
* Invokes the system dialog for selecting CRM entities
|
|
5025
|
+
* (leads, contacts, companies, deals, quotes).
|
|
5026
|
+
*
|
|
5027
|
+
* The resolved `SelectedCRM` object contains a separate bucket per
|
|
5028
|
+
* entity type. Each present bucket is a real `Array`, so consumers can
|
|
5029
|
+
* use `.length`, `.map()`, `for..of`, etc. directly. Buckets for entity
|
|
5030
|
+
* types that were not selected (or not requested via `entityType`) are
|
|
5031
|
+
* left `undefined` rather than being set to an empty array.
|
|
4902
5032
|
*
|
|
4903
|
-
*
|
|
4904
|
-
*
|
|
5033
|
+
* Note: the parent window historically returned each bucket as a
|
|
5034
|
+
* `Record<string, SelectedCRMEntity>` (e.g. `{ 0: {...}, 1: {...} }`).
|
|
5035
|
+
* The SDK normalizes that response to a real array before returning it.
|
|
5036
|
+
*
|
|
5037
|
+
* @param {SelectCRMParams} [params] - Filter and behavior options.
|
|
5038
|
+
* - `entityType`: which entity types are shown in the dialog.
|
|
5039
|
+
* - `multiple`: allow multiple selection (default `false`).
|
|
5040
|
+
* - `value`: pre-selected entities (only applied when `multiple` is `true`).
|
|
5041
|
+
* @return {Promise<SelectedCRM>} Resolves to an object whose properties
|
|
5042
|
+
* (`lead`, `contact`, `company`, `deal`, `quote`) are arrays of
|
|
5043
|
+
* {@link SelectedCRMEntity} objects.
|
|
4905
5044
|
*
|
|
4906
5045
|
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-crm.html
|
|
4907
5046
|
*/
|
|
@@ -4989,14 +5128,38 @@ declare class PlacementManager {
|
|
|
4989
5128
|
bindEvent(eventName: string, callBack: (...args: any[]) => void): Promise<any>;
|
|
4990
5129
|
/**
|
|
4991
5130
|
* Call the Registered Interface Command
|
|
4992
|
-
* @param { string } command
|
|
4993
|
-
* @param { Record<string, any> } parameters
|
|
4994
|
-
* @return { Promise<any> }
|
|
4995
5131
|
*
|
|
4996
5132
|
* @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
|
|
4997
|
-
*
|
|
5133
|
+
*
|
|
5134
|
+
* @memo The `setValue` command is special: the parent window calls `JSON.parse(value)`
|
|
5135
|
+
* on the received payload, so `value` MUST be a JSON-serialized string
|
|
5136
|
+
* (e.g. `JSON.stringify('test')` or `JSON.stringify({ a: 1 })`).
|
|
5137
|
+
* Prefer {@link PlacementManager.setValue} which serializes for you.
|
|
5138
|
+
*
|
|
5139
|
+
* @throws {TypeError} when `command === 'setValue'` and `parameters.value` is not a string.
|
|
4998
5140
|
*/
|
|
5141
|
+
call(command: 'setValue', parameters: {
|
|
5142
|
+
value: string;
|
|
5143
|
+
}): Promise<any>;
|
|
4999
5144
|
call(command: string, parameters?: Record<string, any>): Promise<any>;
|
|
5145
|
+
/**
|
|
5146
|
+
* Set Value for the Current Embedding Location
|
|
5147
|
+
*
|
|
5148
|
+
* Convenience wrapper around `placement.call('setValue', ...)` that handles
|
|
5149
|
+
* JSON serialization. Pass any value (string, number, boolean, object, array)
|
|
5150
|
+
* — it will be serialized via `JSON.stringify` before being sent to the
|
|
5151
|
+
* parent window, which performs `JSON.parse` on receipt.
|
|
5152
|
+
*
|
|
5153
|
+
* @param { unknown } value Any JSON-serializable value
|
|
5154
|
+
* @return { Promise<any> }
|
|
5155
|
+
*
|
|
5156
|
+
* @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
|
|
5157
|
+
*
|
|
5158
|
+
* @example
|
|
5159
|
+
* await b24.placement.setValue('test')
|
|
5160
|
+
* await b24.placement.setValue({ id: 1, title: 'demo' })
|
|
5161
|
+
*/
|
|
5162
|
+
setValue(value: unknown): Promise<any>;
|
|
5000
5163
|
/**
|
|
5001
5164
|
* Set Up the Interface Event Handler
|
|
5002
5165
|
* @param {string} command
|