@ -91,13 +91,95 @@
name : 'shared-photo' ,
query : { fileName } ,
} "
class = "block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_ rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md mb-2 mt-2"
class = "block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md mb-2 mt-2"
data - testId = "fileUploadButton"
>
Go to Shared Page
< / r o u t e r - l i n k >
< / div >
<!-- URL Flow Testing Section -- >
< div class = "mt-8" >
< h2 class = "text-xl font-bold mb-4" > URL Flow Testing < / h2 >
< p class = "text-sm text-gray-600 mb-3" >
Test claim and partner server URL flow from initialization to change
propagation .
< / p >
< div class = "space-y-4" >
< div class = "p-4 border border-gray-300 rounded-md bg-gray-50" >
< h3 class = "font-semibold mb-2" > Current URL State < / h3 >
< div class = "space-y-2 text-sm" >
< div >
< strong > API Server : < / strong >
< span class = "font-mono" > { { apiServer || "Not Set" } } < / span >
< / div >
< div >
< strong > Partner API Server : < / strong >
< span class = "font-mono" > { { partnerApiServer || "Not Set" } } < / span >
< / div >
< div >
< strong > Active DID : < / strong >
< span class = "font-mono" > { { activeDid || "Not Set" } } < / span >
< / div >
< div >
< strong > Platform : < / strong >
< span class = "font-mono" > { { getCurrentPlatform ( ) } } < / span >
< / div >
< / div >
< / div >
< div class = "space-y-2" >
< button
: class = "primaryButtonClasses"
: disabled = "isUrlTestRunning"
@ click = "testUrlFlow()"
>
{ { isUrlTestRunning ? "Testing..." : "Test URL Flow" } }
< / button >
< button :class ="secondaryButtonClasses" @click ="changeApiServer()" >
Change API Server ( Test → Prod )
< / button >
< button
: class = "secondaryButtonClasses"
@ click = "changePartnerApiServer()"
>
Change Partner API Server ( Test → Prod )
< / button >
< button :class ="warningButtonClasses" @click ="resetToDefaults()" >
Reset to Defaults
< / button >
< button :class ="secondaryButtonClasses" @click ="refreshSettings()" >
Refresh Settings
< / button >
< button
: class = "secondaryButtonClasses"
@ click = "logEnvironmentState()"
>
Log Environment State
< / button >
< / div >
< div class = "p-4 border border-gray-300 rounded-md bg-gray-50" >
< h3 class = "font-semibold mb-2" > URL Flow Test Results < / h3 >
< div class = "max-h-64 overflow-y-auto space-y-2" >
< div
v - for = "(result, index) in urlTestResults"
: key = "index"
class = "p-2 border border-gray-200 rounded text-xs font-mono bg-white"
>
{ { result } }
< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "mt-8" >
< h2 class = "text-xl font-bold mb-4" > Passkeys < / h2 >
See console for results .
@ -326,6 +408,11 @@ export default class Help extends Vue {
showEntityGridTest = false ;
showPlatformServiceTest = false ;
/ / f o r U R L f l o w t e s t i n g
isUrlTestRunning = false ;
urlTestResults : string [ ] = [ ] ;
partnerApiServer : string | undefined ;
/ * *
* Computed properties for template streamlining
* Eliminates repeated classes and logic in template
@ -534,24 +621,93 @@ export default class Help extends Vue {
}
/ * *
* Component initialization
*
* Loads user settings and account information for testing interface
* Uses PlatformServiceMixin for database access
* /
async mounted ( ) {
const settings = await this . $accountSettings ( ) ;
this . activeDid = settings . activeDid || "" ;
this . apiServer = settings . apiServer || "" ;
this . userName = settings . firstName ;
const account = await retrieveAccountMetadata ( this . activeDid ) ;
if ( this . activeDid ) {
if ( account ) {
this . credIdHex = account . passkeyCredIdHex as string ;
} else {
alert ( "No account found for DID " + this . activeDid ) ;
logger . info (
"[TestView] 🚀 Component mounting - starting URL flow tracking" ,
) ;
/ / B o o t - t i m e l o g g i n g f o r i n i t i a l c o n f i g u r a t i o n
logger . info ( "[TestView] 🌍 Boot-time configuration detected:" , {
platform : process . env . VITE_PLATFORM ,
defaultEndorserApiServer : process . env . VITE_DEFAULT_ENDORSER_API_SERVER ,
defaultPartnerApiServer : process . env . VITE_DEFAULT_PARTNER_API_SERVER ,
nodeEnv : process . env . NODE_ENV ,
timestamp : new Date ( ) . toISOString ( ) ,
} ) ;
try {
/ / T r a c k s e t t i n g s l o a d i n g
logger . info ( "[TestView] 📥 Loading account settings..." ) ;
const settings = await this . $accountSettings ( ) ;
logger . info ( "[TestView] 📊 Settings loaded:" , {
activeDid : settings . activeDid ,
apiServer : settings . apiServer ,
partnerApiServer : settings . partnerApiServer ,
isRegistered : settings . isRegistered ,
firstName : settings . firstName ,
} ) ;
/ / U p d a t e c o m p o n e n t s t a t e
this . activeDid = settings . activeDid || "" ;
this . apiServer = settings . apiServer || "" ;
this . partnerApiServer = settings . partnerApiServer || "" ;
this . userName = settings . firstName ;
logger . info ( "[TestView] ✅ Component state updated:" , {
activeDid : this . activeDid ,
apiServer : this . apiServer ,
partnerApiServer : this . partnerApiServer ,
} ) ;
/ / L o a d a c c o u n t m e t a d a t a
if ( this . activeDid ) {
logger . info (
"[TestView] 🔍 Loading account metadata for DID:" ,
this . activeDid ,
) ;
const account = await retrieveAccountMetadata ( this . activeDid ) ;
if ( account ) {
this . credIdHex = account . passkeyCredIdHex as string ;
logger . info ( "[TestView] ✅ Account metadata loaded:" , {
did : account . did ,
hasPasskey : ! ! account . passkeyCredIdHex ,
passkeyId : account . passkeyCredIdHex ,
} ) ;
} else {
logger . warn (
"[TestView] ⚠️ No account found for DID:" ,
this . activeDid ,
) ;
alert ( "No account found for DID " + this . activeDid ) ;
}
}
logger . info ( "[TestView] 🎯 Component initialization complete:" , {
activeDid : this . activeDid ,
apiServer : this . apiServer ,
partnerApiServer : this . partnerApiServer ,
hasPasskey : ! ! this . credIdHex ,
platform : this . getCurrentPlatform ( ) ,
} ) ;
} catch ( error ) {
logger . error (
"[TestView] ❌ Error during component initialization:" ,
error ,
) ;
this . $notify (
{
group : "error" ,
type : "error" ,
title : "Initialization Error" ,
text : ` Failed to initialize component: ${ error instanceof Error ? error . message : String ( error ) } ` ,
} ,
5000 ,
) ;
}
}
@ -824,5 +980,276 @@ export default class Help extends Vue {
) ;
}
}
/ * *
* Tests the URL flow from initialization to change propagation .
* This simulates the flow where a user ' s DID is set , and then the
* claim and partner server URLs are updated .
* /
public async testUrlFlow ( ) {
this . isUrlTestRunning = true ;
this . urlTestResults = [ ] ;
try {
logger . info ( "[TestView] 🔬 Starting comprehensive URL flow test" ) ;
this . addUrlTestResult ( "🚀 Starting URL flow test..." ) ;
/ / T e s t 1 : C u r r e n t s t a t e
this . addUrlTestResult ( ` 📊 Current State: ` ) ;
this . addUrlTestResult ( ` - API Server: ${ this . apiServer || "Not Set" } ` ) ;
this . addUrlTestResult (
` - Partner API Server: ${ this . partnerApiServer || "Not Set" } ` ,
) ;
this . addUrlTestResult ( ` - Active DID: ${ this . activeDid || "Not Set" } ` ) ;
this . addUrlTestResult ( ` - Platform: ${ this . getCurrentPlatform ( ) } ` ) ;
/ / T e s t 2 : L o a d f r e s h s e t t i n g s
this . addUrlTestResult ( ` \ n📥 Testing Settings Loading: ` ) ;
const startTime = Date . now ( ) ;
const settings = await this . $accountSettings ( ) ;
const loadTime = Date . now ( ) - startTime ;
this . addUrlTestResult ( ` - Settings loaded in ${ loadTime } ms ` ) ;
this . addUrlTestResult (
` - API Server from settings: ${ settings . apiServer || "Not Set" } ` ,
) ;
this . addUrlTestResult (
` - Partner API Server from settings: ${ settings . partnerApiServer || "Not Set" } ` ,
) ;
/ / T e s t 3 : D a t a b a s e q u e r y
this . addUrlTestResult ( ` \ n💾 Testing Database Query: ` ) ;
const dbStartTime = Date . now ( ) ;
const dbResult = await this . $dbQuery (
"SELECT apiServer, partnerApiServer, activeDid FROM settings WHERE id = ? OR accountDid = ?" ,
[ 1 , this . activeDid || "" ] ,
) ;
const dbTime = Date . now ( ) - dbStartTime ;
if ( dbResult ? . values ) {
this . addUrlTestResult ( ` - Database query completed in ${ dbTime } ms ` ) ;
this . addUrlTestResult (
` - Raw DB values: ${ JSON . stringify ( dbResult . values ) } ` ,
) ;
} else {
this . addUrlTestResult (
` - Database query failed or returned no results ` ,
) ;
}
/ / T e s t 4 : E n v i r o n m e n t v a r i a b l e s
this . addUrlTestResult ( ` \ n🌍 Testing Environment Variables: ` ) ;
this . addUrlTestResult (
` - VITE_PLATFORM: ${ import . meta . env . VITE_PLATFORM || "Not Set" } ` ,
) ;
this . addUrlTestResult (
` - VITE_DEFAULT_ENDORSER_API_SERVER: ${ import . meta . env . VITE_DEFAULT_ENDORSER_API_SERVER || "Not Set" } ` ,
) ;
this . addUrlTestResult (
` - VITE_DEFAULT_PARTNER_API_SERVER: ${ import . meta . env . VITE_DEFAULT_PARTNER_API_SERVER || "Not Set" } ` ,
) ;
/ / T e s t 5 : C o n s t a n t s
this . addUrlTestResult ( ` \ n📋 Testing App Constants: ` ) ;
this . addUrlTestResult (
` - PROD_ENDORSER_API_SERVER: ${ AppString . PROD_ENDORSER_API_SERVER } ` ,
) ;
this . addUrlTestResult (
` - PROD_PARTNER_API_SERVER: ${ AppString . PROD_PARTNER_API_SERVER } ` ,
) ;
/ / T e s t 6 : C h a n g e d e t e c t i o n
this . addUrlTestResult ( ` \ n🔄 Testing Change Detection: ` ) ;
const originalApiServer = this . apiServer ;
const originalPartnerServer = this . partnerApiServer ;
/ / S i m u l a t e a c h a n g e
this . addUrlTestResult ( ` - Original API Server: ${ originalApiServer } ` ) ;
this . addUrlTestResult (
` - Original Partner Server: ${ originalPartnerServer } ` ,
) ;
/ / T e s t 7 : S e t t i n g s u p d a t e
this . addUrlTestResult ( ` \ n💾 Testing Settings Update: ` ) ;
const testChanges = {
apiServer :
originalApiServer === "https://api.endorser.ch"
? "https://test-api.endorser.ch"
: "https://api.endorser.ch" ,
} ;
this . addUrlTestResult (
` - Attempting to change API Server to: ${ testChanges . apiServer } ` ,
) ;
const updateResult = await this . $saveSettings ( testChanges ) ;
this . addUrlTestResult (
` - Update result: ${ updateResult ? "Success" : "Failed" } ` ,
) ;
/ / T e s t 8 : V e r i f y c h a n g e p r o p a g a t i o n
this . addUrlTestResult ( ` \ n✅ Testing Change Propagation: ` ) ;
const newSettings = await this . $accountSettings ( ) ;
this . addUrlTestResult (
` - New API Server from settings: ${ newSettings . apiServer || "Not Set" } ` ,
) ;
this . addUrlTestResult (
` - Component state API Server: ${ this . apiServer || "Not Set" } ` ,
) ;
this . addUrlTestResult (
` - Change propagated: ${ newSettings . apiServer === this . apiServer ? "Yes" : "No" } ` ,
) ;
/ / T e s t 9 : R e v e r t c h a n g e s
this . addUrlTestResult ( ` \ n🔄 Reverting Changes: ` ) ;
const revertResult = await this . $saveSettings ( {
apiServer : originalApiServer ,
} ) ;
this . addUrlTestResult (
` - Revert result: ${ revertResult ? "Success" : "Failed" } ` ,
) ;
/ / T e s t 1 0 : F i n a l v e r i f i c a t i o n
this . addUrlTestResult ( ` \ n🎯 Final Verification: ` ) ;
const finalSettings = await this . $accountSettings ( ) ;
this . addUrlTestResult (
` - Final API Server: ${ finalSettings . apiServer || "Not Set" } ` ,
) ;
this . addUrlTestResult (
` - Matches original: ${ finalSettings . apiServer === originalApiServer ? "Yes" : "No" } ` ,
) ;
this . addUrlTestResult ( ` \ n✅ URL flow test completed successfully! ` ) ;
logger . info ( "[TestView] ✅ URL flow test completed successfully" ) ;
} catch ( error ) {
const errorMsg = ` ❌ URL flow test failed: ${ error instanceof Error ? error . message : String ( error ) } ` ;
this . addUrlTestResult ( errorMsg ) ;
logger . error ( "[TestView] ❌ URL flow test failed:" , error ) ;
} finally {
this . isUrlTestRunning = false ;
}
}
/ * *
* Adds a result to the URL test results array .
* /
private addUrlTestResult ( message : string ) {
this . urlTestResults . push ( message ) ;
}
/ * *
* Changes the API server to the production URL .
* /
public changeApiServer ( ) {
const currentServer = this . apiServer ;
const newServer =
currentServer === "https://api.endorser.ch"
? "https://test-api.endorser.ch"
: "https://api.endorser.ch" ;
logger . info ( "[TestView] 🔄 Changing API server:" , {
from : currentServer ,
to : newServer ,
} ) ;
this . apiServer = newServer ;
this . addUrlTestResult (
` API Server changed from ${ currentServer } to ${ newServer } ` ,
) ;
}
/ * *
* Changes the partner API server to the production URL .
* /
public changePartnerApiServer ( ) {
const currentServer = this . partnerApiServer ;
const newServer =
currentServer === "https://partner-api.endorser.ch"
? "https://test-partner-api.endorser.ch"
: "https://partner-api.endorser.ch" ;
logger . info ( "[TestView] 🔄 Changing partner API server:" , {
from : currentServer ,
to : newServer ,
} ) ;
this . partnerApiServer = newServer ;
this . addUrlTestResult (
` Partner API Server changed from ${ currentServer } to ${ newServer } ` ,
) ;
}
/ * *
* Resets all URL - related settings to their initial values .
* /
public resetToDefaults ( ) {
this . apiServer = AppString . TEST_ENDORSER_API_SERVER ;
this . partnerApiServer = AppString . TEST_PARTNER_API_SERVER ;
this . activeDid = "" ;
this . addUrlTestResult ( "URL Flow Test Results Reset to Defaults." ) ;
}
/ * *
* Refreshes settings from the database to verify changes .
* /
public async refreshSettings ( ) {
try {
logger . info ( "[TestView] 🔄 Refreshing settings from database" ) ;
const settings = await this . $accountSettings ( ) ;
/ / U p d a t e c o m p o n e n t s t a t e
this . apiServer = settings . apiServer || "" ;
this . partnerApiServer = settings . partnerApiServer || "" ;
logger . info ( "[TestView] ✅ Settings refreshed:" , {
apiServer : this . apiServer ,
partnerApiServer : this . partnerApiServer ,
} ) ;
this . addUrlTestResult (
` Settings refreshed - API Server: ${ this . apiServer } , Partner API Server: ${ this . partnerApiServer } ` ,
) ;
} catch ( error ) {
logger . error ( "[TestView] ❌ Error refreshing settings:" , error ) ;
this . addUrlTestResult (
` Error refreshing settings: ${ error instanceof Error ? error . message : String ( error ) } ` ,
) ;
}
}
/ * *
* Logs the current environment state to the console .
* /
public logEnvironmentState ( ) {
logger . info ( "[TestView] 🌐 Current Environment State:" , {
VITE_PLATFORM : import . meta . env . VITE_PLATFORM ,
VITE_DEFAULT_ENDORSER_API_SERVER : import . meta . env
. VITE_DEFAULT_ENDORSER_API_SERVER ,
VITE_DEFAULT_PARTNER_API_SERVER : import . meta . env
. VITE_DEFAULT_PARTNER_API_SERVER ,
NODE_ENV : process . env . NODE_ENV ,
activeDid : this . activeDid ,
apiServer : this . apiServer ,
partnerApiServer : this . partnerApiServer ,
} ) ;
this . $notify ( {
group : "info" ,
type : "info" ,
title : "Environment State Logged" ,
text : "Current environment state logged to console." ,
} ) ;
}
/ * *
* Gets the current platform based on the API server .
* /
public getCurrentPlatform ( ) : string {
if ( this . apiServer ? . includes ( AppString . PROD_ENDORSER_API_SERVER ) ) {
return "Production" ;
} else if ( this . apiServer ? . includes ( AppString . TEST_ENDORSER_API_SERVER ) ) {
return "Test" ;
} else {
return "Unknown" ;
}
}
}
< / script >