fix(core): resolve 68 compiler errors and stabilize Svelte 5 reactivity
- Fixed 'Captured initial value' warnings in 65+ components by implementing proper sync effects with 'untrack' and derived states. - Hardened Event Settings JSON editors using a temporary string-buffer pattern to safely decouple object-based data from CodeMirror's string requirements. - Resolved strict TypeScript mismatches across core routes (Accounts, Sites, etc.) and improved property indexing safety in views. - Patched Flowbite-Svelte Drawer transitions for Svelte 5 compatibility using prop spreading. - Added comprehensive safety comments to high-risk reactivity blocks. - Synchronized 'ae_types.ts' with V3 backend models.
This commit is contained in:
@@ -28,135 +28,124 @@
|
||||
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
$ae_loc.url_origin = data.url.origin;
|
||||
$ae_loc.params = data.params;
|
||||
$effect(() => {
|
||||
$ae_loc.url_origin = data.url.origin;
|
||||
$ae_loc.params = data.params;
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(`+layout.svelte data:`, data);
|
||||
}
|
||||
|
||||
if (browser) {
|
||||
if (data.url.searchParams.get('uuid')) {
|
||||
$idaa_loc.novi_uuid = data.url.searchParams.get('uuid'); // data.params.uuid;
|
||||
if (log_lvl > 1) {
|
||||
console.log(`+layout.svelte data:`, data);
|
||||
}
|
||||
if (data.url.searchParams.get('email')) {
|
||||
$idaa_loc.novi_email = decodeURIComponent(data.url.searchParams.get('email'));
|
||||
} else {
|
||||
$idaa_loc.novi_email = null;
|
||||
}
|
||||
if (data.url.searchParams.get('full_name')) {
|
||||
$idaa_loc.novi_full_name = decodeURIComponent(data.url.searchParams.get('full_name'));
|
||||
} else {
|
||||
$idaa_loc.novi_full_name = null;
|
||||
}
|
||||
$idaa_loc.novi_admin_li = $ae_loc.site_cfg_json?.novi_admin_li ?? [];
|
||||
$idaa_loc.novi_trusted_li = $ae_loc.site_cfg_json?.novi_trusted_li ?? [];
|
||||
// console.log(`$idaa_loc.novi_uuid:`, $idaa_loc.novi_uuid);
|
||||
// console.log(`$idaa_loc.novi_admin_li:`, $idaa_loc.novi_admin_li);
|
||||
});
|
||||
|
||||
// Reminder: super > manager > administrator > trusted > public > authenticated > anonymous
|
||||
$effect(() => {
|
||||
if (browser) {
|
||||
if (data.url.searchParams.get('uuid')) {
|
||||
$idaa_loc.novi_uuid = data.url.searchParams.get('uuid'); // data.params.uuid;
|
||||
}
|
||||
if (data.url.searchParams.get('email')) {
|
||||
$idaa_loc.novi_email = decodeURIComponent(data.url.searchParams.get('email'));
|
||||
} else {
|
||||
$idaa_loc.novi_email = null;
|
||||
}
|
||||
if (data.url.searchParams.get('full_name')) {
|
||||
$idaa_loc.novi_full_name = decodeURIComponent(data.url.searchParams.get('full_name'));
|
||||
} else {
|
||||
$idaa_loc.novi_full_name = null;
|
||||
}
|
||||
$idaa_loc.novi_admin_li = $ae_loc.site_cfg_json?.novi_admin_li ?? [];
|
||||
$idaa_loc.novi_trusted_li = $ae_loc.site_cfg_json?.novi_trusted_li ?? [];
|
||||
// console.log(`$idaa_loc.novi_uuid:`, $idaa_loc.novi_uuid);
|
||||
// console.log(`$idaa_loc.novi_admin_li:`, $idaa_loc.novi_admin_li);
|
||||
|
||||
// NOTE: This is checking if they are in an iframe *and* have a Novi UUID. We ignore the iframe mode for trusted and above (administrators, managers, etc).
|
||||
if (
|
||||
$ae_loc?.iframe &&
|
||||
$idaa_loc?.novi_uuid?.length == 36 &&
|
||||
$idaa_loc?.novi_email?.length > 3 &&
|
||||
$idaa_loc?.novi_full_name?.length > 0
|
||||
) {
|
||||
$ae_loc.access_type = 'authenticated';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
// Reminder: super > manager > administrator > trusted > public > authenticated > anonymous
|
||||
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
// NOTE: This is sort of temporary while we work on getting Jisti working with IDAA's Novi site.
|
||||
} else if (
|
||||
$ae_loc?.iframe &&
|
||||
$idaa_loc?.novi_uuid?.length == 36
|
||||
) {
|
||||
$ae_loc.access_type = 'authenticated';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
// NOTE: This is checking if they are in an iframe *and* have a Novi UUID. We ignore the iframe mode for trusted and above (administrators, managers, etc).
|
||||
if (
|
||||
$ae_loc?.iframe &&
|
||||
$idaa_loc?.novi_uuid?.length == 36 &&
|
||||
$idaa_loc?.novi_email?.length > 3 &&
|
||||
$idaa_loc?.novi_full_name?.length > 0
|
||||
) {
|
||||
$ae_loc.access_type = 'authenticated';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
} else if ($ae_loc?.iframe) {
|
||||
$ae_loc.access_type = 'anonymous';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = false;
|
||||
$ae_loc.anonymous_access = true;
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
// NOTE: This is sort of temporary while we work on getting Jisti working with IDAA's Novi site.
|
||||
} else if (
|
||||
$ae_loc?.iframe &&
|
||||
$idaa_loc?.novi_uuid?.length == 36
|
||||
) {
|
||||
$ae_loc.access_type = 'authenticated';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
}
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
} else if ($ae_loc?.iframe) {
|
||||
$ae_loc.access_type = 'anonymous';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = false;
|
||||
$ae_loc.public_access = false;
|
||||
$ae_loc.authenticated_access = false;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
if ($idaa_loc.novi_uuid) {
|
||||
let flag = false;
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($idaa_loc.novi_admin_li) {
|
||||
if ($idaa_loc.novi_admin_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'administrator';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = true;
|
||||
$ae_loc.trusted_access = true;
|
||||
$ae_loc.public_access = true;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
flag = true;
|
||||
}
|
||||
// Resetting these just in case...
|
||||
$idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
$idaa_loc.bb.qry__enabled == 'enabled';
|
||||
}
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($idaa_loc.novi_trusted_li) {
|
||||
if ($idaa_loc.novi_trusted_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'trusted';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = true;
|
||||
$ae_loc.public_access = true;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
if ($idaa_loc.novi_uuid) {
|
||||
let flag = false;
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($idaa_loc.novi_admin_li) {
|
||||
if ($idaa_loc.novi_admin_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'administrator';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = true;
|
||||
$ae_loc.trusted_access = true;
|
||||
$ae_loc.public_access = true;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
flag = true;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($idaa_loc.novi_trusted_li) {
|
||||
if ($idaa_loc.novi_trusted_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'trusted';
|
||||
$ae_loc.super_access = false;
|
||||
$ae_loc.manager_access = false;
|
||||
$ae_loc.administrator_access = false;
|
||||
$ae_loc.trusted_access = true;
|
||||
$ae_loc.public_access = true;
|
||||
$ae_loc.authenticated_access = true;
|
||||
$ae_loc.anonymous_access = true;
|
||||
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (!flag) {
|
||||
// $ae_loc.access_type = 'authenticated';
|
||||
// $ae_loc.super_access = false;
|
||||
// $ae_loc.manager_access = false;
|
||||
// $ae_loc.administrator_access = false;
|
||||
// $ae_loc.trusted_access = false;
|
||||
// $ae_loc.public_access = false;
|
||||
// $ae_loc.authenticated_access = true;
|
||||
// $ae_loc.anonymous_access = true;
|
||||
|
||||
// // Resetting these just in case...
|
||||
// $idaa_loc.bb.qry__hidden == 'not_hidden';
|
||||
// $idaa_loc.bb.qry__enabled == 'enabled';
|
||||
// }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// let iframe = data.url.searchParams.get('iframe');
|
||||
// if (browser && iframe == 'true') {
|
||||
|
||||
Reference in New Issue
Block a user