Context
You can customize the access to the widget in your application by triggering its opening from any button.
In the example below, the “Subscribe” button on the homepage of the MyService website opens the widget. Since the user does not have a subscription yet, the widget displays the page with the offers, which serves as the entry point to the subscription process.
Procedure
1/ Hide the Widget
In the startup settings, set the property visible: false
2/ Trigger the Widget Opening
- Create your button
- Add the opening parameter.
<button onClick="window.ProAbono.open()">Subscribe</button>
In this example, clicking the “Subscribe” button triggers the opening of the widget, allowing your users to access the offer presentation page.
Detect if the Customer is Subscribed (optional)
Knowing whether the customer is already subscribed or not is a good practice as it allows you to display either:
- The offer presentation page to subscribe your customer to one of your services
- The Customer Portal
ProAbono provides a function to check if the customer is subscribed. The function returns undefined if the data has not been retrieved yet.
To check if the user is already subscribed, use the function window.ProAbono.isSubscriber().
var isSubscriber = window.ProAbono.isSubscriber();