@perceptimagery/dita-configurator-staging
v1.2.2201
Published
| An embeddable package for Dita's 3D configurator
Downloads
185
Readme
Dita-configurator
| An embeddable package for Dita's 3D configurator
Usage
Prod: https://cdn.jsdelivr.net/npm/@perceptimagery/dita-configurator@latest
Dev : https://cdn.jsdelivr.net/npm/@perceptimagery/dita-configurator-staging@latest
<!-- index.html -->
<!-- Declare element with id `‘dita-3dconfig-element’` . This will get transformed after authentication -->
<div
id="‘dita-3dconfig-element’"
></div>
<!-- Inject `Dita configurator` from CDN -->
<script src="https://cdn.jsdelivr.net/npm/@perceptimagery/dita-configurator@latest?apikey={apikey}"></script>
<!-- call our sdk and load your sku and add event listener for `add-to-cart` event -->
<!-- Our SDK exposes the Dita -->
<script>
function run() {
const SKU = "YOUR-SKU-CODE";
window.ditaConfigurator.load(SKU);
window.ditaConfigurator.events.on("add-to-cart",(eventData)=>{
console.log(eventData);
})
}
// on document load execute our run function
window.onload = () => { run(); } // to make sure our sdk and DOM is successfully loaded.
</script>