@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.
@@ -4701,10 +4701,19 @@ function validateOrderKinds(v) {
4701
4701
  }
4702
4702
 
4703
4703
  // src/core/validate/steps/service-vs-input.ts
4704
+ function hasButtonTriggerMap(v, fieldId) {
4705
+ var _a, _b;
4706
+ const includes = (_a = v.props.includes_for_buttons) == null ? void 0 : _a[fieldId];
4707
+ const excludes = (_b = v.props.excludes_for_buttons) == null ? void 0 : _b[fieldId];
4708
+ return Array.isArray(includes) && includes.length > 0 || Array.isArray(excludes) && excludes.length > 0;
4709
+ }
4704
4710
  function validateServiceVsUserInput(v) {
4705
4711
  for (const f of v.fields) {
4706
4712
  const anySvc = hasAnyServiceOption(f);
4707
4713
  const hasName = !!(f.name && f.name.trim());
4714
+ const isButton2 = f.button === true;
4715
+ const hasFieldService = f.service_id !== void 0 && f.service_id !== null;
4716
+ const hasTriggerMap = isButton2 && hasButtonTriggerMap(v, f.id);
4708
4717
  if (f.type === "custom" && anySvc) {
4709
4718
  v.errors.push({
4710
4719
  code: "user_input_field_has_service_option",
@@ -4715,14 +4724,15 @@ function validateServiceVsUserInput(v) {
4715
4724
  });
4716
4725
  }
4717
4726
  if (!hasName) {
4718
- if (!anySvc) {
4719
- v.errors.push({
4720
- code: "service_field_missing_service_id",
4721
- severity: "error",
4722
- message: `Service-backed field "${f.id}" has no "name" and must provide at least one option with a service_id.`,
4723
- nodeId: f.id
4724
- });
4727
+ if (hasFieldService || anySvc || hasTriggerMap) {
4728
+ continue;
4725
4729
  }
4730
+ v.errors.push({
4731
+ code: "service_field_missing_service_id",
4732
+ severity: "error",
4733
+ 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.`,
4734
+ nodeId: f.id
4735
+ });
4726
4736
  } else {
4727
4737
  if (anySvc) {
4728
4738
  v.errors.push({