@next-core/brick-kit 2.136.2 → 2.137.2

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/dist/index.esm.js CHANGED
@@ -6055,13 +6055,25 @@ var ContractApi_searchSingleContract = /*#__PURE__*/function () {
6055
6055
  }();
6056
6056
 
6057
6057
  var contractsMap = new Map();
6058
- function collectContract(contracts) {
6058
+ var widgetContractMap = new Map();
6059
+
6060
+ var addContract = (contracts, map) => {
6059
6061
  contracts === null || contracts === void 0 ? void 0 : contracts.forEach(contract => {
6060
- contractsMap.set("".concat(contract.namespaceId, ".").concat(contract.name), contract);
6062
+ map.set("".concat(contract.namespaceId, ".").concat(contract.name), contract);
6061
6063
  });
6064
+ };
6065
+
6066
+ function collectContract(contracts) {
6067
+ addContract(contracts, contractsMap);
6068
+ }
6069
+ function collectWidgetContract(contracts) {
6070
+ addContract(contracts, widgetContractMap);
6071
+ }
6072
+ function clearCollectWidgetContract() {
6073
+ widgetContractMap.clear();
6062
6074
  }
6063
6075
  function getContract(name) {
6064
- return contractsMap.get(name);
6076
+ return contractsMap.get(name) || widgetContractMap.get(name);
6065
6077
  }
6066
6078
 
6067
6079
  var flowApiDefinitionPromiseMap = new Map(); // Legacy Custom API: `${namespace}@${name}`
@@ -8378,6 +8390,10 @@ function expandCustomTemplate(brickConf, proxyBrick, context) {
8378
8390
  var tplContext = new CustomTemplateContext(proxyBrick);
8379
8391
  var template = customTemplateRegistry.get(brickConf.brick);
8380
8392
 
8393
+ if (template.contracts) {
8394
+ collectWidgetContract(template.contracts);
8395
+ }
8396
+
8381
8397
  if (Array.isArray(template.state)) {
8382
8398
  tplContext.state.syncDefine(template.state, context, proxyBrick);
8383
8399
  }
@@ -8393,6 +8409,10 @@ function _asyncExpandCustomTemplate() {
8393
8409
  var tplContext = new CustomTemplateContext(proxyBrick);
8394
8410
  var template = customTemplateRegistry.get(brickConf.brick);
8395
8411
 
8412
+ if (template.contracts) {
8413
+ collectWidgetContract(template.contracts);
8414
+ }
8415
+
8396
8416
  if (Array.isArray(template.state)) {
8397
8417
  yield tplContext.state.define(template.state, context, proxyBrick);
8398
8418
  }
@@ -11926,6 +11946,7 @@ class Router {
11926
11946
  _this3.renderId = uniqueId("render-id-");
11927
11947
  resetAllInjected();
11928
11948
  clearPollTimeout();
11949
+ clearCollectWidgetContract();
11929
11950
 
11930
11951
  if (_this3.locationContext) {
11931
11952
  _this3.locationContext.resolver.resetRefreshQueue();