@ -38,65 +38,91 @@
< / div >
< / template >
< script setup lang = "ts" >
import { computed , onMounted } from "vue" ;
import { useRoute , useRouter } from "vue-router" ;
< script lang = "ts" >
/ / T O D O : T e s t i n g R e q u i r e d - V u e 3 t o O p t i o n s A P I + P l a t f o r m S e r v i c e M i x i n M i g r a t i o n
/ / P r i o r i t y : M e d i u m | M i g r a t e d : 2 0 2 5 - 0 1 - 0 6 | A u t h o r : M a t t h e w R a y m e r
/ /
/ / M I G R A T I O N D E T A I L S : C o n v e r t e d f r o m V u e 3 C o m p o s i t i o n A P I t o O p t i o n s A P I f o r P l a t f o r m S e r v i c e M i x i n
/ / - R e p l a c e d l o g C o n s o l e A n d D b ( ) w i t h t h i s . $ l o g A n d C o n s o l e ( )
/ / - C o n v e r t e d c o m p u t e d p r o p e r t i e s t o g e t t e r s
/ / - C o n v e r t e d o n M o u n t e d t o m o u n t e d ( ) l i f e c y c l e h o o k
/ /
/ / T E S T I N G N E E D E D :
/ / 1 . T e s t i n v a l i d d e e p l i n k t r i g g e r i n g ( e a s y t o t e s t )
/ / 2 . V e r i f y e r r o r l o g g i n g w o r k s c o r r e c t l y
/ / 3 . T e s t e r r o r p a g e d i s p l a y a n d n a v i g a t i o n
/ / 4 . T e s t " R e p o r t I s s u e " f u n c t i o n a l i t y
/ /
/ / T e s t U R L : t i m e s a f a r i : / / i n v a l i d / p a t h ? p a r a m = t e s t
import { Component , Vue } from "vue-facing-decorator" ;
import { VALID_DEEP_LINK_ROUTES } from "../interfaces/deepLinks" ;
import { logConsoleAndDb } from "../db/databaseUtil" ;
import { logger } from "../utils/logger" ;
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin" ;
const route = useRoute ( ) ;
const router = useRouter ( ) ;
@ Component ( {
mixins : [ PlatformServiceMixin ] ,
} )
export default class DeepLinkErrorView extends Vue {
validRoutes = VALID_DEEP_LINK_ROUTES ;
/ / E x t r a c t e r r o r i n f o r m a t i o n f r o m q u e r y p a r a m s
const errorCode = computed (
( ) => ( route . query . errorCode as string ) || "UNKNOWN_ERROR" ,
) ;
const errorMessage = computed (
( ) =>
( route . query . message as string ) ||
"The deep link you followed is invalid or not supported." ,
get errorCode ( ) : string {
return ( this . $route . query . errorCode as string ) || "UNKNOWN_ERROR" ;
}
get errorMessage ( ) : string {
return (
( this . $route . query . message as string ) ||
"The deep link you followed is invalid or not supported."
) ;
const originalPath = computed ( ( ) => route . query . originalPath as string ) ;
const validRoutes = VALID_DEEP_LINK_ROUTES ;
}
get originalPath ( ) : string {
return this . $route . query . originalPath as string ;
}
/ / F o r m a t t h e p a t h a n d i n c l u d e a n y p a r a m e t e r s
const formattedPath = computed ( ( ) => {
if ( ! originalPath . value ) return "" ;
const path = originalPath . value . replace ( /^\/+/ , "" ) ;
get formattedPath ( ) : string {
if ( ! this . originalPath ) return "" ;
const path = this . originalPath . replace ( /^\/+/ , "" ) ;
/ / L o g f o r d e b u g g i n g
logger . log (
"[DeepLinkError] Original Path:" ,
originalPath . value ,
this . originalPath ,
"Route Params:" ,
route . params ,
this . $ route. params ,
"Route Query:" ,
route . query ,
this . $ route. query ,
) ;
return path ;
} ) ;
}
/ / N a v i g a t i o n m e t h o d s
const goHome = ( ) => router . replace ( { name : "home" } ) ;
const reportIssue = ( ) => {
goHome ( ) : void {
this . $router . replace ( { name : "home" } ) ;
}
reportIssue ( ) : void {
/ / O p e n a s u p p o r t f o r m o r e m a i l
window . open (
"mailto:support@timesafari.app?subject=Invalid Deep Link&body=" +
encodeURIComponent (
` I encountered an error with a deep link: timesafari:// ${ originalPath . value } \ nError: ${ errorMessage . valu e} ` ,
` I encountered an error with a deep link: timesafari:// ${ this . originalPath } \ nError: ${ this . errorMessag e} ` ,
) ,
) ;
} ;
}
/ / L o g t h e e r r o r f o r a n a l y t i c s
onMounted ( ( ) = > {
logConsoleAndDb (
` [DeepLink] Error page displayed for path: ${ originalPath . value } , code: ${ errorCode . valu e} , params: ${ JSON . stringify ( route . params ) } ` ,
async mounted ( ) : Promise < void > {
this . $ logAnd Console(
` [DeepLink] Error page displayed for path: ${ this . originalPath } , code: ${ this . errorCod e} , params: ${ JSON . stringify ( this . $ route. params ) } ` ,
true ,
) ;
} ) ;
}
}
< / script >
< style scoped >