@next-core/brick-kit 2.117.9 → 2.117.10

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';
@@ -10210,15 +10210,16 @@ class Router {
10210
10210
  };
10211
10211
 
10212
10212
  try {
10213
- yield locationContext.mountRoutes( // Concat with a placeholder when loading template preview settings.
10214
- [{
10213
+ var specificTemplatePreviewIndex = findLastIndex(storyboard.routes, route => route.path.startsWith("${APP.homepage}/_dev_only_/template-preview/"));
10214
+ var mergedRoutes = [...storyboard.routes.slice(0, specificTemplatePreviewIndex + 1), {
10215
10215
  path: "${APP.homepage}/_dev_only_/template-preview/:templateId",
10216
10216
  bricks: [{
10217
10217
  brick: "span"
10218
10218
  }],
10219
10219
  menu: false,
10220
10220
  exact: true
10221
- }].concat(storyboard.routes), undefined, mountRoutesResult);
10221
+ }, ...storyboard.routes.slice(specificTemplatePreviewIndex + 1)];
10222
+ yield locationContext.mountRoutes(mergedRoutes, undefined, mountRoutesResult);
10222
10223
  } catch (error) {
10223
10224
  // eslint-disable-next-line no-console
10224
10225
  console.error(error); // Redirect to login page if not logged in.