@contenify/chatbot 4.0.0 → 4.0.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.mjs CHANGED
@@ -2878,6 +2878,16 @@ function ContenifyChatBot({ apiUrl, apiKey, domain, onPost }) {
2878
2878
  useEffect7(() => {
2879
2879
  setConfig({ apiUrl, apiKey, domain });
2880
2880
  }, [apiUrl, apiKey, domain]);
2881
+ useEffect7(() => {
2882
+ if (!onPost) return;
2883
+ const handler = (e) => {
2884
+ var _a, _b;
2885
+ const detail = e.detail;
2886
+ onPost((_a = detail.article) != null ? _a : "", (_b = detail.keywords) != null ? _b : []);
2887
+ };
2888
+ window.addEventListener("contenify-post-article", handler);
2889
+ return () => window.removeEventListener("contenify-post-article", handler);
2890
+ }, [onPost]);
2881
2891
  return /* @__PURE__ */ jsx9(ChatBot, {});
2882
2892
  }
2883
2893
  var index_default = ContenifyChatBot;