// Initial setup
const instance = window.ddoComponent.init({
containerId: 'ddo-component-container',
backendUrl: 'https://ddo.metapack.com',
getToken: async function() {
const response = await fetch('/api/ddo-token');
return (await response.json()).token;
},
senderDetails: {
warehouseCode: 'UK',
wh_cc: 'GB'
}
});
// Later, update configuration (requires re-initialization)
window.ddoComponent.destroy();
window.ddoComponent.init({
// New configuration
containerId: 'ddo-component-container',
backendUrl: 'https://ddo.metapack.com',
getToken: async function() {
const response = await fetch('/api/ddo-token');
return (await response.json()).token;
},
senderDetails: {
warehouseCode: 'FR', // Changed warehouse
wh_cc: 'FR'
}
});