@timeax/digital-service-engine 0.2.6 → 0.2.7

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.
@@ -4658,10 +4658,19 @@ function validateOrderKinds(v) {
4658
4658
  }
4659
4659
 
4660
4660
  // src/core/validate/steps/service-vs-input.ts
4661
+ function hasButtonTriggerMap(v, fieldId) {
4662
+ var _a, _b;
4663
+ const includes = (_a = v.props.includes_for_buttons) == null ? void 0 : _a[fieldId];
4664
+ const excludes = (_b = v.props.excludes_for_buttons) == null ? void 0 : _b[fieldId];
4665
+ return Array.isArray(includes) && includes.length > 0 || Array.isArray(excludes) && excludes.length > 0;
4666
+ }
4661
4667
  function validateServiceVsUserInput(v) {
4662
4668
  for (const f of v.fields) {
4663
4669
  const anySvc = hasAnyServiceOption(f);
4664
4670
  const hasName = !!(f.name && f.name.trim());
4671
+ const isButton2 = f.button === true;
4672
+ const hasFieldService = f.service_id !== void 0 && f.service_id !== null;
4673
+ const hasTriggerMap = isButton2 && hasButtonTriggerMap(v, f.id);
4665
4674
  if (f.type === "custom" && anySvc) {
4666
4675
  v.errors.push({
4667
4676
  code: "user_input_field_has_service_option",
@@ -4672,14 +4681,15 @@ function validateServiceVsUserInput(v) {
4672
4681
  });
4673
4682
  }
4674
4683
  if (!hasName) {
4675
- if (!anySvc) {
4676
- v.errors.push({
4677
- code: "service_field_missing_service_id",
4678
- severity: "error",
4679
- message: `Service-backed field "${f.id}" has no "name" and must provide at least one option with a service_id.`,
4680
- nodeId: f.id
4681
- });
4684
+ if (hasFieldService || anySvc || hasTriggerMap) {
4685
+ continue;
4682
4686
  }
4687
+ v.errors.push({
4688
+ code: "service_field_missing_service_id",
4689
+ severity: "error",
4690
+ message: isButton2 ? `Button field "${f.id}" has no "name", no "service_id", and no includes/excludes trigger map. Add a name, attach a service_id, or configure includes_for_buttons/excludes_for_buttons.` : `Service-backed field "${f.id}" has no "name" and must provide at least one option with a service_id.`,
4691
+ nodeId: f.id
4692
+ });
4683
4693
  } else {
4684
4694
  if (anySvc) {
4685
4695
  v.errors.push({