@next-core/brick-kit 2.179.1 → 2.179.3
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.bundle.js +87 -53
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +87 -53
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/CustomForms/CustomFormContext.d.ts +1 -1
- package/dist/types/core/CustomForms/CustomFormContext.d.ts.map +1 -1
- package/dist/types/core/CustomTemplates/CustomTemplateContext.d.ts +1 -1
- package/dist/types/core/CustomTemplates/CustomTemplateContext.d.ts.map +1 -1
- package/dist/types/core/CustomTemplates/expandCustomTemplate.d.ts.map +1 -1
- package/dist/types/core/FlowApi.d.ts.map +1 -1
- package/dist/types/core/LocationContext.d.ts +2 -1
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/StoryboardContext.d.ts +2 -1
- package/dist/types/core/StoryboardContext.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.bundle.js
CHANGED
|
@@ -1798,7 +1798,7 @@
|
|
|
1798
1798
|
}
|
|
1799
1799
|
|
|
1800
1800
|
class StoryboardContextWrapper {
|
|
1801
|
-
constructor(tplContextId, formContextId) {
|
|
1801
|
+
constructor(tplContextId, formContextId, renderId) {
|
|
1802
1802
|
_defineProperty__default["default"](this, "data", new Map());
|
|
1803
1803
|
_defineProperty__default["default"](this, "batchUpdate", false);
|
|
1804
1804
|
_defineProperty__default["default"](this, "batchUpdateContextsNames", []);
|
|
@@ -1807,9 +1807,11 @@
|
|
|
1807
1807
|
_defineProperty__default["default"](this, "formContextId", void 0);
|
|
1808
1808
|
_defineProperty__default["default"](this, "eventName", void 0);
|
|
1809
1809
|
_defineProperty__default["default"](this, "pendingStack", []);
|
|
1810
|
+
_defineProperty__default["default"](this, "renderId", void 0);
|
|
1810
1811
|
this.tplContextId = tplContextId;
|
|
1811
1812
|
this.formContextId = formContextId;
|
|
1812
1813
|
this.eventName = this.formContextId ? "formstate.change" : this.tplContextId ? "state.change" : "context.change";
|
|
1814
|
+
this.renderId = renderId;
|
|
1813
1815
|
}
|
|
1814
1816
|
set(name, item) {
|
|
1815
1817
|
if (this.data.has(name)) {
|
|
@@ -1909,6 +1911,13 @@
|
|
|
1909
1911
|
promise = item.loading;
|
|
1910
1912
|
}
|
|
1911
1913
|
}
|
|
1914
|
+
var shouldDismiss = error => {
|
|
1915
|
+
// If render twice immediately, flow API contracts maybe cleared before
|
|
1916
|
+
// the second rendering, while the page load handlers of the first
|
|
1917
|
+
// rendering can't be cancelled, which throws `FlowApiNotFoundError`.
|
|
1918
|
+
// So we ignore error reporting for this case.
|
|
1919
|
+
return (error === null || error === void 0 ? void 0 : error.name) === "FlowApiNotFoundError" && this.renderId && this.renderId !== _internalApiGetRouterRenderId();
|
|
1920
|
+
};
|
|
1912
1921
|
if (!promise) {
|
|
1913
1922
|
promise = item.loading = item.load(_objectSpread__default["default"]({
|
|
1914
1923
|
cache: method === "load" ? "default" : "reload"
|
|
@@ -1923,7 +1932,7 @@
|
|
|
1923
1932
|
}));
|
|
1924
1933
|
}, err => {
|
|
1925
1934
|
// Let users to override error handling.
|
|
1926
|
-
if (!(callback !== null && callback !== void 0 && callback.error)) {
|
|
1935
|
+
if (!shouldDismiss(err) && !(callback !== null && callback !== void 0 && callback.error)) {
|
|
1927
1936
|
handleHttpError(err);
|
|
1928
1937
|
}
|
|
1929
1938
|
});
|
|
@@ -1936,7 +1945,9 @@
|
|
|
1936
1945
|
});
|
|
1937
1946
|
callbackFactory("finally")();
|
|
1938
1947
|
}, err => {
|
|
1939
|
-
|
|
1948
|
+
if (!shouldDismiss(err) && callback.error) {
|
|
1949
|
+
callbackFactory("error")(err);
|
|
1950
|
+
}
|
|
1940
1951
|
callbackFactory("finally")();
|
|
1941
1952
|
});
|
|
1942
1953
|
}
|
|
@@ -2221,13 +2232,13 @@
|
|
|
2221
2232
|
|
|
2222
2233
|
var tplContextMap = new Map();
|
|
2223
2234
|
class CustomTemplateContext {
|
|
2224
|
-
constructor(brick) {
|
|
2235
|
+
constructor(brick, renderId) {
|
|
2225
2236
|
_defineProperty__default["default"](this, "variables", void 0);
|
|
2226
2237
|
_defineProperty__default["default"](this, "state", void 0);
|
|
2227
2238
|
_defineProperty__default["default"](this, "id", _.uniqueId("tpl-ctx-"));
|
|
2228
2239
|
this.brick = brick;
|
|
2229
2240
|
tplContextMap.set(this.id, this);
|
|
2230
|
-
this.state = new StoryboardContextWrapper(this.id);
|
|
2241
|
+
this.state = new StoryboardContextWrapper(this.id, undefined, renderId);
|
|
2231
2242
|
brick.tplContextId = this.id;
|
|
2232
2243
|
}
|
|
2233
2244
|
setVariables(variables) {
|
|
@@ -2299,11 +2310,11 @@
|
|
|
2299
2310
|
|
|
2300
2311
|
var FormContextMap = new Map();
|
|
2301
2312
|
class CustomFormContext {
|
|
2302
|
-
constructor() {
|
|
2313
|
+
constructor(renderId) {
|
|
2303
2314
|
_defineProperty__default["default"](this, "formState", void 0);
|
|
2304
2315
|
_defineProperty__default["default"](this, "id", _.uniqueId("form-ctx-"));
|
|
2305
2316
|
FormContextMap.set(this.id, this);
|
|
2306
|
-
this.formState = new StoryboardContextWrapper(undefined, this.id);
|
|
2317
|
+
this.formState = new StoryboardContextWrapper(undefined, this.id, renderId);
|
|
2307
2318
|
}
|
|
2308
2319
|
}
|
|
2309
2320
|
function getCustomFormContext(formContextId) {
|
|
@@ -5891,7 +5902,7 @@
|
|
|
5891
5902
|
return contractsMap.get(name) || widgetContractMap.get(name);
|
|
5892
5903
|
}
|
|
5893
5904
|
|
|
5894
|
-
var
|
|
5905
|
+
var remoteContractCache = new Map();
|
|
5895
5906
|
|
|
5896
5907
|
// Legacy Custom API: `${namespace}@${name}`
|
|
5897
5908
|
// Flow API: `${namespace}@${name}:${version}`
|
|
@@ -5909,7 +5920,7 @@
|
|
|
5909
5920
|
var isFlowApi = provider.includes(":");
|
|
5910
5921
|
var apiDefinition = isFlowApi ? yield fetchFlowApiDefinition(provider) : (yield _internalApiGetMicroAppApiOrchestrationMap()).get(provider);
|
|
5911
5922
|
if (!apiDefinition) {
|
|
5912
|
-
throw new
|
|
5923
|
+
throw new FlowApiNotFoundError("".concat(isFlowApi ? "Flow" : "Legacy Custom", " API not found: \"").concat(provider, "\""));
|
|
5913
5924
|
}
|
|
5914
5925
|
var apiProfile = getApiProfileFromApiDefinition(provider, apiDefinition);
|
|
5915
5926
|
return getApiArgsFromApiProfile(apiProfile, originalArgs, method);
|
|
@@ -5985,23 +5996,18 @@
|
|
|
5985
5996
|
request: contract.request
|
|
5986
5997
|
};
|
|
5987
5998
|
}
|
|
5988
|
-
function fetchFlowApiDefinition(
|
|
5989
|
-
|
|
5990
|
-
if (!promise) {
|
|
5991
|
-
promise = _fetchFlowApiDefinition(provider);
|
|
5992
|
-
flowApiDefinitionPromiseMap.set(provider, promise);
|
|
5993
|
-
}
|
|
5994
|
-
return promise;
|
|
5995
|
-
}
|
|
5996
|
-
function _fetchFlowApiDefinition(_x4) {
|
|
5997
|
-
return _fetchFlowApiDefinition2.apply(this, arguments);
|
|
5999
|
+
function fetchFlowApiDefinition(_x4) {
|
|
6000
|
+
return _fetchFlowApiDefinition.apply(this, arguments);
|
|
5998
6001
|
}
|
|
5999
|
-
function
|
|
6000
|
-
|
|
6002
|
+
function _fetchFlowApiDefinition() {
|
|
6003
|
+
_fetchFlowApiDefinition = _asyncToGenerator__default["default"](function* (provider) {
|
|
6001
6004
|
var [namespaceName, nameWithVersion] = provider.split("@");
|
|
6002
6005
|
var [name, version] = nameWithVersion.split(":");
|
|
6003
|
-
|
|
6004
|
-
|
|
6006
|
+
|
|
6007
|
+
// Do not cache the result of `geContract`, which will lead to no contract
|
|
6008
|
+
// will be found when render twice immediately.
|
|
6009
|
+
var contract = getContract("".concat(namespaceName, ".").concat(name));
|
|
6010
|
+
if (contract) {
|
|
6005
6011
|
return {
|
|
6006
6012
|
name: contract.name,
|
|
6007
6013
|
namespace: contract.namespaceId,
|
|
@@ -6013,32 +6019,56 @@
|
|
|
6013
6019
|
request: contract.request
|
|
6014
6020
|
}
|
|
6015
6021
|
};
|
|
6016
|
-
} else {
|
|
6017
|
-
var {
|
|
6018
|
-
contractData
|
|
6019
|
-
} = yield ContractApi_searchSingleContract({
|
|
6020
|
-
contractName: "".concat(namespaceName, ".").concat(name),
|
|
6021
|
-
version
|
|
6022
|
-
});
|
|
6023
|
-
|
|
6024
|
-
// return undefined if don't found contract
|
|
6025
|
-
if (contractData) {
|
|
6026
|
-
var _contractData$namespa, _contractData$namespa2;
|
|
6027
|
-
return {
|
|
6028
|
-
name: contractData.name,
|
|
6029
|
-
namespace: (_contractData$namespa = contractData.namespace) === null || _contractData$namespa === void 0 ? void 0 : (_contractData$namespa2 = _contractData$namespa[0]) === null || _contractData$namespa2 === void 0 ? void 0 : _contractData$namespa2.name,
|
|
6030
|
-
serviceName: contractData.serviceName,
|
|
6031
|
-
version: contractData.version,
|
|
6032
|
-
contract: {
|
|
6033
|
-
endpoint: contractData.endpoint,
|
|
6034
|
-
response: contractData.response,
|
|
6035
|
-
request: contractData.request
|
|
6036
|
-
}
|
|
6037
|
-
};
|
|
6038
|
-
}
|
|
6039
6022
|
}
|
|
6023
|
+
var promise = remoteContractCache.get(provider);
|
|
6024
|
+
if (!promise) {
|
|
6025
|
+
promise = fetchFlowApiDefinitionFromRemote(namespaceName, name, version);
|
|
6026
|
+
remoteContractCache.set(provider, promise);
|
|
6027
|
+
}
|
|
6028
|
+
return promise;
|
|
6029
|
+
});
|
|
6030
|
+
return _fetchFlowApiDefinition.apply(this, arguments);
|
|
6031
|
+
}
|
|
6032
|
+
function fetchFlowApiDefinitionFromRemote(_x5, _x6, _x7) {
|
|
6033
|
+
return _fetchFlowApiDefinitionFromRemote.apply(this, arguments);
|
|
6034
|
+
}
|
|
6035
|
+
function _fetchFlowApiDefinitionFromRemote() {
|
|
6036
|
+
_fetchFlowApiDefinitionFromRemote = _asyncToGenerator__default["default"](function* (namespace, name, version) {
|
|
6037
|
+
var _contractData$namespa, _contractData$namespa2;
|
|
6038
|
+
var {
|
|
6039
|
+
contractData
|
|
6040
|
+
} = yield ContractApi_searchSingleContract({
|
|
6041
|
+
contractName: "".concat(namespace, ".").concat(name),
|
|
6042
|
+
version
|
|
6043
|
+
});
|
|
6044
|
+
|
|
6045
|
+
// return null if didn't find contract
|
|
6046
|
+
return contractData ? {
|
|
6047
|
+
name: contractData.name,
|
|
6048
|
+
namespace: (_contractData$namespa = contractData.namespace) === null || _contractData$namespa === void 0 ? void 0 : (_contractData$namespa2 = _contractData$namespa[0]) === null || _contractData$namespa2 === void 0 ? void 0 : _contractData$namespa2.name,
|
|
6049
|
+
serviceName: contractData.serviceName,
|
|
6050
|
+
version: contractData.version,
|
|
6051
|
+
contract: {
|
|
6052
|
+
endpoint: contractData.endpoint,
|
|
6053
|
+
response: contractData.response,
|
|
6054
|
+
request: contractData.request
|
|
6055
|
+
}
|
|
6056
|
+
} : null;
|
|
6040
6057
|
});
|
|
6041
|
-
return
|
|
6058
|
+
return _fetchFlowApiDefinitionFromRemote.apply(this, arguments);
|
|
6059
|
+
}
|
|
6060
|
+
class FlowApiNotFoundError extends Error {
|
|
6061
|
+
constructor(message) {
|
|
6062
|
+
// Pass remaining arguments (including vendor specific ones) to parent constructor
|
|
6063
|
+
super(message);
|
|
6064
|
+
this.name = "FlowApiNotFoundError";
|
|
6065
|
+
|
|
6066
|
+
// Maintains proper stack trace for where our error was thrown (only available on V8)
|
|
6067
|
+
// istanbul ignore else
|
|
6068
|
+
if (Error.captureStackTrace) {
|
|
6069
|
+
Error.captureStackTrace(this, FlowApiNotFoundError);
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6042
6072
|
}
|
|
6043
6073
|
|
|
6044
6074
|
function bindListeners(brick, eventsMap, context) {
|
|
@@ -8189,7 +8219,7 @@
|
|
|
8189
8219
|
}
|
|
8190
8220
|
function _asyncExpandCustomTemplate() {
|
|
8191
8221
|
_asyncExpandCustomTemplate = _asyncToGenerator__default["default"](function* (brickConf, proxyBrick, context, locationContext) {
|
|
8192
|
-
var tplContext = new CustomTemplateContext(proxyBrick);
|
|
8222
|
+
var tplContext = new CustomTemplateContext(proxyBrick, locationContext === null || locationContext === void 0 ? void 0 : locationContext.renderId);
|
|
8193
8223
|
var template = customTemplateRegistry.get(brickConf.brick);
|
|
8194
8224
|
if (template.contracts) {
|
|
8195
8225
|
collectWidgetContract(template.contracts);
|
|
@@ -9810,7 +9840,7 @@
|
|
|
9810
9840
|
}
|
|
9811
9841
|
function _AsyncExpandCustomForm() {
|
|
9812
9842
|
_AsyncExpandCustomForm = _asyncToGenerator__default["default"](function* (formData, brickConf, isPreview, context, locationContext) {
|
|
9813
|
-
var formContext = new CustomFormContext();
|
|
9843
|
+
var formContext = new CustomFormContext(locationContext === null || locationContext === void 0 ? void 0 : locationContext.renderId);
|
|
9814
9844
|
formData = initFormContext(formData, brickConf, isPreview);
|
|
9815
9845
|
if (Array.isArray(formData.context)) {
|
|
9816
9846
|
if (locationContext) {
|
|
@@ -10192,7 +10222,7 @@
|
|
|
10192
10222
|
}
|
|
10193
10223
|
|
|
10194
10224
|
class LocationContext {
|
|
10195
|
-
constructor(kernel, location) {
|
|
10225
|
+
constructor(kernel, location, renderId) {
|
|
10196
10226
|
_defineProperty__default["default"](this, "query", void 0);
|
|
10197
10227
|
_defineProperty__default["default"](this, "resolver", void 0);
|
|
10198
10228
|
_defineProperty__default["default"](this, "messageDispatcher", void 0);
|
|
@@ -10210,11 +10240,14 @@
|
|
|
10210
10240
|
_defineProperty__default["default"](this, "currentMatch", void 0);
|
|
10211
10241
|
_defineProperty__default["default"](this, "storyboardContextWrapper", new StoryboardContextWrapper());
|
|
10212
10242
|
_defineProperty__default["default"](this, "observersList", []);
|
|
10243
|
+
_defineProperty__default["default"](this, "renderId", void 0);
|
|
10213
10244
|
this.kernel = kernel;
|
|
10214
10245
|
this.location = location;
|
|
10215
10246
|
this.resolver = new Resolver(kernel, this);
|
|
10216
10247
|
this.query = new URLSearchParams(location.search);
|
|
10217
10248
|
this.messageDispatcher = getMessageDispatcher();
|
|
10249
|
+
this.storyboardContextWrapper = new StoryboardContextWrapper(undefined, undefined, renderId);
|
|
10250
|
+
this.renderId = renderId;
|
|
10218
10251
|
}
|
|
10219
10252
|
getContext(_ref) {
|
|
10220
10253
|
var {
|
|
@@ -10374,15 +10407,16 @@
|
|
|
10374
10407
|
}
|
|
10375
10408
|
}
|
|
10376
10409
|
}
|
|
10377
|
-
yield _this4.mountMenu(route.menu, matched.match, mountRoutesResult);
|
|
10378
10410
|
if (route.documentId) {
|
|
10379
10411
|
mountRoutesResult.appBar.documentId = route.documentId;
|
|
10380
10412
|
}
|
|
10381
10413
|
if (isRouteConfOfRoutes(route) && Array.isArray(route.routes)) {
|
|
10382
10414
|
yield _this4.preFetchMenu(route.context);
|
|
10415
|
+
yield _this4.mountMenu(route.menu, matched.match, mountRoutesResult);
|
|
10383
10416
|
yield _this4.mountRoutes(route.routes, slotId, mountRoutesResult);
|
|
10384
10417
|
} else if (isRouteConfOfBricks(route) && Array.isArray(route.bricks)) {
|
|
10385
10418
|
yield _this4.preFetchMenu(route);
|
|
10419
|
+
yield _this4.mountMenu(route.menu, matched.match, mountRoutesResult);
|
|
10386
10420
|
yield _this4.mountBricks(route.bricks, matched.match, slotId, mountRoutesResult);
|
|
10387
10421
|
|
|
10388
10422
|
// analytics data (page_view event)
|
|
@@ -11659,7 +11693,7 @@
|
|
|
11659
11693
|
return _asyncToGenerator__default["default"](function* () {
|
|
11660
11694
|
var _apiAnalyzer$getInsta, _currentApp$config, _currentApp$config$_e, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme;
|
|
11661
11695
|
_this3.state = "initial";
|
|
11662
|
-
_this3.renderId = _.uniqueId("render-id-");
|
|
11696
|
+
var renderId = _this3.renderId = _.uniqueId("render-id-");
|
|
11663
11697
|
resetAllInjected();
|
|
11664
11698
|
clearPollTimeout();
|
|
11665
11699
|
clearCollectWidgetContract();
|
|
@@ -11673,7 +11707,7 @@
|
|
|
11673
11707
|
// Create the page tracker before page load.
|
|
11674
11708
|
// And the API Analyzer maybe disabled.
|
|
11675
11709
|
var tracePageEnd = (_apiAnalyzer$getInsta = easyopsAnalytics.apiAnalyzer.getInstance()) === null || _apiAnalyzer$getInsta === void 0 ? void 0 : _apiAnalyzer$getInsta.tracePage();
|
|
11676
|
-
var locationContext = _this3.locationContext = new LocationContext(_this3.kernel, location);
|
|
11710
|
+
var locationContext = _this3.locationContext = new LocationContext(_this3.kernel, location, renderId);
|
|
11677
11711
|
if (window.DEVELOPER_PREVIEW) {
|
|
11678
11712
|
return;
|
|
11679
11713
|
}
|