Files
OSIT-AE-App-Svelte/src/lib/stores/ae_events_stores.ts
Scott Idem 573d20e574 feat(stores): retire events_loc — Svelte 4 persisted store fully replaced
events_loc has been completely removed after migrating all consumers:

- EVENTS_MODULE_TITLE constant replaces $events_loc.title (was always
  the static default 'OSIT\'s Æ Events', never written dynamically)
- events/+layout.svelte: qry__* writes moved to events_sess; stale-deploy
  ver check block removed (store_versions.ts handles this already)
- 3 stale pres_mgmt stragglers fixed: device_obj_li, location_page_menu,
  event_reports_page_menu now use pres_mgmt_loc.current directly
- testing/+page.svelte: missed launcher ref fixed (launcher_loc.current)
- events_loc export, events_local_data_struct, persisted import, and
  AE_EVENTS_LOC_VERSION import all removed from ae_events_stores.ts
- events_loc import cleaned from all consumer files

events_sess (in-memory writable) stays in ae_events_stores.ts unchanged.
store_versions.ts keeps its _check_and_wipe('ae_events_loc') entry to
clean lingering old data from users' browsers.

svelte-check: 0 errors, 0 warnings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 16:41:06 -04:00

159 lines
4.8 KiB
TypeScript

import { writable } from 'svelte/store';
import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/stores/ae_stores';
// Static display title for the Events module. Always this value — nothing writes to it.
// Use this constant instead of $events_loc.title (which is being retired).
export const EVENTS_MODULE_TITLE = `OSIT's Æ Events`;
import { badges_sess_defaults } from '$lib/stores/ae_events_stores__badges_defaults';
import { launcher_sess_defaults } from '$lib/stores/ae_events_stores__launcher_defaults';
import { leads_sess_defaults } from '$lib/stores/ae_events_stores__leads_defaults';
import { 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.
const ver = '2025-10-16_2139';
/* *** BEGIN *** Initialize events_session_data_struct */
// In-memory only (writable, not persisted). Resets on page load.
const events_session_data_struct: key_val = {
// Deployment version stamp — bump alongside ver above when pushing breaking changes.
ver: ver,
log_lvl: 1,
// Shared
ds: {
submit_status: null
},
qry__enabled: 'enabled', // all, disabled, enabled
qry__hidden: 'not_hidden', // all, hidden, not_hidden
qry__limit: 20,
qry__offset: 0,
// This is intended to only be temporary.
auth__person: {},
auth__entered_key: null,
auth__entered_passcode: null,
auth__kv: {
event: {},
exhibit: {},
location: {},
session: {},
presentation: {},
presenter: {},
person: {}
},
// Badge Printing — see ae_events_stores__badges_defaults.ts
badges: badges_sess_defaults,
// Event Files - uploads for sessions, presenters, etc
files: {
disable_submit__event_file_obj: null,
status__submit: null,
status__file_list: null, // processing, complete
processed_file_list: []
},
// Event Presentation Launcher — see ae_events_stores__launcher_defaults.ts
launcher: launcher_sess_defaults,
// Lead Retrievals (Exhibit) — see ae_events_stores__leads_defaults.ts
leads: leads_sess_defaults,
// Presentation Management — see ae_events_stores__pres_mgmt_defaults.ts
pres_mgmt: pres_mgmt_sess_defaults
// Speakers Management (Collection)
// other
};
export const events_sess = writable(events_session_data_struct);
/* *** BEGIN *** Initialize events_slct and events_trigger */
// In-memory only — tabs can have different event/session/presenter selections.
// Intended for temporary session storage.
// Updated 2024-03-06
const events_slct_obj_template: key_val = {
// Top level
event_id: null,
event_obj: {},
event_obj_li: [],
// Sub-level event_
badge_id: null,
badge_obj: {},
badge_obj_li: [],
exhibit_id: null,
exhibit_obj: {},
exhibit_obj_li: [],
file_id: null,
file_obj: {},
file_obj_li: [],
event_file_obj: {},
event_file_obj_li: [],
location_id: null,
location_obj: {},
location_obj_li: [],
person_id: null,
person_obj: {},
person_obj_li: [],
presentation_id: null,
presentation_obj: {},
presentation_obj_li: [],
event_presentation_obj: {},
presenter_id: null,
presenter_obj: {},
presenter_obj_li: [],
event_presenter_obj: {},
session_id: null,
event_session_id: null,
session_obj: {},
session_obj_li: [],
event_session_obj: {},
auth__event_presenter_id: null,
auth__event_presentation_id: null
};
// In-memory only (not persisted) — separate tabs can select different events/sessions/presenters.
export const events_slct = writable(events_slct_obj_template);
// Broadcast trigger — increment or set truthy to signal subscribers to re-query.
export const events_trigger: any = writable(null);
// events_trig: fine-grained triggers per object type.
// Set an ID to signal that specific object needs to be re-fetched.
const tmp__events_trig: key_val = {
event_id: null,
event_id_li: [],
event_location_id: null,
event_location_id_li: [],
event_session_id: null,
event_session_id_li: [],
event_presentation_id: null,
event_presentation_id_li: [],
event_presenter_id: null,
event_presenter_id_li: []
};
// console.log(`AE Stores - Events Trigger:`, events_trig);
export const events_trig: Writable<key_val> = writable(tmp__events_trig);
// events_trig_kv: response/status map — keys are request IDs, values are
// completion status or Promise results. Used for tracking parallel downloads.
const tmp__events_trig_kv: key_val = {};
export const events_trig_kv = writable(tmp__events_trig_kv);