refactor(stores): Phase 2a — split store defaults into domain sub-files

ae_stores.ts
- Extract auth/identity section (~80 lines) into ae_stores__auth_loc_defaults.ts
- Spread auth_loc_defaults into ae_app_local_data_defaults (zero consumer changes)

ae_events_stores.ts (both loc and sess structs)
- badges   → ae_events_stores__badges_defaults.ts
- launcher → ae_events_stores__launcher_defaults.ts
- leads    → ae_events_stores__leads_defaults.ts
- pres_mgmt → ae_events_stores__pres_mgmt_defaults.ts

Each new file exports *_loc_defaults and *_sess_defaults. The store files
now reference these by name instead of embedding inline objects. All
$ae_loc.* and $events_loc.* consumer paths are unchanged.

svelte-check: 0 errors, 0 warnings
This commit is contained in:
Scott Idem
2026-03-16 15:42:21 -04:00
parent f4020e7834
commit 41ed6a8adc
7 changed files with 551 additions and 495 deletions

View File

@@ -8,6 +8,11 @@ import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/stores/ae_stores';
import { badges_loc_defaults, badges_sess_defaults } from '$lib/stores/ae_events_stores__badges_defaults';
import { launcher_loc_defaults, launcher_sess_defaults } from '$lib/stores/ae_events_stores__launcher_defaults';
import { leads_loc_defaults, leads_sess_defaults } from '$lib/stores/ae_events_stores__leads_defaults';
import { pres_mgmt_loc_defaults, pres_mgmt_sess_defaults } from '$lib/stores/ae_events_stores__pres_mgmt_defaults';
// Deployment version stamp. Compared against events_sess.ver in events/+layout.svelte
// to detect stale persisted data after a deploy (triggers a reload). Bump this alongside
// events_session_data_struct.ver. See store_versions.ts for the schema-level wipe mechanism.
@@ -56,271 +61,17 @@ const events_local_data_struct: key_val = {
person: {}
},
// Badge Printing
badges: {
auto_view: true,
// Badge Printing — see ae_events_stores__badges_defaults.ts
badges: badges_loc_defaults,
show_hidden: false, // These are hidden (archived) leads so the list is not as long.
show_not_enabled: false,
// Event Presentation Launcher — see ae_events_stores__launcher_defaults.ts
launcher: launcher_loc_defaults,
show_printed: false,
allow_reprint: false,
// Lead Retrievals (Exhibit) — see ae_events_stores__leads_defaults.ts
leads: leads_loc_defaults,
show_element__cfg: true,
show_element__cfg_detail: false,
fulltext_search_qry_str: null,
search_badge_type_code: null,
// New additions for search stabilization (Standardized Pattern 2026-01-27)
search_version: 0,
qry__remote_first: false,
// New additions for filter states
qry_printed_status: 'all', // Default to all
qry_affiliations: null, // Default to null for no filter
qry_sort_order: '', // Default to empty string for default sort
status_qry__search: null,
use_id_li: true,
search_status: null,
search_complete: false,
classes__form: 'border border-surface-200 p-4 space-y-4 rounded-container'
},
// Event Presentation Launcher (and native Electron app)
launcher: {
// default - browser, onsite - browser onsite, native - Electron app onsite
app_mode: 'default', // 'default', 'native', 'onsite'
ws_connect: false,
qry_limit__files: 25,
qry_limit__presentations: 25,
qry_limit__presenters: 75,
qry_limit__sessions: 50,
hide__launcher_header: false,
hide__launcher_menu: false,
hide__launcher_footer: false,
hide__modal_header_title: false,
hide_drawer__debug: true,
hide__ws_element: true,
hide__ws_form: true,
hide__ws_messages: true,
hide__ws_commands: true,
hide_content__draft_files: true,
show_content__disabled_files: false,
show_content__hidden_files: false,
show_content__hidden_presentations: false,
show_content__hidden_presenters: false,
show_content__hidden_sessions: false,
show_content__draft_files: false,
// These should be renamed to match the pres_mgmt section. Use "hide" instead of "show".
show_content__session_code: true,
show_content__presentation_code: true,
show_content__presenter_code: true,
show_section__controller: false,
// 3-Way Section States (V5 Overhaul)
// Values: 'collapsed' | 'auto' | 'pinned'
section_state__health: 'auto',
section_state__native_os: 'collapsed',
section_state__sync_timers: 'collapsed',
section_state__updates: 'collapsed',
section_state__controller: 'auto',
section_state__screen_saver: 'collapsed',
section_state__app_modes: 'collapsed',
section_state__local_actions: 'collapsed',
datetime_format: 'datetime_12_long',
time_format: 'time_12_short',
time_hours: 12, // 12 or 24
sync_intervals: {
event: 90000,
device: 60000,
location: 30000,
session: 15000,
presentation: 45000,
presenter: 60000,
file_sync: 10000
},
slct: {
event_id: null,
event_location_id: null,
event_session_id: null,
event_presentation_id: null,
event_presenter_id: null,
event_file_id: null // event_file_id
},
native: {
host_file_config_path: 'device_configs/ae_native_app_config.default.json'
},
idle_timer: 7 * 60 * 1000, // How many seconds until idle
idle_cycle: 5 * 1000, // How frequently the idle status is checked
idle_loop_period: 3 * 60 * 1000, // How frequently the loop runs for the screen saver and similar
screen_saver_img_kv: {}, // This key value list is generate when the launcher_file_cont is loaded. It only adds image file types.
modal__title: '-- Not Set --',
modal__open: null,
modal__open_filename: null,
modal_img_src: null,
controller: 'local',
controller_group_code: 'launcher-00',
controller_client_id: null
// controller_cmd: null,
// controller_trigger_send: null,
},
// Lead Retrievals (Exhibit)
leads: {
show_option__paid_tab: true,
show_content__scan_alert: true, // For QR scanner bug...
show_content__scan_requirements: true,
show_content__custom_question_descriptions: true,
show_content__email_link_warning: true,
default_to_scan: true,
// Fallback external registration ID used when building lead export data.
// Should be overridden by the active event's external_event_id in cfg_json.
default__external_registration_id: '2024_Annual Meeting',
auto_view: true, // Show the new lead after added by scan or search
auto_hide_on_sign_in: true,
show_hidden: false, // These are hidden (archived) leads so the list is not as long.
show_not_enabled: false,
refresh_interval__tracking_li: 30000, // 30 seconds
// Standardized Search Pattern 2026-01-28
search_version: 0,
qry__remote_first: false,
qry__search_text: '',
qry__sort_order: 'name_asc',
// Standardized Search Pattern (Tracking) 2026-01-28
tracking__search_version: 0,
tracking__qry__remote_first: false,
tracking__qry__search_text: '',
tracking__qry__sort_order: 'created_desc',
tracking__qry__licensee_email: 'all',
// The entered_passcode is the exhibit booths shared passcode for staff. This is used to initially access the lead retrieval service.
entered_passcode: null,
// auth_exhibit_kv: key-value of exhibit IDs this browser client
// is authorized for, mapped to { key, updated_on }. Entries expire
// after a configurable max age and must be re-authenticated.
auth_exhibit_kv: {},
edit_license_li: false,
// The "tab" is a key value list of exhibit ID and tab name. This is intentionally using local storage to store the current tab for each exhibit.
// example: {'LNDF-67-89-92': 'start', 'OFLN-32-38-14': 'add_scan'}
tab: {}
},
// Presentation Management
pres_mgmt: {
sync_local_config: false,
lock_config: true,
datetime_format: 'datetime_12_long',
time_format: 'time_12_short',
time_hours: 12, // 12 or 24
qry_enabled: 'enabled', // all, disabled, enabled
qry_hidden: 'not_hidden', // all, hidden, not_hidden
qry_limit__files: 75,
qry_limit__presentations: 25,
qry_limit__presenters: 500,
qry_limit__sessions: 100,
qry_max: 500, // This is the max number the limit is allowed to be set to.
qry__files_offset_seconds: null,
qry__files_sort: 'created_on',
// New additions for search stabilization (Standardized Pattern 2026-01-27)
search_version: 0,
qry__remote_first: false,
qry_and__file_count: true, // Essentially it should be greater than 0
save_search_text: true,
saved_search__session: null,
require__presenter_agree: false,
require__session_agree: false,
show_content__event_view: null,
show_content__location_qr: false,
show_content__presentation_description: false, // Note that this is for *all* presentations in the user interface. It is a global setting.
show_content__presenter_page_help: true,
// show_content__presenter_start: false,
show_content__presenter_view: null,
show_content__presenter_qr: false,
show_content__session_description: false,
show_content__session_files: false,
show_content__session_help: true,
show_content__session_presentations: false,
show_content__session_search_view: null,
show_content__session_search_help: true,
show_content__session_search_room_name: false,
show_content__session_view: null,
show_content__session_qr: false,
hide__session_msg: true,
hide__session_poc: true,
hide__session_poc_biography: true,
hide__presenter_biography: true,
// Only specific to lists and tables:
hide__session_li_location_field: false,
hide__session_li_poc_field: false,
hide__launcher_link_legacy: true, // Flask version
hide__launcher_link: true, // New Svelte version
hide__location_link: true,
show_content__disabled_files: false,
show_content__hidden_files: false,
show_content__hidden_presentations: false,
show_content__hidden_presenters: false,
show_content__hidden_sessions: false,
show__direct_download: false,
// No longer used. Use "hide" instead of "show". Now it is initially set in the remote event config sync.
// show_content__presentation_code: true,
// show_content__presenter_code: true,
// show_content__session_code: true,
show_menu__presenter: null,
show_menu__session: null,
show_menu__session_search: null,
show_menu__event_reports: null,
show_report: null,
disable_submit__opt_out: true,
submit_status__opt_out: null,
device_kv: {
// 'LNDF-67-89-92': {'collapse': true},
},
location_kv: {
// 'LNDF-67-89-92': {'collapse': true},
}
}
// Presentation Management — see ae_events_stores__pres_mgmt_defaults.ts
pres_mgmt: pres_mgmt_loc_defaults
};
@@ -358,22 +109,8 @@ const events_session_data_struct: key_val = {
person: {}
},
// Badge Printing
badges: {
fulltext_search_qry_str: null,
search_badge_type_code: null,
status_qry__search: null,
use_id_li: true,
search_status: null,
search_complete: true,
show_form__search: true,
show_form__search_results: true,
show_form__scan: false,
qr_scan_start: true,
qr_scan_result: null
},
// Badge Printing — see ae_events_stores__badges_defaults.ts
badges: badges_sess_defaults,
// Event Files - uploads for sessions, presenters, etc
files: {
@@ -384,158 +121,14 @@ const events_session_data_struct: key_val = {
processed_file_list: []
},
// Event Presentation Launcher (and native Electron app)
launcher: {
ws_connect_status: null,
av_recording_status: null,
controller_cmd: null,
controller_trigger_send: null,
event_file_open: {}, // This is from the older Launcher.
native: {},
// Event Presentation Launcher — see ae_events_stores__launcher_defaults.ts
launcher: launcher_sess_defaults,
// Shared observability for Sync Monitor and Config Drawer
sync_stats: {
total: 0,
cached: 0,
missing: 0,
currently_syncing: null
},
heartbeat_info: {
last_timestamp: null,
status: 'pending'
},
// Lead Retrievals (Exhibit) — see ae_events_stores__leads_defaults.ts
leads: leads_sess_defaults,
modal__title: '',
modal__open_event_file_id: false,
modal__event_file_obj: null,
loading__session_li_status: null,
loading__session_id_status: null,
trigger_reload__event_session_obj_id: null,
trigger_reload__event_session_obj_li: null,
trigger_reload__event_location_obj_id: null,
trigger_reload__event_location_obj_li: null,
trigger__ws_connect: null,
trigger__ws_disconnect: null
},
// Lead Retrievals (Exhibit)
leads: {
show_form__license: false,
show_form__search: false,
show_form__scan: false,
show_form__view_lead: false, // Set to event_exhibit_tracking_id
// show_form__view_lead: [],
show_confirm__add_lead: [],
submit_status__license: null, // 'saving', 'created', 'updated'
// create_status__license: null, // 'creating', 'created', 'updated'
// update_status__license: null, // 'updating', 'created', 'updated'
submit_status__search: null, // 'searching', 'complete'
last_refresh_time: null as string | null,
next_refresh_countdown: 0,
entered_passcode: null,
tmp_license: {
index: null,
// 'agree' : false, // The user must agree to the license agreement.
email: '',
full_name: '',
passcode: '',
session_count: 0,
updated_on: new Date().toISOString()
},
entered_search_str: null,
lead_data_changed: null,
qr_scan_start: true,
qr_scan_result: null
},
// Presentation Management
pres_mgmt: {
// link: {
// ae_core: true,
// pres_mgmt__launcher_id: null, // event_location_id
// pres_mgmt__location_id: null, // event_location_id
// pres_mgmt__presenter_id: null, // event_presenter_id
// pres_mgmt__reports: null, // event_id
// pres_mgmt__session_id: null, // event_session_id
// pres_mgmt__session_search: null, // event_id
// },
// presenter__url_str: null,
presenter__updated_on: null,
session_updated_on: null,
location_name_qry_str: null,
fulltext_search_qry_str: null,
status_qry__search: null,
disable_submit__event_file_obj: true,
show_form__search: true,
show_form__search_results: true,
show_content__agree_text: false,
show_content__presenter_start: false,
show_content__presentation_description: false, // Note that this is per presentation. The event_presentation_id_random should match.
show_report: null,
// show_report__presenters_agree: false,
// show_report__recent_files: false,
show_field_edit__filename: false, // For file rename
new_upload_list: null,
files_uploading_count: null,
qry_limit__files: 75,
qry_limit__presentations: 25,
qry_limit__presenters: 500,
qry_limit__sessions: 100,
show_fields__presentation: true,
show_fields__session: true,
show_modal__presenter_agree: false,
show__session_poc_profile: false,
show_modal__session_poc_agree: false,
// hide__edit_location: {},
show__edit_location: {},
show__edit_poc_person: {},
show__view_alert: {}, // key values
show__edit_alert_msg: {}, // key values
tmp__alert_msg: {}, // key values
session_qr_url: {}, // key value of session_id and URL string
status_rpt: {
recent_files: null,
presenters_agree: null,
presenters_biography: null
},
rpt__session_no_files: true,
rpt__session_poc_agree: false, // Default to false for new events.
rpt__session_no_bio: true,
rpt__presenter_agree: true,
tmp_val__filename_no_ext: null // For file rename
}
// Presentation Management — see ae_events_stores__pres_mgmt_defaults.ts
pres_mgmt: pres_mgmt_sess_defaults
// Speakers Management (Collection)