@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
package/dist/esm/tools/index.mjs
CHANGED
package/dist/esm/tools/text.mjs
CHANGED
package/dist/esm/tools/type.mjs
CHANGED
package/dist/esm/types/b24.mjs
CHANGED
package/dist/esm/types/pull.mjs
CHANGED
package/dist/umd/index.js
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
|
|
@@ -10644,8 +10644,6 @@ ${this.stack}`;
|
|
|
10644
10644
|
const payload = this._data;
|
|
10645
10645
|
return Object.freeze({
|
|
10646
10646
|
result: payload.result,
|
|
10647
|
-
next: "next" in payload ? payload.next : void 0,
|
|
10648
|
-
total: "total" in payload ? payload.total : void 0,
|
|
10649
10647
|
time: payload.time
|
|
10650
10648
|
});
|
|
10651
10649
|
}
|
|
@@ -10702,10 +10700,27 @@ ${this.stack}`;
|
|
|
10702
10700
|
}
|
|
10703
10701
|
/**
|
|
10704
10702
|
* Alias for isMore
|
|
10703
|
+
*
|
|
10704
|
+
* @deprecated Will be removed in `2.0.0`. Tied to the `restApi:v2` envelope
|
|
10705
|
+
* field `next`, which `restApi:v3` does not return. Use the SDK's list
|
|
10706
|
+
* helpers — they hide pagination entirely:
|
|
10707
|
+
* - `restApi:v2`: {@link CallListV2.make `b24.actions.v2.callList.make`} or {@link FetchListV2.make `b24.actions.v2.fetchList.make`}
|
|
10708
|
+
* - `restApi:v3`: {@link CallListV3.make `b24.actions.v3.callList.make`} or {@link FetchListV3.make `b24.actions.v3.fetchList.make`}
|
|
10709
|
+
*
|
|
10710
|
+
* @removed 2.0.0
|
|
10705
10711
|
*/
|
|
10706
10712
|
hasMore() {
|
|
10707
10713
|
return this.isMore();
|
|
10708
10714
|
}
|
|
10715
|
+
/**
|
|
10716
|
+
* @deprecated Will be removed in `2.0.0`. Tied to the `restApi:v2` envelope
|
|
10717
|
+
* field `next`, which `restApi:v3` does not return. Use the SDK's list
|
|
10718
|
+
* helpers — they hide pagination entirely:
|
|
10719
|
+
* - `restApi:v2`: {@link CallListV2.make `b24.actions.v2.callList.make`} or {@link FetchListV2.make `b24.actions.v2.fetchList.make`}
|
|
10720
|
+
* - `restApi:v3`: {@link CallListV3.make `b24.actions.v3.callList.make`} or {@link FetchListV3.make `b24.actions.v3.fetchList.make`}
|
|
10721
|
+
*
|
|
10722
|
+
* @removed 2.0.0
|
|
10723
|
+
*/
|
|
10709
10724
|
isMore() {
|
|
10710
10725
|
if (!this.isSuccess) {
|
|
10711
10726
|
return false;
|
|
@@ -10714,6 +10729,15 @@ ${this.stack}`;
|
|
|
10714
10729
|
const nextValue = "next" in payload ? payload.next : void 0;
|
|
10715
10730
|
return Type.isNumber(nextValue);
|
|
10716
10731
|
}
|
|
10732
|
+
/**
|
|
10733
|
+
* @deprecated Will be removed in `2.0.0`. Tied to the `restApi:v2` envelope
|
|
10734
|
+
* field `total`, which `restApi:v3` does not return. For `restApi:v3` the
|
|
10735
|
+
* SDK exposes element counts via the `aggregate` action (`count` /
|
|
10736
|
+
* `countDistinct`); for `restApi:v2` use the list helpers, which iterate
|
|
10737
|
+
* without exposing `total`.
|
|
10738
|
+
*
|
|
10739
|
+
* @removed 2.0.0
|
|
10740
|
+
*/
|
|
10717
10741
|
getTotal() {
|
|
10718
10742
|
if (!this.isSuccess) {
|
|
10719
10743
|
return 0;
|
|
@@ -10732,7 +10756,13 @@ ${this.stack}`;
|
|
|
10732
10756
|
* Alias for getNext
|
|
10733
10757
|
* @param http
|
|
10734
10758
|
*
|
|
10735
|
-
* @
|
|
10759
|
+
* @deprecated Will be removed in `2.0.0`. `restApi:v3` does not support
|
|
10760
|
+
* `getNext()` (the v2 envelope field `next` does not exist). Use the SDK's
|
|
10761
|
+
* list helpers instead — they hide pagination entirely:
|
|
10762
|
+
* - `restApi:v2`: {@link CallListV2.make `b24.actions.v2.callList.make`} or {@link FetchListV2.make `b24.actions.v2.fetchList.make`}
|
|
10763
|
+
* - `restApi:v3`: {@link CallListV3.make `b24.actions.v3.callList.make`} or {@link FetchListV3.make `b24.actions.v3.fetchList.make`}
|
|
10764
|
+
*
|
|
10765
|
+
* @removed 2.0.0
|
|
10736
10766
|
*/
|
|
10737
10767
|
async fetchNext(http) {
|
|
10738
10768
|
const data = await this.getNext(http);
|
|
@@ -10741,6 +10771,16 @@ ${this.stack}`;
|
|
|
10741
10771
|
}
|
|
10742
10772
|
return data;
|
|
10743
10773
|
}
|
|
10774
|
+
/**
|
|
10775
|
+
* @deprecated Will be removed in `2.0.0`. Throws on `restApi:v3` because the
|
|
10776
|
+
* v2 envelope field `next` is not part of the v3 protocol. Use the SDK's
|
|
10777
|
+
* list helpers instead — they hide pagination entirely:
|
|
10778
|
+
* - `restApi:v2`: {@link CallListV2.make `b24.actions.v2.callList.make`} or {@link FetchListV2.make `b24.actions.v2.fetchList.make`}
|
|
10779
|
+
* - `restApi:v3`: {@link CallListV3.make `b24.actions.v3.callList.make`} or {@link FetchListV3.make `b24.actions.v3.fetchList.make`}
|
|
10780
|
+
*
|
|
10781
|
+
* @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`.
|
|
10782
|
+
* @removed 2.0.0
|
|
10783
|
+
*/
|
|
10744
10784
|
async getNext(http) {
|
|
10745
10785
|
if (http.apiVersion === ApiVersion.v3) {
|
|
10746
10786
|
throw new SdkError({
|
|
@@ -10803,7 +10843,8 @@ ${this.stack}`;
|
|
|
10803
10843
|
maxDelay: 7e3
|
|
10804
10844
|
},
|
|
10805
10845
|
maxRetries: 3,
|
|
10806
|
-
retryDelay: 1e3
|
|
10846
|
+
retryDelay: 1e3,
|
|
10847
|
+
retryOnNetworkError: true
|
|
10807
10848
|
};
|
|
10808
10849
|
}
|
|
10809
10850
|
/**
|
|
@@ -11695,49 +11736,81 @@ ${this.stack}`;
|
|
|
11695
11736
|
].includes(answerError.code) || (answerError.description ?? "").includes("Could not find value for parameter");
|
|
11696
11737
|
}
|
|
11697
11738
|
/**
|
|
11698
|
-
*
|
|
11739
|
+
* Built-in hard error codes (always throw, never retry).
|
|
11740
|
+
*
|
|
11741
|
+
* Includes authorization and fatal codes that must never be silently retried.
|
|
11742
|
+
* Use `RestrictionParams.hardErrorCodes` to extend this list with custom codes.
|
|
11743
|
+
*/
|
|
11744
|
+
static BUILT_IN_HARD_ERROR_CODES = [
|
|
11745
|
+
"ERR_BAD_REQUEST",
|
|
11746
|
+
"JSSDK_UNKNOWN_ERROR",
|
|
11747
|
+
"100",
|
|
11748
|
+
"INTERNAL_SERVER_ERROR",
|
|
11749
|
+
"ERROR_UNEXPECTED_ANSWER",
|
|
11750
|
+
"PORTAL_DELETED",
|
|
11751
|
+
"ERROR_BATCH_METHOD_NOT_ALLOWED",
|
|
11752
|
+
"ERROR_BATCH_LENGTH_EXCEEDED",
|
|
11753
|
+
"NO_AUTH_FOUND",
|
|
11754
|
+
"INVALID_REQUEST",
|
|
11755
|
+
"OVERLOAD_LIMIT",
|
|
11756
|
+
"expired_token",
|
|
11757
|
+
"ACCESS_DENIED",
|
|
11758
|
+
"INVALID_CREDENTIALS",
|
|
11759
|
+
"user_access_error",
|
|
11760
|
+
"insufficient_scope",
|
|
11761
|
+
"ERROR_MANIFEST_IS_NOT_AVAILABLE",
|
|
11762
|
+
"allowed_only_intranet_user",
|
|
11763
|
+
"NOT_FOUND",
|
|
11764
|
+
"INVALID_ARG_VALUE"
|
|
11765
|
+
];
|
|
11766
|
+
/**
|
|
11767
|
+
* Built-in soft error codes (returned as `AjaxResult` with error, never thrown).
|
|
11768
|
+
*
|
|
11769
|
+
* Use `RestrictionParams.softErrorCodes` to extend this list with custom codes.
|
|
11770
|
+
*/
|
|
11771
|
+
static BUILT_IN_SOFT_ERROR_CODES = [
|
|
11772
|
+
"ERROR_ENTITY_NOT_FOUND",
|
|
11773
|
+
"BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION",
|
|
11774
|
+
"BITRIX_REST_V3_EXCEPTION_INVALIDJSONEXCEPTION",
|
|
11775
|
+
"BITRIX_REST_V3_EXCEPTION_INVALIDFILTEREXCEPTION",
|
|
11776
|
+
"BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION",
|
|
11777
|
+
"BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION",
|
|
11778
|
+
"BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION",
|
|
11779
|
+
"BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION",
|
|
11780
|
+
"BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION",
|
|
11781
|
+
"BITRIX_REST_V3_EXCEPTION_VALIDATION_DTOVALIDATIONEXCEPTION"
|
|
11782
|
+
];
|
|
11783
|
+
/**
|
|
11784
|
+
* Codes that cause the SDK to throw immediately.
|
|
11785
|
+
*
|
|
11786
|
+
* Composed of:
|
|
11787
|
+
* - `BUILT_IN_HARD_ERROR_CODES` (always included)
|
|
11788
|
+
* - `NETWORK_ERROR` and `REQUEST_TIMEOUT` when `retryOnNetworkError === false`
|
|
11789
|
+
* - `RestrictionParams.hardErrorCodes` (user-provided extensions)
|
|
11699
11790
|
*/
|
|
11700
11791
|
get exceptionCodeForHard() {
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
"
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
"ERROR_BATCH_METHOD_NOT_ALLOWED",
|
|
11710
|
-
"ERROR_BATCH_LENGTH_EXCEEDED",
|
|
11711
|
-
"NO_AUTH_FOUND",
|
|
11712
|
-
"INVALID_REQUEST",
|
|
11713
|
-
"OVERLOAD_LIMIT",
|
|
11714
|
-
"expired_token",
|
|
11715
|
-
"ACCESS_DENIED",
|
|
11716
|
-
"INVALID_CREDENTIALS",
|
|
11717
|
-
"user_access_error",
|
|
11718
|
-
"insufficient_scope",
|
|
11719
|
-
"ERROR_MANIFEST_IS_NOT_AVAILABLE",
|
|
11720
|
-
"allowed_only_intranet_user",
|
|
11721
|
-
"NOT_FOUND",
|
|
11722
|
-
"INVALID_ARG_VALUE"
|
|
11723
|
-
];
|
|
11792
|
+
const codes = [...RestrictionManager.BUILT_IN_HARD_ERROR_CODES];
|
|
11793
|
+
if (this.#config.retryOnNetworkError === false) {
|
|
11794
|
+
codes.push("NETWORK_ERROR", "REQUEST_TIMEOUT");
|
|
11795
|
+
}
|
|
11796
|
+
if (this.#config.hardErrorCodes && this.#config.hardErrorCodes.length > 0) {
|
|
11797
|
+
codes.push(...this.#config.hardErrorCodes);
|
|
11798
|
+
}
|
|
11799
|
+
return codes;
|
|
11724
11800
|
}
|
|
11725
11801
|
/**
|
|
11726
|
-
*
|
|
11802
|
+
* Codes returned as `AjaxResult` with an `AjaxError` payload instead of thrown.
|
|
11803
|
+
*
|
|
11804
|
+
* Composed of:
|
|
11805
|
+
* - `BUILT_IN_SOFT_ERROR_CODES` (always included)
|
|
11806
|
+
* - `RestrictionParams.softErrorCodes` (user-provided extensions)
|
|
11727
11807
|
*/
|
|
11728
11808
|
get exceptionCodeForSoft() {
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
"BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION",
|
|
11735
|
-
"BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION",
|
|
11736
|
-
"BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION",
|
|
11737
|
-
"BITRIX_REST_V3_EXCEPTION_UNKNOWNDTOPROPERTYEXCEPTION",
|
|
11738
|
-
"BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION",
|
|
11739
|
-
"BITRIX_REST_V3_EXCEPTION_VALIDATION_DTOVALIDATIONEXCEPTION"
|
|
11740
|
-
];
|
|
11809
|
+
const codes = [...RestrictionManager.BUILT_IN_SOFT_ERROR_CODES];
|
|
11810
|
+
if (this.#config.softErrorCodes && this.#config.softErrorCodes.length > 0) {
|
|
11811
|
+
codes.push(...this.#config.softErrorCodes);
|
|
11812
|
+
}
|
|
11813
|
+
return codes;
|
|
11741
11814
|
}
|
|
11742
11815
|
/**
|
|
11743
11816
|
* Delay due to unknown errors
|
|
@@ -18090,7 +18163,7 @@ ${JSON.stringify({
|
|
|
18090
18163
|
this._logger = LoggerFactory.createNullLogger();
|
|
18091
18164
|
const defaultHeaders = {};
|
|
18092
18165
|
if (this.isServerSide()) {
|
|
18093
|
-
defaultHeaders["User-Agent"] = "b24-js-sdk/1.
|
|
18166
|
+
defaultHeaders["User-Agent"] = "b24-js-sdk/1.1.1";
|
|
18094
18167
|
}
|
|
18095
18168
|
this._authActions = authActions;
|
|
18096
18169
|
this._requestIdGenerator = new RequestIdGenerator();
|
|
@@ -19185,7 +19258,7 @@ ${JSON.stringify({
|
|
|
19185
19258
|
answer: {
|
|
19186
19259
|
error: resultError ? typeof resultError === "string" ? resultError : resultError.error : void 0,
|
|
19187
19260
|
error_description: resultError ? typeof resultError === "string" ? void 0 : resultError.error_description : void 0,
|
|
19188
|
-
result: resultData
|
|
19261
|
+
result: resultData,
|
|
19189
19262
|
total: Number.parseInt(this._getBatchResultByIndex(responseResult.result_total, index) || "0"),
|
|
19190
19263
|
next: Number.parseInt(this._getBatchResultByIndex(responseResult.result_next, index) || "0"),
|
|
19191
19264
|
time: resultTime
|
|
@@ -19343,7 +19416,7 @@ ${JSON.stringify({
|
|
|
19343
19416
|
}
|
|
19344
19417
|
const queryParams = new URLSearchParams({
|
|
19345
19418
|
[this._requestIdGenerator.getQueryStringParameterName()]: requestId,
|
|
19346
|
-
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.
|
|
19419
|
+
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.1.1",
|
|
19347
19420
|
[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
19348
19421
|
});
|
|
19349
19422
|
return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
|
|
@@ -19414,21 +19487,28 @@ ${JSON.stringify({
|
|
|
19414
19487
|
return results;
|
|
19415
19488
|
}
|
|
19416
19489
|
/**
|
|
19417
|
-
*
|
|
19490
|
+
* In `restApi:v3`, `response.getData().result` is the array/record of per-command
|
|
19491
|
+
* results directly (no `result_error`/`result_time`/`result_total`/`result_next`
|
|
19492
|
+
* split as in v2). Per-command errors do not exist in this format.
|
|
19493
|
+
*
|
|
19494
|
+
* The per-command `result` value is forwarded as-is, including `null` when the
|
|
19495
|
+
* underlying REST method returns `null` (see issue #23).
|
|
19418
19496
|
*/
|
|
19419
19497
|
async _processResponseItem(command, index, responseHelper, results) {
|
|
19420
19498
|
const responseResult = responseHelper.response.getData().result;
|
|
19421
19499
|
const resultData = this._getBatchResultByIndex(responseResult, index);
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
|
|
19425
|
-
|
|
19426
|
-
|
|
19500
|
+
if (typeof resultData === "undefined") {
|
|
19501
|
+
throw new SdkError({
|
|
19502
|
+
code: "JSSDK_INTERACTION_BATCH_STRATEGY_V3_EMPTY_COMMAND_RESPONSE",
|
|
19503
|
+
description: `There were difficulties parsing the response for batch { index: ${index}, method: ${command.method} }`,
|
|
19504
|
+
status: 500
|
|
19505
|
+
});
|
|
19427
19506
|
}
|
|
19507
|
+
const resultTime = responseHelper.response.getData().time;
|
|
19428
19508
|
const result = new AjaxResult({
|
|
19429
19509
|
answer: {
|
|
19430
|
-
result: resultData
|
|
19431
|
-
error:
|
|
19510
|
+
result: resultData,
|
|
19511
|
+
error: void 0,
|
|
19432
19512
|
time: resultTime
|
|
19433
19513
|
},
|
|
19434
19514
|
query: {
|
|
@@ -19590,7 +19670,7 @@ ${JSON.stringify({
|
|
|
19590
19670
|
const methodUrl = `/${encodeURIComponent(method)}`;
|
|
19591
19671
|
const queryParams = new URLSearchParams({
|
|
19592
19672
|
[this._requestIdGenerator.getQueryStringParameterName()]: requestId,
|
|
19593
|
-
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.
|
|
19673
|
+
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.1.1",
|
|
19594
19674
|
[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
19595
19675
|
});
|
|
19596
19676
|
return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
|
|
@@ -21316,19 +21396,59 @@ ${JSON.stringify({
|
|
|
21316
21396
|
});
|
|
21317
21397
|
}
|
|
21318
21398
|
/**
|
|
21319
|
-
*
|
|
21399
|
+
* Invokes the system dialog for selecting CRM entities
|
|
21400
|
+
* (leads, contacts, companies, deals, quotes).
|
|
21401
|
+
*
|
|
21402
|
+
* The resolved `SelectedCRM` object contains a separate bucket per
|
|
21403
|
+
* entity type. Each present bucket is a real `Array`, so consumers can
|
|
21404
|
+
* use `.length`, `.map()`, `for..of`, etc. directly. Buckets for entity
|
|
21405
|
+
* types that were not selected (or not requested via `entityType`) are
|
|
21406
|
+
* left `undefined` rather than being set to an empty array.
|
|
21407
|
+
*
|
|
21408
|
+
* Note: the parent window historically returned each bucket as a
|
|
21409
|
+
* `Record<string, SelectedCRMEntity>` (e.g. `{ 0: {...}, 1: {...} }`).
|
|
21410
|
+
* The SDK normalizes that response to a real array before returning it.
|
|
21320
21411
|
*
|
|
21321
|
-
* @param {SelectCRMParams} params
|
|
21322
|
-
*
|
|
21412
|
+
* @param {SelectCRMParams} [params] - Filter and behavior options.
|
|
21413
|
+
* - `entityType`: which entity types are shown in the dialog.
|
|
21414
|
+
* - `multiple`: allow multiple selection (default `false`).
|
|
21415
|
+
* - `value`: pre-selected entities (only applied when `multiple` is `true`).
|
|
21416
|
+
* @return {Promise<SelectedCRM>} Resolves to an object whose properties
|
|
21417
|
+
* (`lead`, `contact`, `company`, `deal`, `quote`) are arrays of
|
|
21418
|
+
* {@link SelectedCRMEntity} objects.
|
|
21323
21419
|
*
|
|
21324
21420
|
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-crm.html
|
|
21325
21421
|
*/
|
|
21326
21422
|
async selectCRM(params) {
|
|
21327
|
-
|
|
21423
|
+
const response = await this.#messageManager.send(MessageCommands.selectCRM, {
|
|
21328
21424
|
entityType: params?.entityType,
|
|
21329
21425
|
multiple: params?.multiple,
|
|
21330
21426
|
value: params?.value
|
|
21331
21427
|
});
|
|
21428
|
+
const result = {};
|
|
21429
|
+
if (!response) {
|
|
21430
|
+
return result;
|
|
21431
|
+
}
|
|
21432
|
+
const toArray = /* @__PURE__ */ __name$q((bucket) => {
|
|
21433
|
+
if (bucket === void 0 || bucket === null) {
|
|
21434
|
+
return void 0;
|
|
21435
|
+
}
|
|
21436
|
+
if (Array.isArray(bucket)) {
|
|
21437
|
+
return bucket;
|
|
21438
|
+
}
|
|
21439
|
+
return Object.values(bucket);
|
|
21440
|
+
}, "toArray");
|
|
21441
|
+
const lead = toArray(response.lead);
|
|
21442
|
+
if (lead) result.lead = lead;
|
|
21443
|
+
const contact = toArray(response.contact);
|
|
21444
|
+
if (contact) result.contact = contact;
|
|
21445
|
+
const company = toArray(response.company);
|
|
21446
|
+
if (company) result.company = company;
|
|
21447
|
+
const deal = toArray(response.deal);
|
|
21448
|
+
if (deal) result.deal = deal;
|
|
21449
|
+
const quote = toArray(response.quote);
|
|
21450
|
+
if (quote) result.quote = quote;
|
|
21451
|
+
return result;
|
|
21332
21452
|
}
|
|
21333
21453
|
}
|
|
21334
21454
|
|
|
@@ -21549,22 +21669,45 @@ ${JSON.stringify({
|
|
|
21549
21669
|
}
|
|
21550
21670
|
);
|
|
21551
21671
|
}
|
|
21672
|
+
async call(command, parameters = {}) {
|
|
21673
|
+
if (command === "setValue" && !Type.isString(parameters?.["value"])) {
|
|
21674
|
+
throw new TypeError(
|
|
21675
|
+
"placement.call('setValue', { value }) expects `value` to be a JSON-serialized string. Use placement.setValue(value) to serialize automatically, or call JSON.stringify yourself."
|
|
21676
|
+
);
|
|
21677
|
+
}
|
|
21678
|
+
return this.#messageManager.send(
|
|
21679
|
+
command,
|
|
21680
|
+
{
|
|
21681
|
+
...parameters,
|
|
21682
|
+
isSafely: true,
|
|
21683
|
+
isRawValue: ["setValue"].includes(command)
|
|
21684
|
+
}
|
|
21685
|
+
);
|
|
21686
|
+
}
|
|
21552
21687
|
/**
|
|
21553
|
-
*
|
|
21554
|
-
*
|
|
21555
|
-
*
|
|
21688
|
+
* Set Value for the Current Embedding Location
|
|
21689
|
+
*
|
|
21690
|
+
* Convenience wrapper around `placement.call('setValue', ...)` that handles
|
|
21691
|
+
* JSON serialization. Pass any value (string, number, boolean, object, array)
|
|
21692
|
+
* — it will be serialized via `JSON.stringify` before being sent to the
|
|
21693
|
+
* parent window, which performs `JSON.parse` on receipt.
|
|
21694
|
+
*
|
|
21695
|
+
* @param { unknown } value Any JSON-serializable value
|
|
21556
21696
|
* @return { Promise<any> }
|
|
21557
21697
|
*
|
|
21558
21698
|
* @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
|
|
21559
|
-
*
|
|
21699
|
+
*
|
|
21700
|
+
* @example
|
|
21701
|
+
* await b24.placement.setValue('test')
|
|
21702
|
+
* await b24.placement.setValue({ id: 1, title: 'demo' })
|
|
21560
21703
|
*/
|
|
21561
|
-
async
|
|
21704
|
+
async setValue(value) {
|
|
21562
21705
|
return this.#messageManager.send(
|
|
21563
|
-
|
|
21706
|
+
"setValue",
|
|
21564
21707
|
{
|
|
21565
|
-
|
|
21708
|
+
value: JSON.stringify(value),
|
|
21566
21709
|
isSafely: true,
|
|
21567
|
-
isRawValue:
|
|
21710
|
+
isRawValue: true
|
|
21568
21711
|
}
|
|
21569
21712
|
);
|
|
21570
21713
|
}
|