From 41ed6a8adcdfdad3c5e92c618a9ed150b22c3c9f Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 16 Mar 2026 15:42:21 -0400 Subject: [PATCH] =?UTF-8?q?refactor(stores):=20Phase=202a=20=E2=80=94=20sp?= =?UTF-8?q?lit=20store=20defaults=20into=20domain=20sub-files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/lib/stores/ae_events_stores.ts | 449 +----------------- .../ae_events_stores__badges_defaults.ts | 57 +++ .../ae_events_stores__launcher_defaults.ts | 139 ++++++ .../ae_events_stores__leads_defaults.ts | 90 ++++ .../ae_events_stores__pres_mgmt_defaults.ts | 150 ++++++ src/lib/stores/ae_stores.ts | 71 +-- .../stores/ae_stores__auth_loc_defaults.ts | 90 ++++ 7 files changed, 551 insertions(+), 495 deletions(-) create mode 100644 src/lib/stores/ae_events_stores__badges_defaults.ts create mode 100644 src/lib/stores/ae_events_stores__launcher_defaults.ts create mode 100644 src/lib/stores/ae_events_stores__leads_defaults.ts create mode 100644 src/lib/stores/ae_events_stores__pres_mgmt_defaults.ts create mode 100644 src/lib/stores/ae_stores__auth_loc_defaults.ts diff --git a/src/lib/stores/ae_events_stores.ts b/src/lib/stores/ae_events_stores.ts index 518020f0..c16c1710 100644 --- a/src/lib/stores/ae_events_stores.ts +++ b/src/lib/stores/ae_events_stores.ts @@ -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) diff --git a/src/lib/stores/ae_events_stores__badges_defaults.ts b/src/lib/stores/ae_events_stores__badges_defaults.ts new file mode 100644 index 00000000..4609bfd1 --- /dev/null +++ b/src/lib/stores/ae_events_stores__badges_defaults.ts @@ -0,0 +1,57 @@ +/** + * ae_events_stores__badges_defaults.ts + * + * Default state for the badges (badge printing) section of ae_events_stores.ts. + * badges_loc_defaults → events_loc.badges (persisted to localStorage) + * badges_sess_defaults → events_sess.badges (in-memory, resets on page load) + */ + +// Persisted badge UI state — survives browser sessions. +export const badges_loc_defaults = { + auto_view: true, + + show_hidden: false, // Hidden (archived) badges are excluded from the main list. + show_not_enabled: false, + + show_printed: false, + allow_reprint: false, + + show_element__cfg: true, + show_element__cfg_detail: false, + + fulltext_search_qry_str: null, + search_badge_type_code: null, + + // Search stabilization — version bump clears cache and re-runs (Standardized Pattern 2026-01-27). + search_version: 0, + qry__remote_first: false, + + // Filter states + qry_printed_status: 'all', // 'all' | 'printed' | 'not_printed' + qry_affiliations: null, // null = no affiliation filter + qry_sort_order: '', // '' = default sort order + + 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' +}; + +// In-memory badge state — resets on page load. +export const badges_sess_defaults = { + 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 +}; diff --git a/src/lib/stores/ae_events_stores__launcher_defaults.ts b/src/lib/stores/ae_events_stores__launcher_defaults.ts new file mode 100644 index 00000000..7b63ef99 --- /dev/null +++ b/src/lib/stores/ae_events_stores__launcher_defaults.ts @@ -0,0 +1,139 @@ +/** + * ae_events_stores__launcher_defaults.ts + * + * Default state for the launcher (Event Presentation Launcher + Electron native app) + * section of ae_events_stores.ts. + * launcher_loc_defaults → events_loc.launcher (persisted to localStorage) + * launcher_sess_defaults → events_sess.launcher (in-memory, resets on page load) + */ + +// Persisted launcher config — survives browser sessions. +export const launcher_loc_defaults = { + // App mode: 'default' = browser, 'onsite' = browser onsite, 'native' = Electron app onsite. + app_mode: 'default', + 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 + }, + + native: { + host_file_config_path: 'device_configs/ae_native_app_config.default.json' + }, + + idle_timer: 7 * 60 * 1000, // Milliseconds until idle state is entered. + idle_cycle: 5 * 1000, // How frequently idle status is checked (ms). + idle_loop_period: 3 * 60 * 1000, // How frequently screen-saver loop and similar run (ms). + + screen_saver_img_kv: {}, // Built when launcher_file_cont loads — image files only. + 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, +}; + +// In-memory launcher state — resets on page load (mostly real-time status/triggers). +export const launcher_sess_defaults = { + ws_connect_status: null, + av_recording_status: null, + controller_cmd: null, + controller_trigger_send: null, + event_file_open: {}, // From older launcher version; retained for compatibility. + native: {}, + + // 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' + }, + + 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 +}; diff --git a/src/lib/stores/ae_events_stores__leads_defaults.ts b/src/lib/stores/ae_events_stores__leads_defaults.ts new file mode 100644 index 00000000..64ab1f7c --- /dev/null +++ b/src/lib/stores/ae_events_stores__leads_defaults.ts @@ -0,0 +1,90 @@ +/** + * ae_events_stores__leads_defaults.ts + * + * Default state for the leads (exhibitor lead retrieval) section of ae_events_stores.ts. + * leads_loc_defaults → events_loc.leads (persisted to localStorage) + * leads_sess_defaults → events_sess.leads (in-memory, resets on page load) + */ + +// Persisted leads config — survives browser sessions. +export const leads_loc_defaults = { + show_option__paid_tab: true, + show_content__scan_alert: true, // Workaround for QR scanner edge-case 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 immediately after adding by scan or search. + auto_hide_on_sign_in: true, + + show_hidden: false, // Hidden (archived) leads are excluded from the main list. + 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', + + // Exhibitor's shared passcode for staff booth access. Used for initial lead retrieval auth. + 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. + auth_exhibit_kv: {}, + + edit_license_li: false, + + // Per-exhibit current tab. Key = exhibit ID (random), value = tab name. + // Intentionally persisted so each exhibit's last-used tab is remembered across sessions. + // Example: {'LNDF-67-89-92': 'start', 'OFLN-32-38-14': 'add_scan'} + tab: {} +}; + +// In-memory leads state — resets on page load. +export const leads_sess_defaults = { + show_form__license: false, + show_form__search: false, + show_form__scan: false, + show_form__view_lead: false, // Set to event_exhibit_tracking_id when a lead is active. + + show_confirm__add_lead: [], + + submit_status__license: null, // 'saving' | '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, + 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 +}; diff --git a/src/lib/stores/ae_events_stores__pres_mgmt_defaults.ts b/src/lib/stores/ae_events_stores__pres_mgmt_defaults.ts new file mode 100644 index 00000000..b9bcde5b --- /dev/null +++ b/src/lib/stores/ae_events_stores__pres_mgmt_defaults.ts @@ -0,0 +1,150 @@ +/** + * ae_events_stores__pres_mgmt_defaults.ts + * + * Default state for the pres_mgmt (Presentation Management) section of ae_events_stores.ts. + * pres_mgmt_loc_defaults → events_loc.pres_mgmt (persisted to localStorage) + * pres_mgmt_sess_defaults → events_sess.pres_mgmt (in-memory, resets on page load) + */ + +// Persisted pres_mgmt config — survives browser sessions. +export const pres_mgmt_loc_defaults = { + 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, // Maximum value the limit is allowed to be set to. + qry__files_offset_seconds: null, + qry__files_sort: 'created_on', + + // Search stabilization — version bump clears cache and re-runs (Standardized Pattern 2026-01-27). + search_version: 0, + qry__remote_first: false, + + qry_and__file_count: true, // When true, only sessions with at least 1 file are returned. + + 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, // Global toggle — applies to all presentations. + show_content__presenter_page_help: true, + 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, + + // List/table-specific visibility. + hide__session_li_location_field: false, + hide__session_li_poc_field: false, + hide__launcher_link_legacy: true, // Flask version. + hide__launcher_link: true, // SvelteKit 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, + + // Menu visibility — null means "use server-side default". + // Use "hide" prefix for any new additions here. + 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: {}, + location_kv: {} +}; + +// In-memory pres_mgmt state — resets on page load. +export const pres_mgmt_sess_defaults = { + 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, // Per-presentation (keyed by event_presentation_id_random). + + show_report: null, + + 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, + + show__edit_location: {}, + show__edit_poc_person: {}, + + show__view_alert: {}, // Key-value: show alert by ID. + show__edit_alert_msg: {}, // Key-value: show edit alert msg by ID. + tmp__alert_msg: {}, // Key-value: temp alert msg content by ID. + + session_qr_url: {}, // Key-value: session_id → 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. +}; diff --git a/src/lib/stores/ae_stores.ts b/src/lib/stores/ae_stores.ts index 76803af9..20cc3fa6 100644 --- a/src/lib/stores/ae_stores.ts +++ b/src/lib/stores/ae_stores.ts @@ -2,6 +2,8 @@ // before svelte-persisted-store hydrates from it. import { AE_LOC_VERSION } from '$lib/stores/store_versions'; +import { auth_loc_defaults } from '$lib/stores/ae_stores__auth_loc_defaults'; + import { persisted } from 'svelte-persisted-store'; import { readable, writable } from 'svelte/store'; @@ -78,73 +80,8 @@ const ae_app_local_data_defaults: key_val = { adv_mode: false, sync_local_config: true, // When true, pulls site config from the remote API on load. - account_id: ae_account_id, - account_code: 'not_set', - account_name: 'Account Name Not Set', - allow_access: true, // Set to key site key was used, otherwise set to true. - site_domain: null, // https://example.com, https://dev.example.com, etc. - site_access_key: null, // This is the general site access key - site_domain_access_key: null, // This is specific to a (sub)domain. - site_cfg_json: { - slct__event_id: null, - slct__event_badge_template_id: null, - slct__sponsorship_cfg_id: null, - header_image_path: null - }, - - // Per-permission-level passcodes loaded from the site record on login. - // null = no passcode required for that tier. Overwritten by the site API response. - site_access_code_kv: { - administrator: null, - trusted: null, - public: 'public1980', - authenticated: 'auth1980' - }, - - access_type: 'anonymous', - administrator_access: false, - trusted_access: false, - public_access: false, - authenticated_access: false, - anonymous_access: true, - - user_email: null, - // Stored on sign-in so the original permission level can be restored if temporarily escalated. - user_access_type: null, - - jwt: null, // JSON Web Token for authenticated API requests. - - person_id: null, - person: { - id: null, - given_name: null, - full_name: null, - full_name_override: null, // Previously called display_name. - primary_email: null, - user_id: null, - - qry_limit__people: 150, - - show_content__person_page_help: false - }, - - user_id: null, - user: { - id: null, - username: null, - name: null, - email: null, - allow_auth_key: null, // Magic-link token — allows sign-in without password. - super: false, - manager: false, // Can manage accounts and users globally. - administrator: false, // Account-level administrator. - verified: false, - public: false, - person_id: null, - access_type: null, - - qry_limit__users: 100 - }, + // Auth and identity section — see ae_stores__auth_loc_defaults.ts. + ...auth_loc_defaults, qry__enabled: 'enabled', // all, disabled, enabled qry__hidden: 'not_hidden', // all, hidden, not_hidden diff --git a/src/lib/stores/ae_stores__auth_loc_defaults.ts b/src/lib/stores/ae_stores__auth_loc_defaults.ts new file mode 100644 index 00000000..967b08fc --- /dev/null +++ b/src/lib/stores/ae_stores__auth_loc_defaults.ts @@ -0,0 +1,90 @@ +/** + * ae_stores__auth_loc_defaults.ts + * + * Authentication and identity defaults for the ae_loc persisted store. + * Spread into ae_app_local_data_defaults via ae_stores.ts — zero consumer + * changes needed; all $ae_loc.* paths remain unchanged. + * + * Three authentication paths share this store region: + * 1. Site passcode — site_access_code_kv, access_type, *_access flags + * 2. AE user/password — jwt, user{}, user_id + * 3. Resolved identity — person{}, person_id (populated after either path) + * + * See documentation/AE__Permissions_and_Security.md for the full hierarchy. + */ +export const auth_loc_defaults = { + // 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, + account_code: 'not_set', + account_name: 'Account Name Not Set', + + // Set to the site access key used for login, or true if no site passcode is required. + allow_access: true, + + site_domain: null, // e.g. https://example.com, https://dev.example.com + site_access_key: null, // General site access key. + site_domain_access_key: null, // Subdomain-specific access key. + site_cfg_json: { + slct__event_id: null, + slct__event_badge_template_id: null, + slct__sponsorship_cfg_id: null, + header_image_path: null + }, + + // Per-permission-level passcodes loaded from the site record on login. + // null = no passcode required for that tier. Overwritten by the site API response. + site_access_code_kv: { + administrator: null, + trusted: null, + public: 'public1980', + authenticated: 'auth1980' + }, + + // Current permission level. Updated by ae_utils__perm_checks after any auth event. + // Values: 'anonymous' | 'public' | 'authenticated' | 'trusted' | 'administrator' + access_type: 'anonymous', + // Cumulative flags — true means "you have AT LEAST this access level." + administrator_access: false, + trusted_access: false, + public_access: false, + authenticated_access: false, + anonymous_access: true, + + user_email: null, + // Stored on sign-in so the original permission level can be restored if temporarily escalated. + user_access_type: null, + + jwt: null, // JSON Web Token for authenticated API requests. + + // Resolved person identity — populated after either auth path. + person_id: null, + person: { + id: null, + given_name: null, + full_name: null, + full_name_override: null, // Previously called display_name. + primary_email: null, + user_id: null, + qry_limit__people: 150, + show_content__person_page_help: false + }, + + // AE user account — only populated for AE username/password login. + user_id: null, + user: { + id: null, + username: null, + name: null, + email: null, + allow_auth_key: null, // Magic-link token — allows sign-in without password. + super: false, + manager: false, // Can manage accounts and users globally. + administrator: false, // Account-level administrator. + verified: false, + public: false, + person_id: null, + access_type: null, + qry_limit__users: 100 + } +};