Updated Novi iframe HTML content.

This commit is contained in:
Scott Idem
2024-11-15 17:01:21 -05:00
parent 01e320e172
commit d1f37af192
3 changed files with 345 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Novi Test Page</title>
</head>
<body>
<script>
let novi_customer_uid = '<%=Novi.User.CustomerUniqueId%>'; // NOTE: The Novi UUID for the current current user/customer
console.log(`Novi's Current User's ID: ${novi_customer_uid}`);
// var novi_current_user_role = '<%=Novi.User.xyz%>';
// console.log(`Novi's Current User's Role: ${novi_current_user_role}`);
let novi_api_root_url = 'https://idaa.novistaging.com/api';
let novi_api_key_for_idaa = 'CmNdWgdPmgluBWjiTd8xsUCk5mio8F1O9DYAh0pVDcg=';
let novi_current_user_obj = null;
let novi_current_user_email = null;
let idaa_ae_api_root_url = 'https://dev-idaa.oneskyit.com/idaa/archives';
let idaa_ae_params = new URLSearchParams(document.location.search);
let idaa_ae_slct_archive_id = idaa_ae_params.get('archive_id');
let idaa_ae_iframe_height = null;
var novi_api_headers = new Headers();
novi_api_headers.append("Authorization", `Basic ${novi_api_key_for_idaa}`);
var requestOptions = {
method: 'GET',
headers: novi_api_headers,
redirect: 'follow'
};
let novi_api_get_customer_endpoint = `${novi_api_root_url}/customers/${novi_customer_uid}`;
console.log(novi_api_get_customer_endpoint);
fetch(novi_api_get_customer_endpoint, requestOptions)
// .then(response => response.text())
.then(response => response.json())
.then(result => {
novi_current_user_obj = result;
console.log(`Novi's Current User Obj (${novi_current_user_obj.Email}):`, novi_current_user_obj);
let idaa_ae_iframe_element = document.getElementById('ae_idaa_archives_iframe');
if (idaa_ae_slct_archive_id) {
idaa_ae_iframe_element.src = `${idaa_ae_api_root_url}?uuid=${novi_customer_uid}&email=${novi_current_user_obj.Email}&archive_id=${idaa_ae_slct_archive_id}&full_name=${novi_current_user_obj.Name}&iframe=true`;
} else {
idaa_ae_iframe_element.src = `${idaa_ae_api_root_url}?uuid=${novi_customer_uid}&email=${novi_current_user_obj.Email}&full_name=${novi_current_user_obj.Name}&iframe=true`;
}
})
.catch(error => console.log('error', error));
window.addEventListener('message', function(event) {
console.log('Message received from the child:', event.data); // Message received from child
if (event.data) {
if (event.data.iframe_height) {
idaa_ae_iframe_height = event.data.iframe_height;
console.log(`Got iframe height: ${idaa_ae_iframe_height}`);
let idaa_ae_iframe_element = document.getElementById('ae_idaa_archives_iframe');
// idaa_ae_iframe_element.style.height = idaa_ae_iframe_height;
idaa_ae_iframe_element.style.height = `${idaa_ae_iframe_height+50}px`;
}
const url = new URL(location);
// Check if archive_id is defined in the message
if (event.data.archive_id !== undefined) {
console.log(`Got AE Archives ID: ${event.data.archive_id}`);
idaa_ae_slct_archive_id = event.data.archive_id;
if (event.data.archive_id) {
url.searchParams.set('archive_id', event.data.archive_id);
} else {
url.searchParams.delete('archive_id');
}
history.pushState({}, '', url);
}
// Check if archive_content_id is defined in the message
if (event.data.archive_content_id !== undefined) {
console.log(`Got AE Archives Content ID: ${event.data.archive_content_id}`);
idaa_ae_slct_archive_content_id = event.data.archive_content_id;
if (event.data.archive_content_id) {
url.searchParams.set('archive_content_id', event.data.archive_content_id);
} else {
url.searchParams.delete('archive_content_id');
}
history.pushState({}, '', url);
}
} else {
console.log(`No data in message? ${event}`);
}
});
</script>
<!-- IDAA Aether Apps for Novi - Archives iframe -->
<p><iframe width="100%" height="750" id="ae_idaa_archives_iframe" src="" style="min-height: 600px; max-height: 100%;" class="ae_idaa_iframe"></iframe></p>
</body>
</html>

View File

@@ -0,0 +1,115 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Novi Test Page</title>
</head>
<body>
<script>
let novi_customer_uid = '<%=Novi.User.CustomerUniqueId%>'; // NOTE: The Novi UUID for the current current user/customer
console.log(`Novi's Current User's ID: ${novi_customer_uid}`);
// var novi_current_user_role = '<%=Novi.User.xyz%>';
// console.log(`Novi's Current User's Role: ${novi_current_user_role}`);
let novi_api_root_url = 'https://idaa.novistaging.com/api';
let novi_api_key_for_idaa = 'CmNdWgdPmgluBWjiTd8xsUCk5mio8F1O9DYAh0pVDcg=';
let novi_current_user_obj = null;
let novi_current_user_email = null;
let idaa_ae_api_root_url = 'https://dev-idaa.oneskyit.com/idaa/bb';
let idaa_ae_params = new URLSearchParams(document.location.search);
let idaa_ae_slct_post_id = idaa_ae_params.get('post_id');
let idaa_ae_iframe_height = null;
var novi_api_headers = new Headers();
novi_api_headers.append("Authorization", `Basic ${novi_api_key_for_idaa}`);
var requestOptions = {
method: 'GET',
headers: novi_api_headers,
redirect: 'follow'
};
let novi_api_get_customer_endpoint = `${novi_api_root_url}/customers/${novi_customer_uid}`;
console.log(novi_api_get_customer_endpoint);
fetch(novi_api_get_customer_endpoint, requestOptions)
// .then(response => response.text())
.then(response => response.json())
.then(result => {
novi_current_user_obj = result;
console.log(`Novi's Current User Obj (${novi_current_user_obj.Email}):`, novi_current_user_obj);
let idaa_ae_iframe_element = document.getElementById('ae_idaa_bb_iframe');
if (idaa_ae_slct_post_id) {
idaa_ae_iframe_element.src = `${idaa_ae_api_root_url}?uuid=${novi_customer_uid}&email=${novi_current_user_obj.Email}&post_id=${idaa_ae_slct_post_id}&full_name=${novi_current_user_obj.Name}&iframe=true`;
} else {
idaa_ae_iframe_element.src = `${idaa_ae_api_root_url}?uuid=${novi_customer_uid}&email=${novi_current_user_obj.Email}&full_name=${novi_current_user_obj.Name}&iframe=true`;
}
})
.catch(error => console.log('error', error));
window.addEventListener('message', function(event) {
console.log('Message received from the child:', event.data); // Message received from child
if (event.data) {
if (event.data.iframe_height) {
idaa_ae_iframe_height = event.data.iframe_height;
console.log(`Got iframe height: ${idaa_ae_iframe_height}`);
let idaa_ae_iframe_element = document.getElementById('ae_idaa_bb_iframe');
// idaa_ae_iframe_element.style.height = idaa_ae_iframe_height;
idaa_ae_iframe_element.style.height = `${idaa_ae_iframe_height+50}px`;
}
const url = new URL(location);
// Check if post_id is defined in the message
if (event.data.post_id !== undefined) {
console.log(`Got AE Post ID: ${event.data.post_id}`);
idaa_ae_slct_post_id = event.data.post_id;
if (event.data.post_id) {
url.searchParams.set('post_id', event.data.post_id);
} else {
url.searchParams.delete('post_id');
}
history.pushState({}, '', url);
}
// Check if post_comment_id is defined in the message
if (event.data.post_comment_id !== undefined) {
console.log(`Got AE Post Comment ID: ${event.data.post_comment_id}`);
idaa_ae_slct_post_comment_id = event.data.post_comment_id;
if (event.data.post_comment_id) {
url.searchParams.set('post_comment_id', event.data.post_comment_id);
} else {
url.searchParams.delete('post_comment_id');
}
history.pushState({}, '', url);
}
} else {
console.log(`No data in message? ${event}`);
}
});
</script>
<!-- IDAA Aether Apps for Novi - Bulletin Board (posts) iframe -->
<p><iframe width="100%" height="750" id="ae_idaa_bb_iframe" src="" style="min-height: 600px; max-height: 100%;" class="ae_idaa_iframe"></iframe></p>
</body>
</html>

View File

@@ -0,0 +1,115 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Novi Test Page</title>
</head>
<body>
<script>
let novi_customer_uid = '<%=Novi.User.CustomerUniqueId%>'; // NOTE: The Novi UUID for the current current user/customer
console.log(`Novi's Current User's ID: ${novi_customer_uid}`);
// var novi_current_user_role = '<%=Novi.User.xyz%>';
// console.log(`Novi's Current User's Role: ${novi_current_user_role}`);
let novi_api_root_url = 'https://idaa.novistaging.com/api';
let novi_api_key_for_idaa = 'CmNdWgdPmgluBWjiTd8xsUCk5mio8F1O9DYAh0pVDcg=';
let novi_current_user_obj = null;
let novi_current_user_email = null;
let idaa_ae_api_root_url = 'https://dev-idaa.oneskyit.com/idaa/recovery_meetings';
let idaa_ae_params = new URLSearchParams(document.location.search);
let idaa_ae_slct_event_id = idaa_ae_params.get('event_id');
let idaa_ae_iframe_height = null;
var novi_api_headers = new Headers();
novi_api_headers.append("Authorization", `Basic ${novi_api_key_for_idaa}`);
var requestOptions = {
method: 'GET',
headers: novi_api_headers,
redirect: 'follow'
};
let novi_api_get_customer_endpoint = `${novi_api_root_url}/customers/${novi_customer_uid}`;
console.log(novi_api_get_customer_endpoint);
fetch(novi_api_get_customer_endpoint, requestOptions)
// .then(response => response.text())
.then(response => response.json())
.then(result => {
novi_current_user_obj = result;
console.log(`Novi's Current User Obj (${novi_current_user_obj.Email}):`, novi_current_user_obj);
let idaa_ae_iframe_element = document.getElementById('ae_idaa_recovery_meetings_iframe');
if (idaa_ae_slct_event_id) {
idaa_ae_iframe_element.src = `${idaa_ae_api_root_url}?uuid=${novi_customer_uid}&email=${novi_current_user_obj.Email}&event_id=${idaa_ae_slct_event_id}&full_name=${novi_current_user_obj.Name}&iframe=true`;
} else {
idaa_ae_iframe_element.src = `${idaa_ae_api_root_url}?uuid=${novi_customer_uid}&email=${novi_current_user_obj.Email}&full_name=${novi_current_user_obj.Name}&iframe=true`;
}
})
.catch(error => console.log('error', error));
window.addEventListener('message', function(event) {
console.log('Message received from the child:', event.data); // Message received from child
if (event.data) {
if (event.data.iframe_height) {
idaa_ae_iframe_height = event.data.iframe_height;
console.log(`Got iframe height: ${idaa_ae_iframe_height}`);
let idaa_ae_iframe_element = document.getElementById('ae_idaa_recovery_meetings_iframe');
// idaa_ae_iframe_element.style.height = idaa_ae_iframe_height;
idaa_ae_iframe_element.style.height = `${idaa_ae_iframe_height+50}px`;
}
const url = new URL(location);
// Check if event_id is defined in the message
if (event.data.event_id !== undefined) {
console.log(`Got AE Events ID: ${event.data.event_id}`);
idaa_ae_slct_event_id = event.data.event_id;
if (event.data.event_id) {
url.searchParams.set('event_id', event.data.event_id);
} else {
url.searchParams.delete('event_id');
}
history.pushState({}, '', url);
}
// Check if event_id is defined in the message
if (event.data.event_id !== undefined) {
console.log(`Got AE Event ID: ${event.data.event_id}`);
idaa_ae_slct_event_id = event.data.event_id;
if (event.data.event_id) {
url.searchParams.set('event_id', event.data.event_id);
} else {
url.searchParams.delete('event_id');
}
history.pushState({}, '', url);
}
} else {
console.log(`No data in message? ${event}`);
}
});
</script>
<!-- IDAA Aether Apps for Novi - Recovery Meetings (events) iframe -->
<p><iframe width="100%" height="750" id="ae_idaa_recovery_meetings_iframe" src="" style="min-height: 600px; max-height: 100%;" class="ae_idaa_iframe"></iframe></p>
</body>
</html>