Refactor: Organize src/lib into subdirectories and move files accordingly.
This commit is contained in:
681
src/lib/stores/ae_events_stores.ts
Normal file
681
src/lib/stores/ae_events_stores.ts
Normal file
@@ -0,0 +1,681 @@
|
||||
import { persisted } from 'svelte-persisted-store';
|
||||
import { writable } from 'svelte/store';
|
||||
import type { Writable } from 'svelte/store';
|
||||
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
|
||||
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
|
||||
let ver = '2025-10-16_2139';
|
||||
let ver_idb = '2025-10-16_2139';
|
||||
|
||||
/* *** BEGIN *** Initialize events_local_data_struct */
|
||||
// Longer-term app data. This should be stored to *local* storage.
|
||||
// Updated 2024-03-06
|
||||
let events_local_data_struct: key_val = {
|
||||
ver: ver,
|
||||
ver_idb: ver_idb,
|
||||
|
||||
// Shared
|
||||
name: 'Aether - Events (SvelteKit 2.x Svelte 4.x)',
|
||||
title: `OSIT's Æ Events`, // - Dev SvelteKit`, // Æ
|
||||
|
||||
'ds': {},
|
||||
|
||||
'events_cfg_json': {},
|
||||
|
||||
'event_id': null,
|
||||
|
||||
// all, disabled, enabled
|
||||
'qry__enabled': 'enabled',
|
||||
// all, hidden, not_hidden
|
||||
'qry__hidden': 'not_hidden',
|
||||
'qry__limit': 20,
|
||||
'qry__offset': 0,
|
||||
|
||||
// The show details is intended for things like meta data and additional details that are not always needed.
|
||||
show_details: false,
|
||||
|
||||
auth__person: {}, // allow, id, name, email, passcode, etc
|
||||
// The auth__entered_key (usually email or person_id) and auth__entered_passcode is found under events_sess.entered_key and events_sess.entered_passcode because it should be temporary.
|
||||
// auth__entered_passcode: null,
|
||||
|
||||
// The auth__kv (key value pairs) is used to store the xyz IDs that the browser client can access. This is a key value list of xyz ID and created datetime stamp (or just true). These should not be more than X days old.
|
||||
auth__kv: {
|
||||
event: {
|
||||
// 'LNDF-67-89-92': true
|
||||
},
|
||||
exhibit: {
|
||||
// 'LNDF-67-89-92': true
|
||||
},
|
||||
location: {
|
||||
// 'LNDF-67-89-92': true
|
||||
},
|
||||
session: {
|
||||
// 'LNDF-67-89-92': true, false, 'read', 'write'
|
||||
},
|
||||
presentation: {
|
||||
// 'LNDF-67-89-92': true
|
||||
},
|
||||
presenter: {
|
||||
// 'LNDF-67-89-92': true
|
||||
},
|
||||
person: {
|
||||
// 'LNDF-67-89-92': true
|
||||
},
|
||||
},
|
||||
|
||||
// auth__session_kv: {
|
||||
// // {'LNDF-67-89-92': true}
|
||||
// },
|
||||
// auth__presentation_kv: {
|
||||
// // {'LNDF-67-89-92': true}
|
||||
// },
|
||||
// auth__presenter_kv: {
|
||||
// // {'LNDF-67-89-92': true}
|
||||
// },
|
||||
|
||||
// Badge Printing
|
||||
'badges': {
|
||||
auto_view: true,
|
||||
|
||||
show_hidden: false, // These are hidden (archived) leads so the list is not as long.
|
||||
show_not_enabled: false,
|
||||
|
||||
show_printed: false,
|
||||
allow_reprint: false,
|
||||
|
||||
'show_element__cfg': true,
|
||||
'show_element__cfg_detail': false,
|
||||
// 'theme_mode': 'dark',
|
||||
// 'theme_name': 'wintry',
|
||||
|
||||
'fulltext_search_qry_str': null,
|
||||
'search_badge_type_code': null,
|
||||
'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 Files - uploads for sessions, presenters, etc
|
||||
// 'files': {
|
||||
// },
|
||||
|
||||
// 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: true,
|
||||
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,
|
||||
|
||||
datetime_format: 'datetime_12_long',
|
||||
time_format: 'time_12_short',
|
||||
time_hours: 12, // 12 or 24
|
||||
|
||||
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: {
|
||||
// 'local_file_cache_path': aether_cfg_data.app.local_file_cache_path,
|
||||
// 'host_file_temp_path': aether_cfg_data.app.host_file_temp_path,
|
||||
'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,
|
||||
|
||||
// For ISHLT 2024 Annual Meeting only!
|
||||
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
|
||||
|
||||
// The entered_passcode is the exhibit booths shared passcode for staff. This is used to initially access the lead retrieval service.
|
||||
entered_passcode: null,
|
||||
|
||||
// The auth_exhibit_kv (key value pairs) is used to store the exhibit IDs that the browser client can access. This is a key value list of exhibit ID and created datetime stamp. These should not be more than X days old. The entered_passcode for events_sess.leads is what they are entering to log in.
|
||||
auth_exhibit_kv: {
|
||||
// {'LNDF-67-89-92': {key: 'example@oneskyit.com', updated_on: '2024-03-13T08:05:29Z}}
|
||||
},
|
||||
|
||||
// The auth_exhibit_license_li is used to store the exhibit license(s) being used on the browser client. There can be multiple exhibit IDs, but only one license per exhibit ID for the browser client. This is used to determine who can actually access and use the lead retrieval service. This is a key value list of key (email address) and created datetime stamp. These should not be more than X days old.
|
||||
// auth_exhibit_license_li: {
|
||||
// // 'LNDF-67-89-92': { 'key': 'example@oneskyit.com', 'updated_on': '2024-03-13T08:05:29Z'}
|
||||
// },
|
||||
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',
|
||||
|
||||
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__agree_text: false,
|
||||
show_content__event_view: null,
|
||||
// show__launcher_link: false,
|
||||
// show__location_link: false,
|
||||
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,
|
||||
// show_report__presenters_agree: false,
|
||||
// show_report__recent_files: false,
|
||||
|
||||
// time_format: 'time_12_short', // 'time_short', 'time_12_short'
|
||||
|
||||
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},
|
||||
},
|
||||
},
|
||||
|
||||
// Speakers Management (Collection)
|
||||
// 'speakers': {
|
||||
// },
|
||||
|
||||
// other
|
||||
}
|
||||
// console.log(`AE Stores - App Events Local Storage Data:`, events_local_data_struct);
|
||||
|
||||
// This works, but does not uses local storage:
|
||||
// export let ae_loc = writable(events_local_data_struct);
|
||||
|
||||
// This works and uses *local* storage:
|
||||
export let events_loc: Writable<key_val> = persisted('ae_events_loc', events_local_data_struct);
|
||||
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize events_session_data_struct */
|
||||
// Temporary app data. This should be stored to session storage.
|
||||
// Updated 2024-03-06
|
||||
let events_session_data_struct: key_val = {
|
||||
ver: ver,
|
||||
ver_idb: ver_idb,
|
||||
log_lvl: 1,
|
||||
|
||||
// Shared
|
||||
'ds': {
|
||||
'submit_status': null,
|
||||
},
|
||||
'ds_loaded': {
|
||||
},
|
||||
|
||||
'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
|
||||
'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,
|
||||
},
|
||||
|
||||
// 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 (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: {
|
||||
},
|
||||
|
||||
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': {
|
||||
example: true,
|
||||
|
||||
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'
|
||||
|
||||
// The entered_passcode is the exhibit booths shared passcode for staff. This is used to initially access the lead retrieval service.
|
||||
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,
|
||||
},
|
||||
|
||||
'stripe': {
|
||||
'license_qty': 1,
|
||||
'rental_qty': 0,
|
||||
'rental_option': true,
|
||||
'api_use': false,
|
||||
'client_reference_id': null,
|
||||
'publishable_key': 'pk_live_zqaWNDfak2eDHeqnRiyaJcFi',
|
||||
'btn_payment_id': null,
|
||||
'btn_1_license': 'buy_btn_1OvqWJ2gJkNsDuiNqMCWz5nG',
|
||||
'btn_1_license_rental': 'buy_btn_1OvqVA2gJkNsDuiNhk9r8Io2',
|
||||
'btn_3_license': 'buy_btn_1OvrI22gJkNsDuiNXjBg3c4Y',
|
||||
'btn_3_license_rental': 'buy_btn_1OvrKa2gJkNsDuiNhSBCkNau',
|
||||
'btn_6_license': 'buy_btn_1OvrWc2gJkNsDuiN7mnwvZNL',
|
||||
'btn_6_license_rental': 'buy_btn_1OvrXP2gJkNsDuiNZpWZs3Uy',
|
||||
'btn_10_license': 'buy_btn_1OvrPM2gJkNsDuiNRCMHfSuz',
|
||||
'btn_10_license_rental': 'buy_btn_1OvrPs2gJkNsDuiN1nPkjPOM',
|
||||
},
|
||||
|
||||
// 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
|
||||
},
|
||||
|
||||
// Speakers Management (Collection)
|
||||
|
||||
// other
|
||||
};
|
||||
// console.log(`AE Stores - App Events Session Storage Data:`, events_session_data_struct);
|
||||
export let events_sess = writable(events_session_data_struct);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize events_slct and events_trigger */
|
||||
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different events, badges, exhibits, etc. */
|
||||
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2024-03-06
|
||||
let events_slct_obj_template: key_val = {
|
||||
// Top level
|
||||
'event_id': null,
|
||||
'event_obj': {},
|
||||
'event_obj_li': [],
|
||||
|
||||
// Sub-level event_
|
||||
'abstract_id': null,
|
||||
'abstract_obj': {},
|
||||
'abstract_obj_li': [],
|
||||
|
||||
'badge_id': null,
|
||||
'badge_obj': {},
|
||||
'badge_obj_li': [],
|
||||
|
||||
'badge_template_id': null,
|
||||
'badge_template_obj': {},
|
||||
'badge_template_obj_li': [],
|
||||
|
||||
'device_id': null,
|
||||
'device_obj': {},
|
||||
'device_obj_li': [],
|
||||
|
||||
'exhibit_id': null,
|
||||
'exhibit_obj': {},
|
||||
'exhibit_obj_li': [],
|
||||
|
||||
// Rename these to badge_tracking_*?
|
||||
'exhibit_tracking_id': null,
|
||||
'exhibit_tracking_obj': {},
|
||||
'exhibit_tracking_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,
|
||||
'session_obj': {},
|
||||
'session_obj_li': [],
|
||||
'event_session_obj': {},
|
||||
|
||||
'lq__presenter_obj': {}, // Testing passing a LiveQuery object around...
|
||||
|
||||
'auth__event_presenter_id': null,
|
||||
'auth__event_presentation_id': null,
|
||||
};
|
||||
// console.log(`AE Stores - Selected Events Objects:`, events_slct_obj_template);
|
||||
|
||||
// This works, and uses *session* (not local) storage:
|
||||
export let events_slct = writable(events_slct_obj_template);
|
||||
|
||||
// This works and uses *local* storage:
|
||||
// export let events_slct: Writable<key_val> = persisted('ae_events_slct', events_slct_obj_template);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize events_trigger */
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2024-03-06
|
||||
export let events_trigger: any = writable(null);
|
||||
// console.log(`AE Events Stores - Events Trigger:`, events_trigger);
|
||||
|
||||
let 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 let events_trig: Writable<key_val> = writable(tmp__events_trig);
|
||||
|
||||
/* *** BEGIN *** TESTING Initialize trig_resp */
|
||||
// The idea behind this is for a shared (Svelte app (within Events for now)) trigger and response. In theory this could be used to monitor multiple downloads or have a universal status area. Intended for temporary session storage.
|
||||
// Updated 2024-06-25
|
||||
let tmp__events_trig_kv: key_val = {};
|
||||
// {
|
||||
// 'example-1':
|
||||
// {
|
||||
// 'a-rand-id-1': true,
|
||||
// 'a-rand-id-2': false,
|
||||
// 'a-rand-id-3': Promise.resolve('This is a test promise.'),
|
||||
// },
|
||||
// 'example-2':
|
||||
// {
|
||||
// 'a-rand-id-4': true,
|
||||
// 'a-rand-id-5': false,
|
||||
// 'a-rand-id-6': Promise.resolve('This is a test promise.'),
|
||||
// },
|
||||
// };
|
||||
export let events_trig_kv = writable(tmp__events_trig_kv);
|
||||
225
src/lib/stores/ae_idaa_stores.ts
Normal file
225
src/lib/stores/ae_idaa_stores.ts
Normal file
@@ -0,0 +1,225 @@
|
||||
import { persisted } from 'svelte-persisted-store';
|
||||
import { writable } from 'svelte/store';
|
||||
import type { Writable } from 'svelte/store';
|
||||
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { offset } from '@floating-ui/dom';
|
||||
|
||||
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
|
||||
let ver = '2024-08-21_1646';
|
||||
let ver_idb = '2024-08-21_1645';
|
||||
|
||||
/* *** BEGIN *** Initialize idaa_local_data_struct */
|
||||
// Longer-term app data. This should be stored to *local* storage.
|
||||
// Updated 2024-03-06
|
||||
let idaa_local_data_struct: key_val = {
|
||||
ver: ver,
|
||||
ver_idb: ver_idb,
|
||||
|
||||
// Shared
|
||||
name: 'Aether - IDAA (SvelteKit 2.x Svelte 4.x)',
|
||||
title: `OSIT's Æ IDAA`, // - Dev SvelteKit`, // Æ
|
||||
|
||||
novi_uuid: null,
|
||||
novi_email: null,
|
||||
novi_full_name: null,
|
||||
novi_admin_li: [
|
||||
"2b078deb-b4e7-4203-99da-9f7cd62159a5"
|
||||
],
|
||||
novi_trusted_li: [
|
||||
"c9ea07b5-06b0-4a43-a2d0-8d06558c8a82",
|
||||
"58db22ee-4b0a-49a7-9f34-53d2ba85a84b",
|
||||
],
|
||||
novi_jitsi_mod_li: [
|
||||
"5724aad7-6d89-47e7-8943-966fd22911bd",
|
||||
],
|
||||
|
||||
novi_archives_base_url: "https://www.idaa.org/idaa-archives",
|
||||
novi_bb_base_url: "https://www.idaa.org/idaa-bulletin-board",
|
||||
novi_meetings_base_url: "https://www.idaa.org/idaa-meetings",
|
||||
|
||||
'ds': {},
|
||||
|
||||
'idaa_cfg_json': {},
|
||||
|
||||
// all, disabled, enabled
|
||||
'qry__enabled': 'enabled',
|
||||
// all, hidden, not_hidden
|
||||
'qry__hidden': 'not_hidden',
|
||||
'qry__limit': 20,
|
||||
'qry__offset': 0,
|
||||
|
||||
archives: {
|
||||
enabled: 'enabled', // all, disabled, enabled
|
||||
hidden: 'not_hidden', // all, hidden, not_hidden
|
||||
limit: 150,
|
||||
offset: 0,
|
||||
|
||||
edit_kv: {}, // Used to track which archive objects are being edited
|
||||
edit__archive_obj: null,
|
||||
edit__archive_content_obj: null,
|
||||
|
||||
// qry__order_by: 'updated_on', // For the IDB index query
|
||||
// qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, // For the SQL query
|
||||
},
|
||||
|
||||
bb: {
|
||||
enabled: 'enabled', // all, disabled, enabled
|
||||
hidden: 'not_hidden', // all, hidden, not_hidden
|
||||
limit: 50,
|
||||
offset: 0,
|
||||
|
||||
edit_kv: {}, // Used to track which post objects are being edited
|
||||
edit__post_obj: null,
|
||||
edit__post_comment_obj: null,
|
||||
|
||||
show_list__post_obj_li: true,
|
||||
|
||||
qry__enabled: 'enabled', // all, disabled, enabled
|
||||
qry__hidden: 'not_hidden', // all, hidden, not_hidden
|
||||
qry__limit: 25,
|
||||
qry__offset: 0,
|
||||
qry__order_by: 'updated_on', // For the IDB index query
|
||||
qry__order_by_li: {'updated_on': 'DESC', 'created_on': 'DESC'}, // For the SQL query
|
||||
|
||||
|
||||
},
|
||||
|
||||
recovery_meetings: {
|
||||
edit_kv: {}, // Used to track which event objects are being edited
|
||||
edit__event_obj: null,
|
||||
|
||||
qry__enabled: 'enabled', // all, disabled, enabled
|
||||
qry__hidden: 'not_hidden', // all, hidden, not_hidden
|
||||
qry__limit: 150,
|
||||
qry__order_by: 'updated_on', // For the IDB index query; name, updated_on/created_on
|
||||
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, // For the SQL query
|
||||
qry__offset: 0,
|
||||
|
||||
qry__fulltext_str: null,
|
||||
qry__physical: null,
|
||||
qry__type: null,
|
||||
qry__virtual: null,
|
||||
},
|
||||
};
|
||||
// console.log(`AE Stores - App IDAA Local Storage Data:`, idaa_local_data_struct);
|
||||
|
||||
// This works, but does not uses local storage:
|
||||
// export let ae_loc = writable(idaa_local_data_struct);
|
||||
|
||||
// This works and uses *local* storage:
|
||||
export let idaa_loc: Writable<key_val> = persisted('ae_idaa_loc', idaa_local_data_struct);
|
||||
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize idaa_session_data_struct */
|
||||
// Temporary app data. This should be stored to session storage.
|
||||
// Updated 2024-03-06
|
||||
let idaa_session_data_struct: key_val = {
|
||||
ver: ver,
|
||||
ver_idb: ver_idb,
|
||||
log_lvl: 1,
|
||||
|
||||
archives: {
|
||||
qry__status: null,
|
||||
show__modal_edit__archive_id: null,
|
||||
show__modal_view__archive_id: null,
|
||||
show__modal_edit__archive_content_id: null,
|
||||
show__modal_view__archive_content_id: null,
|
||||
obj_changed: false, // Used to track if the archive object has been changed in the edit view
|
||||
},
|
||||
|
||||
bb: {
|
||||
qry__status: null,
|
||||
|
||||
edit__post_obj: null,
|
||||
|
||||
show__inline_edit__post_obj: null,
|
||||
show__modal_edit__post_id: null,
|
||||
show__modal_view__post_id: null,
|
||||
obj_changed: false, // Used to track if the post object has been changed in the edit view
|
||||
// edit_kv: {}, // Used to track which post objects are being edited
|
||||
},
|
||||
|
||||
recovery_meetings: {
|
||||
qry__status: null,
|
||||
qry__fulltext_str: null,
|
||||
|
||||
edit__event_obj: null,
|
||||
|
||||
status_qry__last_request_str: null,
|
||||
|
||||
show__modal_edit: false,
|
||||
show__modal_view: false,
|
||||
show__modal_edit__event_id: null,
|
||||
show__modal_view__event_id: null,
|
||||
obj_changed: false, // Used to track if the event object has been changed in the edit view
|
||||
|
||||
attend_platform: null, // 'Zoom', 'Google Meet', 'Microsoft Teams', etc.
|
||||
},
|
||||
|
||||
};
|
||||
// console.log(`AE Stores - App IDAA Session Storage Data:`, idaa_session_data_struct);
|
||||
export let idaa_sess = writable(idaa_session_data_struct);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize idaa_slct and idaa_trig */
|
||||
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different idaa, badges, exhibits, etc. */
|
||||
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2024-03-06
|
||||
let idaa_slct_obj_template: key_val = {
|
||||
// Top level
|
||||
'event_id': null,
|
||||
'event_obj': {},
|
||||
'event_obj_li': [],
|
||||
|
||||
'archive_id': null,
|
||||
'archive_obj': {},
|
||||
'archive_obj_li': [],
|
||||
|
||||
'archive_content_id': null,
|
||||
'archive_content_obj': {},
|
||||
'archive_content_obj_li': [],
|
||||
|
||||
'post_id': null,
|
||||
'post_obj': {},
|
||||
'post_obj_li': [],
|
||||
|
||||
'post_comment_id': null,
|
||||
'post_comment_obj': {},
|
||||
'post_comment_obj_li': [],
|
||||
};
|
||||
// console.log(`AE Stores - Selected IDAA Objects:`, idaa_slct_obj_template);
|
||||
|
||||
// This works, and uses *session* (not local) storage:
|
||||
export let idaa_slct = writable(idaa_slct_obj_template);
|
||||
|
||||
// This works and uses *local* storage:
|
||||
// export let idaa_slct: Writable<key_val> = persisted('ae_idaa_slct', idaa_slct_obj_template);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize idaa_trig */
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2024-11-19
|
||||
let idaa_trig_template: key_val = {
|
||||
archive_id: false,
|
||||
archive_content_li: false,
|
||||
event_id: false,
|
||||
post_id: false,
|
||||
};
|
||||
export let idaa_trig: any = writable(idaa_trig_template);
|
||||
// console.log(`AE IDAA Stores - IDAA Trigger:`, idaa_trig);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize idaa_prom */
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2024-11-19
|
||||
let idaa_prom_template: key_val = {
|
||||
archive_id: false,
|
||||
archive_content_li: false,
|
||||
event_id: false,
|
||||
post_id: false,
|
||||
};
|
||||
export let idaa_prom: any = writable(idaa_prom_template);
|
||||
// console.log(`AE IDAA Stores - IDAA Trigger:`, idaa_prom);
|
||||
535
src/lib/stores/ae_stores.ts
Normal file
535
src/lib/stores/ae_stores.ts
Normal file
@@ -0,0 +1,535 @@
|
||||
import { persisted } from 'svelte-persisted-store';
|
||||
|
||||
import { readable, writable } from 'svelte/store';
|
||||
import type { Readable, Writable } from 'svelte/store';
|
||||
|
||||
|
||||
import { PUBLIC_TESTING, PUBLIC_AE_API_PROTOCOL, PUBLIC_AE_API_SERVER, PUBLIC_AE_API_BAK_SERVER, PUBLIC_AE_API_PORT, PUBLIC_AE_API_PATH, PUBLIC_AE_API_SECRET_KEY, PUBLIC_AE_API_CRUD_SUPER_KEY, PUBLIC_AE_NO_ACCOUNT_ID, PUBLIC_AE_NO_ACCOUNT_ID_TOKEN, PUBLIC_AE_ACCOUNT_ID, PUBLIC_AE_EVENT_ID, PUBLIC_AE_SPONSORSHIP_CFG_ID } from '$env/static/public';
|
||||
console.log(`AE Stores - PUBLIC_TESTING:`, PUBLIC_TESTING);
|
||||
|
||||
const api_server_fqdn = PUBLIC_AE_API_SERVER; // 'api.oneskyit.com'
|
||||
const api_base_url = `${PUBLIC_AE_API_PROTOCOL}://${PUBLIC_AE_API_SERVER}:${PUBLIC_AE_API_PORT}${PUBLIC_AE_API_PATH}`;
|
||||
const api_base_url_bak = `${PUBLIC_AE_API_PROTOCOL}://${PUBLIC_AE_API_BAK_SERVER}:${PUBLIC_AE_API_PORT}${PUBLIC_AE_API_PATH}`;
|
||||
|
||||
const api_secret_key = PUBLIC_AE_API_SECRET_KEY;
|
||||
const api_crud_super_key = PUBLIC_AE_API_CRUD_SUPER_KEY;
|
||||
|
||||
// const ae_account_id = PUBLIC_AE_ACCOUNT_ID;
|
||||
let ae_account_id: null|string = null;
|
||||
const ae_no_account_id = PUBLIC_AE_NO_ACCOUNT_ID;
|
||||
const ae_no_account_id_token = PUBLIC_AE_NO_ACCOUNT_ID_TOKEN;
|
||||
const ae_event_id = PUBLIC_AE_EVENT_ID;
|
||||
const ae_sponsorship_cfg_id = PUBLIC_AE_SPONSORSHIP_CFG_ID;
|
||||
|
||||
// import { getStores, navigating, page, updated } from '$app/stores';
|
||||
// import { assets, base, resolveRoute } from '$app/paths';
|
||||
// console.log(page.path); // Everything after the domain name
|
||||
|
||||
// console.log(import.meta.env.MODE);
|
||||
// console.log(import.meta.env.BASE_URL);
|
||||
|
||||
|
||||
// Export the key_val type for use in other files.
|
||||
export type key_val = {
|
||||
[key: string]: any; // variable key
|
||||
// name: string;
|
||||
};
|
||||
// export type key_val = key_val;
|
||||
|
||||
|
||||
// import { html__not_set, classes__events_pres_mgmt_menu } from './ae_string_snippets';
|
||||
import {string_snippets} from './ae_string_snippets';
|
||||
export let ae_snip = string_snippets;
|
||||
|
||||
// export let ae_snip =
|
||||
// {
|
||||
// 'not_set': html__not_set,
|
||||
// 'classes__events_pres_mgmt_menu': classes__events_pres_mgmt_menu
|
||||
// };
|
||||
|
||||
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
|
||||
let ver = '2025-05-01_1445'; // KEEP: 2025-05-01_1445
|
||||
let ver_idb = '2025-05-01_1445'; // Not currently used
|
||||
|
||||
// *** BEGIN *** Longer-term app data. This should be stored to local storage.
|
||||
const ae_app_local_data_defaults: key_val = {
|
||||
last_page_reload: null,
|
||||
// last_idb_reload: null,
|
||||
// last_cache_refresh: null, // Date.now()
|
||||
last_cache_refresh: Date.now(),
|
||||
cache_expired: false,
|
||||
ver: ver, // ver, // '2025-04-18_1100',
|
||||
ver_idb: ver_idb, // '2025-04-18_1100',
|
||||
|
||||
name: 'Aether - App Hub (SvelteKit 2.x Svelte 4.x)',
|
||||
|
||||
theme: 'light',
|
||||
theme_mode: 'light',
|
||||
theme_name: 'nouveau', // wintry
|
||||
iframe: false,
|
||||
|
||||
// disable_sys_header: false,
|
||||
// disable_sys_nav: false,
|
||||
// disable_sys_footer: false,
|
||||
|
||||
browser_type: null, // Safari needs help with scrolling correctly in iframes.
|
||||
|
||||
title: `OSIT's Æ`, // - Dev SvelteKit`, // Æ
|
||||
|
||||
// debug_menu: false, // Flag show debug menu.
|
||||
debug_mode: false, // Flag to know if we should be in debug mode and show show debug options.
|
||||
edit_mode: false, // Flag to know if we should be in edit mode and show edit options.
|
||||
adv_mode: false, // Flag to know if we should be in advanced mode and show advanced options.
|
||||
// sys_menu: true, // Flag show system menu.
|
||||
sync_local_config: true, // Flag to know if we should sync local config with the remote API server.
|
||||
|
||||
'account_id': ae_account_id, // OSIT Demo _XY7DXtc9MY
|
||||
'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,
|
||||
},
|
||||
|
||||
// The site access codes can be pulled from the site records for an account.
|
||||
'site_access_code_kv': {
|
||||
// 'manager': '10240',
|
||||
'administrator': null,
|
||||
'trusted': null,
|
||||
'public': 'public1980',
|
||||
'authenticated': 'auth1980'
|
||||
},
|
||||
// 'manager_passcode': '10240',
|
||||
// 'administrator_passcode': '11500',
|
||||
// 'trusted_passcode': '19111',
|
||||
// 'authenticated_passcode': 'auth2024',
|
||||
|
||||
access_type: 'anonymous',
|
||||
administrator_access: false,
|
||||
trusted_access: false,
|
||||
public_access: false,
|
||||
authenticated_access: false,
|
||||
anonymous_access: true,
|
||||
|
||||
user_email: null, // Currently used with Sponsorships only?
|
||||
user_access_type: null, // Used to revert back to the user's access type after quick access (temporarily escalate permissions) turned off.
|
||||
|
||||
// Added 2025-04-04
|
||||
person_id: null, // The current person_id of the logged-in user (if any)
|
||||
person: {
|
||||
// WARNING: We need to add some logic on sign in to only include needed fields. 2025-08-12
|
||||
id: null, // The current person_id of the logged-in user
|
||||
// profile_id: null, // The current person_profile_id of the logged-in user
|
||||
// pronouns: null,
|
||||
// informal_name: null,
|
||||
given_name: null,
|
||||
// family_name: null,
|
||||
// professional_title: null,
|
||||
full_name: null, // convenience
|
||||
full_name_override: null, // was called display_name
|
||||
|
||||
// affiliations: null,
|
||||
primary_email: null, // The primary email of the logged-in person/user
|
||||
user_id: null, // The user ID of the logged-in user
|
||||
|
||||
qry_limit__people: 150,
|
||||
|
||||
show_content__person_page_help: false,
|
||||
},
|
||||
|
||||
// Added 2025-04-04
|
||||
user_id: null, // The current user_id of the logged-in user (if any)
|
||||
user: {
|
||||
id: null, // The current user_id of the logged-in user
|
||||
username: null,
|
||||
name: null,
|
||||
email: null, // The email of the logged-in user
|
||||
allow_auth_key: null, // For sign in without password
|
||||
super: false, // Is the user a super user
|
||||
manager: false, // Is the user a global manager (can manage accounts and users)
|
||||
administrator: false, // Is the user an account administrator
|
||||
verified: false, // Is the user verified
|
||||
public: false, // Is the user a public user (can view public content)
|
||||
person_id: null, // The person ID of the logged-in user
|
||||
access_type: null, // The access type of the logged-in user
|
||||
|
||||
qry_limit__users: 100,
|
||||
},
|
||||
|
||||
'qry__enabled': 'enabled', // all, disabled, enabled
|
||||
'qry__hidden': 'not_hidden', // all, hidden, not_hidden
|
||||
'qry__limit': 20,
|
||||
'qry__offset': 0,
|
||||
|
||||
qr_scanner_version: 'one',
|
||||
|
||||
'admin': {
|
||||
show_element__sql_qry: false,
|
||||
show_element__sql_qry_results: false,
|
||||
},
|
||||
|
||||
sys_menu: {
|
||||
hide: false,
|
||||
expand: false,
|
||||
hide_access_type: false,
|
||||
expand_access_type: false,
|
||||
hide_edit_mode: false,
|
||||
expand_edit_mode: false,
|
||||
hide_user: false,
|
||||
expand_user: false,
|
||||
hide_theme: false,
|
||||
expand_theme: false,
|
||||
hide_app_cfg: false,
|
||||
expand_app_cfg: false,
|
||||
},
|
||||
debug_menu: {
|
||||
hide: false,
|
||||
expand: false,
|
||||
// hide_quick_info: true
|
||||
},
|
||||
|
||||
app_cfg: {
|
||||
show_element__header: false,
|
||||
show_element__footer: false,
|
||||
show_element__menu: false,
|
||||
show_element__menu_btn: true,
|
||||
|
||||
show_element__access_type: true,
|
||||
show_element__passcode_input: true,
|
||||
show_element__cfg: true,
|
||||
show_element__cfg_detail: false,
|
||||
show_element__sign_in_out: true, // Show the sign-in/out button in the UI
|
||||
show_opt__debug: true,
|
||||
show_opt__permissions: true,
|
||||
show_opt__reset: true,
|
||||
show_opt__sync: true,
|
||||
show_opt__theme: true,
|
||||
show_opt__utilities: true,
|
||||
},
|
||||
|
||||
files: {
|
||||
processed_file_kv: {},
|
||||
uploaded_file_kv: {},
|
||||
video_clip_file_kv: {},
|
||||
add_to_use_files_method: 'upload', // upload, select
|
||||
},
|
||||
|
||||
'ds': {},
|
||||
'hub': {
|
||||
'show_element__cfg': true,
|
||||
'show_element__cfg_detail': false,
|
||||
'show_element__access_type': true,
|
||||
'theme_mode': 'light',
|
||||
'theme_name': 'wintry', // wintry
|
||||
|
||||
'classes__form': 'border border-surface-200 p-4 space-y-4 rounded-container',
|
||||
|
||||
'qr': {},
|
||||
},
|
||||
'mod': {
|
||||
'archives': {},
|
||||
|
||||
'events': {
|
||||
'event_id': null,
|
||||
|
||||
show_edit__event_presenter_obj: false,
|
||||
show_list__event_presenter_obj_li: true,
|
||||
show_view__event_presenter_obj: false,
|
||||
|
||||
submit_status: null, // 'saving', 'created', 'updated'
|
||||
|
||||
// Badge Printing
|
||||
|
||||
// Lead Retrievals
|
||||
|
||||
// Presentation Management
|
||||
|
||||
// Speakers Management
|
||||
'default_session_id': null, // Assign to presenters by default
|
||||
|
||||
// other
|
||||
},
|
||||
|
||||
'journals': {},
|
||||
|
||||
'posts': {},
|
||||
|
||||
'sponsorships': {
|
||||
'cfg_id': ae_sponsorship_cfg_id,
|
||||
|
||||
for_type: null,
|
||||
for_id: null,
|
||||
|
||||
level_guest_max_li: {
|
||||
0: 0,
|
||||
1: 4, // CHOW 2024 - Friend
|
||||
2: 8, // CHOW 2024 - Supporter
|
||||
3: 8, // CHOW 2024 - Advocate
|
||||
4: 8, // CHOW 2024 - Champion
|
||||
5: 8, // CHOW 2024 - Presenting Partner
|
||||
6: 16, // CHOW 2024 - Signature Partner
|
||||
7: 16, // CHOW 2024 - Premier Partner
|
||||
},
|
||||
|
||||
show_edit__sponsorship_obj: false,
|
||||
show_list__sponsorship_obj_li: true,
|
||||
show_view__sponsorship_obj: false,
|
||||
|
||||
show_question__accommodations: false,
|
||||
|
||||
submit_status: null, // 'saving', 'created', 'updated'
|
||||
},
|
||||
|
||||
// testing: {},
|
||||
},
|
||||
|
||||
// testing: true,
|
||||
// ver_testing: true,
|
||||
}
|
||||
|
||||
// let ae_app_local_data_struct: key_val = {
|
||||
// ...ae_app_local_data_defaults,
|
||||
// };
|
||||
// // {
|
||||
// // // ...ae_app_local_data_defaults,
|
||||
// // };
|
||||
// // console.log(`AE Stores - App Local Storage Data:`, ae_app_local_data_struct);
|
||||
// if (!ae_app_local_data_defaults?.ver_testing) {
|
||||
// console.log(`TEST: AE Stores - ver_testing missing:`, ae_app_local_data_defaults);
|
||||
// // ae_app_local_data_struct = {
|
||||
// // ...ae_app_local_data_defaults,
|
||||
// // ...ae_app_local_data_struct,
|
||||
// // };
|
||||
// } else {
|
||||
// console.log(`TEST: AE Stores - ver_testing found`);
|
||||
// }
|
||||
// if (ae_app_local_data_struct?.ver !== ae_app_local_data_defaults?.ver) {
|
||||
// console.log(`TEST: AE Stores - ver not match:`, ae_app_local_data_struct);
|
||||
|
||||
// ae_app_local_data_struct = {
|
||||
// ...ae_app_local_data_defaults,
|
||||
// };
|
||||
// } else {
|
||||
// console.log(`TEST: AE Stores - ver match: ${ae_app_local_data_struct.ver} === ${ae_app_local_data_defaults.ver}`);
|
||||
// }
|
||||
// if (!ae_app_local_data_struct?.app_cfg) {
|
||||
// console.log(`TEST: AE Stores - app_cfg missing:`, ae_app_local_data_struct);
|
||||
|
||||
// ae_app_local_data_struct = {
|
||||
// ...ae_app_local_data_defaults,
|
||||
// ...ae_app_local_data_struct,
|
||||
// };
|
||||
// }
|
||||
|
||||
// This works, but does not uses local storage:
|
||||
// export let ae_loc = writable(ae_app_local_data_struct);
|
||||
|
||||
// This works and uses local storage:
|
||||
export let ae_loc: Writable<key_val> = persisted('ae_loc', ae_app_local_data_defaults);
|
||||
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
|
||||
|
||||
|
||||
// *** BEGIN *** Temporary app data. This should be stored to session storage.
|
||||
let ae_app_session_data_defaults: key_val = {
|
||||
// ver: '2025-04-18_1335', // ver, // '2025-04-18_1100',
|
||||
ver: ver,
|
||||
ver_idb: ver_idb,
|
||||
log_lvl: 0,
|
||||
|
||||
disable_sys_header: false,
|
||||
disable_sys_nav: false,
|
||||
disable_sys_footer: false,
|
||||
|
||||
sys_menu: {
|
||||
expand: false,
|
||||
focus_passcode_input: false,
|
||||
},
|
||||
|
||||
debug_menu: {
|
||||
hide_quick_info: true
|
||||
},
|
||||
|
||||
app_cfg: {
|
||||
show_element__passcode_input: true,
|
||||
},
|
||||
|
||||
'ds': {
|
||||
'submit_status': null,
|
||||
},
|
||||
'ds_loaded': {
|
||||
},
|
||||
|
||||
'files': {
|
||||
disable_submit__hosted_file_obj: false,
|
||||
processed_file_kv: {},
|
||||
uploaded_file_kv: {},
|
||||
video_clip_file_kv: {},
|
||||
processed_file_list: [],
|
||||
// uploaded_file_list: [],
|
||||
video_clip_file_list: [],
|
||||
submit_status: null, // 'saving', 'created', 'updated', 'saved'
|
||||
clip_complete: null,
|
||||
},
|
||||
|
||||
'hub': {
|
||||
'show_xyz': null,
|
||||
'account_id_qry_status': null,
|
||||
'event_badge_id_status_qry__search': null,
|
||||
'event_presenter_id_qry_status': null,
|
||||
'site_domain_id_qry_status': null,
|
||||
'sponsorship_id_qry_status': null,
|
||||
'sponsorship_cfg_id_qry_status': null,
|
||||
|
||||
'qr': {},
|
||||
},
|
||||
'mod': {
|
||||
'archives': {},
|
||||
'events': {
|
||||
// Badge Printing
|
||||
|
||||
// Lead Retrievals
|
||||
|
||||
// Presentation Management
|
||||
|
||||
// Speakers Management
|
||||
|
||||
// other
|
||||
},
|
||||
'journals': {},
|
||||
'posts': {},
|
||||
'sponsorships': {
|
||||
disable_submit__sponsorship_obj: false,
|
||||
slct__level_num: 0,
|
||||
show_question__accommodations: false,
|
||||
submit_status: null, // 'saving', 'created', 'updated', 'saved'
|
||||
},
|
||||
'testing': {},
|
||||
},
|
||||
|
||||
'person': {
|
||||
show_report__person_li: false,
|
||||
|
||||
qry_limit__people: 100,
|
||||
},
|
||||
|
||||
show__modal_change_password: false,
|
||||
|
||||
|
||||
'download': {},
|
||||
// For API download and upload progress status per file.
|
||||
'api_download_kv': {},
|
||||
// Example: {example_file_id: {status: 'downloading', endpoint: '/event/file/abc123/download', filename: 'example_file_name.ext', size_total: 0, size_loaded: 0, percent_completed: 0}}
|
||||
'api_upload_kv': {}, // {example_temp_id: {status: 'uploading', endpoint: '/event/file/abc123/upload', filename: 'example_file_name.ext', size_total: 0, size_loaded: 0, percent_completed: 0}}
|
||||
|
||||
test: true,
|
||||
};
|
||||
// console.log(`AE Stores - App Session Storage Data:`, ae_app_session_data_defaults);
|
||||
export let ae_sess = writable(ae_app_session_data_defaults);
|
||||
|
||||
|
||||
// *** BEGIN *** Temporary API data. This should be stored to session storage.
|
||||
export let ae_api_data_struct: key_val = {
|
||||
'ver': '2024-08-11_11',
|
||||
'fqdn': api_server_fqdn,
|
||||
'base_url': api_base_url,
|
||||
'base_url_bak': api_base_url_bak,
|
||||
'api_secret_key': api_secret_key, // 'YOUR_API_SECRET_KEY',
|
||||
'api_secret_key_bak': api_secret_key, // 'YOUR_API_SECRET_KEY',
|
||||
'api_crud_super_key': api_crud_super_key, // 'YOUR_SUPER_KEY' 'zp5PtX4zUsI'
|
||||
'headers': {},
|
||||
'account_id': ae_account_id,
|
||||
};
|
||||
|
||||
let ae_api_headers: key_val = {};
|
||||
ae_api_headers['Access-Control-Allow-Origin'] = '*';
|
||||
ae_api_headers['Content-Yype'] = 'application/json';
|
||||
ae_api_headers['x-aether-api-key'] = ae_api_data_struct.api_secret_key;
|
||||
ae_api_headers['x-aether-api-token'] = 'fake-temp-token';
|
||||
ae_api_headers['x-aether-api-expire-on'] = '';
|
||||
if (ae_account_id) {
|
||||
ae_api_headers['x-account-id'] = ae_account_id;
|
||||
} else {
|
||||
// ae_api_headers['x-account-id'] = ;
|
||||
}
|
||||
if (ae_no_account_id) {
|
||||
ae_api_headers['x-no-account-id'] = ae_no_account_id;
|
||||
}
|
||||
ae_api_data_struct['headers'] = ae_api_headers;
|
||||
|
||||
// console.log(`AE Stores - API Data:`, ae_api_data_struct);
|
||||
export let ae_api = writable(ae_api_data_struct);
|
||||
|
||||
// *** BEGIN *** Trigger to update the slct variables and other things.
|
||||
let ae_trig_template: key_val = {};
|
||||
export let ae_trig = writable(ae_trig_template);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize slct and slct_trigger */
|
||||
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different accounts, events, sponsorships, etc. */
|
||||
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2024-03-15
|
||||
let slct_obj_template: key_val = {
|
||||
'account_id': ae_account_id,
|
||||
'account_obj': {},
|
||||
'event_id': null,
|
||||
'event_obj': {},
|
||||
'event_obj_li': [],
|
||||
// 'event_exhibit_id': null,
|
||||
// 'event_exhibit_obj': {},
|
||||
// 'event_exhibit_obj_li': [],
|
||||
'event_presentation_id': null,
|
||||
'event_presentation_obj': {},
|
||||
'event_presentation_obj_li': [],
|
||||
'event_presenter_id': null,
|
||||
'event_presenter_obj': {},
|
||||
'event_presenter_obj_li': [],
|
||||
'event_session_id': null,
|
||||
'event_session_obj': {},
|
||||
'event_session_obj_li': [],
|
||||
'sponsorship_id': null,
|
||||
'sponsorship_obj': {},
|
||||
'sponsorship_obj_li': [],
|
||||
'sponsorship_cfg_id': ae_sponsorship_cfg_id,
|
||||
'sponsorship_cfg_obj': {},
|
||||
'sponsorship_cfg_obj_li': [],
|
||||
'post_id': null,
|
||||
'post_obj': {},
|
||||
'post_obj_li': [],
|
||||
'post_comment_id': null,
|
||||
'post_comment_obj': {},
|
||||
'post_comment_obj_li': []
|
||||
};
|
||||
// console.log(`AE Stores - Selected Objects:`, slct_obj_template);
|
||||
|
||||
// This works, and uses *session* (not local) storage:
|
||||
export let slct = writable(slct_obj_template);
|
||||
|
||||
// This works and uses *local* storage:
|
||||
// export let slct: Writable<key_val> = persisted('ae_slct', slct_obj_template);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize slct_trigger */
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2024-02-27
|
||||
export let slct_trigger: any = writable(null);
|
||||
// console.log(`AE Stores - Selected Trigger:`, slct_trigger);
|
||||
|
||||
|
||||
/* *** BEGIN *** Create time variable */
|
||||
// Updated 2020
|
||||
export const time = readable(new Date(), function start(set) {
|
||||
const interval = setInterval(() => {
|
||||
set(new Date());
|
||||
}, 1000);
|
||||
|
||||
return function stop() {
|
||||
clearInterval(interval);
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user