Creating for AE "Sponsorships". Update file timestamps and remove unused files. Also switched to Svelte with Vite.
This commit is contained in:
196
src/stores.ts
Normal file
196
src/stores.ts
Normal file
@@ -0,0 +1,196 @@
|
||||
import { readable, writable } from 'svelte/store';
|
||||
// console.log('*** stores.ts ***');
|
||||
|
||||
/* FAKE TESTING DATA */
|
||||
|
||||
let fake_app_base_url = 'https://dev-app.oneskyit.com';
|
||||
let fake_app_base_url_backup = 'https://bak-app.oneskyit.com';
|
||||
let fake_api_base_url = 'https://dev-api.oneskyit.com';
|
||||
let fake_api_base_url_backup = 'https://bak-api.oneskyit.com';
|
||||
let fake_api_secret_key = 'dFP6J9DVj9hUgIMn-fNIqg';
|
||||
let fake_ae_account_id = 'Q8lR8Ai8hx2FjbQ3C_EH1Q'; // IDAA Q8lR8Ai8hx2FjbQ3C_EH1Q (13)
|
||||
let fake_ae_api_jwt_key="EHmSXZFKfMEW65E8kxCKmQ" // 22 characters; super secret Aether JWT signing key
|
||||
|
||||
let fake_api_temporary_token = '';
|
||||
|
||||
let fake_access_type = 'anonymous';
|
||||
let fake_administrator_access: boolean = false;
|
||||
let fake_trusted_access: boolean = false;
|
||||
|
||||
/* FAKE TESTING DATA */
|
||||
|
||||
type key_val = {
|
||||
[key: string]: any; // variable key
|
||||
// name: string;
|
||||
};
|
||||
|
||||
export const account_id = fake_ae_account_id;
|
||||
|
||||
let ae_cfg_data: key_val = {};
|
||||
|
||||
// NOTE: This API CRUD super key thing being here should be short term! -2023-05-02
|
||||
|
||||
ae_cfg_data['api'] = {};
|
||||
ae_cfg_data['app'] = {};
|
||||
|
||||
// ae_cfg_data['api']['api_crud_super_key'] = 'zp5PtX4zUsI';
|
||||
|
||||
let ae_api_cfg_data: key_val = {};
|
||||
if (api_base_url) {
|
||||
ae_api_cfg_data['base_url'] = api_base_url;
|
||||
} else {
|
||||
console.log(`WARNING: api_base_url not set. Using fake_api_base_url: ${fake_api_base_url}`);
|
||||
ae_api_cfg_data['base_url'] = fake_api_base_url;
|
||||
}
|
||||
if (api_base_url_backup) {
|
||||
ae_api_cfg_data['base_url_backup'] = api_base_url_backup;
|
||||
} else {
|
||||
console.log(`WARNING: api_base_url_backup not set. Using fake_api_base_url_backup: ${fake_api_base_url_backup}`);
|
||||
ae_api_cfg_data['base_url_backup'] = fake_api_base_url_backup;
|
||||
}
|
||||
|
||||
ae_api_cfg_data['api_crud_super_key'] = 'zp5PtX4zUsI';
|
||||
|
||||
ae_api_cfg_data['headers'] = {};
|
||||
ae_api_cfg_data['headers']['Access-Control-Allow-Origin'] = '*';
|
||||
ae_api_cfg_data['headers']['content-type'] = 'application/json';
|
||||
ae_api_cfg_data['headers']['x-aether-api-key'] = fake_api_secret_key;
|
||||
ae_api_cfg_data['headers']['x-aether-api-token'] = 'fake-temp-token';
|
||||
ae_api_cfg_data['headers']['x-aether-api-expire-on'] = '';
|
||||
ae_api_cfg_data['headers']['x-account-id'] = fake_ae_account_id;
|
||||
|
||||
console.log(`Aether API Config Data:`, ae_api_cfg_data);
|
||||
|
||||
ae_cfg_data['api']['headers'] = ae_api_cfg_data['headers'];
|
||||
|
||||
let ae_app_cfg_data: key_val = {};
|
||||
if (app_base_url) {
|
||||
ae_app_cfg_data['base_url'] = app_base_url;
|
||||
} else {
|
||||
console.log(`WARNING: app_base_url not set. Using fake_app_base_url: ${fake_app_base_url}`);
|
||||
ae_app_cfg_data['base_url'] = fake_app_base_url;
|
||||
}
|
||||
ae_cfg_data['app'] = ae_app_cfg_data;
|
||||
|
||||
console.log(`All Aether App and API Config Data:`, ae_cfg_data);
|
||||
window.localStorage.setItem('ae_cfg', JSON.stringify(ae_cfg_data)); // Also set in main HTML template files
|
||||
export const ae_cfg = readable(ae_cfg_data);
|
||||
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize slct variable */
|
||||
// Updated 2023-11-01
|
||||
export let slct_trigger: any = writable(null);
|
||||
let slct_obj_template: key_val = { 'event_id': null, 'event_obj': {}, 'post_id': null, 'post_obj': {}, 'post_obj_li': [], 'post_comment_id': null, 'post_comment_obj': {}, 'post_comment_obj_li': [] };
|
||||
export let slct = writable(slct_obj_template);
|
||||
|
||||
let novi_api_cfg_data: key_val = {};
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize IDAA app structure variable (JS object) */
|
||||
// Updated 2023-11-01
|
||||
let ae_app_data_version = .5;
|
||||
|
||||
let ae_app_struct: key_val = {
|
||||
'ver': ae_app_data_version,
|
||||
'app': ae_cfg_data.app, // Includes AE app base_url {'base_url': ae_cfg_data.app.base_url},
|
||||
'ae_api': ae_api_cfg_data, // Includes the AE API headers
|
||||
'novi_api': novi_api_cfg_data, // Includes the Novi API headers
|
||||
|
||||
'access_type': fake_access_type,
|
||||
'administrator_access': fake_administrator_access,
|
||||
'trusted_access': fake_trusted_access,
|
||||
|
||||
'account_id': account_id,
|
||||
|
||||
// YYYY-MM-DD string of the current date
|
||||
'current_date_str': new Date().toISOString().slice(0, 10),
|
||||
|
||||
'novi_uuid': null,
|
||||
'novi_email': null,
|
||||
'novi_full_name': null,
|
||||
'novi_admin_li': [],
|
||||
|
||||
// Module - Archives (IDAA Archives)
|
||||
'archives':{
|
||||
// 'show_start_new_view_help': true, // getting ready to start new submission
|
||||
// 'show_active_submission_view_help': true, // started in progress submission
|
||||
// 'show_grant_list': false,
|
||||
|
||||
'show_archive_new_form': false,
|
||||
'show_archive_content_new_form': false,
|
||||
'show_archive_content_view': false,
|
||||
'show_archive_content_crud': false,
|
||||
'show_archive_content_crud_new': false,
|
||||
'show_list__archive_content_li_group': null,
|
||||
|
||||
// all, disabled, enabled
|
||||
'enabled': 'enabled', // all or nothing... easier for now
|
||||
|
||||
// all, hidden, not_hidden
|
||||
'hidden': 'not_hidden', // all or nothing... easier for now
|
||||
|
||||
'limit': 250, // all or nothing... easier for now
|
||||
'offset': 0, // all or nothing... easier for now
|
||||
'archive_group_sort': 'ASC', // ASC or DESC
|
||||
'content_group_sort': 'ASC', // ASC or DESC
|
||||
|
||||
'archive_id': null,
|
||||
'archive_content_id': null,
|
||||
|
||||
'ds':{},
|
||||
},
|
||||
|
||||
// Module - Events (IDAA Recovery Meetings)
|
||||
'events':{
|
||||
'show_event_id_view': false,
|
||||
'show_event_id_edit': false,
|
||||
|
||||
'filter_meeting_type': 'all', // all, idaa, al-anon
|
||||
'filter_meeting_group': 'all', // all, in-person, virtual
|
||||
'filter_location': 'all', // all, something something
|
||||
|
||||
// all, disabled, enabled
|
||||
'enabled': 'enabled', // all or nothing... easier for now
|
||||
|
||||
// all, hidden, not_hidden
|
||||
'hidden': 'not_hidden', // all or nothing... easier for now
|
||||
|
||||
'limit': 250, // all or nothing... easier for now
|
||||
'offset': 0, // all or nothing... easier for now
|
||||
|
||||
'event_id': null,
|
||||
|
||||
'ds':{},
|
||||
},
|
||||
|
||||
// Module - Posts (IDAA Support BB)
|
||||
'posts':{
|
||||
'show_post_new_form': false,
|
||||
'show_post_comment_new_form': false,
|
||||
'show_view__post_id': false,
|
||||
'show_post_comment_crud': false,
|
||||
|
||||
'show_post_comment_list': true,
|
||||
|
||||
// all, disabled, enabled
|
||||
'enabled': 'enabled', // all or nothing... easier for now
|
||||
|
||||
// all, hidden, not_hidden
|
||||
'hidden': 'not_hidden', // all or nothing... easier for now
|
||||
|
||||
'limit': 250, // all or nothing... easier for now
|
||||
'offset': 0, // all or nothing... easier for now
|
||||
|
||||
'post_id': null,
|
||||
'post_comment_id': null,
|
||||
|
||||
'ds':{},
|
||||
},
|
||||
|
||||
'ds':{},
|
||||
|
||||
'testing': null
|
||||
}
|
||||
export let ae_app = writable(ae_app_struct);
|
||||
console.log(ae_app);
|
||||
Reference in New Issue
Block a user