import { localStorageStore } from '@skeletonlabs/skeleton'; 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 = '2024-08-21_1646'; let ver_idb = '2024-08-21_1645'; /* *** 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', 'classes__form': 'border border-surface-200 p-4 space-y-4 rounded-container-token', }, // 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__sessions: 50, qry_limit__presentations: 25, qry_limit__presenters: 75, qry_limit__files: 75, 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, // 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: 5*60*1000, // How many seconds until idle idle_cycle: 2*1000, // How frequently the idle status is checked idle_loop_period: 1*60*1000, // How frequently the loop runs for the screen saver and similar screen_saver_img_kv: {}, // screen_saver_img_li: [], modal__title: '-- Not Set --', modal__open: null, modal__open_filename: null, modal_img_src: null, controller: 'local', controller_group_code: 'launcher-00', // 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: false, 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: 75, 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_and__file_count: true, // Essentially it should be greater than 0 save_search_text: true, saved_search__session: null, // 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, 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, // 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 = localStorageStore('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, 'status_qry__search': null, 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: { }, }, // 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__sessions: 75, qry_limit__presentations: 25, qry_limit__presenters: 75, qry_limit__files: 75, show_fields__presentation: true, show_fields__session: true, status_rpt: { recent_files: null, presenters_agree: null, presenters_biography: null, }, 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 = localStorageStore('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 = 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);