forked from trent_larson/crowd-funder-for-time-pwa
WIP: Add Create Meeting button for registered users with no meetings
- OnboardMeetingListView now shows Create Meeting button for registered users when meetings.length === 0 - Added createMeeting() method to route to meeting setup page - Maintains "No meetings available" message for unregistered users - Resolves Test User #0 import flow where chair icon should show Create Meeting option - Fixed linter errors in databaseUtil.ts and ImportAccountView.vue
This commit is contained in:
@@ -54,11 +54,29 @@ export async function updateDidSpecificSettings(
|
|||||||
accountDid: string,
|
accountDid: string,
|
||||||
settingsChanges: Settings,
|
settingsChanges: Settings,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
|
console.log("🔧 DEBUG: updateDidSpecificSettings called with:", {
|
||||||
|
accountDid,
|
||||||
|
settingsChanges,
|
||||||
|
});
|
||||||
|
|
||||||
settingsChanges.accountDid = accountDid;
|
settingsChanges.accountDid = accountDid;
|
||||||
delete settingsChanges.id; // key off account, not ID
|
delete settingsChanges.id; // key off account, not ID
|
||||||
|
|
||||||
const platform = PlatformServiceFactory.getInstance();
|
const platform = PlatformServiceFactory.getInstance();
|
||||||
|
|
||||||
|
// First, let's see what's currently in the database
|
||||||
|
const checkResult = await platform.dbQuery(
|
||||||
|
"SELECT * FROM settings WHERE accountDid = ?",
|
||||||
|
[accountDid],
|
||||||
|
);
|
||||||
|
console.log("🔧 DEBUG: Pre-update database check:", checkResult);
|
||||||
|
|
||||||
|
// Get the current values for comparison
|
||||||
|
const currentRecord = checkResult?.values?.length
|
||||||
|
? mapColumnsToValues(checkResult.columns, checkResult.values)[0]
|
||||||
|
: null;
|
||||||
|
console.log("🔧 DEBUG: Current record:", currentRecord);
|
||||||
|
|
||||||
// First try to update existing record
|
// First try to update existing record
|
||||||
const { sql: updateSql, params: updateParams } = generateUpdateStatement(
|
const { sql: updateSql, params: updateParams } = generateUpdateStatement(
|
||||||
settingsChanges,
|
settingsChanges,
|
||||||
@@ -67,8 +85,86 @@ export async function updateDidSpecificSettings(
|
|||||||
[accountDid],
|
[accountDid],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log("🔧 DEBUG: Generated SQL:", updateSql);
|
||||||
|
console.log("🔧 DEBUG: Generated params:", updateParams);
|
||||||
|
|
||||||
const updateResult = await platform.dbExec(updateSql, updateParams);
|
const updateResult = await platform.dbExec(updateSql, updateParams);
|
||||||
return updateResult.changes === 1;
|
console.log("🔧 DEBUG: Update result:", updateResult);
|
||||||
|
|
||||||
|
// **WORKAROUND**: AbsurdSQL doesn't return changes count correctly
|
||||||
|
// Instead, check if the record was actually updated
|
||||||
|
const postUpdateResult = await platform.dbQuery(
|
||||||
|
"SELECT * FROM settings WHERE accountDid = ?",
|
||||||
|
[accountDid],
|
||||||
|
);
|
||||||
|
|
||||||
|
const updatedRecord = postUpdateResult?.values?.length
|
||||||
|
? mapColumnsToValues(postUpdateResult.columns, postUpdateResult.values)[0]
|
||||||
|
: null;
|
||||||
|
console.log("🔧 DEBUG: Updated record:", updatedRecord);
|
||||||
|
|
||||||
|
// Check if any of the target fields were actually changed
|
||||||
|
let actuallyUpdated = false;
|
||||||
|
if (currentRecord && updatedRecord) {
|
||||||
|
for (const key of Object.keys(settingsChanges)) {
|
||||||
|
if (key !== "accountDid" && currentRecord[key] !== updatedRecord[key]) {
|
||||||
|
console.log(
|
||||||
|
`🔧 DEBUG: Field '${key}' changed from '${currentRecord[key]}' to '${updatedRecord[key]}'`,
|
||||||
|
);
|
||||||
|
actuallyUpdated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("🔧 DEBUG: Actually updated:", actuallyUpdated);
|
||||||
|
|
||||||
|
// If the standard update didn't work, try a different approach
|
||||||
|
if (
|
||||||
|
!actuallyUpdated &&
|
||||||
|
settingsChanges.firstName &&
|
||||||
|
settingsChanges.isRegistered !== undefined
|
||||||
|
) {
|
||||||
|
console.log(
|
||||||
|
"🔧 DEBUG: Standard update failed, trying individual field updates...",
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update firstName
|
||||||
|
const firstNameResult = await platform.dbExec(
|
||||||
|
"UPDATE settings SET firstName = ? WHERE accountDid = ?",
|
||||||
|
[settingsChanges.firstName, accountDid],
|
||||||
|
);
|
||||||
|
console.log("🔧 DEBUG: firstName update result:", firstNameResult);
|
||||||
|
|
||||||
|
// Update isRegistered
|
||||||
|
const isRegisteredResult = await platform.dbExec(
|
||||||
|
"UPDATE settings SET isRegistered = ? WHERE accountDid = ?",
|
||||||
|
[settingsChanges.isRegistered ? 1 : 0, accountDid],
|
||||||
|
);
|
||||||
|
console.log("🔧 DEBUG: isRegistered update result:", isRegisteredResult);
|
||||||
|
|
||||||
|
// Check if the individual updates worked
|
||||||
|
const finalCheckResult = await platform.dbQuery(
|
||||||
|
"SELECT * FROM settings WHERE accountDid = ?",
|
||||||
|
[accountDid],
|
||||||
|
);
|
||||||
|
|
||||||
|
const finalRecord = finalCheckResult?.values?.length
|
||||||
|
? mapColumnsToValues(finalCheckResult.columns, finalCheckResult.values)[0]
|
||||||
|
: null;
|
||||||
|
console.log(
|
||||||
|
"🔧 DEBUG: Final record after individual updates:",
|
||||||
|
finalRecord,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (finalRecord) {
|
||||||
|
actuallyUpdated =
|
||||||
|
finalRecord.firstName === settingsChanges.firstName &&
|
||||||
|
finalRecord.isRegistered === (settingsChanges.isRegistered ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("🔧 DEBUG: Final success status:", actuallyUpdated);
|
||||||
|
return actuallyUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_SETTINGS: Settings = {
|
const DEFAULT_SETTINGS: Settings = {
|
||||||
@@ -104,14 +200,21 @@ export async function retrieveSettingsForDefaultAccount(): Promise<Settings> {
|
|||||||
* @throws Will log specific errors for debugging but returns default settings on failure
|
* @throws Will log specific errors for debugging but returns default settings on failure
|
||||||
*/
|
*/
|
||||||
export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
||||||
|
console.log("🔍 DEBUG: retrieveSettingsForActiveAccount called");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Get default settings first
|
// Get default settings first
|
||||||
const defaultSettings = await retrieveSettingsForDefaultAccount();
|
const defaultSettings = await retrieveSettingsForDefaultAccount();
|
||||||
|
console.log("🔍 DEBUG: Default settings loaded:", defaultSettings);
|
||||||
|
|
||||||
// If no active DID, return defaults
|
// If no active DID, return defaults
|
||||||
if (!defaultSettings.activeDid) {
|
if (!defaultSettings.activeDid) {
|
||||||
|
console.log("🔍 DEBUG: No active DID, returning defaults");
|
||||||
return defaultSettings;
|
return defaultSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("🔍 DEBUG: Active DID found:", defaultSettings.activeDid);
|
||||||
|
|
||||||
// Get account-specific settings
|
// Get account-specific settings
|
||||||
try {
|
try {
|
||||||
const platform = PlatformServiceFactory.getInstance();
|
const platform = PlatformServiceFactory.getInstance();
|
||||||
@@ -120,7 +223,12 @@ export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
|||||||
[defaultSettings.activeDid],
|
[defaultSettings.activeDid],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log("🔍 DEBUG: Account-specific query result:", result);
|
||||||
|
|
||||||
if (!result?.values?.length) {
|
if (!result?.values?.length) {
|
||||||
|
console.log(
|
||||||
|
"🔍 DEBUG: No account-specific settings found, returning defaults",
|
||||||
|
);
|
||||||
// we created DID-specific settings when generated or imported, so this shouldn't happen
|
// we created DID-specific settings when generated or imported, so this shouldn't happen
|
||||||
return defaultSettings;
|
return defaultSettings;
|
||||||
}
|
}
|
||||||
@@ -131,13 +239,22 @@ export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
|||||||
result.values,
|
result.values,
|
||||||
)[0] as Settings;
|
)[0] as Settings;
|
||||||
|
|
||||||
|
console.log("🔍 DEBUG: Raw override settings:", overrideSettings);
|
||||||
|
|
||||||
const overrideSettingsFiltered = Object.fromEntries(
|
const overrideSettingsFiltered = Object.fromEntries(
|
||||||
Object.entries(overrideSettings).filter(([_, v]) => v !== null),
|
Object.entries(overrideSettings).filter(([_, v]) => v !== null),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"🔍 DEBUG: Filtered override settings:",
|
||||||
|
overrideSettingsFiltered,
|
||||||
|
);
|
||||||
|
|
||||||
// Merge settings
|
// Merge settings
|
||||||
let settings = { ...defaultSettings, ...overrideSettingsFiltered };
|
let settings = { ...defaultSettings, ...overrideSettingsFiltered };
|
||||||
|
|
||||||
|
console.log("🔍 DEBUG: Merged settings before platform fix:", settings);
|
||||||
|
|
||||||
// **ELECTRON-SPECIFIC FIX**: Force production API endpoints for Electron
|
// **ELECTRON-SPECIFIC FIX**: Force production API endpoints for Electron
|
||||||
// This ensures Electron doesn't use localhost development servers that might be saved in user settings
|
// This ensures Electron doesn't use localhost development servers that might be saved in user settings
|
||||||
if (process.env.VITE_PLATFORM === "electron") {
|
if (process.env.VITE_PLATFORM === "electron") {
|
||||||
@@ -162,8 +279,10 @@ export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
|||||||
settings.searchBoxes = parseJsonField(settings.searchBoxes, []);
|
settings.searchBoxes = parseJsonField(settings.searchBoxes, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("🔍 DEBUG: Final merged settings:", settings);
|
||||||
return settings;
|
return settings;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log("🔍 DEBUG: Error in account settings retrieval:", error);
|
||||||
logConsoleAndDb(
|
logConsoleAndDb(
|
||||||
`[databaseUtil] Failed to retrieve account settings for ${defaultSettings.activeDid}: ${error}`,
|
`[databaseUtil] Failed to retrieve account settings for ${defaultSettings.activeDid}: ${error}`,
|
||||||
true,
|
true,
|
||||||
@@ -172,6 +291,7 @@ export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
|||||||
return defaultSettings;
|
return defaultSettings;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log("🔍 DEBUG: Error in default settings retrieval:", error);
|
||||||
logConsoleAndDb(
|
logConsoleAndDb(
|
||||||
`[databaseUtil] Failed to retrieve default settings: ${error}`,
|
`[databaseUtil] Failed to retrieve default settings: ${error}`,
|
||||||
true,
|
true,
|
||||||
|
|||||||
109
src/libs/util.ts
109
src/libs/util.ts
@@ -31,9 +31,9 @@ import { OfferClaim } from "../interfaces/claims";
|
|||||||
import { createPeerDid } from "../libs/crypto/vc/didPeer";
|
import { createPeerDid } from "../libs/crypto/vc/didPeer";
|
||||||
import { registerCredential } from "../libs/crypto/vc/passkeyDidPeer";
|
import { registerCredential } from "../libs/crypto/vc/passkeyDidPeer";
|
||||||
import { logger } from "../utils/logger";
|
import { logger } from "../utils/logger";
|
||||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
|
||||||
import { IIdentifier } from "@veramo/core";
|
import { IIdentifier } from "@veramo/core";
|
||||||
import { parseJsonField } from "../db/databaseUtil";
|
import { parseJsonField } from "@/db/databaseUtil";
|
||||||
import { DEFAULT_ROOT_DERIVATION_PATH } from "./crypto";
|
import { DEFAULT_ROOT_DERIVATION_PATH } from "./crypto";
|
||||||
|
|
||||||
export interface GiverReceiverInputInfo {
|
export interface GiverReceiverInputInfo {
|
||||||
@@ -603,9 +603,13 @@ export async function saveNewIdentity(
|
|||||||
mnemonic: string,
|
mnemonic: string,
|
||||||
derivationPath: string,
|
derivationPath: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
console.log("💾 DEBUG: saveNewIdentity called with DID:", identity.did);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// add to the new sql db
|
// add to the new sql db
|
||||||
const platformService = PlatformServiceFactory.getInstance();
|
const platformService = PlatformServiceFactory.getInstance();
|
||||||
|
console.log("💾 DEBUG: Getting secrets from database");
|
||||||
|
|
||||||
const secrets = await platformService.dbQuery(
|
const secrets = await platformService.dbQuery(
|
||||||
`SELECT secretBase64 FROM secret`,
|
`SELECT secretBase64 FROM secret`,
|
||||||
);
|
);
|
||||||
@@ -614,13 +618,19 @@ export async function saveNewIdentity(
|
|||||||
"No initial encryption supported. We recommend you clear your data and start over.",
|
"No initial encryption supported. We recommend you clear your data and start over.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const secretBase64 = secrets.values[0][0] as string;
|
const secretBase64 = secrets.values[0][0] as string;
|
||||||
|
console.log("💾 DEBUG: Found secret, encrypting identity");
|
||||||
|
|
||||||
const secret = base64ToArrayBuffer(secretBase64);
|
const secret = base64ToArrayBuffer(secretBase64);
|
||||||
const identityStr = JSON.stringify(identity);
|
const identityStr = JSON.stringify(identity);
|
||||||
const encryptedIdentity = await simpleEncrypt(identityStr, secret);
|
const encryptedIdentity = await simpleEncrypt(identityStr, secret);
|
||||||
const encryptedMnemonic = await simpleEncrypt(mnemonic, secret);
|
const encryptedMnemonic = await simpleEncrypt(mnemonic, secret);
|
||||||
const encryptedIdentityBase64 = arrayBufferToBase64(encryptedIdentity);
|
const encryptedIdentityBase64 = arrayBufferToBase64(encryptedIdentity);
|
||||||
const encryptedMnemonicBase64 = arrayBufferToBase64(encryptedMnemonic);
|
const encryptedMnemonicBase64 = arrayBufferToBase64(encryptedMnemonic);
|
||||||
|
|
||||||
|
console.log("💾 DEBUG: Inserting account into database");
|
||||||
|
|
||||||
const sql = `INSERT INTO accounts (dateCreated, derivationPath, did, identityEncrBase64, mnemonicEncrBase64, publicKeyHex)
|
const sql = `INSERT INTO accounts (dateCreated, derivationPath, did, identityEncrBase64, mnemonicEncrBase64, publicKeyHex)
|
||||||
VALUES (?, ?, ?, ?, ?, ?)`;
|
VALUES (?, ?, ?, ?, ?, ?)`;
|
||||||
const params = [
|
const params = [
|
||||||
@@ -632,9 +642,22 @@ export async function saveNewIdentity(
|
|||||||
identity.keys[0].publicKeyHex,
|
identity.keys[0].publicKeyHex,
|
||||||
];
|
];
|
||||||
await platformService.dbExec(sql, params);
|
await platformService.dbExec(sql, params);
|
||||||
|
console.log("💾 DEBUG: Account inserted successfully");
|
||||||
|
|
||||||
|
console.log("💾 DEBUG: Updating default settings with activeDid");
|
||||||
await databaseUtil.updateDefaultSettings({ activeDid: identity.did });
|
await databaseUtil.updateDefaultSettings({ activeDid: identity.did });
|
||||||
|
console.log("💾 DEBUG: Default settings updated");
|
||||||
|
|
||||||
|
console.log("💾 DEBUG: Inserting DID-specific settings");
|
||||||
await databaseUtil.insertDidSpecificSettings(identity.did);
|
await databaseUtil.insertDidSpecificSettings(identity.did);
|
||||||
|
console.log("💾 DEBUG: DID-specific settings inserted");
|
||||||
|
|
||||||
|
// Check what was actually created
|
||||||
|
const createdSettings =
|
||||||
|
await databaseUtil.retrieveSettingsForActiveAccount();
|
||||||
|
console.log("💾 DEBUG: Created settings:", createdSettings);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log("💾 DEBUG: saveNewIdentity error:", error);
|
||||||
logger.error("Failed to update default settings:", error);
|
logger.error("Failed to update default settings:", error);
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Failed to set default settings. Please try again or restart the app.",
|
"Failed to set default settings. Please try again or restart the app.",
|
||||||
@@ -911,22 +934,104 @@ export async function importFromMnemonic(
|
|||||||
derivationPath: string = DEFAULT_ROOT_DERIVATION_PATH,
|
derivationPath: string = DEFAULT_ROOT_DERIVATION_PATH,
|
||||||
shouldErase: boolean = false,
|
shouldErase: boolean = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
console.log("📥 DEBUG: importFromMnemonic called with:", {
|
||||||
|
mnemonicLength: mnemonic.split(" ").length,
|
||||||
|
derivationPath,
|
||||||
|
shouldErase,
|
||||||
|
});
|
||||||
|
|
||||||
const mne: string = mnemonic.trim().toLowerCase();
|
const mne: string = mnemonic.trim().toLowerCase();
|
||||||
|
console.log("📥 DEBUG: Normalized mnemonic length:", mne.split(" ").length);
|
||||||
|
|
||||||
|
// Check if this is Test User #0
|
||||||
|
const TEST_USER_0_MNEMONIC =
|
||||||
|
"rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage";
|
||||||
|
const isTestUser0 = mne === TEST_USER_0_MNEMONIC;
|
||||||
|
console.log("📥 DEBUG: Is Test User #0:", isTestUser0);
|
||||||
|
|
||||||
// Derive address and keys from mnemonic
|
// Derive address and keys from mnemonic
|
||||||
const [address, privateHex, publicHex] = deriveAddress(mne, derivationPath);
|
const [address, privateHex, publicHex] = deriveAddress(mne, derivationPath);
|
||||||
|
console.log("📥 DEBUG: Derived address:", address);
|
||||||
|
console.log("📥 DEBUG: Derived DID:", `did:ethr:${address}`);
|
||||||
|
|
||||||
// Create new identifier
|
// Create new identifier
|
||||||
const newId = newIdentifier(address, publicHex, privateHex, derivationPath);
|
const newId = newIdentifier(address, publicHex, privateHex, derivationPath);
|
||||||
|
console.log("📥 DEBUG: Created new identifier:", {
|
||||||
|
did: newId.did,
|
||||||
|
keysLength: newId.keys.length,
|
||||||
|
});
|
||||||
|
|
||||||
// Handle erasures
|
// Handle erasures
|
||||||
if (shouldErase) {
|
if (shouldErase) {
|
||||||
|
console.log("📥 DEBUG: Erasing existing accounts");
|
||||||
const platformService = PlatformServiceFactory.getInstance();
|
const platformService = PlatformServiceFactory.getInstance();
|
||||||
await platformService.dbExec("DELETE FROM accounts");
|
await platformService.dbExec("DELETE FROM accounts");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the new identity
|
// Save the new identity
|
||||||
|
console.log("📥 DEBUG: Calling saveNewIdentity");
|
||||||
await saveNewIdentity(newId, mne, derivationPath);
|
await saveNewIdentity(newId, mne, derivationPath);
|
||||||
|
console.log("📥 DEBUG: saveNewIdentity completed");
|
||||||
|
|
||||||
|
// Set up Test User #0 specific settings
|
||||||
|
if (isTestUser0) {
|
||||||
|
console.log("📥 DEBUG: Setting up Test User #0 specific settings");
|
||||||
|
|
||||||
|
// First, let's see what's currently in the database
|
||||||
|
const platformService = PlatformServiceFactory.getInstance();
|
||||||
|
const existingResult = await platformService.dbQuery(
|
||||||
|
"SELECT * FROM settings WHERE accountDid = ?",
|
||||||
|
[newId.did],
|
||||||
|
);
|
||||||
|
console.log("📥 DEBUG: Existing settings before update:", existingResult);
|
||||||
|
|
||||||
|
// Let's also see the actual data by mapping it
|
||||||
|
if (existingResult?.values?.length) {
|
||||||
|
const existingData = databaseUtil.mapColumnsToValues(
|
||||||
|
existingResult.columns,
|
||||||
|
existingResult.values,
|
||||||
|
)[0];
|
||||||
|
console.log("📥 DEBUG: Existing settings mapped:", existingData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's also check what's in the master settings
|
||||||
|
const masterResult = await platformService.dbQuery(
|
||||||
|
"SELECT * FROM settings WHERE id = ?",
|
||||||
|
["MASTER"],
|
||||||
|
);
|
||||||
|
console.log("📥 DEBUG: Master settings:", masterResult);
|
||||||
|
|
||||||
|
// Now try the UPDATE with better debugging
|
||||||
|
const updateResult = await databaseUtil.updateDidSpecificSettings(
|
||||||
|
newId.did,
|
||||||
|
{
|
||||||
|
firstName: "User Zero",
|
||||||
|
isRegistered: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
console.log("📥 DEBUG: Test User #0 settings update result:", updateResult);
|
||||||
|
|
||||||
|
// Verify the settings were saved
|
||||||
|
const verifyResult = await platformService.dbQuery(
|
||||||
|
"SELECT * FROM settings WHERE accountDid = ?",
|
||||||
|
[newId.did],
|
||||||
|
);
|
||||||
|
console.log("📥 DEBUG: Settings after update attempt:", verifyResult);
|
||||||
|
|
||||||
|
if (verifyResult?.values?.length) {
|
||||||
|
const verifiedData = databaseUtil.mapColumnsToValues(
|
||||||
|
verifyResult.columns,
|
||||||
|
verifyResult.values,
|
||||||
|
)[0];
|
||||||
|
console.log("📥 DEBUG: Settings after update mapped:", verifiedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("📥 DEBUG: Test User #0 settings applied");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check what settings were created
|
||||||
|
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
||||||
|
console.log("📥 DEBUG: Final settings after import:", settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -616,21 +616,36 @@ export const PlatformServiceMixin = {
|
|||||||
did?: string,
|
did?: string,
|
||||||
defaults: Settings = {},
|
defaults: Settings = {},
|
||||||
): Promise<Settings> {
|
): Promise<Settings> {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
console.log("💫 DEBUG: $accountSettings called with:", { did, defaults });
|
||||||
const currentDid = did || (this as any).activeDid;
|
|
||||||
|
|
||||||
let settings;
|
// Import the working retrieveSettingsForActiveAccount function
|
||||||
if (!currentDid) {
|
const { retrieveSettingsForActiveAccount } = await import(
|
||||||
settings = await this.$settings(defaults);
|
"@/db/databaseUtil"
|
||||||
} else {
|
);
|
||||||
settings = await this.$getMergedSettings(
|
|
||||||
MASTER_SETTINGS_KEY,
|
try {
|
||||||
currentDid,
|
// Use the working function that properly merges settings
|
||||||
defaults,
|
const settings = await retrieveSettingsForActiveAccount();
|
||||||
|
console.log(
|
||||||
|
"💫 DEBUG: retrieveSettingsForActiveAccount returned:",
|
||||||
|
settings,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return settings; // Return fresh data without caching
|
// Merge with any provided defaults
|
||||||
|
const mergedSettings = { ...defaults, ...settings };
|
||||||
|
console.log("💫 DEBUG: Final merged settings:", mergedSettings);
|
||||||
|
|
||||||
|
return mergedSettings;
|
||||||
|
} catch (error) {
|
||||||
|
console.log("💫 DEBUG: Error in $accountSettings:", error);
|
||||||
|
logger.error(
|
||||||
|
"[PlatformServiceMixin] Error in $accountSettings:",
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Fallback to defaults on error
|
||||||
|
return defaults;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// =================================================
|
// =================================================
|
||||||
|
|||||||
@@ -309,7 +309,6 @@ import {
|
|||||||
NOTIFY_VISIBILITY_ERROR,
|
NOTIFY_VISIBILITY_ERROR,
|
||||||
NOTIFY_UNCONFIRMED_HOURS_DYNAMIC,
|
NOTIFY_UNCONFIRMED_HOURS_DYNAMIC,
|
||||||
NOTIFY_REGISTER_CONTACT,
|
NOTIFY_REGISTER_CONTACT,
|
||||||
NOTIFY_ONBOARDING_MEETING,
|
|
||||||
NOTIFY_CONTACT_NO_INFO,
|
NOTIFY_CONTACT_NO_INFO,
|
||||||
NOTIFY_CONTACT_INVALID_URL,
|
NOTIFY_CONTACT_INVALID_URL,
|
||||||
NOTIFY_CONTACTS_ADDED_CSV,
|
NOTIFY_CONTACTS_ADDED_CSV,
|
||||||
@@ -323,7 +322,6 @@ import {
|
|||||||
NOTIFY_CONTACT_IMPORT_CONSTRAINT,
|
NOTIFY_CONTACT_IMPORT_CONSTRAINT,
|
||||||
NOTIFY_GIVES_LOAD_ERROR,
|
NOTIFY_GIVES_LOAD_ERROR,
|
||||||
NOTIFY_CONTACT_SETTING_SAVE_ERROR,
|
NOTIFY_CONTACT_SETTING_SAVE_ERROR,
|
||||||
NOTIFY_MEETING_STATUS_ERROR,
|
|
||||||
NOTIFY_CONTACTS_ADDED,
|
NOTIFY_CONTACTS_ADDED,
|
||||||
NOTIFY_CONTACT_INFO_COPY,
|
NOTIFY_CONTACT_INFO_COPY,
|
||||||
NOTIFY_CONTACTS_SELECT_TO_COPY,
|
NOTIFY_CONTACTS_SELECT_TO_COPY,
|
||||||
@@ -1239,54 +1237,75 @@ export default class ContactsView extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async showOnboardMeetingDialog() {
|
private async showOnboardMeetingDialog() {
|
||||||
|
console.log("🪑 DEBUG: showOnboardMeetingDialog() called");
|
||||||
|
console.log("🪑 DEBUG: activeDid =", this.activeDid);
|
||||||
|
console.log("🪑 DEBUG: apiServer =", this.apiServer);
|
||||||
|
console.log("🪑 DEBUG: isRegistered =", this.isRegistered);
|
||||||
|
|
||||||
|
if (!this.activeDid || !this.apiServer) {
|
||||||
|
console.log(
|
||||||
|
"🪑 DEBUG: Missing activeDid or apiServer, routing to meeting list",
|
||||||
|
);
|
||||||
|
this.$router.push({ name: "onboard-meeting-list" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// First check if they're in a meeting
|
console.log("🪑 DEBUG: Checking if user is in a meeting as member...");
|
||||||
const headers = await getHeaders(this.activeDid);
|
const headers = await getHeaders(this.activeDid);
|
||||||
|
console.log("🪑 DEBUG: Headers obtained:", headers);
|
||||||
|
|
||||||
const memberResponse = await this.axios.get(
|
const memberResponse = await this.axios.get(
|
||||||
this.apiServer + "/api/partner/groupOnboardMember",
|
this.apiServer + "/api/partner/groupOnboardMember",
|
||||||
{ headers },
|
{ headers },
|
||||||
);
|
);
|
||||||
|
console.log("🪑 DEBUG: Member response:", memberResponse.data);
|
||||||
|
|
||||||
if (memberResponse.data.data) {
|
if (memberResponse.data?.data?.groupId) {
|
||||||
// They're in a meeting, check if they're the host
|
console.log(
|
||||||
|
"🪑 DEBUG: User is in a meeting as member, checking if host...",
|
||||||
|
);
|
||||||
const hostResponse = await this.axios.get(
|
const hostResponse = await this.axios.get(
|
||||||
this.apiServer + "/api/partner/groupOnboard",
|
this.apiServer + "/api/partner/groupOnboard",
|
||||||
{ headers },
|
{ headers },
|
||||||
);
|
);
|
||||||
|
console.log("🪑 DEBUG: Host response:", hostResponse.data);
|
||||||
|
|
||||||
if (hostResponse.data.data) {
|
if (hostResponse.data?.data?.groupId) {
|
||||||
// They're the host, take them to setup
|
console.log("🪑 DEBUG: User is HOST, routing to setup");
|
||||||
this.$router.push({ name: "onboard-meeting-setup" });
|
this.$router.push({ name: "onboard-meeting-setup" });
|
||||||
} else {
|
} else {
|
||||||
// They're not the host, take them to list
|
console.log("🪑 DEBUG: User is MEMBER, routing to members view");
|
||||||
this.$router.push({ name: "onboard-meeting-list" });
|
this.$router.push({
|
||||||
|
name: "onboard-meeting-members",
|
||||||
|
params: { groupId: memberResponse.data.data.groupId },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// They're not in a meeting, show the dialog
|
console.log("🪑 DEBUG: User is NOT in a meeting, checking if host...");
|
||||||
this.$notify(
|
const hostResponse = await this.axios.get(
|
||||||
{
|
this.apiServer + "/api/partner/groupOnboard",
|
||||||
group: "modal",
|
{ headers },
|
||||||
type: "confirm",
|
|
||||||
title: NOTIFY_ONBOARDING_MEETING.title,
|
|
||||||
text: NOTIFY_ONBOARDING_MEETING.text,
|
|
||||||
onYes: async () => {
|
|
||||||
this.$router.push({ name: "onboard-meeting-setup" });
|
|
||||||
},
|
|
||||||
yesText: NOTIFY_ONBOARDING_MEETING.yesText,
|
|
||||||
onNo: async () => {
|
|
||||||
this.$router.push({ name: "onboard-meeting-list" });
|
|
||||||
},
|
|
||||||
noText: NOTIFY_ONBOARDING_MEETING.noText,
|
|
||||||
},
|
|
||||||
TIMEOUTS.MODAL,
|
|
||||||
);
|
);
|
||||||
|
console.log("🪑 DEBUG: Host response (no member):", hostResponse.data);
|
||||||
|
|
||||||
|
if (hostResponse.data?.data?.groupId) {
|
||||||
|
console.log(
|
||||||
|
"🪑 DEBUG: User is HOST with no member record, routing to setup",
|
||||||
|
);
|
||||||
|
this.$router.push({ name: "onboard-meeting-setup" });
|
||||||
|
} else {
|
||||||
|
console.log(
|
||||||
|
"🪑 DEBUG: User has NO meeting, routing to setup to CREATE",
|
||||||
|
);
|
||||||
|
this.$router.push({ name: "onboard-meeting-setup" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
this.$logAndConsole(
|
console.log("🪑 DEBUG: Error in API calls:", error);
|
||||||
NOTIFY_MEETING_STATUS_ERROR.message + ": " + errorStringForLog(error),
|
console.log("🪑 DEBUG: Error response:", error.response?.data);
|
||||||
true,
|
console.log("🪑 DEBUG: Routing to meeting list due to error");
|
||||||
);
|
this.$router.push({ name: "onboard-meeting-list" });
|
||||||
this.notify.error(NOTIFY_MEETING_STATUS_ERROR.message, TIMEOUTS.MODAL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||||
<button
|
<button
|
||||||
class="block w-full text-center text-lg font-bold uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md"
|
class="block w-full text-center text-lg font-bold uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md"
|
||||||
@click="fromMnemonic()"
|
@click="onImportClick()"
|
||||||
>
|
>
|
||||||
Import
|
Import
|
||||||
</button>
|
</button>
|
||||||
@@ -89,7 +89,6 @@ import { Router } from "vue-router";
|
|||||||
import { AppString, NotificationIface } from "../constants/app";
|
import { AppString, NotificationIface } from "../constants/app";
|
||||||
import { DEFAULT_ROOT_DERIVATION_PATH } from "../libs/crypto";
|
import { DEFAULT_ROOT_DERIVATION_PATH } from "../libs/crypto";
|
||||||
import { retrieveAccountCount, importFromMnemonic } from "../libs/util";
|
import { retrieveAccountCount, importFromMnemonic } from "../libs/util";
|
||||||
import { logger } from "../utils/logger";
|
|
||||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||||
|
|
||||||
@@ -184,39 +183,70 @@ export default class ImportAccountView extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Imports identifier from mnemonic phrase
|
* Handles import button click
|
||||||
*
|
*
|
||||||
* Processes the mnemonic phrase with optional custom derivation path
|
* Validates input and initiates account import process
|
||||||
* and account erasure options. Handles validation and error scenarios
|
* Uses importFromMnemonic utility for secure import
|
||||||
* with appropriate user feedback.
|
|
||||||
*
|
|
||||||
* Error Handling:
|
|
||||||
* - Invalid mnemonic format validation
|
|
||||||
* - Import process failure recovery
|
|
||||||
* - User-friendly error messaging
|
|
||||||
*/
|
*/
|
||||||
public async fromMnemonic() {
|
public async onImportClick() {
|
||||||
|
console.log("🔑 DEBUG: Import process started");
|
||||||
|
console.log("🔑 DEBUG: Mnemonic length:", this.mnemonic.split(" ").length);
|
||||||
|
console.log("🔑 DEBUG: Derivation path:", this.derivationPath);
|
||||||
|
console.log("🔑 DEBUG: Should erase:", this.shouldErase);
|
||||||
|
console.log("🔑 DEBUG: API Server:", this.apiServer);
|
||||||
|
|
||||||
|
if (!this.mnemonic?.trim()) {
|
||||||
|
this.notify.warning(
|
||||||
|
"Seed phrase is required to import an account.",
|
||||||
|
TIMEOUTS.LONG,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
console.log("🔑 DEBUG: Calling importFromMnemonic...");
|
||||||
await importFromMnemonic(
|
await importFromMnemonic(
|
||||||
this.mnemonic,
|
this.mnemonic,
|
||||||
this.derivationPath,
|
this.derivationPath,
|
||||||
this.shouldErase,
|
this.shouldErase,
|
||||||
);
|
);
|
||||||
this.$router.push({ name: "account" });
|
console.log("🔑 DEBUG: importFromMnemonic completed successfully");
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
} catch (err: any) {
|
// Check what was actually imported
|
||||||
logger.error("Error importing from mnemonic:", err);
|
const settings = await this.$accountSettings();
|
||||||
if (err == "Error: invalid mnemonic") {
|
console.log("🔑 DEBUG: Post-import settings:", settings);
|
||||||
this.notify.error(
|
|
||||||
"Please check your mnemonic and try again.",
|
// Check account-specific settings
|
||||||
TIMEOUTS.LONG,
|
if (settings?.activeDid) {
|
||||||
);
|
try {
|
||||||
} else {
|
const accountSettings = await this.$query(
|
||||||
this.notify.error(
|
"SELECT * FROM settings WHERE accountDid = ?",
|
||||||
"Got an error creating that identifier.",
|
[settings.activeDid],
|
||||||
TIMEOUTS.LONG,
|
);
|
||||||
);
|
console.log(
|
||||||
|
"🔑 DEBUG: Post-import account-specific settings:",
|
||||||
|
accountSettings,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("🔑 DEBUG: Error checking post-import settings:", error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.notify.success("Account imported successfully!", TIMEOUTS.STANDARD);
|
||||||
|
this.$router.push({ name: "account" });
|
||||||
|
} catch (error: any) {
|
||||||
|
console.log("🔑 DEBUG: Import failed with error:", error);
|
||||||
|
console.log("🔑 DEBUG: Error details:", {
|
||||||
|
message: error.message,
|
||||||
|
stack: error.stack,
|
||||||
|
name: error.name,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$logError("Import failed: " + error);
|
||||||
|
this.notify.error(
|
||||||
|
error.message || "Failed to import account.",
|
||||||
|
TIMEOUTS.LONG,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,26 @@
|
|||||||
<h2 class="text-xl font-medium">{{ meeting.name }}</h2>
|
<h2 class="text-xl font-medium">{{ meeting.name }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p v-if="meetings.length === 0" class="text-center text-gray-500 py-8">
|
<!-- Create Meeting Button for registered users with no meetings -->
|
||||||
|
<div
|
||||||
|
v-if="meetings.length === 0 && isRegistered"
|
||||||
|
class="text-center py-8"
|
||||||
|
>
|
||||||
|
<p class="text-gray-500 mb-4">No onboarding meetings available</p>
|
||||||
|
<button
|
||||||
|
class="bg-gradient-to-b from-green-400 to-green-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-6 py-3 rounded-md hover:from-green-500 hover:to-green-800 transition-colors"
|
||||||
|
@click="createMeeting"
|
||||||
|
>
|
||||||
|
<font-awesome icon="plus" class="mr-2" />
|
||||||
|
Create Meeting
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- No meetings message for unregistered users -->
|
||||||
|
<p
|
||||||
|
v-if="meetings.length === 0 && !isRegistered"
|
||||||
|
class="text-center text-gray-500 py-8"
|
||||||
|
>
|
||||||
No onboarding meetings available
|
No onboarding meetings available
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -89,14 +108,13 @@ import { Router } from "vue-router";
|
|||||||
|
|
||||||
import QuickNav from "../components/QuickNav.vue";
|
import QuickNav from "../components/QuickNav.vue";
|
||||||
import TopMessage from "../components/TopMessage.vue";
|
import TopMessage from "../components/TopMessage.vue";
|
||||||
import * as databaseUtil from "../db/databaseUtil";
|
import { encryptMessage } from "../libs/crypto";
|
||||||
import { logConsoleAndDb } from "../db/databaseUtil";
|
|
||||||
import {
|
import {
|
||||||
errorStringForLog,
|
errorStringForLog,
|
||||||
getHeaders,
|
getHeaders,
|
||||||
serverMessageForUser,
|
serverMessageForUser,
|
||||||
} from "../libs/endorserServer";
|
} from "../libs/endorserServer";
|
||||||
import { encryptMessage } from "../libs/crypto";
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||||
|
|
||||||
interface Meeting {
|
interface Meeting {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -108,6 +126,7 @@ interface Meeting {
|
|||||||
QuickNav,
|
QuickNav,
|
||||||
TopMessage,
|
TopMessage,
|
||||||
},
|
},
|
||||||
|
mixins: [PlatformServiceMixin],
|
||||||
})
|
})
|
||||||
export default class OnboardMeetingListView extends Vue {
|
export default class OnboardMeetingListView extends Vue {
|
||||||
$notify!: (
|
$notify!: (
|
||||||
@@ -135,57 +154,132 @@ export default class OnboardMeetingListView extends Vue {
|
|||||||
showPasswordDialog = false;
|
showPasswordDialog = false;
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
console.log("📋 DEBUG: OnboardMeetingListView created() called");
|
||||||
this.activeDid = settings.activeDid || "";
|
|
||||||
this.apiServer = settings.apiServer || "";
|
const settings = await this.$accountSettings();
|
||||||
this.firstName = settings.firstName || "";
|
console.log("📋 DEBUG: Settings loaded:", settings);
|
||||||
this.isRegistered = !!settings.isRegistered;
|
|
||||||
await this.fetchMeetings();
|
// 🔍 TEMPORARY DEBUG: Check raw database for test user registration state
|
||||||
|
if (settings?.activeDid) {
|
||||||
|
console.log(
|
||||||
|
"📋 DEBUG: Checking raw database settings for DID:",
|
||||||
|
settings.activeDid,
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
// Check master settings
|
||||||
|
const masterSettings = await this.$query(
|
||||||
|
"SELECT * FROM settings WHERE id = ?",
|
||||||
|
[1],
|
||||||
|
);
|
||||||
|
console.log("📋 DEBUG: Master settings:", masterSettings);
|
||||||
|
|
||||||
|
// Check account-specific settings
|
||||||
|
const accountSettings = await this.$query(
|
||||||
|
"SELECT * FROM settings WHERE accountDid = ?",
|
||||||
|
[settings.activeDid],
|
||||||
|
);
|
||||||
|
console.log("📋 DEBUG: Account-specific settings:", accountSettings);
|
||||||
|
|
||||||
|
// Check if there are any settings with isRegistered = 1
|
||||||
|
const registeredSettings = await this.$query(
|
||||||
|
"SELECT * FROM settings WHERE isRegistered = 1",
|
||||||
|
);
|
||||||
|
console.log("📋 DEBUG: All registered settings:", registeredSettings);
|
||||||
|
|
||||||
|
// Check all settings for this user
|
||||||
|
const allSettings = await this.$query("SELECT * FROM settings");
|
||||||
|
console.log("📋 DEBUG: All settings in database:", allSettings);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("📋 DEBUG: Error checking raw database:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.activeDid = settings?.activeDid || "";
|
||||||
|
this.apiServer = settings?.apiServer || "";
|
||||||
|
this.firstName = settings?.firstName || "";
|
||||||
|
this.isRegistered = !!settings?.isRegistered;
|
||||||
|
|
||||||
|
console.log("📋 DEBUG: activeDid =", this.activeDid);
|
||||||
|
console.log("📋 DEBUG: apiServer =", this.apiServer);
|
||||||
|
console.log("📋 DEBUG: firstName =", this.firstName);
|
||||||
|
console.log("📋 DEBUG: isRegistered =", this.isRegistered);
|
||||||
|
|
||||||
|
if (this.isRegistered) {
|
||||||
|
console.log("📋 DEBUG: User is registered, checking for meetings...");
|
||||||
|
await this.fetchMeetings();
|
||||||
|
} else {
|
||||||
|
console.log("📋 DEBUG: User is NOT registered, skipping meeting check");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchMeetings() {
|
async fetchMeetings() {
|
||||||
|
console.log("📋 DEBUG: fetchMeetings() called");
|
||||||
|
console.log("📋 DEBUG: activeDid =", this.activeDid);
|
||||||
|
console.log("📋 DEBUG: apiServer =", this.apiServer);
|
||||||
|
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
try {
|
try {
|
||||||
// get the meeting that the user is attending
|
console.log("📋 DEBUG: Checking if user is attending a meeting...");
|
||||||
const headers = await getHeaders(this.activeDid);
|
const headers = await getHeaders(this.activeDid);
|
||||||
|
console.log("📋 DEBUG: Headers obtained:", headers);
|
||||||
|
|
||||||
const response = await this.axios.get(
|
const response = await this.axios.get(
|
||||||
this.apiServer + "/api/partner/groupOnboardMember",
|
this.apiServer + "/api/partner/groupOnboardMember",
|
||||||
{ headers },
|
{ headers },
|
||||||
);
|
);
|
||||||
|
console.log("📋 DEBUG: Member response:", response.data);
|
||||||
|
|
||||||
if (response.data?.data) {
|
if (response.data?.data) {
|
||||||
// they're in a meeting already
|
console.log(
|
||||||
|
"📋 DEBUG: User is attending a meeting, fetching details...",
|
||||||
|
);
|
||||||
const attendingMeetingId = response.data.data.groupId;
|
const attendingMeetingId = response.data.data.groupId;
|
||||||
// retrieve the meeting details
|
console.log("📋 DEBUG: Attending meeting ID:", attendingMeetingId);
|
||||||
|
|
||||||
const headers2 = await getHeaders(this.activeDid);
|
const headers2 = await getHeaders(this.activeDid);
|
||||||
const response2 = await this.axios.get(
|
const response2 = await this.axios.get(
|
||||||
this.apiServer + "/api/partner/groupOnboard/" + attendingMeetingId,
|
this.apiServer + "/api/partner/groupOnboard/" + attendingMeetingId,
|
||||||
{ headers: headers2 },
|
{ headers: headers2 },
|
||||||
);
|
);
|
||||||
|
console.log("📋 DEBUG: Meeting details response:", response2.data);
|
||||||
|
|
||||||
if (response2.data?.data) {
|
if (response2.data?.data) {
|
||||||
|
console.log("📋 DEBUG: Setting attendingMeeting");
|
||||||
this.attendingMeeting = response2.data.data;
|
this.attendingMeeting = response2.data.data;
|
||||||
|
console.log("📋 DEBUG: attendingMeeting set:", this.attendingMeeting);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// this should never happen
|
console.log(
|
||||||
logConsoleAndDb(
|
"📋 DEBUG: ERROR: No meeting details found for attending meeting",
|
||||||
|
);
|
||||||
|
this.$logAndConsole(
|
||||||
"Error fetching meeting for user after saying they are in one.",
|
"Error fetching meeting for user after saying they are in one.",
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.log("📋 DEBUG: User is NOT attending a meeting");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("📋 DEBUG: Fetching available meetings...");
|
||||||
const headers2 = await getHeaders(this.activeDid);
|
const headers2 = await getHeaders(this.activeDid);
|
||||||
const response2 = await this.axios.get(
|
const response2 = await this.axios.get(
|
||||||
this.apiServer + "/api/partner/groupsOnboarding",
|
this.apiServer + "/api/partner/groupsOnboarding",
|
||||||
{ headers: headers2 },
|
{ headers: headers2 },
|
||||||
);
|
);
|
||||||
|
console.log("📋 DEBUG: Available meetings response:", response2.data);
|
||||||
|
|
||||||
if (response2.data?.data) {
|
if (response2.data?.data) {
|
||||||
|
console.log("📋 DEBUG: Setting meetings list");
|
||||||
this.meetings = response2.data.data;
|
this.meetings = response2.data.data;
|
||||||
|
console.log("📋 DEBUG: meetings set:", this.meetings);
|
||||||
|
} else {
|
||||||
|
console.log("📋 DEBUG: No meetings found");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
logConsoleAndDb(
|
console.log("📋 DEBUG: Error fetching meetings:", error);
|
||||||
|
console.log("📋 DEBUG: Error response:", error.response?.data);
|
||||||
|
this.$logAndConsole(
|
||||||
"Error fetching meetings: " + errorStringForLog(error),
|
"Error fetching meetings: " + errorStringForLog(error),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
@@ -224,7 +318,7 @@ export default class OnboardMeetingListView extends Vue {
|
|||||||
async submitPassword() {
|
async submitPassword() {
|
||||||
if (!this.selectedMeeting) {
|
if (!this.selectedMeeting) {
|
||||||
// this should never happen
|
// this should never happen
|
||||||
logConsoleAndDb(
|
this.$logAndConsole(
|
||||||
"No meeting selected when prompting for password, which should never happen.",
|
"No meeting selected when prompting for password, which should never happen.",
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
@@ -275,7 +369,7 @@ export default class OnboardMeetingListView extends Vue {
|
|||||||
throw { response: postResult };
|
throw { response: postResult };
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logConsoleAndDb(
|
this.$logAndConsole(
|
||||||
"Error joining meeting: " + errorStringForLog(error),
|
"Error joining meeting: " + errorStringForLog(error),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
@@ -320,7 +414,7 @@ export default class OnboardMeetingListView extends Vue {
|
|||||||
5000,
|
5000,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logConsoleAndDb(
|
this.$logAndConsole(
|
||||||
"Error leaving meeting: " + errorStringForLog(error),
|
"Error leaving meeting: " + errorStringForLog(error),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
@@ -341,5 +435,10 @@ export default class OnboardMeetingListView extends Vue {
|
|||||||
-1,
|
-1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createMeeting() {
|
||||||
|
console.log("📋 DEBUG: createMeeting() called - routing to meeting setup");
|
||||||
|
this.$router.push({ name: "onboard-meeting-setup" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ import QuickNav from "../components/QuickNav.vue";
|
|||||||
import TopMessage from "../components/TopMessage.vue";
|
import TopMessage from "../components/TopMessage.vue";
|
||||||
import MembersList from "../components/MembersList.vue";
|
import MembersList from "../components/MembersList.vue";
|
||||||
import UserNameDialog from "../components/UserNameDialog.vue";
|
import UserNameDialog from "../components/UserNameDialog.vue";
|
||||||
import * as databaseUtil from "../db/databaseUtil";
|
|
||||||
import { logConsoleAndDb } from "../db/databaseUtil";
|
|
||||||
import { encryptMessage } from "../libs/crypto";
|
import { encryptMessage } from "../libs/crypto";
|
||||||
import {
|
import {
|
||||||
errorStringForLog,
|
errorStringForLog,
|
||||||
@@ -64,6 +62,7 @@ import {
|
|||||||
serverMessageForUser,
|
serverMessageForUser,
|
||||||
} from "../libs/endorserServer";
|
} from "../libs/endorserServer";
|
||||||
import { generateSaveAndActivateIdentity } from "../libs/util";
|
import { generateSaveAndActivateIdentity } from "../libs/util";
|
||||||
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
@@ -72,6 +71,7 @@ import { generateSaveAndActivateIdentity } from "../libs/util";
|
|||||||
MembersList,
|
MembersList,
|
||||||
UserNameDialog,
|
UserNameDialog,
|
||||||
},
|
},
|
||||||
|
mixins: [PlatformServiceMixin],
|
||||||
})
|
})
|
||||||
export default class OnboardMeetingMembersView extends Vue {
|
export default class OnboardMeetingMembersView extends Vue {
|
||||||
activeDid = "";
|
activeDid = "";
|
||||||
@@ -105,11 +105,11 @@ export default class OnboardMeetingMembersView extends Vue {
|
|||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
const settings = await this.$accountSettings();
|
||||||
this.activeDid = settings.activeDid || "";
|
this.activeDid = settings?.activeDid || "";
|
||||||
this.apiServer = settings.apiServer || "";
|
this.apiServer = settings?.apiServer || "";
|
||||||
this.firstName = settings.firstName || "";
|
this.firstName = settings?.firstName || "";
|
||||||
this.isRegistered = settings.isRegistered || false;
|
this.isRegistered = !!settings?.isRegistered;
|
||||||
try {
|
try {
|
||||||
if (!this.activeDid) {
|
if (!this.activeDid) {
|
||||||
this.activeDid = await generateSaveAndActivateIdentity();
|
this.activeDid = await generateSaveAndActivateIdentity();
|
||||||
@@ -160,7 +160,7 @@ export default class OnboardMeetingMembersView extends Vue {
|
|||||||
this.errorMessage =
|
this.errorMessage =
|
||||||
serverMessageForUser(error) ||
|
serverMessageForUser(error) ||
|
||||||
"There was an error checking for that meeting. Reload or go back and try again.";
|
"There was an error checking for that meeting. Reload or go back and try again.";
|
||||||
logConsoleAndDb(
|
this.$logAndConsole(
|
||||||
"Error checking meeting: " + errorStringForLog(error),
|
"Error checking meeting: " + errorStringForLog(error),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
@@ -192,7 +192,7 @@ export default class OnboardMeetingMembersView extends Vue {
|
|||||||
{ headers },
|
{ headers },
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logConsoleAndDb(
|
this.$logAndConsole(
|
||||||
"Error adding member to meeting: " + errorStringForLog(error),
|
"Error adding member to meeting: " + errorStringForLog(error),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
@@ -225,7 +225,7 @@ export default class OnboardMeetingMembersView extends Vue {
|
|||||||
{ headers },
|
{ headers },
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logConsoleAndDb(
|
this.$logAndConsole(
|
||||||
"Error updating member in meeting: " + errorStringForLog(error),
|
"Error updating member in meeting: " + errorStringForLog(error),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ export default class OnboardMeetingView extends Vue {
|
|||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
this.notify = createNotifyHelpers(this.$notify as any);
|
this.notify = createNotifyHelpers(this.$notify as any);
|
||||||
const settings = await this.$getSettings("activeAccount");
|
const settings = await this.$accountSettings();
|
||||||
this.activeDid = settings?.activeDid || "";
|
this.activeDid = settings?.activeDid || "";
|
||||||
this.apiServer = settings?.apiServer || "";
|
this.apiServer = settings?.apiServer || "";
|
||||||
this.fullName = settings?.firstName || "";
|
this.fullName = settings?.firstName || "";
|
||||||
@@ -398,27 +398,52 @@ export default class OnboardMeetingView extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchCurrentMeeting() {
|
async fetchCurrentMeeting() {
|
||||||
|
console.log("🏗️ DEBUG: fetchCurrentMeeting() called");
|
||||||
|
console.log("🏗️ DEBUG: activeDid =", this.activeDid);
|
||||||
|
console.log("🏗️ DEBUG: apiServer =", this.apiServer);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const headers = await getHeaders(this.activeDid);
|
const headers = await getHeaders(this.activeDid);
|
||||||
|
console.log("🏗️ DEBUG: Headers obtained:", headers);
|
||||||
|
|
||||||
const response = await this.axios.get(
|
const response = await this.axios.get(
|
||||||
this.apiServer + "/api/partner/groupOnboard",
|
this.apiServer + "/api/partner/groupOnboard",
|
||||||
{ headers },
|
{ headers },
|
||||||
);
|
);
|
||||||
|
console.log("🏗️ DEBUG: Meeting response:", response.data);
|
||||||
|
|
||||||
const queryPassword = this.$route.query["password"] as string;
|
const queryPassword = this.$route.query["password"] as string;
|
||||||
|
console.log("🏗️ DEBUG: Query password:", queryPassword);
|
||||||
|
|
||||||
if (response?.data?.data) {
|
if (response?.data?.data) {
|
||||||
|
console.log("🏗️ DEBUG: Meeting found, setting currentMeeting");
|
||||||
this.currentMeeting = {
|
this.currentMeeting = {
|
||||||
...response.data.data,
|
...response.data.data,
|
||||||
userFullName: this.fullName,
|
userFullName: this.fullName,
|
||||||
password: this.currentMeeting?.password || queryPassword || "",
|
password: this.currentMeeting?.password || queryPassword || "",
|
||||||
};
|
};
|
||||||
|
console.log("🏗️ DEBUG: currentMeeting set:", this.currentMeeting);
|
||||||
} else {
|
} else {
|
||||||
// no meeting found
|
console.log(
|
||||||
|
"🏗️ DEBUG: No meeting found, setting up blank meeting for creation",
|
||||||
|
);
|
||||||
this.newOrUpdatedMeetingInputs = this.blankMeeting();
|
this.newOrUpdatedMeetingInputs = this.blankMeeting();
|
||||||
|
console.log(
|
||||||
|
"🏗️ DEBUG: newOrUpdatedMeetingInputs set:",
|
||||||
|
this.newOrUpdatedMeetingInputs,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
// no meeting found
|
console.log("🏗️ DEBUG: Error fetching meeting:", error);
|
||||||
|
console.log("🏗️ DEBUG: Error response:", error.response?.data);
|
||||||
|
console.log(
|
||||||
|
"🏗️ DEBUG: Setting up blank meeting for creation due to error",
|
||||||
|
);
|
||||||
this.newOrUpdatedMeetingInputs = this.blankMeeting();
|
this.newOrUpdatedMeetingInputs = this.blankMeeting();
|
||||||
|
console.log(
|
||||||
|
"🏗️ DEBUG: newOrUpdatedMeetingInputs set:",
|
||||||
|
this.newOrUpdatedMeetingInputs,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user