Fixed the activity logs!!! The ae_api was not imported or used. The account_id was also referenced incorrectly.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import { ae_loc } from '$lib/stores/ae_stores';
|
||||
import { ae_loc, ae_api } from '$lib/stores/ae_stores';
|
||||
import { create_ae_obj__activity_log } from '$lib/ae_core/core__activity_log';
|
||||
|
||||
let log_lvl: number = $state(0);
|
||||
|
||||
interface Props {
|
||||
data: any;
|
||||
}
|
||||
@@ -47,15 +49,18 @@
|
||||
|
||||
async function report_meeting_stats() {
|
||||
if (!is_moderator) {
|
||||
console.log('Jitsi: Not a moderator, skipping stats report.');
|
||||
if (log_lvl) {
|
||||
console.log('Jitsi: Not a moderator, skipping stats report.');
|
||||
}
|
||||
// If for some reason the timer is running for a non-mod, kill it.
|
||||
if (reporting_timer_id) clearInterval(reporting_timer_id);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Jitsi: Preparing to report meeting stats...');
|
||||
if (log_lvl) {
|
||||
console.log('Jitsi: Preparing to report meeting stats...');
|
||||
}
|
||||
const participants_array = Array.from(meeting_participants.values());
|
||||
console.log('Jitsi: DONE! Compiled participants array for stats report:', participants_array);
|
||||
|
||||
const data_kv = {
|
||||
external_client_id: user_id, // Novi Customer GUID in this case
|
||||
@@ -73,20 +78,20 @@
|
||||
}
|
||||
};
|
||||
|
||||
console.log('Jitsi: Stats payload being sent:', JSON.stringify(data_kv, null, 2));
|
||||
if (log_lvl > 1) {
|
||||
console.log('Jitsi: Stats payload being sent:', JSON.stringify(data_kv, null, 2));
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('Jitsi: HERE! Calling create_ae_obj__activity_log API... Lost contact....');
|
||||
const result = await create_ae_obj__activity_log({
|
||||
api_cfg: $ae_loc.auth.api_cfg,
|
||||
account_id: $ae_loc.auth.account.account_id_random,
|
||||
api_cfg: $ae_api,
|
||||
account_id: $ae_loc.account_id,
|
||||
data_kv: data_kv,
|
||||
log_lvl: 2,
|
||||
log_lvl: log_lvl,
|
||||
})
|
||||
// .catch((err) => {
|
||||
// console.error('Jitsi: Error in create_ae_obj__activity_log API call:', err);
|
||||
// });
|
||||
console.log('Jitsi: NOT SEEING THIS! Activity log API call successful.', result);
|
||||
if (log_lvl > 1) {
|
||||
console.log('Jitsi: Activity log API call successful.', result);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Jitsi: Error calling create_ae_obj__activity_log:', error);
|
||||
}
|
||||
@@ -247,9 +252,13 @@
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
console.log('Jitsi: onMount - fetching user data and initializing Jitsi...');
|
||||
if (log_lvl) {
|
||||
console.log('Jitsi: onMount - fetching user data and initializing Jitsi...');
|
||||
}
|
||||
const url_params = data.params;
|
||||
console.log('Jitsi: url_params:', url_params);
|
||||
if (log_lvl > 1) {
|
||||
console.log('Jitsi: url_params:', url_params);
|
||||
}
|
||||
|
||||
// --- Start with fallback data from URL ---
|
||||
user_id = url_params.uuid; // Novi Customer GUID
|
||||
@@ -265,9 +274,11 @@
|
||||
disable_reaction_sound = url_params.reaction_sound === 'true';
|
||||
disable_raise_hand_sound = url_params.raise_hand_sound === 'true';
|
||||
|
||||
console.log(
|
||||
`Jitsi: Initial data: user_id: ${user_id}, display_name: ${display_name}, email: ${email}, room_name: ${room_name}, domain: ${domain}`
|
||||
);
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Jitsi: Initial data: user_id: ${user_id}, display_name: ${display_name}, email: ${email}, room_name: ${room_name}, domain: ${domain}`
|
||||
);
|
||||
}
|
||||
|
||||
if (!user_id) {
|
||||
const container = document.getElementById(jitsi_container_id);
|
||||
@@ -352,7 +363,9 @@
|
||||
const requestOptions = { method: 'GET', headers: headers };
|
||||
const url = `${api_root_url}/customers/${user_id}`;
|
||||
|
||||
console.log('Jitsi: Fetching Novi member details from:', url);
|
||||
if (log_lvl) {
|
||||
console.log('Jitsi: Fetching Novi member details from:', url);
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(url, requestOptions);
|
||||
@@ -360,7 +373,9 @@
|
||||
throw new Error(`Novi API request failed with status ${response.status}`);
|
||||
}
|
||||
const result = await response.json();
|
||||
console.log(`Jitsi: Novi's Current User Obj:`, result);
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Jitsi: Novi's Current User Obj:`, result);
|
||||
}
|
||||
|
||||
let full_name = result?.Name;
|
||||
const first_name = result?.FirstName;
|
||||
@@ -401,7 +416,9 @@
|
||||
const requestOptions = { method: 'GET', headers: headers };
|
||||
let allModeratorsRaw: any[] = [];
|
||||
|
||||
console.log('Jitsi: Fetching Novi group moderators...');
|
||||
if (log_lvl) {
|
||||
console.log('Jitsi: Fetching Novi group moderators...');
|
||||
}
|
||||
|
||||
for (const group_guid of group_guid_li) {
|
||||
const url = `${api_root_url}/groups/${group_guid}/members?pageSize=200`;
|
||||
@@ -419,9 +436,11 @@
|
||||
else console.warn(`Jitsi: Moderator list format unexpected for group ${group_guid}.`, result);
|
||||
|
||||
allModeratorsRaw = allModeratorsRaw.concat(groupModList);
|
||||
console.log(
|
||||
`Jitsi: Fetched ${groupModList.length} moderators from group ${group_guid}. Total: ${allModeratorsRaw.length}`
|
||||
);
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Jitsi: Fetched ${groupModList.length} moderators from group ${group_guid}. Total: ${allModeratorsRaw.length}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
console.warn(
|
||||
`Jitsi: Failed to fetch moderators for group ${group_guid}. Status: ${response.status}`
|
||||
@@ -435,7 +454,10 @@
|
||||
if (allModeratorsRaw.length === 0) {
|
||||
console.warn('Jitsi: No moderators found across all specified Novi groups.');
|
||||
}
|
||||
console.log('Jitsi: Fetched all raw moderators (combined):', allModeratorsRaw);
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log('Jitsi: Fetched all raw moderators (combined):', allModeratorsRaw);
|
||||
}
|
||||
|
||||
const modIdSet = new Set(
|
||||
allModeratorsRaw
|
||||
|
||||
Reference in New Issue
Block a user