@next-core/editor-bricks-helper 0.47.38 → 0.48.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.
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useMemo, useRef, useCallback, createContext
2
2
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import { sortBy, clamp, isEmpty, cloneDeep, upperFirst, omit } from 'lodash';
5
- import { hasOwnProperty, normalizeBuilderNode, isBrickNode, isRouteNode, isCustomTemplateNode, isSnippetNode, JsonStorage } from '@next-core/brick-utils';
5
+ import { hasOwnProperty, normalizeBuilderNode, isBrickNode, isRouteNode, computeConstantCondition, isCustomTemplateNode, isSnippetNode, JsonStorage } from '@next-core/brick-utils';
6
6
  export { isBrickNode, isCustomTemplateNode, isRouteNode, isSnippetNode } from '@next-core/brick-utils';
7
7
  import yaml from 'js-yaml';
8
8
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
@@ -454,8 +454,21 @@ function getBuilderNode(nodeData, nodeUid, isTemplateInternalNode) {
454
454
 
455
455
  var isBrick = isBrickNode(nodeData);
456
456
  var brickName = isBrick ? nodeData.brick.split(".").pop() : null;
457
+ var unreachable = false;
458
+
459
+ if ((normalized === null || normalized === void 0 ? void 0 : normalized.if) !== undefined && (isBrick || isRouteNode(nodeData))) {
460
+ var check = {
461
+ if: normalized.if
462
+ };
463
+ computeConstantCondition(check);
464
+
465
+ if (check.if === false) {
466
+ unreachable = true;
467
+ }
468
+ }
469
+
457
470
  return Object.fromEntries(Object.entries(nodeData).filter(entry => !nodeIgnoreFields.includes(entry[0])).concat([["alias", // Ignore alias which equals to brick name.
458
- !(isBrick && nodeData.alias === brickName) && nodeData.alias || (isBrick ? nodeData.ref || parsedTestId || parsedId || brickName : undefined)], ["$$uid", nodeUid], ["$$matchedSelectors", matchedSelectors], ["$$isTemplateInternalNode", isTemplateInternalNode], ["$$normalized", normalized]]).concat(parsedFields));
471
+ !(isBrick && nodeData.alias === brickName) && nodeData.alias || (isBrick ? nodeData.ref || parsedTestId || parsedId || brickName : undefined)], ["$$uid", nodeUid], ["$$matchedSelectors", matchedSelectors], ["$$isTemplateInternalNode", isTemplateInternalNode], ["$$normalized", normalized], ["$$unreachable", unreachable]]).concat(parsedFields));
459
472
  }
460
473
 
461
474
  function getAppendingNodesAndEdges(nodeData, nodeUid, templateSourceMap) {