Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hide chat widget on page leave. #47

Closed
Saqib92 opened this issue Jul 16, 2022 · 6 comments
Closed

How to hide chat widget on page leave. #47

Saqib92 opened this issue Jul 16, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@Saqib92
Copy link

Saqib92 commented Jul 16, 2022

Is your feature request related to a problem? Please describe.
How can I hide / Destroy chat widget on page leave. I dont want to show chat widget on all pages. i have a support page and want to show chat only on support page.

Describe the solution you'd like
there should be an option to show/hide on widget.

Describe alternatives you've considered
i hide it via css.

Additional context
I am using angular with ionic framework. and i want to hide it using *ngIf or is there an directive available ?

@Saqib92 Saqib92 added the enhancement New feature or request label Jul 16, 2022
@walaszczykm
Copy link
Collaborator

walaszczykm commented Jul 16, 2022

Hello @Saqib92 👋

If you would like to hide the Chat Widget on particular pages you can use visibility="hidden" component property. Later if you would like to show it again, change the value to visibility="minimized" for example. You can read about all available component properties here: #config-data.

In case you would like to destroy the widget completely, just use *ngIf on the <livechat-widget> element.

  • Setting it to false value would cause the ngOnDestroy to be called which destroys current widget instance.
  • Setting it to true value would cause the ngOnInit to be called which initialize new widget instance.

@Saqib92
Copy link
Author

Saqib92 commented Jul 18, 2022

dynamic visibility="hidden" is not working.
I tried Ionic Life cycle hook:

page.ts

myVisibilityVariable: string = 'minimized'; // by default;

ionViewDidEnter(){ // WillEnter workd when page loads. 
    this.myVisibilityVariable = 'minimized';
}

ionViewDidLeave(){. // didLeave works when page changed.
    this.myVisibilityVariable = 'hidden'; // not working
}

page.html


[visibility]="myVisibilityVariable" // not working

visibility="{{myVisibilityVariable}}" // not working 

@RanganadhCreditcorp
Copy link

Hi @Saqib92, I have tried it the same way, it is maximizing/minimizing/hiding the widget fine for me now.
I have added livechat-widget in app.component.html, so it is working as the model defined in app.component.ts.

But I am looking to find the solution to hide/maximize/minimize the widget from other component like Login.component/AccountDetails.component.

Do you have any solution for the same, much like we do in js as below, I need to implement in angular, please help me out.

LiveChatWidget.get(‘chat_data’)
LiveChatWidget.call(‘set_customer_name’, ‘Test’)
LiveChatWidget.call(‘set_customer_email’, ‘testemail@gmail.com’)
LiveChatWidget.call(‘maximize’)
LiveChatWidget.call(‘minimize’)
LiveChatWidget.call(‘hide’)

Please note that, LiveChatWidget is globally accessible in js, I should be able to do these where ever is required across the application in Angular.

@walaszczykm please help me to proceed further.

@Saqib92
Copy link
Author

Saqib92 commented Oct 24, 2022

Hi @Saqib92, I have tried it the same way, it is maximizing/minimizing/hiding the widget fine for me now. I have added livechat-widget in app.component.html, so it is working as the model defined in app.component.ts.

But I am looking to find the solution to hide/maximize/minimize the widget from other component like Login.component/AccountDetails.component.

Do you have any solution for the same, much like we do in js as below, I need to implement in angular, please help me out.

LiveChatWidget.get(‘chat_data’) LiveChatWidget.call(‘set_customer_name’, ‘Test’) LiveChatWidget.call(‘set_customer_email’, ‘testemail@gmail.com’) LiveChatWidget.call(‘maximize’) LiveChatWidget.call(‘minimize’) LiveChatWidget.call(‘hide’)

Please note that, LiveChatWidget is globally accessible in js, I should be able to do these where ever is required across the application in Angular.

@walaszczykm please help me to proceed further.

you can do something like this: #40 (comment)
with the help you SubjectBehaviour Service.

@RanganadhCreditcorp
Copy link

@Saqib92 Thanks for the prompt reply, I have tried the BehaviourService too in other components.
I tried updating the properties using WidgetState, but the property values are not updating at the widget side.
I am not sure, may be these WidgetStateSubject, WidgetStateService are meant for read-only.

@RanganadhCreditcorp
Copy link

@walaszczykm please help me to proceed further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants