@uniformdev/canvas 19.173.1-alpha.17 → 19.173.2-alpha.258

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
@@ -462,14 +462,17 @@ var nullLimitPolicy = async (func) => await func();
462
462
  // src/utils/rewriteFilters.ts
463
463
  var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
464
464
  function rewriteFilters(filters) {
465
- return Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
466
- const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
467
- const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
468
- return {
469
- ...acc,
470
- [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
471
- };
472
- }, {});
465
+ return Object.entries(filters != null ? filters : {}).reduce(
466
+ (acc, [key, value]) => {
467
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
468
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
469
+ return {
470
+ ...acc,
471
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
472
+ };
473
+ },
474
+ {}
475
+ );
473
476
  }
474
477
 
475
478
  // src/CanvasClient.ts
@@ -980,6 +983,9 @@ function isAssetParamValueItem(item) {
980
983
  item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
981
984
  );
982
985
  }
986
+ function isLinkParamValue(value) {
987
+ return typeof value === "object" && value !== null && "type" in value && "path" in value;
988
+ }
983
989
 
984
990
  // src/utils/properties.ts
985
991
  function getPropertiesValue(entity) {
@@ -1031,6 +1037,89 @@ function flattenSingleNodeValues(data, options = {}) {
1031
1037
  ) : properties;
1032
1038
  }
1033
1039
 
1040
+ // src/utils/variables/parseVariableExpression.ts
1041
+ var escapeCharacter = "\\";
1042
+ var variablePrefix = "${";
1043
+ var variableSuffix = "}";
1044
+ function parseVariableExpression(serialized, onToken) {
1045
+ if (typeof serialized !== "string") {
1046
+ throw new TypeError("Variable expression must be a string");
1047
+ }
1048
+ let bufferStartIndex = 0;
1049
+ let bufferEndIndex = 0;
1050
+ let tokenCount = 0;
1051
+ const handleToken = (token, type) => {
1052
+ tokenCount++;
1053
+ return onToken == null ? void 0 : onToken(token, type);
1054
+ };
1055
+ let state = "text";
1056
+ for (let index = 0; index < serialized.length; index++) {
1057
+ const char = serialized[index];
1058
+ if (bufferStartIndex > bufferEndIndex) {
1059
+ bufferEndIndex = bufferStartIndex;
1060
+ }
1061
+ if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
1062
+ if (serialized[index - 1] === escapeCharacter) {
1063
+ bufferEndIndex -= escapeCharacter.length;
1064
+ if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
1065
+ return tokenCount;
1066
+ }
1067
+ bufferStartIndex = index;
1068
+ bufferEndIndex = index + 1;
1069
+ continue;
1070
+ }
1071
+ state = "variable";
1072
+ if (bufferEndIndex > bufferStartIndex) {
1073
+ if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
1074
+ return tokenCount;
1075
+ }
1076
+ bufferStartIndex = bufferEndIndex;
1077
+ }
1078
+ index += variablePrefix.length - 1;
1079
+ bufferStartIndex += variablePrefix.length;
1080
+ continue;
1081
+ }
1082
+ if (char === variableSuffix && state === "variable") {
1083
+ if (serialized[index - 1] === escapeCharacter) {
1084
+ bufferEndIndex++;
1085
+ continue;
1086
+ }
1087
+ state = "text";
1088
+ if (bufferEndIndex > bufferStartIndex) {
1089
+ const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
1090
+ if (handleToken(unescapedVariableName, "variable") === false) {
1091
+ return tokenCount;
1092
+ }
1093
+ bufferStartIndex = bufferEndIndex + variableSuffix.length;
1094
+ }
1095
+ continue;
1096
+ }
1097
+ bufferEndIndex++;
1098
+ }
1099
+ if (bufferEndIndex > bufferStartIndex) {
1100
+ if (state === "variable") {
1101
+ state = "text";
1102
+ bufferStartIndex -= variablePrefix.length;
1103
+ }
1104
+ handleToken(serialized.substring(bufferStartIndex), state);
1105
+ }
1106
+ return tokenCount;
1107
+ }
1108
+
1109
+ // src/utils/variables/hasReferencedVariables.ts
1110
+ function hasReferencedVariables(value) {
1111
+ if (value === void 0) {
1112
+ return 0;
1113
+ }
1114
+ let variableTokenCount = 0;
1115
+ parseVariableExpression(value, (_, tokenType) => {
1116
+ if (tokenType === "variable") {
1117
+ variableTokenCount++;
1118
+ }
1119
+ });
1120
+ return variableTokenCount;
1121
+ }
1122
+
1034
1123
  // src/enhancement/walkNodeTree.ts
1035
1124
  function walkNodeTree(node, visitor, options) {
1036
1125
  var _a, _b;
@@ -1254,7 +1343,25 @@ function walkNodeTree(node, visitor, options) {
1254
1343
  const propertyEntries = Object.entries(properties);
1255
1344
  for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
1256
1345
  const [propKey, propObject] = propertyEntries[propIndex];
1257
- if (!isNestedNodeType(propObject.type)) continue;
1346
+ if (!isNestedNodeType(propObject.type)) {
1347
+ continue;
1348
+ }
1349
+ if (typeof propObject.value === "string" && hasReferencedVariables(propObject.value) > 0) {
1350
+ continue;
1351
+ }
1352
+ if (!Array.isArray(propObject.value)) {
1353
+ const error = new BlockFormatError(
1354
+ `${getComponentPath(currentQueueEntry.ancestorsAndSelf)}`,
1355
+ propKey,
1356
+ propObject.value
1357
+ );
1358
+ if (options == null ? void 0 : options.throwForInvalidBlockValues) {
1359
+ throw error;
1360
+ } else {
1361
+ console.warn(`Skipped invalid block value: ${error.message}}`);
1362
+ continue;
1363
+ }
1364
+ }
1258
1365
  const blocks = (_b = propObject.value) != null ? _b : [];
1259
1366
  for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
1260
1367
  const enqueueingBlock = blocks[blockIndex];
@@ -1290,6 +1397,17 @@ function getBlockValue(component, parameterName) {
1290
1397
  }
1291
1398
  return [];
1292
1399
  }
1400
+ var BlockFormatError = class _BlockFormatError extends Error {
1401
+ constructor(componentPath, propertyId, blockValue) {
1402
+ super(
1403
+ `${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${blockValue === null ? "null" : typeof blockValue}`
1404
+ );
1405
+ this.componentPath = componentPath;
1406
+ this.propertyId = propertyId;
1407
+ this.blockValue = blockValue;
1408
+ Object.setPrototypeOf(this, _BlockFormatError.prototype);
1409
+ }
1410
+ };
1293
1411
 
1294
1412
  // src/enhancement/enhance.ts
1295
1413
  async function enhance({
@@ -1618,12 +1736,18 @@ function evaluateVisibilityCriteriaGroup(options) {
1618
1736
  return hasIndeterminateClauses ? null : !earlyExitResult;
1619
1737
  }
1620
1738
  function evaluateCriterion(clause, rootOptions) {
1739
+ var _a;
1621
1740
  if ("clauses" in clause) {
1622
1741
  return evaluateVisibilityCriteriaGroup({
1623
1742
  ...rootOptions,
1624
1743
  criteriaGroup: clause
1625
1744
  });
1626
1745
  }
1746
+ const lhs = (_a = clause.source) != null ? _a : clause.rule;
1747
+ const rhs = Array.isArray(clause.value) ? clause.value : clause.value !== void 0 ? [clause.value] : void 0;
1748
+ if (typeof lhs === "string" && hasReferencedVariables(lhs) > 0 || (rhs == null ? void 0 : rhs.some((rhv) => typeof rhv === "string" && hasReferencedVariables(rhv) > 0))) {
1749
+ return null;
1750
+ }
1627
1751
  const rule = rootOptions.rules[clause.rule];
1628
1752
  if (rule) {
1629
1753
  return rule(clause);
@@ -1631,6 +1755,24 @@ function evaluateCriterion(clause, rootOptions) {
1631
1755
  return null;
1632
1756
  }
1633
1757
 
1758
+ // src/enhancement/visibility/evaluateNodeVisibilityParameter.ts
1759
+ function evaluateNodeVisibilityParameter({
1760
+ parameter,
1761
+ ...evaluateGroupOptions
1762
+ }) {
1763
+ if (parameter == null ? void 0 : parameter.explicitlyHidden) {
1764
+ return false;
1765
+ }
1766
+ if (!(parameter == null ? void 0 : parameter.criteria)) {
1767
+ return true;
1768
+ }
1769
+ const result = evaluateVisibilityCriteriaGroup({
1770
+ ...evaluateGroupOptions,
1771
+ criteriaGroup: parameter.criteria
1772
+ });
1773
+ return result;
1774
+ }
1775
+
1634
1776
  // src/enhancement/visibility/evaluatePropertyCriteria.ts
1635
1777
  function evaluatePropertyCriteria({
1636
1778
  baseValue,
@@ -1695,17 +1837,11 @@ function evaluateNodeVisibility({
1695
1837
  var _a;
1696
1838
  const properties = getPropertiesValue(node);
1697
1839
  const vizCriteria = (_a = properties == null ? void 0 : properties[CANVAS_VIZ_CONTROL_PARAM]) == null ? void 0 : _a.value;
1698
- if (vizCriteria == null ? void 0 : vizCriteria.explicitlyHidden) {
1699
- return false;
1700
- }
1701
- if (!(vizCriteria == null ? void 0 : vizCriteria.criteria)) {
1702
- return true;
1703
- }
1704
- const result = evaluateVisibilityCriteriaGroup({
1840
+ const result = evaluateNodeVisibilityParameter({
1705
1841
  ...evaluateGroupOptions,
1706
- criteriaGroup: vizCriteria.criteria
1842
+ parameter: vizCriteria
1707
1843
  });
1708
- if (vizCriteria.criteria.clauses.length === 0 && evaluateGroupOptions.simplifyCriteria) {
1844
+ if ((vizCriteria == null ? void 0 : vizCriteria.criteria) && vizCriteria.criteria.clauses.length === 0 && evaluateGroupOptions.simplifyCriteria) {
1709
1845
  properties == null ? true : delete properties[CANVAS_VIZ_CONTROL_PARAM];
1710
1846
  }
1711
1847
  return result;
@@ -1747,7 +1883,7 @@ function evaluateWalkTreePropertyCriteria({
1747
1883
  ...Object.keys((_b = property.localesConditions) != null ? _b : {})
1748
1884
  ];
1749
1885
  localesDefined.forEach((locale) => {
1750
- var _a2, _b2, _c2, _d, _e, _f, _g;
1886
+ var _a2, _b2, _c2, _d, _e, _f;
1751
1887
  const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
1752
1888
  baseValue: (_a2 = property.locales) == null ? void 0 : _a2[locale],
1753
1889
  conditionalValues: (_b2 = property.localesConditions) == null ? void 0 : _b2[locale],
@@ -1755,25 +1891,25 @@ function evaluateWalkTreePropertyCriteria({
1755
1891
  simplifyCriteria: true,
1756
1892
  keepIndeterminate
1757
1893
  });
1758
- if (currentValue === null) {
1894
+ if (currentValue === null || currentValue === void 0) {
1759
1895
  (_c2 = property.locales) == null ? true : delete _c2[locale];
1760
- if (!Object.keys((_d = property.locales) != null ? _d : {}).length) {
1761
- delete properties[propertyName];
1762
- }
1763
1896
  } else {
1764
- (_e = property.locales) != null ? _e : property.locales = {};
1897
+ (_d = property.locales) != null ? _d : property.locales = {};
1765
1898
  property.locales[locale] = currentValue;
1766
1899
  }
1767
1900
  if (!(remainingConditionalValues == null ? void 0 : remainingConditionalValues.length)) {
1768
- (_f = property.localesConditions) == null ? true : delete _f[locale];
1901
+ (_e = property.localesConditions) == null ? true : delete _e[locale];
1769
1902
  } else {
1770
- (_g = property.localesConditions) != null ? _g : property.localesConditions = {};
1903
+ (_f = property.localesConditions) != null ? _f : property.localesConditions = {};
1771
1904
  property.localesConditions[locale] = remainingConditionalValues;
1772
1905
  }
1773
1906
  });
1774
1907
  if (!Object.keys((_c = property.localesConditions) != null ? _c : {}).length) {
1775
1908
  delete property.localesConditions;
1776
1909
  }
1910
+ if (!property.locales && !property.localesConditions) {
1911
+ delete properties[propertyName];
1912
+ }
1777
1913
  } else {
1778
1914
  const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
1779
1915
  baseValue: property.value,
@@ -1785,9 +1921,17 @@ function evaluateWalkTreePropertyCriteria({
1785
1921
  if (currentValue === null) {
1786
1922
  delete properties[propertyName];
1787
1923
  } else {
1788
- property.value = currentValue;
1924
+ if (currentValue !== void 0) {
1925
+ property.value = currentValue;
1926
+ } else {
1927
+ delete property.value;
1928
+ }
1929
+ }
1930
+ if (remainingConditionalValues === void 0) {
1931
+ delete property.conditions;
1932
+ } else {
1933
+ property.conditions = remainingConditionalValues;
1789
1934
  }
1790
- property.conditions = remainingConditionalValues;
1791
1935
  }
1792
1936
  });
1793
1937
  }
@@ -1869,6 +2013,32 @@ function createDynamicInputVisibilityRule(dynamicInputs) {
1869
2013
  };
1870
2014
  }
1871
2015
 
2016
+ // src/enhancement/visibility/rules/createDynamicTokenVisibilityRule.ts
2017
+ var dynamicTokenVisibilityOperators = /* @__PURE__ */ new Set([
2018
+ "is",
2019
+ "!is",
2020
+ "has",
2021
+ "!has",
2022
+ "startswith",
2023
+ "!startswith",
2024
+ "endswith",
2025
+ "!endswith",
2026
+ "empty",
2027
+ "!empty"
2028
+ ]);
2029
+ var CANVAS_VIZ_DYNAMIC_TOKEN_RULE = "$dt";
2030
+ function createDynamicTokenVisibilityRule() {
2031
+ return {
2032
+ [CANVAS_VIZ_DYNAMIC_TOKEN_RULE]: (criterion) => {
2033
+ var _a;
2034
+ if (typeof criterion.source !== "string" || hasReferencedVariables(criterion.source)) {
2035
+ return null;
2036
+ }
2037
+ return evaluateStringMatch(criterion, (_a = criterion.source) != null ? _a : "", dynamicTokenVisibilityOperators);
2038
+ }
2039
+ };
2040
+ }
2041
+
1872
2042
  // src/enhancement/visibility/rules/createLocaleVisibilityRule.ts
1873
2043
  var localeVisibilityOperators = /* @__PURE__ */ new Set(["is", "!is"]);
1874
2044
  var CANVAS_VIZ_LOCALE_RULE = "$locale";
@@ -1931,7 +2101,7 @@ function localize(options) {
1931
2101
  const { type, node, actions } = context;
1932
2102
  if (type !== "component") {
1933
2103
  if (isUsingModernOptions) {
1934
- localizeProperties(node.fields, locale);
2104
+ localizeProperties(node, locale, vizControlLocaleRule);
1935
2105
  }
1936
2106
  return;
1937
2107
  }
@@ -1944,11 +2114,6 @@ function localize(options) {
1944
2114
  if (!result) {
1945
2115
  return;
1946
2116
  }
1947
- evaluateWalkTreePropertyCriteria({
1948
- node: context.node,
1949
- rules: vizControlLocaleRule,
1950
- keepIndeterminate: true
1951
- });
1952
2117
  }
1953
2118
  if (node.type === CANVAS_LOCALIZATION_TYPE) {
1954
2119
  const locales = extractLocales({ component: node });
@@ -1961,7 +2126,7 @@ function localize(options) {
1961
2126
  replaceComponent.forEach((component) => {
1962
2127
  removeLocaleProperty(component);
1963
2128
  if (isUsingModernOptions) {
1964
- localizeProperties(getPropertiesValue(component), locale);
2129
+ localizeProperties(component, locale, vizControlLocaleRule);
1965
2130
  }
1966
2131
  });
1967
2132
  const [first, ...rest] = replaceComponent;
@@ -1973,7 +2138,7 @@ function localize(options) {
1973
2138
  actions.remove();
1974
2139
  }
1975
2140
  } else if (isUsingModernOptions) {
1976
- localizeProperties(getPropertiesValue(node), locale);
2141
+ localizeProperties(node, locale, vizControlLocaleRule);
1977
2142
  }
1978
2143
  });
1979
2144
  }
@@ -1992,36 +2157,51 @@ function removeLocaleProperty(component) {
1992
2157
  }
1993
2158
  }
1994
2159
  }
1995
- function localizeProperties(properties, locale) {
2160
+ function localizeProperties(node, locale, rules) {
2161
+ const properties = getPropertiesValue(node);
1996
2162
  if (!properties) {
1997
2163
  return void 0;
1998
2164
  }
1999
- Object.entries(properties).forEach(([key, property]) => {
2000
- var _a;
2165
+ Object.entries(properties).forEach(([propertyId, propertyValue]) => {
2166
+ var _a, _b;
2001
2167
  if (!locale) {
2002
- delete property.locales;
2168
+ delete propertyValue.locales;
2169
+ delete propertyValue.localesConditions;
2003
2170
  }
2004
- const currentLocaleValue = locale ? (_a = property.locales) == null ? void 0 : _a[locale] : void 0;
2171
+ const currentLocaleValue = locale ? (_a = propertyValue.locales) == null ? void 0 : _a[locale] : void 0;
2005
2172
  if (currentLocaleValue !== void 0) {
2006
- property.value = currentLocaleValue;
2173
+ propertyValue.value = currentLocaleValue;
2174
+ }
2175
+ const currentLocaleConditionalValues = locale ? (_b = propertyValue.localesConditions) == null ? void 0 : _b[locale] : void 0;
2176
+ if (currentLocaleConditionalValues !== void 0) {
2177
+ propertyValue.conditions = currentLocaleConditionalValues;
2007
2178
  }
2008
- delete property.locales;
2009
- if (property.value === void 0) {
2010
- delete properties[key];
2179
+ delete propertyValue.locales;
2180
+ delete propertyValue.localesConditions;
2181
+ if (propertyValue.value === void 0 && propertyValue.conditions === void 0) {
2182
+ delete properties[propertyId];
2011
2183
  }
2012
2184
  });
2185
+ evaluateWalkTreePropertyCriteria({
2186
+ node,
2187
+ rules,
2188
+ keepIndeterminate: true
2189
+ });
2013
2190
  }
2014
2191
 
2015
2192
  // src/enhancement/UniqueBatchEntries.ts
2016
2193
  var UniqueBatchEntries = class {
2017
2194
  constructor(entries, uniqueKeySelector) {
2018
- this.groups = entries.reduce((acc, task) => {
2019
- var _a;
2020
- const key = uniqueKeySelector(task.args);
2021
- acc[key] = (_a = acc[key]) != null ? _a : [];
2022
- acc[key].push(task);
2023
- return acc;
2024
- }, {});
2195
+ this.groups = entries.reduce(
2196
+ (acc, task) => {
2197
+ var _a;
2198
+ const key = uniqueKeySelector(task.args);
2199
+ acc[key] = (_a = acc[key]) != null ? _a : [];
2200
+ acc[key].push(task);
2201
+ return acc;
2202
+ },
2203
+ {}
2204
+ );
2025
2205
  }
2026
2206
  /** Resolves all entries in a group key with the same result value. */
2027
2207
  resolveKey(key, result) {
@@ -2776,14 +2956,19 @@ function convertEntryToPutEntry(entry) {
2776
2956
  _overridability: entry.entry._overridability,
2777
2957
  _overrides: entry.entry._overrides,
2778
2958
  fields: entry.entry.fields,
2779
- _locales: entry.entry._locales
2959
+ _locales: entry.entry._locales,
2960
+ _thumbnail: entry.entry._thumbnail,
2961
+ _patternDataResources: entry.entry._patternDataResources
2780
2962
  },
2781
2963
  pattern: entry.pattern,
2782
2964
  state: entry.state,
2783
2965
  projectId: entry.projectId,
2784
2966
  releaseId: entry.releaseId,
2785
2967
  workflowId: entry.workflowId,
2786
- workflowStageId: entry.workflowStageId
2968
+ workflowStageId: entry.workflowStageId,
2969
+ editionId: entry.editionId,
2970
+ editionName: entry.editionName,
2971
+ editionPriority: entry.editionPriority
2787
2972
  };
2788
2973
  }
2789
2974
 
@@ -2869,7 +3054,7 @@ var isComponentPlaceholderId = (id) => {
2869
3054
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2870
3055
  };
2871
3056
  var generateComponentPlaceholderId = (randomId, sdkVersion, parent) => {
2872
- if (typeof sdkVersion === "undefined" || sdkVersion === 1) {
3057
+ if (sdkVersion === 1) {
2873
3058
  return PLACEHOLDER_ID;
2874
3059
  }
2875
3060
  let idParts = [PLACEHOLDER_ID, randomId];
@@ -2895,72 +3080,6 @@ var parseComponentPlaceholderId = (id) => {
2895
3080
  return result;
2896
3081
  };
2897
3082
 
2898
- // src/utils/variables/parseVariableExpression.ts
2899
- var escapeCharacter = "\\";
2900
- var variablePrefix = "${";
2901
- var variableSuffix = "}";
2902
- function parseVariableExpression(serialized, onToken) {
2903
- let bufferStartIndex = 0;
2904
- let bufferEndIndex = 0;
2905
- let tokenCount = 0;
2906
- const handleToken = (token, type) => {
2907
- tokenCount++;
2908
- return onToken == null ? void 0 : onToken(token, type);
2909
- };
2910
- let state = "text";
2911
- for (let index = 0; index < serialized.length; index++) {
2912
- const char = serialized[index];
2913
- if (bufferStartIndex > bufferEndIndex) {
2914
- bufferEndIndex = bufferStartIndex;
2915
- }
2916
- if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
2917
- if (serialized[index - 1] === escapeCharacter) {
2918
- bufferEndIndex -= escapeCharacter.length;
2919
- if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
2920
- return tokenCount;
2921
- }
2922
- bufferStartIndex = index;
2923
- bufferEndIndex = index + 1;
2924
- continue;
2925
- }
2926
- state = "variable";
2927
- if (bufferEndIndex > bufferStartIndex) {
2928
- if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
2929
- return tokenCount;
2930
- }
2931
- bufferStartIndex = bufferEndIndex;
2932
- }
2933
- index += variablePrefix.length - 1;
2934
- bufferStartIndex += variablePrefix.length;
2935
- continue;
2936
- }
2937
- if (char === variableSuffix && state === "variable") {
2938
- if (serialized[index - 1] === escapeCharacter) {
2939
- bufferEndIndex++;
2940
- continue;
2941
- }
2942
- state = "text";
2943
- if (bufferEndIndex > bufferStartIndex) {
2944
- const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
2945
- if (handleToken(unescapedVariableName, "variable") === false) {
2946
- return tokenCount;
2947
- }
2948
- bufferStartIndex = bufferEndIndex + variableSuffix.length;
2949
- }
2950
- continue;
2951
- }
2952
- bufferEndIndex++;
2953
- }
2954
- if (bufferEndIndex > bufferStartIndex) {
2955
- if (state === "variable") {
2956
- state = "text";
2957
- bufferStartIndex -= variablePrefix.length;
2958
- }
2959
- handleToken(serialized.substring(bufferStartIndex), state);
2960
- }
2961
- return tokenCount;
2962
- }
2963
-
2964
3083
  // src/utils/variables/bindVariables.ts
2965
3084
  function bindVariables({
2966
3085
  variables,
@@ -2998,7 +3117,7 @@ function bindVariables({
2998
3117
  }
2999
3118
 
3000
3119
  // src/utils/variables/bindVariablesToObject.ts
3001
- import { produce } from "immer";
3120
+ import { isDraft, produce } from "immer";
3002
3121
 
3003
3122
  // src/utils/variables/createVariableReference.ts
3004
3123
  function createVariableReference(variableName) {
@@ -3026,7 +3145,11 @@ function bindVariablesToObjectRecursive({
3026
3145
  if (richTextNodeResult !== void 0) {
3027
3146
  return richTextNodeResult;
3028
3147
  }
3029
- const result = produce(value, (draft) => {
3148
+ const produceToUse = !isDraft(value) ? produce : (produceValue, producer) => {
3149
+ producer(produceValue);
3150
+ return produceValue;
3151
+ };
3152
+ const result = produceToUse(value, (draft) => {
3030
3153
  Object.entries(draft).forEach(([property, oldValue]) => {
3031
3154
  const currentObjectPath = recursivePath ? `${recursivePath}.${property}` : property;
3032
3155
  if (typeof oldValue === "string") {
@@ -3132,6 +3255,7 @@ export {
3132
3255
  ATTRIBUTE_PLACEHOLDER,
3133
3256
  ApiClientError2 as ApiClientError,
3134
3257
  BatchEntry,
3258
+ BlockFormatError,
3135
3259
  CANVAS_BLOCK_PARAM_TYPE,
3136
3260
  CANVAS_DRAFT_STATE,
3137
3261
  CANVAS_EDITOR_STATE,
@@ -3151,6 +3275,7 @@ export {
3151
3275
  CANVAS_TEST_VARIANT_PARAM,
3152
3276
  CANVAS_VIZ_CONTROL_PARAM,
3153
3277
  CANVAS_VIZ_DI_RULE,
3278
+ CANVAS_VIZ_DYNAMIC_TOKEN_RULE,
3154
3279
  CANVAS_VIZ_LOCALE_RULE,
3155
3280
  CANVAS_VIZ_QUIRKS_RULE,
3156
3281
  CanvasClient,
@@ -3196,6 +3321,7 @@ export {
3196
3321
  createBatchEnhancer,
3197
3322
  createCanvasChannel,
3198
3323
  createDynamicInputVisibilityRule,
3324
+ createDynamicTokenVisibilityRule,
3199
3325
  createEventBus,
3200
3326
  createLimitPolicy,
3201
3327
  createLocaleVisibilityRule,
@@ -3203,6 +3329,7 @@ export {
3203
3329
  createUniformApiEnhancer,
3204
3330
  createVariableReference,
3205
3331
  enhance,
3332
+ evaluateNodeVisibilityParameter,
3206
3333
  evaluatePropertyCriteria,
3207
3334
  evaluateVisibilityCriteriaGroup,
3208
3335
  evaluateWalkTreeNodeVisibility,
@@ -3222,6 +3349,7 @@ export {
3222
3349
  getParameterAttributes,
3223
3350
  getPropertiesValue,
3224
3351
  getPropertyValue,
3352
+ hasReferencedVariables,
3225
3353
  isAddComponentMessage,
3226
3354
  isAllowedReferrer,
3227
3355
  isAssetParamValue,
@@ -3231,6 +3359,7 @@ export {
3231
3359
  isContextStorageUpdatedMessage,
3232
3360
  isDismissPlaceholderMessage,
3233
3361
  isEntryData,
3362
+ isLinkParamValue,
3234
3363
  isMovingComponentMessage,
3235
3364
  isNestedNodeType,
3236
3365
  isOpenParameterEditorMessage,