Created
December 18, 2023 18:27
-
-
Save stuartchaney/902ad58f081b975d8e09cd970cd428a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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