feat(stores): Phase 2b — TypeScript interfaces for store defaults sub-files

ae_stores__auth_loc_defaults.ts
  SiteCfgJson, AePerson, AeUser, AccessType, AuthLocState

ae_events_stores__badges_defaults.ts
  BadgesLocState, BadgesSessState

ae_events_stores__launcher_defaults.ts
  SectionState, LauncherLocState, LauncherSessState

ae_events_stores__leads_defaults.ts
  LeadsLocState, TmpLicense, LeadsSessState

ae_events_stores__pres_mgmt_defaults.ts
  PresMgmtLocState, PresMgmtSessState

All exported consts annotated with their interface type.
svelte-check: 0 errors, 0 warnings
This commit is contained in:
Scott Idem
2026-03-16 15:52:19 -04:00
parent 41ed6a8adc
commit b8104b3ff2
5 changed files with 385 additions and 9 deletions

View File

@@ -6,8 +6,44 @@
* badges_sess_defaults → events_sess.badges (in-memory, resets on page load)
*/
export interface BadgesLocState {
auto_view: boolean;
show_hidden: boolean;
show_not_enabled: boolean;
show_printed: boolean;
allow_reprint: boolean;
show_element__cfg: boolean;
show_element__cfg_detail: boolean;
fulltext_search_qry_str: string | null;
search_badge_type_code: string | null;
search_version: number;
qry__remote_first: boolean;
qry_printed_status: string; // 'all' | 'printed' | 'not_printed'
qry_affiliations: string | null;
qry_sort_order: string;
status_qry__search: string | null;
use_id_li: boolean;
search_status: string | null;
search_complete: boolean;
classes__form: string;
}
export interface BadgesSessState {
fulltext_search_qry_str: string | null;
search_badge_type_code: string | null;
status_qry__search: string | null;
use_id_li: boolean;
search_status: string | null;
search_complete: boolean;
show_form__search: boolean;
show_form__search_results: boolean;
show_form__scan: boolean;
qr_scan_start: boolean;
qr_scan_result: string | null;
}
// Persisted badge UI state — survives browser sessions.
export const badges_loc_defaults = {
export const badges_loc_defaults: BadgesLocState = {
auto_view: true,
show_hidden: false, // Hidden (archived) badges are excluded from the main list.
@@ -40,7 +76,7 @@ export const badges_loc_defaults = {
};
// In-memory badge state — resets on page load.
export const badges_sess_defaults = {
export const badges_sess_defaults: BadgesSessState = {
fulltext_search_qry_str: null,
search_badge_type_code: null,
status_qry__search: null,

View File

@@ -7,8 +7,112 @@
* launcher_sess_defaults → events_sess.launcher (in-memory, resets on page load)
*/
/** 3-way section collapse state used throughout the Launcher UI. */
export type SectionState = 'collapsed' | 'auto' | 'pinned';
export interface LauncherLocState {
app_mode: 'default' | 'onsite' | 'native';
ws_connect: boolean;
qry_limit__files: number;
qry_limit__presentations: number;
qry_limit__presenters: number;
qry_limit__sessions: number;
hide__launcher_header: boolean;
hide__launcher_menu: boolean;
hide__launcher_footer: boolean;
hide__modal_header_title: boolean;
hide_drawer__debug: boolean;
hide__ws_element: boolean;
hide__ws_form: boolean;
hide__ws_messages: boolean;
hide__ws_commands: boolean;
hide_content__draft_files: boolean;
show_content__disabled_files: boolean;
show_content__hidden_files: boolean;
show_content__hidden_presentations: boolean;
show_content__hidden_presenters: boolean;
show_content__hidden_sessions: boolean;
show_content__draft_files: boolean;
show_content__session_code: boolean;
show_content__presentation_code: boolean;
show_content__presenter_code: boolean;
show_section__controller: boolean;
section_state__health: SectionState;
section_state__native_os: SectionState;
section_state__sync_timers: SectionState;
section_state__updates: SectionState;
section_state__controller: SectionState;
section_state__screen_saver: SectionState;
section_state__app_modes: SectionState;
section_state__local_actions: SectionState;
datetime_format: string;
time_format: string;
time_hours: 12 | 24;
sync_intervals: {
event: number;
device: number;
location: number;
session: number;
presentation: number;
presenter: number;
file_sync: number;
};
slct: {
event_id: string | null;
event_location_id: string | null;
event_session_id: string | null;
event_presentation_id: string | null;
event_presenter_id: string | null;
event_file_id: string | null;
};
native: {
host_file_config_path: string;
};
idle_timer: number;
idle_cycle: number;
idle_loop_period: number;
screen_saver_img_kv: Record<string, any>;
modal__title: string;
modal__open: string | null;
modal__open_filename: string | null;
modal_img_src: string | null;
controller: string;
controller_group_code: string;
controller_client_id: string | null;
}
export interface LauncherSessState {
ws_connect_status: string | null;
av_recording_status: string | null;
controller_cmd: string | null;
controller_trigger_send: any;
event_file_open: Record<string, any>;
native: Record<string, any>;
sync_stats: {
total: number;
cached: number;
missing: number;
currently_syncing: string | null;
};
heartbeat_info: {
last_timestamp: string | null;
status: string;
};
modal__title: string;
modal__open_event_file_id: boolean | string;
modal__event_file_obj: Record<string, any> | null;
loading__session_li_status: string | null;
loading__session_id_status: string | null;
trigger_reload__event_session_obj_id: string | null;
trigger_reload__event_session_obj_li: string | null;
trigger_reload__event_location_obj_id: string | null;
trigger_reload__event_location_obj_li: string | null;
trigger__ws_connect: any;
trigger__ws_disconnect: any;
}
// Persisted launcher config — survives browser sessions.
export const launcher_loc_defaults = {
export const launcher_loc_defaults: LauncherLocState = {
// App mode: 'default' = browser, 'onsite' = browser onsite, 'native' = Electron app onsite.
app_mode: 'default',
ws_connect: false,
@@ -102,7 +206,7 @@ export const launcher_loc_defaults = {
};
// In-memory launcher state — resets on page load (mostly real-time status/triggers).
export const launcher_sess_defaults = {
export const launcher_sess_defaults: LauncherSessState = {
ws_connect_status: null,
av_recording_status: null,
controller_cmd: null,

View File

@@ -6,8 +6,66 @@
* leads_sess_defaults → events_sess.leads (in-memory, resets on page load)
*/
export interface LeadsLocState {
show_option__paid_tab: boolean;
show_content__scan_alert: boolean;
show_content__scan_requirements: boolean;
show_content__custom_question_descriptions: boolean;
show_content__email_link_warning: boolean;
default_to_scan: boolean;
default__external_registration_id: string;
auto_view: boolean;
auto_hide_on_sign_in: boolean;
show_hidden: boolean;
show_not_enabled: boolean;
refresh_interval__tracking_li: number;
search_version: number;
qry__remote_first: boolean;
qry__search_text: string;
qry__sort_order: string;
tracking__search_version: number;
tracking__qry__remote_first: boolean;
tracking__qry__search_text: string;
tracking__qry__sort_order: string;
tracking__qry__licensee_email: string;
entered_passcode: string | null;
// Value shape: { key: string; updated_on: string } — entries expire after a configurable max age.
auth_exhibit_kv: Record<string, { key: string; updated_on: string }>;
edit_license_li: boolean;
// Key = exhibit ID (random), value = last-used tab name.
tab: Record<string, string>;
}
export interface TmpLicense {
index: number | null;
email: string;
full_name: string;
passcode: string;
session_count: number;
updated_on: string;
}
export interface LeadsSessState {
show_form__license: boolean;
show_form__search: boolean;
show_form__scan: boolean;
// false when no lead is active; string (event_exhibit_tracking_id) when one is open.
show_form__view_lead: boolean | string;
show_confirm__add_lead: string[];
submit_status__license: string | null; // 'saving' | 'created' | 'updated'
submit_status__search: string | null; // 'searching' | 'complete'
last_refresh_time: string | null;
next_refresh_countdown: number;
entered_passcode: string | null;
tmp_license: TmpLicense;
entered_search_str: string | null;
lead_data_changed: any;
qr_scan_start: boolean;
qr_scan_result: string | null;
}
// Persisted leads config — survives browser sessions.
export const leads_loc_defaults = {
export const leads_loc_defaults: LeadsLocState = {
show_option__paid_tab: true,
show_content__scan_alert: true, // Workaround for QR scanner edge-case bug.
show_content__scan_requirements: true,
@@ -56,7 +114,7 @@ export const leads_loc_defaults = {
};
// In-memory leads state — resets on page load.
export const leads_sess_defaults = {
export const leads_sess_defaults: LeadsSessState = {
show_form__license: false,
show_form__search: false,
show_form__scan: false,

View File

@@ -6,8 +6,115 @@
* pres_mgmt_sess_defaults → events_sess.pres_mgmt (in-memory, resets on page load)
*/
export interface PresMgmtLocState {
sync_local_config: boolean;
lock_config: boolean;
datetime_format: string;
time_format: string;
time_hours: 12 | 24;
qry_enabled: string; // 'all' | 'disabled' | 'enabled'
qry_hidden: string; // 'all' | 'hidden' | 'not_hidden'
qry_limit__files: number;
qry_limit__presentations: number;
qry_limit__presenters: number;
qry_limit__sessions: number;
qry_max: number;
qry__files_offset_seconds: number | null;
qry__files_sort: string;
search_version: number;
qry__remote_first: boolean;
qry_and__file_count: boolean;
save_search_text: boolean;
saved_search__session: string | null;
require__presenter_agree: boolean;
require__session_agree: boolean;
show_content__event_view: string | null;
show_content__location_qr: boolean;
show_content__presentation_description: boolean;
show_content__presenter_page_help: boolean;
show_content__presenter_view: string | null;
show_content__presenter_qr: boolean;
show_content__session_description: boolean;
show_content__session_files: boolean;
show_content__session_help: boolean;
show_content__session_presentations: boolean;
show_content__session_search_view: string | null;
show_content__session_search_help: boolean;
show_content__session_search_room_name: boolean;
show_content__session_view: string | null;
show_content__session_qr: boolean;
hide__session_msg: boolean;
hide__session_poc: boolean;
hide__session_poc_biography: boolean;
hide__presenter_biography: boolean;
hide__session_li_location_field: boolean;
hide__session_li_poc_field: boolean;
hide__launcher_link_legacy: boolean;
hide__launcher_link: boolean;
hide__location_link: boolean;
show_content__disabled_files: boolean;
show_content__hidden_files: boolean;
show_content__hidden_presentations: boolean;
show_content__hidden_presenters: boolean;
show_content__hidden_sessions: boolean;
show__direct_download: boolean;
// null = use server-side default.
show_menu__presenter: boolean | null;
show_menu__session: boolean | null;
show_menu__session_search: boolean | null;
show_menu__event_reports: boolean | null;
show_report: string | null;
disable_submit__opt_out: boolean;
submit_status__opt_out: string | null;
device_kv: Record<string, any>;
location_kv: Record<string, any>;
}
export interface PresMgmtSessState {
presenter__updated_on: string | null;
session_updated_on: string | null;
location_name_qry_str: string | null;
fulltext_search_qry_str: string | null;
status_qry__search: string | null;
disable_submit__event_file_obj: boolean;
show_form__search: boolean;
show_form__search_results: boolean;
show_content__agree_text: boolean;
show_content__presenter_start: boolean;
show_content__presentation_description: boolean;
show_report: string | null;
show_field_edit__filename: boolean;
new_upload_list: any[] | null;
files_uploading_count: number | null;
qry_limit__files: number;
qry_limit__presentations: number;
qry_limit__presenters: number;
qry_limit__sessions: number;
show_fields__presentation: boolean;
show_fields__session: boolean;
show_modal__presenter_agree: boolean;
show__session_poc_profile: boolean;
show_modal__session_poc_agree: boolean;
show__edit_location: Record<string, boolean>;
show__edit_poc_person: Record<string, boolean>;
show__view_alert: Record<string, boolean>;
show__edit_alert_msg: Record<string, boolean>;
tmp__alert_msg: Record<string, string>;
session_qr_url: Record<string, string>;
status_rpt: {
recent_files: string | null;
presenters_agree: string | null;
presenters_biography: string | null;
};
rpt__session_no_files: boolean;
rpt__session_poc_agree: boolean;
rpt__session_no_bio: boolean;
rpt__presenter_agree: boolean;
tmp_val__filename_no_ext: string | null;
}
// Persisted pres_mgmt config — survives browser sessions.
export const pres_mgmt_loc_defaults = {
export const pres_mgmt_loc_defaults: PresMgmtLocState = {
sync_local_config: false,
lock_config: true,
@@ -89,7 +196,7 @@ export const pres_mgmt_loc_defaults = {
};
// In-memory pres_mgmt state — resets on page load.
export const pres_mgmt_sess_defaults = {
export const pres_mgmt_sess_defaults: PresMgmtSessState = {
presenter__updated_on: null,
session_updated_on: null,

View File

@@ -12,7 +12,78 @@
*
* See documentation/AE__Permissions_and_Security.md for the full hierarchy.
*/
export const auth_loc_defaults = {
export interface SiteCfgJson {
slct__event_id: string | null;
slct__event_badge_template_id: string | null;
slct__sponsorship_cfg_id: string | null;
header_image_path: string | null;
[key: string]: any; // Server may add further site-specific fields.
}
export interface AePerson {
id: string | null;
given_name: string | null;
full_name: string | null;
full_name_override: string | null; // Previously called display_name.
primary_email: string | null;
user_id: string | null;
qry_limit__people: number;
show_content__person_page_help: boolean;
[key: string]: any; // API may populate additional person fields.
}
export interface AeUser {
id: string | null;
username: string | null;
name: string | null;
email: string | null;
allow_auth_key: string | null; // Magic-link token — allows sign-in without password.
super: boolean;
manager: boolean; // Can manage accounts and users globally.
administrator: boolean; // Account-level administrator.
verified: boolean;
public: boolean;
person_id: string | null;
access_type: string | null;
qry_limit__users: number;
[key: string]: any; // API may populate additional user fields.
}
export type AccessType = 'anonymous' | 'public' | 'authenticated' | 'trusted' | 'administrator';
export interface AuthLocState {
account_id: string | null;
account_code: string;
account_name: string;
// true when no site passcode is required; string = the access key that was used.
allow_access: boolean | string;
site_domain: string | null;
site_access_key: string | null;
site_domain_access_key: string | null;
site_cfg_json: SiteCfgJson;
site_access_code_kv: {
administrator: string | null;
trusted: string | null;
public: string | null;
authenticated: string | null;
};
access_type: AccessType;
administrator_access: boolean;
trusted_access: boolean;
public_access: boolean;
authenticated_access: boolean;
anonymous_access: boolean;
user_email: string | null;
user_access_type: string | null;
jwt: string | null;
person_id: string | null;
person: AePerson;
user_id: string | null;
user: AeUser;
}
export const auth_loc_defaults: AuthLocState = {
// account_id is always null at module init — the env var is intentionally not
// read here; the value is set from the site API after the first trusted login.
account_id: null,