We fire an event when our shipping protection is added to the cart.
The event corsoGspAdded is fired from #gsp-widget anytime that the Corso GSP variant is added to the cart. While we attempt to reduce the number of times this event is fired, we err on the side of ensuring that the correct variant is in the cart, and the event may appear to be more aggressive than expected. This event can be listened to with something similar to the following:
document.querySelector("#gsp-widget").addEventListener("corsoGspAdded", (e) => console.log(e));
We do NOT fire a removal event. Any developers wishing to be made aware of a removal should generally be able to achieve this result by listening for a change event on #corso-input-checkbox and checking the state of the .checked property.
Note that there are other scenarios where GSP can be removed, such as when a cart changes to be be unquotable (the value exceeds the threshold set for the merchant, for example). Anybody wishing to have a comprehensive, fool-proof view of when GSP is added or removed should examine the cart contents directly.