@next-core/brick-kit 2.117.9 → 2.117.12

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
@@ -5,7 +5,7 @@ import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
5
5
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
6
6
  import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext, useReducer, useCallback } from 'react';
7
7
  import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, matchPath, scanAppGetMenuInAny, asyncProcessBrick, restoreDynamicTemplates, mapCustomApisToNameAndNamespace, scanCustomApisInStoryboard } from '@next-core/brick-utils';
8
- import lodash, { set, get, difference, identity, uniqueId, cloneDeep, isNil, sortBy, merge, pick, orderBy, omit, clamp, isEmpty, noop, isObject as isObject$1, isString } from 'lodash';
8
+ import lodash, { set, get, difference, identity, uniqueId, cloneDeep, isNil, sortBy, merge, pick, orderBy, omit, findLastIndex, clamp, isEmpty, noop, isObject as isObject$1, isString } from 'lodash';
9
9
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
10
10
  import moment from 'moment';
11
11
  import { pipes } from '@next-core/pipes';
@@ -2754,7 +2754,6 @@ function constructMenuByMenusList(_x4, _x5, _x6) {
2754
2754
 
2755
2755
  function _constructMenuByMenusList() {
2756
2756
  _constructMenuByMenusList = _asyncToGenerator$4(function* (menus, context, kernel) {
2757
- processMenuCache.clear();
2758
2757
  var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
2759
2758
  data.forEach((item, index) => processMenuCache.set(menus[index], item));
2760
2759
  });
@@ -8081,7 +8080,7 @@ class Kernel {
8081
8080
  path: previewPath,
8082
8081
  bricks: [_objectSpread({
8083
8082
  brick: templateId
8084
- }, pick(settings, "properties", "events", "lifeCycle"))],
8083
+ }, pick(settings, "properties", "events", "lifeCycle", "context"))],
8085
8084
  menu: false,
8086
8085
  exact: true
8087
8086
  };
@@ -10210,15 +10209,16 @@ class Router {
10210
10209
  };
10211
10210
 
10212
10211
  try {
10213
- yield locationContext.mountRoutes( // Concat with a placeholder when loading template preview settings.
10214
- [{
10212
+ var specificTemplatePreviewIndex = findLastIndex(storyboard.routes, route => route.path.startsWith("${APP.homepage}/_dev_only_/template-preview/"));
10213
+ var mergedRoutes = [...storyboard.routes.slice(0, specificTemplatePreviewIndex + 1), {
10215
10214
  path: "${APP.homepage}/_dev_only_/template-preview/:templateId",
10216
10215
  bricks: [{
10217
10216
  brick: "span"
10218
10217
  }],
10219
10218
  menu: false,
10220
10219
  exact: true
10221
- }].concat(storyboard.routes), undefined, mountRoutesResult);
10220
+ }, ...storyboard.routes.slice(specificTemplatePreviewIndex + 1)];
10221
+ yield locationContext.mountRoutes(mergedRoutes, undefined, mountRoutesResult);
10222
10222
  } catch (error) {
10223
10223
  // eslint-disable-next-line no-console
10224
10224
  console.error(error); // Redirect to login page if not logged in.