Skip to content

Instantly share code, notes, and snippets.

@stuartchaney
Created December 18, 2023 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartchaney/902ad58f081b975d8e09cd970cd428a4 to your computer and use it in GitHub Desktop.
Save stuartchaney/902ad58f081b975d8e09cd970cd428a4 to your computer and use it in GitHub Desktop.
<script src="https://cdn.tapcart.com/webbridge-sdk/webbridge.umd.js" defer></script>
<script type="text/javascript">
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "<%= asset_url('app_proxy/application') %>";
document.head.appendChild(script);
document.addEventListener("webbridge-loaded", function() {
const div = document.getElementById('rivo-app-root');
if(window.Tapcart && window.Tapcart.isInitialized){
div.innerHTML += 'Tapcart was initialized';
Tapcart.actions.showToast({
message: 'String',
type: 'success'
});
Tapcart.actions.getCustomerIdentity(null, {
onSuccess: (res) => {
console.log("getCustomerIdentity success", res)
}
});
} else {
div.innerHTML += 'Tapcart was not initialized';
}
});
</script>
<%= csrf_meta_tags %>
<%= yield %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment