@bitrix24/b24jssdk 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README-AI.md +26 -3
  2. package/dist/esm/_virtual/_commonjsHelpers.mjs +1 -1
  3. package/dist/esm/_virtual/protobuf.mjs +1 -1
  4. package/dist/esm/_virtual/protobuf2.mjs +1 -1
  5. package/dist/esm/core/abstract-b24.mjs +1 -1
  6. package/dist/esm/core/actions/abstract-action.mjs +1 -1
  7. package/dist/esm/core/actions/abstract-batch.mjs +1 -1
  8. package/dist/esm/core/actions/manager.mjs +1 -1
  9. package/dist/esm/core/actions/v2/batch-by-chunk.mjs +1 -1
  10. package/dist/esm/core/actions/v2/batch.mjs +1 -1
  11. package/dist/esm/core/actions/v2/call-list.mjs +1 -1
  12. package/dist/esm/core/actions/v2/call.mjs +1 -1
  13. package/dist/esm/core/actions/v2/fetch-list.mjs +1 -1
  14. package/dist/esm/core/actions/v2/manager-v2.mjs +1 -1
  15. package/dist/esm/core/actions/v3/batch-by-chunk.mjs +1 -1
  16. package/dist/esm/core/actions/v3/batch.mjs +1 -1
  17. package/dist/esm/core/actions/v3/call-list.mjs +1 -1
  18. package/dist/esm/core/actions/v3/call.mjs +1 -1
  19. package/dist/esm/core/actions/v3/fetch-list.mjs +1 -1
  20. package/dist/esm/core/actions/v3/manager-v3.mjs +1 -1
  21. package/dist/esm/core/http/abstract-http.mjs +2 -2
  22. package/dist/esm/core/http/ajax-error.mjs +1 -1
  23. package/dist/esm/core/http/ajax-result.mjs +44 -4
  24. package/dist/esm/core/http/ajax-result.mjs.map +1 -1
  25. package/dist/esm/core/http/limiters/adaptive-delayer.mjs +1 -1
  26. package/dist/esm/core/http/limiters/manager.mjs +1 -1
  27. package/dist/esm/core/http/limiters/operating-limiter.mjs +1 -1
  28. package/dist/esm/core/http/limiters/params-factory.mjs +1 -1
  29. package/dist/esm/core/http/limiters/rate-limiter.mjs +1 -1
  30. package/dist/esm/core/http/v2.mjs +2 -2
  31. package/dist/esm/core/http/v3.mjs +2 -2
  32. package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +1 -1
  33. package/dist/esm/core/interaction/batch/parse-row.mjs +1 -1
  34. package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +1 -1
  35. package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +1 -1
  36. package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs.map +1 -1
  37. package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +1 -1
  38. package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +1 -1
  39. package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +1 -1
  40. package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs.map +1 -1
  41. package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +1 -1
  42. package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +1 -1
  43. package/dist/esm/core/interaction/batch/v2.mjs +1 -1
  44. package/dist/esm/core/interaction/batch/v3.mjs +1 -1
  45. package/dist/esm/core/language/list.mjs +1 -1
  46. package/dist/esm/core/request-id-generator.mjs +1 -1
  47. package/dist/esm/core/result.mjs +1 -1
  48. package/dist/esm/core/sdk-error.mjs +1 -1
  49. package/dist/esm/core/tools/abstract-tool.mjs +1 -1
  50. package/dist/esm/core/tools/healthcheck.mjs +1 -1
  51. package/dist/esm/core/tools/manager.mjs +1 -1
  52. package/dist/esm/core/tools/ping.mjs +1 -1
  53. package/dist/esm/core/version-manager.mjs +1 -1
  54. package/dist/esm/frame/auth.mjs +1 -1
  55. package/dist/esm/frame/b24.mjs +1 -1
  56. package/dist/esm/frame/dialog.mjs +45 -5
  57. package/dist/esm/frame/dialog.mjs.map +1 -1
  58. package/dist/esm/frame/frame.mjs +1 -1
  59. package/dist/esm/frame/message/commands.mjs +1 -1
  60. package/dist/esm/frame/message/controller.mjs +1 -1
  61. package/dist/esm/frame/options.mjs +1 -1
  62. package/dist/esm/frame/parent.mjs +1 -1
  63. package/dist/esm/frame/placement.mjs +32 -9
  64. package/dist/esm/frame/placement.mjs.map +1 -1
  65. package/dist/esm/frame/slider.mjs +1 -1
  66. package/dist/esm/helper/abstract-helper.mjs +1 -1
  67. package/dist/esm/helper/app-manager.mjs +1 -1
  68. package/dist/esm/helper/currency-manager.mjs +1 -1
  69. package/dist/esm/helper/helper-manager.mjs +1 -1
  70. package/dist/esm/helper/license-manager.mjs +1 -1
  71. package/dist/esm/helper/options-manager.mjs +1 -1
  72. package/dist/esm/helper/payment-manager.mjs +1 -1
  73. package/dist/esm/helper/profile-manager.mjs +1 -1
  74. package/dist/esm/helper/use-b24-helper.mjs +1 -1
  75. package/dist/esm/hook/auth.mjs +1 -1
  76. package/dist/esm/hook/b24.mjs +1 -1
  77. package/dist/esm/index.d.mts +105 -9
  78. package/dist/esm/index.d.ts +105 -9
  79. package/dist/esm/index.mjs +1 -1
  80. package/dist/esm/loader-b24frame.mjs +1 -1
  81. package/dist/esm/logger/abstract-logger.mjs +1 -1
  82. package/dist/esm/logger/browser.mjs +1 -1
  83. package/dist/esm/logger/formatter/abstract-formatter.mjs +1 -1
  84. package/dist/esm/logger/formatter/json-formatter.mjs +1 -1
  85. package/dist/esm/logger/formatter/line-formatter.mjs +1 -1
  86. package/dist/esm/logger/formatter/telegram-formatter.mjs +1 -1
  87. package/dist/esm/logger/handler/abstract-handler.mjs +1 -1
  88. package/dist/esm/logger/handler/consola-adapter.mjs +1 -1
  89. package/dist/esm/logger/handler/console-handler.mjs +1 -1
  90. package/dist/esm/logger/handler/console-v2-handler.mjs +1 -1
  91. package/dist/esm/logger/handler/memory-handler.mjs +1 -1
  92. package/dist/esm/logger/handler/stream-handler.mjs +1 -1
  93. package/dist/esm/logger/handler/telegram-handler.mjs +1 -1
  94. package/dist/esm/logger/handler/winston-adapter.mjs +1 -1
  95. package/dist/esm/logger/logger-factory.mjs +1 -1
  96. package/dist/esm/logger/logger.mjs +1 -1
  97. package/dist/esm/logger/null-logger.mjs +1 -1
  98. package/dist/esm/logger/processor/memory-usage-processor.mjs +1 -1
  99. package/dist/esm/logger/processor/pid-processor.mjs +1 -1
  100. package/dist/esm/oauth/auth.mjs +1 -1
  101. package/dist/esm/oauth/b24.mjs +1 -1
  102. package/dist/esm/oauth/refresh-token-error.mjs +1 -1
  103. package/dist/esm/pullClient/abstract-connector.mjs +1 -1
  104. package/dist/esm/pullClient/channel-manager.mjs +1 -1
  105. package/dist/esm/pullClient/channel-manager.mjs.map +1 -1
  106. package/dist/esm/pullClient/client.mjs +1 -1
  107. package/dist/esm/pullClient/errors.mjs +1 -1
  108. package/dist/esm/pullClient/json-rpc.mjs +1 -1
  109. package/dist/esm/pullClient/long-polling-connector.mjs +1 -1
  110. package/dist/esm/pullClient/protobuf/index.mjs +1 -1
  111. package/dist/esm/pullClient/protobuf/model.mjs +1 -1
  112. package/dist/esm/pullClient/protobuf/protobuf.mjs +1 -1
  113. package/dist/esm/pullClient/shared-config.mjs +1 -1
  114. package/dist/esm/pullClient/storage-manager.mjs +1 -1
  115. package/dist/esm/pullClient/web-socket-connector.mjs +1 -1
  116. package/dist/esm/tools/browser.mjs +1 -1
  117. package/dist/esm/tools/environment.mjs +1 -1
  118. package/dist/esm/tools/formatters/iban.mjs +1 -1
  119. package/dist/esm/tools/formatters/numbers.mjs +1 -1
  120. package/dist/esm/tools/index.mjs +1 -1
  121. package/dist/esm/tools/scroll-size.mjs +1 -1
  122. package/dist/esm/tools/text.mjs +1 -1
  123. package/dist/esm/tools/type.mjs +1 -1
  124. package/dist/esm/tools/use-formatters.mjs +1 -1
  125. package/dist/esm/tools/uuidv7.mjs +1 -1
  126. package/dist/esm/types/b24-helper.mjs +1 -1
  127. package/dist/esm/types/b24.mjs +1 -1
  128. package/dist/esm/types/bizproc/index.mjs +1 -1
  129. package/dist/esm/types/catalog/index.mjs +1 -1
  130. package/dist/esm/types/common.mjs +1 -1
  131. package/dist/esm/types/crm/entity-type.mjs +1 -1
  132. package/dist/esm/types/crm/productrow.mjs +1 -1
  133. package/dist/esm/types/logger.mjs +1 -1
  134. package/dist/esm/types/pull.mjs +1 -1
  135. package/dist/umd/index.js +122 -19
  136. package/dist/umd/index.js.map +1 -1
  137. package/dist/umd/index.min.js +17 -17
  138. package/dist/umd/index.min.js.map +1 -1
  139. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
package/dist/umd/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.0.6
3
+ * @version 1.1.0
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
- * @todo !fix api version
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({
@@ -18090,7 +18130,7 @@ ${JSON.stringify({
18090
18130
  this._logger = LoggerFactory.createNullLogger();
18091
18131
  const defaultHeaders = {};
18092
18132
  if (this.isServerSide()) {
18093
- defaultHeaders["User-Agent"] = "b24-js-sdk/1.0.6";
18133
+ defaultHeaders["User-Agent"] = "b24-js-sdk/1.1.0";
18094
18134
  }
18095
18135
  this._authActions = authActions;
18096
18136
  this._requestIdGenerator = new RequestIdGenerator();
@@ -19343,7 +19383,7 @@ ${JSON.stringify({
19343
19383
  }
19344
19384
  const queryParams = new URLSearchParams({
19345
19385
  [this._requestIdGenerator.getQueryStringParameterName()]: requestId,
19346
- [this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.0.6",
19386
+ [this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.1.0",
19347
19387
  [this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
19348
19388
  });
19349
19389
  return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
@@ -19590,7 +19630,7 @@ ${JSON.stringify({
19590
19630
  const methodUrl = `/${encodeURIComponent(method)}`;
19591
19631
  const queryParams = new URLSearchParams({
19592
19632
  [this._requestIdGenerator.getQueryStringParameterName()]: requestId,
19593
- [this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.0.6",
19633
+ [this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.1.0",
19594
19634
  [this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
19595
19635
  });
19596
19636
  return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
@@ -21316,19 +21356,59 @@ ${JSON.stringify({
21316
21356
  });
21317
21357
  }
21318
21358
  /**
21319
- * Method invokes the system dialog for selecting a CRM entity
21359
+ * Invokes the system dialog for selecting CRM entities
21360
+ * (leads, contacts, companies, deals, quotes).
21320
21361
  *
21321
- * @param {SelectCRMParams} params
21322
- * @return {Promise<SelectedCRM>}
21362
+ * The resolved `SelectedCRM` object contains a separate bucket per
21363
+ * entity type. Each present bucket is a real `Array`, so consumers can
21364
+ * use `.length`, `.map()`, `for..of`, etc. directly. Buckets for entity
21365
+ * types that were not selected (or not requested via `entityType`) are
21366
+ * left `undefined` rather than being set to an empty array.
21367
+ *
21368
+ * Note: the parent window historically returned each bucket as a
21369
+ * `Record<string, SelectedCRMEntity>` (e.g. `{ 0: {...}, 1: {...} }`).
21370
+ * The SDK normalizes that response to a real array before returning it.
21371
+ *
21372
+ * @param {SelectCRMParams} [params] - Filter and behavior options.
21373
+ * - `entityType`: which entity types are shown in the dialog.
21374
+ * - `multiple`: allow multiple selection (default `false`).
21375
+ * - `value`: pre-selected entities (only applied when `multiple` is `true`).
21376
+ * @return {Promise<SelectedCRM>} Resolves to an object whose properties
21377
+ * (`lead`, `contact`, `company`, `deal`, `quote`) are arrays of
21378
+ * {@link SelectedCRMEntity} objects.
21323
21379
  *
21324
21380
  * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-crm.html
21325
21381
  */
21326
21382
  async selectCRM(params) {
21327
- return this.#messageManager.send(MessageCommands.selectCRM, {
21383
+ const response = await this.#messageManager.send(MessageCommands.selectCRM, {
21328
21384
  entityType: params?.entityType,
21329
21385
  multiple: params?.multiple,
21330
21386
  value: params?.value
21331
21387
  });
21388
+ const result = {};
21389
+ if (!response) {
21390
+ return result;
21391
+ }
21392
+ const toArray = /* @__PURE__ */ __name$q((bucket) => {
21393
+ if (bucket === void 0 || bucket === null) {
21394
+ return void 0;
21395
+ }
21396
+ if (Array.isArray(bucket)) {
21397
+ return bucket;
21398
+ }
21399
+ return Object.values(bucket);
21400
+ }, "toArray");
21401
+ const lead = toArray(response.lead);
21402
+ if (lead) result.lead = lead;
21403
+ const contact = toArray(response.contact);
21404
+ if (contact) result.contact = contact;
21405
+ const company = toArray(response.company);
21406
+ if (company) result.company = company;
21407
+ const deal = toArray(response.deal);
21408
+ if (deal) result.deal = deal;
21409
+ const quote = toArray(response.quote);
21410
+ if (quote) result.quote = quote;
21411
+ return result;
21332
21412
  }
21333
21413
  }
21334
21414
 
@@ -21549,22 +21629,45 @@ ${JSON.stringify({
21549
21629
  }
21550
21630
  );
21551
21631
  }
21632
+ async call(command, parameters = {}) {
21633
+ if (command === "setValue" && !Type.isString(parameters?.["value"])) {
21634
+ throw new TypeError(
21635
+ "placement.call('setValue', { value }) expects `value` to be a JSON-serialized string. Use placement.setValue(value) to serialize automatically, or call JSON.stringify yourself."
21636
+ );
21637
+ }
21638
+ return this.#messageManager.send(
21639
+ command,
21640
+ {
21641
+ ...parameters,
21642
+ isSafely: true,
21643
+ isRawValue: ["setValue"].includes(command)
21644
+ }
21645
+ );
21646
+ }
21552
21647
  /**
21553
- * Call the Registered Interface Command
21554
- * @param { string } command
21555
- * @param { Record<string, any> } parameters
21648
+ * Set Value for the Current Embedding Location
21649
+ *
21650
+ * Convenience wrapper around `placement.call('setValue', ...)` that handles
21651
+ * JSON serialization. Pass any value (string, number, boolean, object, array)
21652
+ * — it will be serialized via `JSON.stringify` before being sent to the
21653
+ * parent window, which performs `JSON.parse` on receipt.
21654
+ *
21655
+ * @param { unknown } value Any JSON-serializable value
21556
21656
  * @return { Promise<any> }
21557
21657
  *
21558
21658
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
21559
- * @memo For the `setValue` command, use the following parameters { value: string }
21659
+ *
21660
+ * @example
21661
+ * await b24.placement.setValue('test')
21662
+ * await b24.placement.setValue({ id: 1, title: 'demo' })
21560
21663
  */
21561
- async call(command, parameters = {}) {
21664
+ async setValue(value) {
21562
21665
  return this.#messageManager.send(
21563
- command,
21666
+ "setValue",
21564
21667
  {
21565
- ...parameters,
21668
+ value: JSON.stringify(value),
21566
21669
  isSafely: true,
21567
- isRawValue: ["setValue"].includes(command)
21670
+ isRawValue: true
21568
21671
  }
21569
21672
  );
21570
21673
  }