Given attached sample code, nucleus.createConfiguration throws an error saying it's not a function
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Nucleus test</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div style="height:500px;" id="chart"><p>Hello World!</p></div>
</body>
<script src="https://cdn.jsdelivr.net/npm/enigma.js" crossorigin></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js" crossorigin></script>
<script>
const urlQlikServer = "https://jog.us.qlikcloud.com";
const urlLoggedIn = "/api/v1/users/me";
const urlLogin = "/login"
const webIntegrationId = 'CJjKP_nzi9sy72SMEniHwhawFra0jgOT';
async function connect() {
//Step 1: Check to see if logged in
return await fetch(`${urlQlikServer}${urlLoggedIn}`, {
credentials: 'include',
headers: {
'Qlik-Web-Integration-ID':webIntegrationId
}
})
.then(async function(response)
{
if(response.status===401){
const url = new URL(`${urlQlikServer}/login`);
url.searchParams.append('returnto', 'http://localhost:3001/mashup');
url.searchParams.append('qlik-web-integration-id', webIntegrationId);
window.location.href = url;
}
return await fetch(`${urlQlikServer}/api/v1/csrf-token?qlik-web-integration-id=${webIntegrationId}`,
{
credentials: 'include',
headers: {
'Qlik-Web-Integration-ID':webIntegrationId
}
})
.then(function(response)
{
console.log(response.headers.get('qlik-csrf-token'));
return response.headers.get('qlik-csrf-token');
})
.then(function(headers)
{
console.log(headers)
return headers;
});
})
.catch(function(error)
{
if(error.response.status===401)
{
const url = new URL(`${urlQlikServer}/login`);
url.searchParams.append('returnto', 'http://localhost:3001/mashup');
url.searchParams.append('qlik-web-integration-id', webIntegrationId);
window.location.href = url;
}
});
}
connect()
.then(async function(token)
{
const schema = await (await fetch('https://cdn.jsdelivr.net/npm/[email protected]/schemas/12.170.2.json')).json();
const enigmaGlobal = await enigma
.create({
schema,
url: `wss://jog.us.qlikcloud.com/app/486e1036-17a3-46b9-a552-b664c4f7afd8?qlik-csrf-token=${token}&qlik-web-integration-id=${webIntegrationId}`,
//createSocket: url => new WebSocket(url)
})
.open();
const enigmaApp = await enigmaGlobal.openDoc('486e1036-17a3-46b9-a552-b664c4f7afd8');
const n = nucleus.createConfiguration({
types: [
{
type: 'barchart',
load: () => Promise.resolve(window['@nebula.js/sn-bar-chart']),
},
],
});
n(enigmaApp).render({
element: document.querySelector('#chart'),
id: 'qZPdytp',
});
})
</script>
<script src="https://cdn.jsdelivr.net/npm/@nebula.js/supernova" crossorigin></script>
<script src="https://cdn.jsdelivr.net/npm/@nebula.js/nucleus" crossorigin></script>
<script src="https://cdn.jsdelivr.net/npm/@nebula.js/sn-bar-chart" crossorigin></script>
</html>