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.cjs.js CHANGED
@@ -10622,12 +10622,21 @@ const SmartBot = (props) => {
10622
10622
  React.useEffect(() => {
10623
10623
  fetchCustomBotConfigurations();
10624
10624
  }, [baseUrl]);
10625
+ // Sync showModal state with props.showModal OR props.invokeBot (backward compatibility)
10626
+ // Host app passes showModal prop, but some integrations may use invokeBot
10625
10627
  React.useEffect(() => {
10626
- if (props.invokeBot) {
10627
- setMinimizedMode(!props.invokeBot);
10628
- setShowModal(props.invokeBot);
10628
+ const shouldShow = props.showModal ?? props.invokeBot;
10629
+ if (shouldShow !== undefined && shouldShow !== showModal) {
10630
+ setMinimizedMode(!shouldShow);
10631
+ setShowModal(shouldShow);
10629
10632
  }
10630
- }, [props.invokeBot]);
10633
+ }, [props.showModal, props.invokeBot]);
10634
+ // Also call props.setShowModal when internal state changes (two-way binding)
10635
+ React.useEffect(() => {
10636
+ if (props.setShowModal && typeof props.setShowModal === 'function') {
10637
+ props.setShowModal(showModal);
10638
+ }
10639
+ }, [showModal]);
10631
10640
  React.useEffect(() => {
10632
10641
  let screenNameStored = localStorage.getItem("smartBotScreenName");
10633
10642
  let currentAppLinkStored = localStorage.getItem("smartBotCurrentAppLink");