import ProductSeoWidget from "./widget.client.js";
import { publishProductSeoValidation, getProductSeoTranslator } from "./state.js";
import { evaluateProductSeo } from "./validation.js";
const widget = {
  metadata: {
    id: "catalog.injection.product-seo",
    title: "Product SEO Helper",
    description: "Helps optimize product metadata for search engines",
    features: ["catalog.products.edit"],
    priority: 90,
    enabled: true,
    requiredFields: ["description"]
  },
  Widget: ProductSeoWidget,
  eventHandlers: {
    onBeforeSave: async (data) => {
      const evaluation = evaluateProductSeo(data, getProductSeoTranslator());
      if (!evaluation.ok) {
        publishProductSeoValidation({ ok: false, issues: evaluation.issues, message: evaluation.message });
        return { ok: false, message: evaluation.message, fieldErrors: evaluation.fieldErrors };
      }
      publishProductSeoValidation({ ok: true, issues: [] });
      return { ok: true };
    }
  }
};
var widget_default = widget;
export {
  widget_default as default
};
//# sourceMappingURL=widget.js.map
