@bitrix24/b24jssdk 1.2.0 → 1.3.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.
- package/README-AI.md +3 -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 +17 -10
- package/dist/esm/core/actions/v2/call-list.mjs.map +1 -1
- package/dist/esm/core/actions/v2/call.mjs +1 -1
- package/dist/esm/core/actions/v2/fetch-list.mjs +17 -10
- package/dist/esm/core/actions/v2/fetch-list.mjs.map +1 -1
- package/dist/esm/core/actions/v2/manager-v2.mjs +6 -6
- package/dist/esm/core/actions/v2/manager-v2.mjs.map +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 +16 -9
- package/dist/esm/core/actions/v3/call-list.mjs.map +1 -1
- package/dist/esm/core/actions/v3/call.mjs +1 -1
- package/dist/esm/core/actions/v3/fetch-list.mjs +16 -9
- package/dist/esm/core/actions/v3/fetch-list.mjs.map +1 -1
- package/dist/esm/core/actions/v3/manager-v3.mjs +6 -6
- package/dist/esm/core/actions/v3/manager-v3.mjs.map +1 -1
- package/dist/esm/core/http/abstract-http.mjs +30 -6
- package/dist/esm/core/http/abstract-http.mjs.map +1 -1
- package/dist/esm/core/http/ajax-error.mjs +1 -1
- package/dist/esm/core/http/ajax-result.mjs +1 -1
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs +1 -1
- package/dist/esm/core/http/limiters/manager.mjs +2 -1
- 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 +1 -1
- package/dist/esm/core/http/limiters/rate-limiter.mjs +1 -1
- package/dist/esm/core/http/redact.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 +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 +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 +28 -1
- package/dist/esm/core/result.mjs.map +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 +3 -3
- package/dist/esm/core/tools/manager.mjs.map +1 -1
- package/dist/esm/core/tools/ping.mjs +1 -1
- package/dist/esm/core/version-manager.mjs +89 -12
- package/dist/esm/core/version-manager.mjs.map +1 -1
- package/dist/esm/frame/auth.mjs +1 -1
- package/dist/esm/frame/b24.mjs +1 -1
- package/dist/esm/frame/dialog.mjs +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 +6 -2
- package/dist/esm/frame/parent.mjs.map +1 -1
- package/dist/esm/frame/placement.mjs +1 -1
- package/dist/esm/frame/slider.mjs +5 -1
- package/dist/esm/frame/slider.mjs.map +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 +95 -16
- package/dist/esm/index.d.ts +95 -16
- 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/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 +231 -66
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +24 -24
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-manager.mjs","sources":["../../../src/core/version-manager.ts"],"sourcesContent":["import { ApiVersion } from '../types/b24'\nimport type {\n BatchCommandsArrayUniversal,\n BatchCommandsObjectUniversal,\n BatchNamedCommandsUniversal\n} from '../types/http'\nimport { ParseRow } from './interaction/batch/parse-row'\nimport { SdkError } from './sdk-error'\n\n/**\n * @todo add docs ??\n */\nclass VersionManager {\n #supportMethods: string[]\n\n constructor() {\n /**\n * get from https://{portal}/rest/api/{user_id}/{webhook}/documentation\n * @see https://apidocs.bitrix24.com/api-reference/rest-v3/index.html#openapi\n */\n this.#supportMethods = [\n '/batch', // done\n '/scopes', // done\n '/rest.scope.list', // done\n '/rest.documentation.openapi',\n '/documentation',\n /** @see /settings/configs/event_log.php */\n '/main.eventlog.list', // done\n '/main.eventlog.get', // done\n '/main.eventlog.tail', // done\n '/tasks.task.chat.message.send',\n '/tasks.task.access.get',\n '/tasks.task.file.attach',\n '/tasks.task.update', // done\n '/tasks.task.delete',\n '/tasks.task.add',\n '/tasks.task.get' // done\n // @todo When API.v3 arrives - change in AuthOAuthManager.initIsAdmin()\n // '/profile' // waite\n // '/main.message.get' // waite\n // '/main.chat.update' // waite\n // '/main.chat.list' // waite\n // '/main.user.list' // waite\n ]\n }\n\n static create(): VersionManager {\n return new VersionManager()\n }\n\n /**\n * List of supported API versions\n * The highest version must be first\n */\n public getAllApiVersions(): ApiVersion[] {\n return [ApiVersion.v3, ApiVersion.v2]\n }\n\n public isSupport(version: ApiVersion, method: string): boolean {\n switch (version) {\n case ApiVersion.v3:\n return this.#v3Support(method)\n case ApiVersion.v2:\n return true\n }\n\n return false\n }\n\n #v3Support(method: string): boolean {\n return this.#supportMethods.includes(`/${method}`)\n }\n\n /**\n * Automatically obtain the API version\n */\n public automaticallyObtainApiVersion(method: string): ApiVersion {\n const version = this.getAllApiVersions().find(version => versionManager.isSupport(version, method))\n if (!version) {\n throw new SdkError({\n code: 'JSSDK_VERSION_MANAGER_NOT_DETECT_FOR_METHOD',\n description: `No API version found that supports method ${method}.`,\n status: 500\n })\n }\n\n return version\n }\n\n /**\n * Automatically obtain the API version for Batch\n *\n * @todo test methods\n * `[['crm.item.get', { entityTypeId: 3, id: 1 }]]`\n * `[{ method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }]`\n * `{ cmd1: { method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }, cmd2: ['crm.item.get', { entityTypeId: 2, id: 2 }] }`\n */\n public automaticallyObtainApiVersionForBatch(\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal\n ): ApiVersion {\n const commands = ParseRow.getMethodsFromCommands(calls)\n\n let isAllSupportV3 = true\n for (const [_, method] of commands.entries()) {\n if (!this.isSupport(ApiVersion.v3, method)) {\n isAllSupportV3 = false\n break\n }\n }\n\n if (isAllSupportV3) {\n return ApiVersion.v3\n }\n return ApiVersion.v2\n }\n}\n\nexport const versionManager = VersionManager.create()\n"],"names":["version"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,cAAA,CAAe;AAAA,EAZrB;AAYqB,IAAA,MAAA,CAAA,IAAA,EAAA,gBAAA,CAAA;AAAA;AAAA,EACnB,eAAA;AAAA,EAEA,WAAA,GAAc;AAKZ,IAAA,IAAA,CAAK,eAAA,GAAkB;AAAA,MACrB,QAAA;AAAA;AAAA,MACA,SAAA;AAAA;AAAA,MACA,kBAAA;AAAA;AAAA,MACA,6BAAA;AAAA,MACA,gBAAA;AAAA;AAAA,MAEA,qBAAA;AAAA;AAAA,MACA,oBAAA;AAAA;AAAA,MACA,qBAAA;AAAA;AAAA,MACA,+BAAA;AAAA,MACA,wBAAA;AAAA,MACA,yBAAA;AAAA,MACA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AAA;AAAA,EAUO,sCACL,KAAA,EACY;AACZ,IAAA,MAAM,QAAA,GAAW,QAAA,CAAS,sBAAA,CAAuB,KAAK,CAAA;AAEtD,IAAA,IAAI,cAAA,GAAiB,IAAA;AACrB,IAAA,KAAA,MAAW,CAAC,CAAA,EAAG,MAAM,CAAA,IAAK,QAAA,CAAS,SAAQ,EAAG;AAC5C,MAAA,IAAI,CAAC,IAAA,CAAK,SAAA,CAAU,UAAA,CAAW,EAAA,EAAI,MAAM,CAAA,EAAG;AAC1C,QAAA,cAAA,GAAiB,KAAA;AACjB,QAAA;AAAA,MACF;AAAA,IACF;AAEA,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,OAAO,UAAA,CAAW,EAAA;AAAA,IACpB;AACA,IAAA,OAAO,UAAA,CAAW,EAAA;AAAA,EACpB;AACF;AAEO,MAAM,cAAA,GAAiB,eAAe,MAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"version-manager.mjs","sources":["../../../src/core/version-manager.ts"],"sourcesContent":["import { ApiVersion } from '../types/b24'\nimport type {\n BatchCommandsArrayUniversal,\n BatchCommandsObjectUniversal,\n BatchNamedCommandsUniversal\n} from '../types/http'\nimport { ParseRow } from './interaction/batch/parse-row'\nimport { SdkError } from './sdk-error'\n\n/**\n * Decides which REST API version (v2 or v3) a method is routed through:\n * v3 only for methods on the published allowlist (`#supportMethods`); everything\n * else falls back to v2.\n */\nclass VersionManager {\n #supportMethods: string[]\n\n constructor() {\n /**\n * Mirrors the methods published under Bitrix24 REST v3 (per the module pages\n * of apidocs rest-v3). Absences are intentional — a module exposes only what\n * is published (e.g. `timeman` is read-only in v3: no `record.get` / `add` /\n * `update`). Entries WITHOUT a `// done` marker are routed but not yet verified\n * end-to-end against a live portal in this SDK.\n *\n * Source of truth: https://{portal}/rest/api/{user_id}/{webhook}/documentation\n * @see https://apidocs.bitrix24.com/api-reference/rest-v3/index.html#openapi\n */\n this.#supportMethods = [\n // --- infrastructure ---\n '/batch', // done\n '/scopes', // done\n '/rest.scope.list', // done\n '/rest.documentation.openapi',\n '/documentation',\n\n // --- main ---\n /** @see /settings/configs/event_log.php */\n '/main.eventlog.list', // done\n '/main.eventlog.get', // done\n '/main.eventlog.tail', // done\n '/main.eventlog.field.list',\n '/main.eventlog.field.get',\n\n // --- mail (rest-v3) ---\n '/mail.mailbox.list',\n '/mail.mailbox.get',\n '/mail.mailbox.senders',\n '/mail.mailbox.field.list',\n '/mail.mailbox.field.get',\n '/mail.message.list',\n '/mail.message.get',\n '/mail.message.thread',\n '/mail.message.send',\n '/mail.message.reply',\n '/mail.message.forward',\n '/mail.message.movetofolder',\n '/mail.message.createcrmactivity',\n '/mail.message.removecrmactivity',\n '/mail.message.createtask',\n '/mail.message.createcalendarevent',\n '/mail.message.createchat',\n '/mail.message.createfeedpost',\n '/mail.message.field.list',\n '/mail.message.field.get',\n '/mail.recipient.listcontacts',\n '/mail.recipient.listemployees',\n '/mail.recipient.field.list',\n '/mail.recipient.field.get',\n\n // --- humanresources (rest-v3) ---\n '/humanresources.node.add',\n '/humanresources.node.edit',\n '/humanresources.node.get',\n '/humanresources.node.list',\n '/humanresources.node.search',\n '/humanresources.node.children',\n '/humanresources.node.count',\n '/humanresources.node.move',\n '/humanresources.node.field.list',\n '/humanresources.node.field.get',\n '/humanresources.node.member.add',\n '/humanresources.node.member.set',\n '/humanresources.node.member.move',\n '/humanresources.node.member.remove',\n '/humanresources.node.communication.edit',\n '/humanresources.node.communication.list',\n '/humanresources.employee.search',\n '/humanresources.employee.subordinates',\n '/humanresources.employee.count',\n '/humanresources.employee.multidepartment',\n '/humanresources.employee.field.list',\n '/humanresources.employee.field.get',\n\n // --- tasks (rest-v3) ---\n '/tasks.task.add',\n '/tasks.task.get', // done\n '/tasks.task.update', // done\n '/tasks.task.delete',\n '/tasks.task.access.get',\n '/tasks.task.file.attach',\n '/tasks.task.chat.message.send',\n '/tasks.task.result.add',\n '/tasks.task.result.addfromchatmessage',\n '/tasks.task.result.update',\n '/tasks.task.result.list',\n '/tasks.task.result.delete',\n '/tasks.task.field.list',\n '/tasks.task.field.get',\n '/tasks.task.access.field.list',\n '/tasks.task.access.field.get',\n '/tasks.task.file.field.list',\n '/tasks.task.file.field.get',\n '/tasks.task.chat.message.field.list',\n '/tasks.task.chat.message.field.get',\n\n // --- timeman (rest-v3) — read-only in v3 (no record.get / add / update / delete) ---\n '/timeman.record.list',\n '/timeman.record.field.list',\n '/timeman.record.field.get'\n\n // Cross-module methods are cross-referenced from the rest-v3 pages above but\n // belong to modules not actualized here — add them when those modules land:\n // user.get — user module (seen on humanresources + timeman)\n // im.message.update / im.message.delete / im.dialog.messages.get — im module (seen on tasks)\n // disk.storage.uploadfile / disk.folder.uploadfile /\n // disk.storage.getchildren / disk.folder.getchildren — disk module (seen on tasks)\n //\n // @todo When API.v3 arrives - change in AuthOAuthManager.initIsAdmin()\n // '/profile' // wait\n // '/main.message.get' // wait\n // '/main.chat.update' // wait\n // '/main.chat.list' // wait\n // '/main.user.list' // wait\n ]\n }\n\n static create(): VersionManager {\n return new VersionManager()\n }\n\n /**\n * List of supported API versions\n * The highest version must be first\n */\n public getAllApiVersions(): ApiVersion[] {\n return [ApiVersion.v3, ApiVersion.v2]\n }\n\n public isSupport(version: ApiVersion, method: string): boolean {\n switch (version) {\n case ApiVersion.v3:\n return this.#v3Support(method)\n case ApiVersion.v2:\n return true\n }\n\n return false\n }\n\n #v3Support(method: string): boolean {\n return this.#supportMethods.includes(`/${method}`)\n }\n\n /**\n * Automatically obtain the API version\n */\n public automaticallyObtainApiVersion(method: string): ApiVersion {\n const version = this.getAllApiVersions().find(version => versionManager.isSupport(version, method))\n if (!version) {\n throw new SdkError({\n code: 'JSSDK_VERSION_MANAGER_NOT_DETECT_FOR_METHOD',\n description: `No API version found that supports method ${method}.`,\n status: 500\n })\n }\n\n return version\n }\n\n /**\n * Automatically obtain the API version for Batch\n *\n * @todo test methods\n * `[['crm.item.get', { entityTypeId: 3, id: 1 }]]`\n * `[{ method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }]`\n * `{ cmd1: { method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }, cmd2: ['crm.item.get', { entityTypeId: 2, id: 2 }] }`\n */\n public automaticallyObtainApiVersionForBatch(\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal\n ): ApiVersion {\n const commands = ParseRow.getMethodsFromCommands(calls)\n\n let isAllSupportV3 = true\n for (const [_, method] of commands.entries()) {\n if (!this.isSupport(ApiVersion.v3, method)) {\n isAllSupportV3 = false\n break\n }\n }\n\n if (isAllSupportV3) {\n return ApiVersion.v3\n }\n return ApiVersion.v2\n }\n}\n\nexport const versionManager = VersionManager.create()\n"],"names":["version"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,cAAA,CAAe;AAAA,EAdrB;AAcqB,IAAA,MAAA,CAAA,IAAA,EAAA,gBAAA,CAAA;AAAA;AAAA,EACnB,eAAA;AAAA,EAEA,WAAA,GAAc;AAWZ,IAAA,IAAA,CAAK,eAAA,GAAkB;AAAA;AAAA,MAErB,QAAA;AAAA;AAAA,MACA,SAAA;AAAA;AAAA,MACA,kBAAA;AAAA;AAAA,MACA,6BAAA;AAAA,MACA,gBAAA;AAAA;AAAA;AAAA,MAIA,qBAAA;AAAA;AAAA,MACA,oBAAA;AAAA;AAAA,MACA,qBAAA;AAAA;AAAA,MACA,2BAAA;AAAA,MACA,0BAAA;AAAA;AAAA,MAGA,oBAAA;AAAA,MACA,mBAAA;AAAA,MACA,uBAAA;AAAA,MACA,0BAAA;AAAA,MACA,yBAAA;AAAA,MACA,oBAAA;AAAA,MACA,mBAAA;AAAA,MACA,sBAAA;AAAA,MACA,oBAAA;AAAA,MACA,qBAAA;AAAA,MACA,uBAAA;AAAA,MACA,4BAAA;AAAA,MACA,iCAAA;AAAA,MACA,iCAAA;AAAA,MACA,0BAAA;AAAA,MACA,mCAAA;AAAA,MACA,0BAAA;AAAA,MACA,8BAAA;AAAA,MACA,0BA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QAAA,cAAA,GAAiB,KAAA;AACjB,QAAA;AAAA,MACF;AAAA,IACF;AAEA,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,OAAO,UAAA,CAAW,EAAA;AAAA,IACpB;AACA,IAAA,OAAO,UAAA,CAAW,EAAA;AAAA,EACpB;AACF;AAEO,MAAM,cAAA,GAAiB,eAAe,MAAA;;;;"}
|
package/dist/esm/frame/auth.mjs
CHANGED
package/dist/esm/frame/b24.mjs
CHANGED
package/dist/esm/frame/frame.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package @bitrix24/b24jssdk
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.3.0
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -159,7 +159,11 @@ class ParentManager {
|
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
162
|
+
* Sets the in-layout page title (the `#pagetitle` element the portal renders around the app).
|
|
163
|
+
*
|
|
164
|
+
* Does NOT change the browser tab title (`document.title`): the portal applies this command to
|
|
165
|
+
* `#pagetitle`, never to the tab. To set the browser tab title, open the view as a slider via
|
|
166
|
+
* `SliderManager.openSliderAppPage` with a `bx24_title` option.
|
|
163
167
|
*
|
|
164
168
|
* @param {string} title
|
|
165
169
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parent.mjs","sources":["../../../src/frame/parent.ts"],"sourcesContent":["import type { MessageManager } from './message'\nimport { MessageCommands } from './message'\nimport useScrollSize from '../tools/scroll-size'\n\n/**\n * Parent window manager\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/\n */\nexport class ParentManager {\n #messageManager: MessageManager\n\n constructor(messageManager: MessageManager) {\n this.#messageManager = messageManager\n }\n\n get message(): MessageManager {\n return this.#messageManager\n }\n\n /**\n * The method closes the open modal window with the application\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html\n */\n async closeApplication(): Promise<void> {\n return this.#messageManager.send(MessageCommands.closeApplication, {\n /**\n * @memo There is no point - everything will be closed, and timeout will not be able to do anything\n */\n isSafely: false\n })\n }\n\n /**\n * Sets the size of the frame containing the application to the size of the frame's content.\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-fit-window.html\n *\n * @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\n */\n async fitWindow(): Promise<any> {\n const width = '100%'\n const height = this.getScrollSize().scrollHeight\n\n return this.#messageManager.send(MessageCommands.resizeWindow, {\n width,\n height,\n isSafely: true\n })\n }\n\n /**\n * Sets the size of the frame containing the application to the size of the frame's content.\n *\n * @param {number} width\n * @param {number} height\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-resize-window.html\n *\n * @memo in certain situations it may not be executed, in this case isSafely mode will be triggered\n */\n async resizeWindow(width: number, height: number): Promise<void> {\n if (width > 0 && height > 0) {\n return this.#messageManager.send(MessageCommands.resizeWindow, {\n width,\n height,\n isSafely: true\n })\n }\n\n return Promise.reject(\n new Error(`Wrong width:number = ${width} or height:number = ${height}`)\n )\n }\n\n /**\n * Automatically resize `document.body` of frame with application according to frame content dimensions\n * If you pass appNode, the height will be calculated relative to it\n *\n * @param {HTMLElement|null} appNode\n * @param {number} minHeight\n * @param {number} minWidth\n *\n * @return {Promise<void>}\n */\n async resizeWindowAuto(\n appNode: null | HTMLElement = null,\n minHeight: number = 0,\n minWidth: number = 0\n ): Promise<void> {\n const body = document.body\n // const html = document.documentElement\n\n let width = Math.max(\n body.scrollWidth,\n body.offsetWidth\n\n // html.clientWidth,\n // html.scrollWidth,\n // html.offsetWidth\n )\n\n if (minWidth > 0) {\n width = Math.max(minWidth, width)\n }\n\n let height = Math.max(\n body.scrollHeight,\n body.offsetHeight\n\n // html.clientHeight,\n // html.scrollHeight,\n // html.offsetHeight\n )\n\n if (appNode) {\n height = Math.max(appNode.scrollHeight, appNode.offsetHeight)\n }\n\n if (minHeight > 0) {\n height = Math.max(minHeight, height)\n }\n\n return this.resizeWindow(width, height)\n }\n\n /**\n * This function returns the inner dimensions of the application frame\n *\n * @return {Promise<{scrollWidth: number; scrollHeight: number}>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-scroll-size.html\n */\n getScrollSize(): {\n scrollWidth: number\n scrollHeight: number\n } {\n return useScrollSize()\n }\n\n /**\n * Scrolls the parent window\n *\n * @param {number} scroll should specify the vertical scrollbar position (0 - scroll to the very top)\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-scroll-parent-window.html\n */\n async scrollParentWindow(scroll: number): Promise<void> {\n if (!Number.isInteger(scroll)) {\n return Promise.reject(new Error('Wrong scroll number'))\n }\n\n if (scroll < 0) {\n scroll = 0\n }\n\n return this.#messageManager.send(MessageCommands.setScroll, {\n scroll,\n isSafely: true\n })\n }\n\n /**\n * Reload the page with the application (the whole page, not just the frame).\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-reload-window.html\n */\n async reloadWindow(): Promise<void> {\n return this.#messageManager.send(MessageCommands.reloadWindow, {\n isSafely: true\n })\n }\n\n /**\n * Set Page Title\n *\n * @param {string} title\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-set-title.html\n */\n async setTitle(title: string): Promise<void> {\n return this.#messageManager.send(MessageCommands.setTitle, {\n title: title.toString(),\n isSafely: true\n })\n }\n\n /**\n * Initiates a call via internal communication\n *\n * @param {number} userId The identifier of the account user\n * @param {boolean} isVideo true - video call, false - audio call. Optional parameter.\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-call-to.html\n */\n async imCallTo(userId: number, isVideo: boolean = true): Promise<void> {\n return this.#messageManager.send(MessageCommands.imCallTo, {\n userId,\n video: isVideo,\n isSafely: true\n })\n }\n\n /**\n * Makes a call to the phone number\n *\n * @param {string} phone Phone number. The number can be in the format: `+44 20 1234 5678` or `x (xxx) xxx-xx-xx`\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-phone-to.html\n */\n async imPhoneTo(phone: string): Promise<void> {\n return this.#messageManager.send(MessageCommands.imPhoneTo, {\n phone,\n isSafely: true\n })\n }\n\n /**\n * Opens the messenger window\n * userId or chatXXX - chat, where XXX is the chat identifier, which can simply be a number.\n * sgXXX - group chat, where XXX is the social network group number (the chat must be enabled in this group).\n *\n * XXXX** - open line, where XXX is the code obtained via the Rest method imopenlines.network.join.\n *\n * If nothing is passed, the chat interface will open with the last opened dialog.\n *\n * @param {number|`chat${number}`|`sg${number}`|`imol|${number}`|undefined} dialogId\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-messenger.html\n * @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=93&LESSON_ID=20152&LESSON_PATH=7657.7883.8025.20150.20152\n *\n */\n async imOpenMessenger(\n dialogId:\n | number\n | `chat${number}`\n | `sg${number}`\n | `imol|${number}`\n | undefined\n ): Promise<void> {\n return this.#messageManager.send(MessageCommands.imOpenMessenger, {\n dialogId: dialogId,\n isSafely: true\n })\n }\n\n /**\n * Opens the history window\n * Identifier of the dialog:\n *\n * userId or chatXXX - chat, where XXX is the chat identifier, which can simply be a number.\n * imol|XXXX - open line, where XXX is the session number of the open line.\n *\n * @param {number|`chat${number}`|`imol|${number}`} dialogId\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-history.html\n */\n async imOpenHistory(\n dialogId: number | `chat${number}` | `imol|${number}`\n ): Promise<void> {\n return this.#messageManager.send(MessageCommands.imOpenHistory, {\n dialogId: dialogId,\n isSafely: true\n })\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AASO,MAAM,aAAA,CAAc;AAAA,EAT3B;AAS2B,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,EAEA,IAAI,OAAA,GAA0B;AAC5B,IAAA,OAAO,IAAA,CAAK,eAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,gBAAA,GAAkC;AACtC,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,gBAAA,EAAkB;AAAA;AAAA;AAAA;AAAA,MAIjE,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,SAAA,GAA0B;AAC9B,IAAA,MAAM,KAAA,GAAQ,MAAA;AACd,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,aAAA,EAAc,CAAE,YAAA;AAEpC,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,YAAA,EAAc;AAAA,MAC7D,KAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,YAAA,CAAa,KAAA,EAAe,MAAA,EAA+B;AAC/D,IAAA,IAAI,KAAA,GAAQ,CAAA,IAAK,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eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,QAAA,EAAU;AAAA,MACzD,MAAA;AAAA,MACA,KAAA,EAAO,OAAA;AAAA,MACP,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,UAAU,KAAA,EAA8B;AAC5C,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,SAAA,EAAW;AAAA,MAC1D,KAAA;AAAA,MACA,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBA,MAAM,gBACJ,QAAA,EAMe;AACf,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,eAAA,EAAiB;AAAA,MAChE,QAAA;AAAA,MACA,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,MAAM,cACJ,QAAA,EACe;AACf,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,aAAA,EAAe;AAAA,MAC9D,QAAA;AAAA,MACA,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"parent.mjs","sources":["../../../src/frame/parent.ts"],"sourcesContent":["import type { MessageManager } from './message'\nimport { MessageCommands } from './message'\nimport useScrollSize from '../tools/scroll-size'\n\n/**\n * Parent window manager\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/\n */\nexport class ParentManager {\n #messageManager: MessageManager\n\n constructor(messageManager: MessageManager) {\n this.#messageManager = messageManager\n }\n\n get message(): MessageManager {\n return this.#messageManager\n }\n\n /**\n * The method closes the open modal window with the application\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html\n */\n async closeApplication(): Promise<void> {\n return this.#messageManager.send(MessageCommands.closeApplication, {\n /**\n * @memo There is no point - everything will be closed, and timeout will not be able to do anything\n */\n isSafely: false\n })\n }\n\n /**\n * Sets the size of the frame containing the application to the size of the frame's content.\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-fit-window.html\n *\n * @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\n */\n async fitWindow(): Promise<any> {\n const width = '100%'\n const height = this.getScrollSize().scrollHeight\n\n return this.#messageManager.send(MessageCommands.resizeWindow, {\n width,\n height,\n isSafely: true\n })\n }\n\n /**\n * Sets the size of the frame containing the application to the size of the frame's content.\n *\n * @param {number} width\n * @param {number} height\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-resize-window.html\n *\n * @memo in certain situations it may not be executed, in this case isSafely mode will be triggered\n */\n async resizeWindow(width: number, height: number): Promise<void> {\n if (width > 0 && height > 0) {\n return this.#messageManager.send(MessageCommands.resizeWindow, {\n width,\n height,\n isSafely: true\n })\n }\n\n return Promise.reject(\n new Error(`Wrong width:number = ${width} or height:number = ${height}`)\n )\n }\n\n /**\n * Automatically resize `document.body` of frame with application according to frame content dimensions\n * If you pass appNode, the height will be calculated relative to it\n *\n * @param {HTMLElement|null} appNode\n * @param {number} minHeight\n * @param {number} minWidth\n *\n * @return {Promise<void>}\n */\n async resizeWindowAuto(\n appNode: null | HTMLElement = null,\n minHeight: number = 0,\n minWidth: number = 0\n ): Promise<void> {\n const body = document.body\n // const html = document.documentElement\n\n let width = Math.max(\n body.scrollWidth,\n body.offsetWidth\n\n // html.clientWidth,\n // html.scrollWidth,\n // html.offsetWidth\n )\n\n if (minWidth > 0) {\n width = Math.max(minWidth, width)\n }\n\n let height = Math.max(\n body.scrollHeight,\n body.offsetHeight\n\n // html.clientHeight,\n // html.scrollHeight,\n // html.offsetHeight\n )\n\n if (appNode) {\n height = Math.max(appNode.scrollHeight, appNode.offsetHeight)\n }\n\n if (minHeight > 0) {\n height = Math.max(minHeight, height)\n }\n\n return this.resizeWindow(width, height)\n }\n\n /**\n * This function returns the inner dimensions of the application frame\n *\n * @return {Promise<{scrollWidth: number; scrollHeight: number}>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-scroll-size.html\n */\n getScrollSize(): {\n scrollWidth: number\n scrollHeight: number\n } {\n return useScrollSize()\n }\n\n /**\n * Scrolls the parent window\n *\n * @param {number} scroll should specify the vertical scrollbar position (0 - scroll to the very top)\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-scroll-parent-window.html\n */\n async scrollParentWindow(scroll: number): Promise<void> {\n if (!Number.isInteger(scroll)) {\n return Promise.reject(new Error('Wrong scroll number'))\n }\n\n if (scroll < 0) {\n scroll = 0\n }\n\n return this.#messageManager.send(MessageCommands.setScroll, {\n scroll,\n isSafely: true\n })\n }\n\n /**\n * Reload the page with the application (the whole page, not just the frame).\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-reload-window.html\n */\n async reloadWindow(): Promise<void> {\n return this.#messageManager.send(MessageCommands.reloadWindow, {\n isSafely: true\n })\n }\n\n /**\n * Sets the in-layout page title (the `#pagetitle` element the portal renders around the app).\n *\n * Does NOT change the browser tab title (`document.title`): the portal applies this command to\n * `#pagetitle`, never to the tab. To set the browser tab title, open the view as a slider via\n * `SliderManager.openSliderAppPage` with a `bx24_title` option.\n *\n * @param {string} title\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-set-title.html\n */\n async setTitle(title: string): Promise<void> {\n return this.#messageManager.send(MessageCommands.setTitle, {\n title: title.toString(),\n isSafely: true\n })\n }\n\n /**\n * Initiates a call via internal communication\n *\n * @param {number} userId The identifier of the account user\n * @param {boolean} isVideo true - video call, false - audio call. Optional parameter.\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-call-to.html\n */\n async imCallTo(userId: number, isVideo: boolean = true): Promise<void> {\n return this.#messageManager.send(MessageCommands.imCallTo, {\n userId,\n video: isVideo,\n isSafely: true\n })\n }\n\n /**\n * Makes a call to the phone number\n *\n * @param {string} phone Phone number. The number can be in the format: `+44 20 1234 5678` or `x (xxx) xxx-xx-xx`\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-phone-to.html\n */\n async imPhoneTo(phone: string): Promise<void> {\n return this.#messageManager.send(MessageCommands.imPhoneTo, {\n phone,\n isSafely: true\n })\n }\n\n /**\n * Opens the messenger window\n * userId or chatXXX - chat, where XXX is the chat identifier, which can simply be a number.\n * sgXXX - group chat, where XXX is the social network group number (the chat must be enabled in this group).\n *\n * XXXX** - open line, where XXX is the code obtained via the Rest method imopenlines.network.join.\n *\n * If nothing is passed, the chat interface will open with the last opened dialog.\n *\n * @param {number|`chat${number}`|`sg${number}`|`imol|${number}`|undefined} dialogId\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-messenger.html\n * @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=93&LESSON_ID=20152&LESSON_PATH=7657.7883.8025.20150.20152\n *\n */\n async imOpenMessenger(\n dialogId:\n | number\n | `chat${number}`\n | `sg${number}`\n | `imol|${number}`\n | undefined\n ): Promise<void> {\n return this.#messageManager.send(MessageCommands.imOpenMessenger, {\n dialogId: dialogId,\n isSafely: true\n })\n }\n\n /**\n * Opens the history window\n * Identifier of the dialog:\n *\n * userId or chatXXX - chat, where XXX is the chat identifier, which can simply be a number.\n * imol|XXXX - open line, where XXX is the session number of the open line.\n *\n * @param {number|`chat${number}`|`imol|${number}`} dialogId\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-history.html\n */\n async imOpenHistory(\n dialogId: number | `chat${number}` | `imol|${number}`\n ): Promise<void> {\n return this.#messageManager.send(MessageCommands.imOpenHistory, {\n dialogId: dialogId,\n isSafely: true\n })\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AASO,MAAM,aAAA,CAAc;AAAA,EAT3B;AAS2B,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,EAEA,IAAI,OAAA,GAA0B;AAC5B,IAAA,OAAO,IAAA,CAAK,eAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,gBAAA,GAAkC;AACtC,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,gBAAA,EAAkB;AAAA;AAAA;AAAA;AAAA,MAIjE,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,SAAA,GAA0B;AAC9B,IAAA,MAAM,KAAA,GAAQ,MAAA;AACd,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,aAAA,EAAc,CAAE,YAAA;AAEpC,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,YAAA,EAAc;AAAA,MAC7D,KAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA,EAAU;AAAA,KACX,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24/b24jssdk
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.3.0
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -35,6 +35,10 @@ class SliderManager {
|
|
|
35
35
|
/**
|
|
36
36
|
* When the method is called, a pop-up window with the application frame will be opened.
|
|
37
37
|
*
|
|
38
|
+
* Settings are passed via `bx24_`-prefixed keys (e.g. `bx24_title`, `bx24_width`).
|
|
39
|
+
* `bx24_title` sets the slider title; the portal also reflects it to the browser tab title
|
|
40
|
+
* (`document.title`) — unlike `ParentManager.setTitle`, which only updates the in-layout `#pagetitle`.
|
|
41
|
+
*
|
|
38
42
|
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html
|
|
39
43
|
*/
|
|
40
44
|
async openSliderAppPage(params = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.mjs","sources":["../../../src/frame/slider.ts"],"sourcesContent":["import type { AppFrame } from './frame'\nimport type { MessageManager } from './message'\nimport { MessageCommands } from './message'\nimport type { StatusClose } from '../types/slider'\n\n/**\n * Sliders Manager\n */\nexport class SliderManager {\n #appFrame: AppFrame\n #messageManager: MessageManager\n\n constructor(appFrame: AppFrame, messageManager: MessageManager) {\n this.#appFrame = appFrame\n this.#messageManager = messageManager\n }\n\n /**\n * Returns the URL relative to the domain name and path\n */\n getUrl(path: string = '/'): URL {\n return new URL(path, this.#appFrame.getTargetOrigin())\n }\n\n /**\n * Get the account address BX24\n */\n getTargetOrigin(): string {\n return this.#appFrame.getTargetOrigin()\n }\n\n /**\n * When the method is called, a pop-up window with the application frame will be opened.\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html\n */\n async openSliderAppPage(params: any = {}): Promise<any> {\n return this.#messageManager.send(MessageCommands.openApplication, params)\n }\n\n /**\n * The method closes the open modal window with the application\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html\n */\n async closeSliderAppPage(): Promise<void> {\n return this.#messageManager.send(MessageCommands.closeApplication, {\n /**\n * @memo There is no point - everything will be closed, and timeout will not be able to do anything\n */\n isSafely: false\n })\n }\n\n /**\n * Defines the base path for width sampling.\n *\n * @param width\n * @private\n */\n #getBaseUrlByWidth(width: number = 1640): string {\n if (width > 0) {\n // region Init baseUrl by Width ////\n if (width > 1200 && width <= 1640) {\n return '/crm/type/0/details/0/../../../../..'\n } else if (width > 950 && width <= 1200) {\n return '/company/personal/user/0/groups/create/../../../../../..'\n } else if (width > 900 && width <= 950) {\n return '/crm/company/requisite/0/../../../..'\n } else if (width <= 900) {\n return '/workgroups/group/0/card/../../../..'\n } else {\n // 1640 /////\n return '/crm/deal/../..'\n }\n // endregion ////\n } else {\n return '/crm/deal/../..'\n }\n }\n\n /**\n * Opens the specified path inside the portal in the slider.\n * @param {URL} url\n * @param {number} width - Number in the range from 1640 to 1200, from 1200 to 950, from 950 to 900, from 900 ...\n * @return {Promise<StatusClose>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-path.html\n * @memo /^\\/(crm\\/(deal|lead|contact|company|type)|marketplace|company\\/personal\\/user\\/[0-9]+|workgroups\\/group\\/[0-9]+)\\//\n */\n async openPath(url: URL, width: number = 1640): Promise<StatusClose> {\n const openSliderUrl = new URL(url)\n openSliderUrl.searchParams.set('IFRAME', 'Y')\n openSliderUrl.searchParams.set('IFRAME_TYPE', 'SIDE_SLIDER')\n\n /**\n * We are trying to open the slider\n */\n return this.#messageManager\n .send(MessageCommands.openPath, {\n path: [\n this.#getBaseUrlByWidth(width),\n openSliderUrl.pathname,\n openSliderUrl.search\n ].join('')\n })\n .then((response) => {\n /**\n * Error handling\n */\n if (response?.result === 'error') {\n /**\n * If the error is related to using a mobile device, we will open it in a new tab\n * Let's wait 5 minutes - and return the promise to open and not close\n */\n if (response?.errorCode === 'METHOD_NOT_SUPPORTED_ON_DEVICE') {\n return new Promise((resolve, reject) => {\n const windowObjectReference = window.open(url, '_blank')\n if (!windowObjectReference) {\n reject(new Error('Error open window'))\n return\n }\n\n let iterator = 0\n // 5 min ////\n const iteratorMax = 1_000 * 60 * 5\n const waitCloseWindow = window.setInterval(() => {\n iterator = iterator + 1\n\n if (windowObjectReference.closed) {\n clearInterval(waitCloseWindow)\n resolve({\n isOpenAtNewWindow: true,\n isClose: true\n })\n } else if (iterator > iteratorMax) {\n clearInterval(waitCloseWindow)\n resolve({\n isOpenAtNewWindow: true,\n isClose: false\n })\n }\n }, 1_000)\n })\n } else {\n /**\n * If the error is different, we will return it.\n */\n return Promise.reject(new Error(response?.errorCode))\n }\n } else if (response?.result === 'close') {\n /**\n * Processing a successful close\n */\n return Promise.resolve({\n isOpenAtNewWindow: false,\n isClose: true\n })\n }\n\n return Promise.resolve({\n isOpenAtNewWindow: false,\n isClose: false\n })\n })\n }\n\n /**\n * @todo test this and remove\n */\n // async showAppForm(params: any): Promise<void> {\n // console.warn(`deprecated showAppForm`)\n // return this.#messageManager.send(MessageCommands.showAppForm, {\n // params: params,\n // isSafely: true\n // })\n // }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAQO,MAAM,aAAA,CAAc;AAAA,EAR3B;AAQ2B,IAAA,MAAA,CAAA,IAAA,EAAA,eAAA,CAAA;AAAA;AAAA,EACzB,SAAA;AAAA,EACA,eAAA;AAAA,EAEA,WAAA,CAAY,UAAoB,cAAA,EAAgC;AAC9D,IAAA,IAAA,CAAK,SAAA,GAAY,QAAA;AACjB,IAAA,IAAA,CAAK,eAAA,GAAkB,cAAA;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA,CAAO,OAAe,GAAA,EAAU;AAC9B,IAAA,OAAO,IAAI,GAAA,CAAI,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,iBAAiB,CAAA;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA,EAKA,eAAA,GAA0B;AACxB,IAAA,OAAO,IAAA,CAAK,UAAU,eAAA,EAAgB;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"slider.mjs","sources":["../../../src/frame/slider.ts"],"sourcesContent":["import type { AppFrame } from './frame'\nimport type { MessageManager } from './message'\nimport { MessageCommands } from './message'\nimport type { StatusClose } from '../types/slider'\n\n/**\n * Sliders Manager\n */\nexport class SliderManager {\n #appFrame: AppFrame\n #messageManager: MessageManager\n\n constructor(appFrame: AppFrame, messageManager: MessageManager) {\n this.#appFrame = appFrame\n this.#messageManager = messageManager\n }\n\n /**\n * Returns the URL relative to the domain name and path\n */\n getUrl(path: string = '/'): URL {\n return new URL(path, this.#appFrame.getTargetOrigin())\n }\n\n /**\n * Get the account address BX24\n */\n getTargetOrigin(): string {\n return this.#appFrame.getTargetOrigin()\n }\n\n /**\n * When the method is called, a pop-up window with the application frame will be opened.\n *\n * Settings are passed via `bx24_`-prefixed keys (e.g. `bx24_title`, `bx24_width`).\n * `bx24_title` sets the slider title; the portal also reflects it to the browser tab title\n * (`document.title`) — unlike `ParentManager.setTitle`, which only updates the in-layout `#pagetitle`.\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html\n */\n async openSliderAppPage(params: any = {}): Promise<any> {\n return this.#messageManager.send(MessageCommands.openApplication, params)\n }\n\n /**\n * The method closes the open modal window with the application\n *\n * @return {Promise<void>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html\n */\n async closeSliderAppPage(): Promise<void> {\n return this.#messageManager.send(MessageCommands.closeApplication, {\n /**\n * @memo There is no point - everything will be closed, and timeout will not be able to do anything\n */\n isSafely: false\n })\n }\n\n /**\n * Defines the base path for width sampling.\n *\n * @param width\n * @private\n */\n #getBaseUrlByWidth(width: number = 1640): string {\n if (width > 0) {\n // region Init baseUrl by Width ////\n if (width > 1200 && width <= 1640) {\n return '/crm/type/0/details/0/../../../../..'\n } else if (width > 950 && width <= 1200) {\n return '/company/personal/user/0/groups/create/../../../../../..'\n } else if (width > 900 && width <= 950) {\n return '/crm/company/requisite/0/../../../..'\n } else if (width <= 900) {\n return '/workgroups/group/0/card/../../../..'\n } else {\n // 1640 /////\n return '/crm/deal/../..'\n }\n // endregion ////\n } else {\n return '/crm/deal/../..'\n }\n }\n\n /**\n * Opens the specified path inside the portal in the slider.\n * @param {URL} url\n * @param {number} width - Number in the range from 1640 to 1200, from 1200 to 950, from 950 to 900, from 900 ...\n * @return {Promise<StatusClose>}\n *\n * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-path.html\n * @memo /^\\/(crm\\/(deal|lead|contact|company|type)|marketplace|company\\/personal\\/user\\/[0-9]+|workgroups\\/group\\/[0-9]+)\\//\n */\n async openPath(url: URL, width: number = 1640): Promise<StatusClose> {\n const openSliderUrl = new URL(url)\n openSliderUrl.searchParams.set('IFRAME', 'Y')\n openSliderUrl.searchParams.set('IFRAME_TYPE', 'SIDE_SLIDER')\n\n /**\n * We are trying to open the slider\n */\n return this.#messageManager\n .send(MessageCommands.openPath, {\n path: [\n this.#getBaseUrlByWidth(width),\n openSliderUrl.pathname,\n openSliderUrl.search\n ].join('')\n })\n .then((response) => {\n /**\n * Error handling\n */\n if (response?.result === 'error') {\n /**\n * If the error is related to using a mobile device, we will open it in a new tab\n * Let's wait 5 minutes - and return the promise to open and not close\n */\n if (response?.errorCode === 'METHOD_NOT_SUPPORTED_ON_DEVICE') {\n return new Promise((resolve, reject) => {\n const windowObjectReference = window.open(url, '_blank')\n if (!windowObjectReference) {\n reject(new Error('Error open window'))\n return\n }\n\n let iterator = 0\n // 5 min ////\n const iteratorMax = 1_000 * 60 * 5\n const waitCloseWindow = window.setInterval(() => {\n iterator = iterator + 1\n\n if (windowObjectReference.closed) {\n clearInterval(waitCloseWindow)\n resolve({\n isOpenAtNewWindow: true,\n isClose: true\n })\n } else if (iterator > iteratorMax) {\n clearInterval(waitCloseWindow)\n resolve({\n isOpenAtNewWindow: true,\n isClose: false\n })\n }\n }, 1_000)\n })\n } else {\n /**\n * If the error is different, we will return it.\n */\n return Promise.reject(new Error(response?.errorCode))\n }\n } else if (response?.result === 'close') {\n /**\n * Processing a successful close\n */\n return Promise.resolve({\n isOpenAtNewWindow: false,\n isClose: true\n })\n }\n\n return Promise.resolve({\n isOpenAtNewWindow: false,\n isClose: false\n })\n })\n }\n\n /**\n * @todo test this and remove\n */\n // async showAppForm(params: any): Promise<void> {\n // console.warn(`deprecated showAppForm`)\n // return this.#messageManager.send(MessageCommands.showAppForm, {\n // params: params,\n // isSafely: true\n // })\n // }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAQO,MAAM,aAAA,CAAc;AAAA,EAR3B;AAQ2B,IAAA,MAAA,CAAA,IAAA,EAAA,eAAA,CAAA;AAAA;AAAA,EACzB,SAAA;AAAA,EACA,eAAA;AAAA,EAEA,WAAA,CAAY,UAAoB,cAAA,EAAgC;AAC9D,IAAA,IAAA,CAAK,SAAA,GAAY,QAAA;AACjB,IAAA,IAAA,CAAK,eAAA,GAAkB,cAAA;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA,CAAO,OAAe,GAAA,EAAU;AAC9B,IAAA,OAAO,IAAI,GAAA,CAAI,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,iBAAiB,CAAA;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA,EAKA,eAAA,GAA0B;AACxB,IAAA,OAAO,IAAA,CAAK,UAAU,eAAA,EAAgB;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,iBAAA,CAAkB,MAAA,GAAc,EAAC,EAAiB;AACtD,IAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,iBAAiB,MAAM,CAAA;A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UACV,CAAC,CAAA;AAAA,QACH,CAAA,MAAO;AAIL,UAAA,OAAO,QAAQ,MAAA,CAAO,IAAI,KAAA,CAAM,QAAA,EAAU,SAAS,CAAC,CAAA;AAAA,QACtD;AAAA,MACF,CAAA,MAAA,IAAW,QAAA,EAAU,MAAA,KAAW,OAAA,EAAS;AAIvC,QAAA,OAAO,QAAQ,OAAA,CAAQ;AAAA,UACrB,iBAAA,EAAmB,KAAA;AAAA,UACnB,OAAA,EAAS;AAAA,SACV,CAAA;AAAA,MACH;AAEA,MAAA,OAAO,QAAQ,OAAA,CAAQ;AAAA,QACrB,iBAAA,EAAmB,KAAA;AAAA,QACnB,OAAA,EAAS;AAAA,OACV,CAAA;AAAA,IACH,CAAC,CAAA;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYF;;;;"}
|
package/dist/esm/hook/auth.mjs
CHANGED
package/dist/esm/hook/b24.mjs
CHANGED
package/dist/esm/index.d.mts
CHANGED
|
@@ -1006,6 +1006,7 @@ interface IResult<T = any> {
|
|
|
1006
1006
|
* Retrieves an iterator for the errors collected in the result.
|
|
1007
1007
|
*
|
|
1008
1008
|
* @returns {IterableIterator<Error>} An iterator over the stored Error objects.
|
|
1009
|
+
* @see {@link IResult.getErrorsByKey} — keeps the request keys.
|
|
1009
1010
|
*/
|
|
1010
1011
|
getErrors: () => IterableIterator<Error>;
|
|
1011
1012
|
/**
|
|
@@ -1014,6 +1015,21 @@ interface IResult<T = any> {
|
|
|
1014
1015
|
* @returns {string[]} An array of strings representing the error messages.
|
|
1015
1016
|
*/
|
|
1016
1017
|
getErrorMessages: () => string[];
|
|
1018
|
+
/**
|
|
1019
|
+
* Retrieves all errors keyed by their identifier (e.g. the batch request key),
|
|
1020
|
+
* preserving which request produced each error. Unlike {@link getErrors}, the
|
|
1021
|
+
* keys are not discarded — useful for batch calls with `isHaltOnError: false`.
|
|
1022
|
+
*
|
|
1023
|
+
* @returns {Record<string, Error>} A map of error key to Error object.
|
|
1024
|
+
*/
|
|
1025
|
+
getErrorsByKey: () => Record<string, Error>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Retrieves all error messages keyed by their identifier (e.g. the batch
|
|
1028
|
+
* request key). Unlike {@link getErrorMessages}, the keys are preserved.
|
|
1029
|
+
*
|
|
1030
|
+
* @returns {Record<string, string>} A map of error key to error message.
|
|
1031
|
+
*/
|
|
1032
|
+
getErrorMessagesByKey: () => Record<string, string>;
|
|
1017
1033
|
/**
|
|
1018
1034
|
* Checks for an error in a collection by key
|
|
1019
1035
|
* @param key - Error key
|
|
@@ -1050,6 +1066,27 @@ declare class Result<T = any> implements IResult<T> {
|
|
|
1050
1066
|
* contains the message of a corresponding error object.
|
|
1051
1067
|
*/
|
|
1052
1068
|
getErrorMessages(): string[];
|
|
1069
|
+
/**
|
|
1070
|
+
* Retrieves all errors as a plain object (a snapshot copy) keyed by their
|
|
1071
|
+
* identifier, preserving which request produced each error. Unlike
|
|
1072
|
+
* {@link Result.getErrors}, the keys are not discarded — useful for batch
|
|
1073
|
+
* calls with `isHaltOnError: false`.
|
|
1074
|
+
*
|
|
1075
|
+
* Keys are meaningful only when the error was added with an explicit key
|
|
1076
|
+
* (e.g. an object / named-command batch). Array-mode batches and
|
|
1077
|
+
* {@link Result.addErrors} fall back to generated UUID keys.
|
|
1078
|
+
*
|
|
1079
|
+
* @returns {Record<string, Error>} A map of error key to Error object.
|
|
1080
|
+
*/
|
|
1081
|
+
getErrorsByKey(): Record<string, Error>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Retrieves all error messages as a plain object (a snapshot copy) keyed by
|
|
1084
|
+
* their identifier. Unlike {@link Result.getErrorMessages}, the keys are
|
|
1085
|
+
* preserved. See {@link Result.getErrorsByKey} for when keys are meaningful.
|
|
1086
|
+
*
|
|
1087
|
+
* @returns {Record<string, string>} A map of error key to error message.
|
|
1088
|
+
*/
|
|
1089
|
+
getErrorMessagesByKey(): Record<string, string>;
|
|
1053
1090
|
/**
|
|
1054
1091
|
* Converts the Result object to a string.
|
|
1055
1092
|
*
|
|
@@ -1465,6 +1502,7 @@ type ActionCallListV2 = ActionOptions & {
|
|
|
1465
1502
|
method: string;
|
|
1466
1503
|
params?: Omit<TypeCallParams, 'start' | 'order'>;
|
|
1467
1504
|
idKey?: string;
|
|
1505
|
+
cursorIdKey?: string;
|
|
1468
1506
|
customKeyForResult?: string;
|
|
1469
1507
|
requestId?: string;
|
|
1470
1508
|
};
|
|
@@ -1481,12 +1519,16 @@ declare class CallListV2 extends AbstractAction {
|
|
|
1481
1519
|
*
|
|
1482
1520
|
* @param {ActionCallListV2} options - parameters for executing the request.
|
|
1483
1521
|
* - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
|
|
1484
|
-
* - `params?: Omit<TypeCallParams, 'start'>` - Request parameters, excluding the `start`
|
|
1522
|
+
* - `params?: Omit<TypeCallParams, 'start' | 'order'>` - Request parameters, excluding the `start` and `order` parameters,
|
|
1485
1523
|
* since the method is designed to obtain all data in one call.
|
|
1486
1524
|
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
1487
|
-
* - `idKey?: string` - The name of the field
|
|
1488
|
-
* Default is 'ID' (uppercase).
|
|
1489
|
-
*
|
|
1525
|
+
* - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
|
|
1526
|
+
* drives the cursor. Default is 'ID' (uppercase). For methods that return a lowercase /
|
|
1527
|
+
* camelCase id (for example `tasks.task.list` returns `id`), set `idKey: 'id'`.
|
|
1528
|
+
* - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the `>` page
|
|
1529
|
+
* filter. Defaults to `idKey`. Set it only when the sortable / filterable field name differs
|
|
1530
|
+
* from the response field name — e.g. `tasks.task.list` sorts and filters by `ID` (uppercase)
|
|
1531
|
+
* but returns `id` (lowercase): pass `idKey: 'id', cursorIdKey: 'ID'`.
|
|
1490
1532
|
* - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
|
|
1491
1533
|
* grouped by this field.
|
|
1492
1534
|
* Example: `items` to group a list of CRM items.
|
|
@@ -1528,6 +1570,7 @@ type ActionFetchListV2 = ActionOptions & {
|
|
|
1528
1570
|
method: string;
|
|
1529
1571
|
params?: Omit<TypeCallParams, 'start' | 'order'>;
|
|
1530
1572
|
idKey?: string;
|
|
1573
|
+
cursorIdKey?: string;
|
|
1531
1574
|
customKeyForResult?: string;
|
|
1532
1575
|
requestId?: string;
|
|
1533
1576
|
};
|
|
@@ -1545,12 +1588,16 @@ declare class FetchListV2 extends AbstractAction {
|
|
|
1545
1588
|
*
|
|
1546
1589
|
* @param {ActionFetchListV2} options - parameters for executing the request.
|
|
1547
1590
|
* - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
|
|
1548
|
-
* - `params?: Omit<TypeCallParams, 'start'>` - Request parameters, excluding the `start`
|
|
1591
|
+
* - `params?: Omit<TypeCallParams, 'start' | 'order'>` - Request parameters, excluding the `start` and `order` parameters,
|
|
1549
1592
|
* since the method is designed to obtain all data in one call.
|
|
1550
1593
|
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
1551
|
-
* - `idKey?: string` - The name of the field
|
|
1552
|
-
* Default is 'ID' (uppercase).
|
|
1553
|
-
*
|
|
1594
|
+
* - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
|
|
1595
|
+
* drives the cursor. Default is 'ID' (uppercase). For methods that return a lowercase /
|
|
1596
|
+
* camelCase id (for example `tasks.task.list` returns `id`), set `idKey: 'id'`.
|
|
1597
|
+
* - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the `>` page
|
|
1598
|
+
* filter. Defaults to `idKey`. Set it only when the sortable / filterable field name differs
|
|
1599
|
+
* from the response field name — e.g. `tasks.task.list` sorts and filters by `ID` (uppercase)
|
|
1600
|
+
* but returns `id` (lowercase): pass `idKey: 'id', cursorIdKey: 'ID'`.
|
|
1554
1601
|
* - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
|
|
1555
1602
|
* grouped by this field.
|
|
1556
1603
|
* Example: `items` to group a list of CRM items.
|
|
@@ -1833,6 +1880,7 @@ type ActionCallListV3 = ActionOptions & {
|
|
|
1833
1880
|
method: string;
|
|
1834
1881
|
params?: Omit<TypeCallParams, 'pagination' | 'order'>;
|
|
1835
1882
|
idKey?: string;
|
|
1883
|
+
cursorIdKey?: string;
|
|
1836
1884
|
customKeyForResult: string;
|
|
1837
1885
|
requestId?: string;
|
|
1838
1886
|
limit?: number;
|
|
@@ -1850,11 +1898,15 @@ declare class CallListV3 extends AbstractAction {
|
|
|
1850
1898
|
*
|
|
1851
1899
|
* @param {ActionCallListV3} options - parameters for executing the request.
|
|
1852
1900
|
* - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
|
|
1853
|
-
* - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination`
|
|
1901
|
+
* - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,
|
|
1854
1902
|
* since the method is designed to obtain all data in one call.
|
|
1855
1903
|
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
1856
|
-
* - `idKey?: string` - The name of the field
|
|
1857
|
-
* Default is 'id'.
|
|
1904
|
+
* - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
|
|
1905
|
+
* drives the cursor. Default is 'id'. Set it to match the id field the method returns.
|
|
1906
|
+
* - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the
|
|
1907
|
+
* `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /
|
|
1908
|
+
* filterable field name differs from the response field name (e.g. an uppercase request
|
|
1909
|
+
* field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.
|
|
1858
1910
|
* - `customKeyForResult: string` - A custom key indicating that the response REST API will be
|
|
1859
1911
|
* grouped by this field.
|
|
1860
1912
|
* Example: `items` to group a list of CRM items.
|
|
@@ -1896,6 +1948,7 @@ type ActionFetchListV3 = ActionOptions & {
|
|
|
1896
1948
|
method: string;
|
|
1897
1949
|
params?: Omit<TypeCallParams, 'pagination' | 'order'>;
|
|
1898
1950
|
idKey?: string;
|
|
1951
|
+
cursorIdKey?: string;
|
|
1899
1952
|
customKeyForResult: string;
|
|
1900
1953
|
requestId?: string;
|
|
1901
1954
|
limit?: number;
|
|
@@ -1914,11 +1967,15 @@ declare class FetchListV3 extends AbstractAction {
|
|
|
1914
1967
|
*
|
|
1915
1968
|
* @param {ActionFetchListV3} options - parameters for executing the request.
|
|
1916
1969
|
* - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
|
|
1917
|
-
* - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination`
|
|
1970
|
+
* - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,
|
|
1918
1971
|
* since the method is designed to obtain all data in one call.
|
|
1919
1972
|
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
1920
|
-
* - `idKey?: string` - The name of the field
|
|
1921
|
-
* Default is 'id'.
|
|
1973
|
+
* - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
|
|
1974
|
+
* drives the cursor. Default is 'id'. Set it to match the id field the method returns.
|
|
1975
|
+
* - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the
|
|
1976
|
+
* `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /
|
|
1977
|
+
* filterable field name differs from the response field name (e.g. an uppercase request
|
|
1978
|
+
* field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.
|
|
1922
1979
|
* - `customKeyForResult: string` - A custom key indicating that the response REST API will be
|
|
1923
1980
|
* grouped by this field.
|
|
1924
1981
|
* Example: `items` to group a list of CRM items.
|
|
@@ -4053,7 +4110,9 @@ declare class RestrictionManager {
|
|
|
4053
4110
|
}
|
|
4054
4111
|
|
|
4055
4112
|
/**
|
|
4056
|
-
*
|
|
4113
|
+
* Decides which REST API version (v2 or v3) a method is routed through:
|
|
4114
|
+
* v3 only for methods on the published allowlist (`#supportMethods`); everything
|
|
4115
|
+
* else falls back to v2.
|
|
4057
4116
|
*/
|
|
4058
4117
|
declare class VersionManager {
|
|
4059
4118
|
#private;
|
|
@@ -4226,6 +4285,12 @@ declare abstract class AbstractHttp implements TypeHttp {
|
|
|
4226
4285
|
protected _authActions: AuthActions;
|
|
4227
4286
|
protected _requestIdGenerator: RequestIdGenerator;
|
|
4228
4287
|
protected _restrictionManager: RestrictionManager;
|
|
4288
|
+
/**
|
|
4289
|
+
* In-flight token refresh, shared so concurrent 401s coalesce into a single
|
|
4290
|
+
* `refreshAuth()` round-trip — avoids OAuth refresh-token reuse errors when a
|
|
4291
|
+
* burst of requests expires together. (#182)
|
|
4292
|
+
*/
|
|
4293
|
+
protected _pendingRefresh: Promise<AuthData> | null;
|
|
4229
4294
|
protected _logger: LoggerInterface;
|
|
4230
4295
|
protected _isClientSideWarning: boolean;
|
|
4231
4296
|
protected _clientSideWarningMessage: string;
|
|
@@ -4298,6 +4363,12 @@ declare abstract class AbstractHttp implements TypeHttp {
|
|
|
4298
4363
|
*/
|
|
4299
4364
|
protected _executeSingleCall<T = unknown>(requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>>;
|
|
4300
4365
|
protected _ensureAuth(requestId: string): Promise<AuthData>;
|
|
4366
|
+
/**
|
|
4367
|
+
* Refresh the auth token, coalescing concurrent callers onto a single
|
|
4368
|
+
* in-flight `refreshAuth()` so a burst of 401s triggers exactly one refresh
|
|
4369
|
+
* round-trip. The slot clears once the refresh settles. (#182)
|
|
4370
|
+
*/
|
|
4371
|
+
protected _refreshAuth(): Promise<AuthData>;
|
|
4301
4372
|
protected _makeRequestWithAuthRetry<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>>;
|
|
4302
4373
|
protected _makeAxiosRequest<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>>;
|
|
4303
4374
|
protected _isAuthError(error: unknown): boolean;
|
|
@@ -4785,7 +4856,11 @@ declare class ParentManager {
|
|
|
4785
4856
|
*/
|
|
4786
4857
|
reloadWindow(): Promise<void>;
|
|
4787
4858
|
/**
|
|
4788
|
-
*
|
|
4859
|
+
* Sets the in-layout page title (the `#pagetitle` element the portal renders around the app).
|
|
4860
|
+
*
|
|
4861
|
+
* Does NOT change the browser tab title (`document.title`): the portal applies this command to
|
|
4862
|
+
* `#pagetitle`, never to the tab. To set the browser tab title, open the view as a slider via
|
|
4863
|
+
* `SliderManager.openSliderAppPage` with a `bx24_title` option.
|
|
4789
4864
|
*
|
|
4790
4865
|
* @param {string} title
|
|
4791
4866
|
*
|
|
@@ -5060,6 +5135,10 @@ declare class SliderManager {
|
|
|
5060
5135
|
/**
|
|
5061
5136
|
* When the method is called, a pop-up window with the application frame will be opened.
|
|
5062
5137
|
*
|
|
5138
|
+
* Settings are passed via `bx24_`-prefixed keys (e.g. `bx24_title`, `bx24_width`).
|
|
5139
|
+
* `bx24_title` sets the slider title; the portal also reflects it to the browser tab title
|
|
5140
|
+
* (`document.title`) — unlike `ParentManager.setTitle`, which only updates the in-layout `#pagetitle`.
|
|
5141
|
+
*
|
|
5063
5142
|
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html
|
|
5064
5143
|
*/
|
|
5065
5144
|
openSliderAppPage(params?: any): Promise<any>;
|