@solhun/feedback-kit-core 0.6.0 → 0.6.1

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.js CHANGED
@@ -2583,6 +2583,8 @@ function parseHintItem(item) {
2583
2583
  const scope = obj.scope;
2584
2584
  const platforms = parsePlatforms(obj.platforms);
2585
2585
  if (platforms === null) return null;
2586
+ const element = parseElementRule(obj.element);
2587
+ if (element === MALFORMED_ELEMENT_RULE) return null;
2586
2588
  return {
2587
2589
  id,
2588
2590
  label,
@@ -2590,7 +2592,7 @@ function parseHintItem(item) {
2590
2592
  scope,
2591
2593
  platforms,
2592
2594
  paths: parsePaths(obj.paths),
2593
- element: parseElementRule(obj.element),
2595
+ element,
2594
2596
  active: parseActive(obj.active)
2595
2597
  };
2596
2598
  }
@@ -2610,19 +2612,18 @@ function parsePaths(value) {
2610
2612
  if (!Array.isArray(value)) return [];
2611
2613
  return value.filter((p) => typeof p === "string");
2612
2614
  }
2615
+ var MALFORMED_ELEMENT_RULE = /* @__PURE__ */ Symbol("malformed-element-rule");
2613
2616
  function parseElementRule(value) {
2614
2617
  if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
2615
2618
  const obj = value;
2616
2619
  const rule = {};
2617
- if (Array.isArray(obj.tags)) rule.tags = obj.tags.filter((v) => typeof v === "string");
2618
- if (Array.isArray(obj.roles)) rule.roles = obj.roles.filter((v) => typeof v === "string");
2619
- if (Array.isArray(obj.classIncludes)) {
2620
- rule.classIncludes = obj.classIncludes.filter((v) => typeof v === "string");
2620
+ const axes = ["tags", "roles", "classIncludes", "componentIncludes", "testIds"];
2621
+ for (const axis of axes) {
2622
+ if (!(axis in obj)) continue;
2623
+ const axisValue = obj[axis];
2624
+ if (!Array.isArray(axisValue)) return MALFORMED_ELEMENT_RULE;
2625
+ rule[axis] = axisValue.filter((v) => typeof v === "string");
2621
2626
  }
2622
- if (Array.isArray(obj.componentIncludes)) {
2623
- rule.componentIncludes = obj.componentIncludes.filter((v) => typeof v === "string");
2624
- }
2625
- if (Array.isArray(obj.testIds)) rule.testIds = obj.testIds.filter((v) => typeof v === "string");
2626
2627
  return rule;
2627
2628
  }
2628
2629
  function nonEmptyString(value) {