impact-chatbot 2.3.20 → 2.3.21

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.esm.js CHANGED
@@ -10600,12 +10600,21 @@ const SmartBot = (props) => {
10600
10600
  useEffect(() => {
10601
10601
  fetchCustomBotConfigurations();
10602
10602
  }, [baseUrl]);
10603
+ // Sync showModal state with props.showModal OR props.invokeBot (backward compatibility)
10604
+ // Host app passes showModal prop, but some integrations may use invokeBot
10603
10605
  useEffect(() => {
10604
- if (props.invokeBot) {
10605
- setMinimizedMode(!props.invokeBot);
10606
- setShowModal(props.invokeBot);
10606
+ const shouldShow = props.showModal ?? props.invokeBot;
10607
+ if (shouldShow !== undefined && shouldShow !== showModal) {
10608
+ setMinimizedMode(!shouldShow);
10609
+ setShowModal(shouldShow);
10607
10610
  }
10608
- }, [props.invokeBot]);
10611
+ }, [props.showModal, props.invokeBot]);
10612
+ // Also call props.setShowModal when internal state changes (two-way binding)
10613
+ useEffect(() => {
10614
+ if (props.setShowModal && typeof props.setShowModal === 'function') {
10615
+ props.setShowModal(showModal);
10616
+ }
10617
+ }, [showModal]);
10609
10618
  useEffect(() => {
10610
10619
  let screenNameStored = localStorage.getItem("smartBotScreenName");
10611
10620
  let currentAppLinkStored = localStorage.getItem("smartBotCurrentAppLink");