414 lines
13 KiB
TypeScript
414 lines
13 KiB
TypeScript
import { localStorageStore } from '@skeletonlabs/skeleton';
|
|
import { writable } from 'svelte/store';
|
|
import type { Writable } from 'svelte/store';
|
|
|
|
import type { key_val } from '$lib/ae_stores';
|
|
|
|
/* *** 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': '2024-06-26_12',
|
|
// Shared
|
|
'name': 'Aether - Events (SvelteKit 2.x Svelte 4.x)',
|
|
'title': `OSIT's Æ Events`, // - Dev SvelteKit`, // Æ
|
|
|
|
'ds': {},
|
|
|
|
'events_cfg_json': {},
|
|
|
|
'default__event_id': null, // OSIT Demo pjrcghqwert
|
|
'default__location_id': null,
|
|
'default__session_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
|
|
},
|
|
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,
|
|
'show_element__access_type': true,
|
|
'theme_mode': 'dark',
|
|
'theme_name': 'wintry',
|
|
|
|
'classes__form': 'border border-surface-200 p-4 space-y-4 rounded-container-token',
|
|
},
|
|
|
|
// 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 (Distributing)
|
|
'pres_mgmt': {
|
|
show_content__session_description: false,
|
|
show_content__presentation_description: false,
|
|
// show_content__agree_text: false,
|
|
// show_content__presenter_start: false,
|
|
show_content__session_help: true,
|
|
show_content__session_search_help: true,
|
|
show_content__presenter_page_help: true,
|
|
|
|
show_report__presenters_agree: false,
|
|
show_report__recent_files: false,
|
|
|
|
disable_submit__opt_out: true,
|
|
submit_status__opt_out: null,
|
|
},
|
|
|
|
// Speakers Management (Collection)
|
|
'speakers': {
|
|
'default__session_id': null, // Assign to new presenters by default
|
|
status__submit: null, // 'saving', 'created', 'updated'
|
|
},
|
|
|
|
// 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> = 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': '2024-03-19_17',
|
|
'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,
|
|
},
|
|
|
|
// 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 (Distributing)
|
|
'pres_mgmt': {
|
|
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_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_max__sessions: 75,
|
|
qry_max__presentations: 25,
|
|
qry_max__presenters: 75,
|
|
qry_max__files: 25,
|
|
|
|
show_fields__presentation: true,
|
|
show_fields__session: 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...
|
|
};
|
|
// 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> = 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);
|
|
|
|
|
|
/* *** 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 events_trig_kv_tmp: 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(events_trig_kv_tmp); |