@ -30,12 +30,12 @@ interface StarredProjectsResponse {
// Your existing TimeSafari PWA class structure
class TimeSafariHomeView {
// Your existing properties
activeDid : string = '' ;
activeDid = '' ;
starredPlanHandleIds : string [ ] = [ ] ;
lastAckedStarredPlanChangesJwtId : string = '' ;
numNewStarredProjectChanges : number = 0 ;
newStarredProjectChangesHitLimit : boolean = false ;
apiServer : string = 'https://endorser.ch' ;
lastAckedStarredPlanChangesJwtId = '' ;
numNewStarredProjectChanges = 0 ;
newStarredProjectChangesHitLimit = false ;
apiServer = 'https://endorser.ch' ;
axios : AxiosInstance ;
// Plugin integration
@ -51,7 +51,7 @@ class TimeSafariHomeView {
* /
async setupDailyNotification ( ) : Promise < void > {
try {
console . log ( 'Setting up DailyNotification for TimeSafari PWA...' ) ;
// Setup DailyNotification for TimeSafari PWA
// Step 1: Configure the DailyNotification plugin
await DailyNotification . configure ( {
@ -214,7 +214,7 @@ class TimeSafariHomeView {
channel : 'timesafari_community_updates'
} ) ;
console . log ( 'DailyNotification setup completed successfully!' ) ;
// DailyNotification setup completed successfully
} catch ( error ) {
console . error ( 'Failed to setup DailyNotification:' , error ) ;
@ -232,22 +232,24 @@ class TimeSafariHomeView {
if ( this . activeDid && this . starredPlanHandleIds . length > 0 ) {
try {
// Use plugin's enhanced fetching with same interface as your existing code
const starredProjectChanges = await this . integrationService ! . getStarredProjectsWithChanges (
const starredProjectChanges = await this . integrationService ? . getStarredProjectsWithChanges (
this . activeDid ,
this . starredPlanHandleIds ,
this . lastAckedStarredPlanChangesJwtId
) ;
if ( ! starredProjectChanges ) {
this . numNewStarredProjectChanges = 0 ;
this . newStarredProjectChangesHitLimit = false ;
return ;
}
// Same handling as your existing code
this . numNewStarredProjectChanges = starredProjectChanges . data . length ;
this . newStarredProjectChangesHitLimit = starredProjectChanges . hitLimit ;
// Enhanced logging (optional)
console . log ( 'Starred projects loaded successfully:' , {
count : this.numNewStarredProjectChanges ,
hitLimit : this.newStarredProjectChangesHitLimit ,
planIds : this.starredPlanHandleIds.length
} ) ;
// Starred projects loaded successfully
} catch ( error ) {
// Same error handling as your existing code
@ -273,10 +275,7 @@ class TimeSafariHomeView {
this . updateStarredProjectsUI ( data ) ;
// Enhanced logging (optional)
console . log ( 'Starred projects success callback:' , {
count : data.data.length ,
hitLimit : data.hitLimit
} ) ;
// Starred projects success callback
}
async handleStarredProjectsError ( error : Error ) : Promise < void > {
@ -293,17 +292,17 @@ class TimeSafariHomeView {
} ) ;
}
async handleStarredProjectsComplete ( result : unknown ) : Promise < void > {
async handleStarredProjectsComplete ( _ result : unknown ) : Promise < void > {
// Handle completion
console . log ( 'Starred projects fetch completed:' , result ) ;
// Starred projects fetch completed
}
/ * *
* Your existing methods ( unchanged )
* /
private updateStarredProjectsUI ( data : StarredProjectsResponse ) : void {
private updateStarredProjectsUI ( _ data : StarredProjectsResponse ) : void {
// Your existing UI update logic
console . log ( 'Updating UI with starred projects data:' , data ) ;
// Updating UI with starred projects data
}
private getTimeSafariStorageAdapter ( ) : unknown {
@ -320,10 +319,10 @@ export async function setupDailyNotificationForTimeSafari(
activeDid : string ,
starredPlanHandleIds : string [ ] ,
lastAckedJwtId : string ,
apiServer : string = 'https://endorser.ch'
apiServer = 'https://endorser.ch'
) : Promise < TimeSafariHomeView > {
console . log ( 'Setting up DailyNotification for TimeSafari PWA...' ) ;
// Setting up DailyNotification for TimeSafari PWA
// Create your existing HomeView instance
const homeView = new TimeSafariHomeView ( axiosInstance ) ;
@ -340,14 +339,14 @@ export async function setupDailyNotificationForTimeSafari(
// Test the enhanced method
await homeView . loadNewStarredProjectChanges ( ) ;
console . log ( 'DailyNotification setup completed successfully!' ) ;
// DailyNotification setup completed successfully
return homeView ;
}
// Vue.js component integration example
export const TimeSafariDailyNotificationMixin = {
data() {
data ( ) : Record < string , unknown > {
return {
// Your existing data
activeDid : '' ,
@ -362,13 +361,13 @@ export const TimeSafariDailyNotificationMixin = {
} ;
} ,
async mounted() {
async mounted ( ) : Promise < void > {
// Setup DailyNotification when component mounts
await this . setupDailyNotification ( ) ;
} ,
methods : {
async setupDailyNotification() {
async setupDailyNotification ( ) : Promise < void > {
try {
// Configure DailyNotification plugin
await DailyNotification . configure ( {
@ -415,7 +414,7 @@ export const TimeSafariDailyNotificationMixin = {
} ,
// Your existing methods (enhanced)
async loadNewStarredProjectChanges() {
async loadNewStarredProjectChanges ( ) : Promise < void > {
if ( this . activeDid && this . starredPlanHandleIds . length > 0 ) {
try {
const starredProjectChanges = await this . integrationService . getStarredProjectsWithChanges (
@ -438,24 +437,24 @@ export const TimeSafariDailyNotificationMixin = {
}
} ,
handleStarredProjectsSuccess ( data : StarredProjectsResponse ) {
handleStarredProjectsSuccess ( data : StarredProjectsResponse ) : void {
this . numNewStarredProjectChanges = data . data . length ;
this . newStarredProjectChangesHitLimit = data . hitLimit ;
this . updateStarredProjectsUI ( data ) ;
} ,
handleStarredProjectsError ( error : Error ) {
handleStarredProjectsError ( error : Error ) : void {
console . warn ( '[HomeView] Failed to load starred project changes:' , error ) ;
this . numNewStarredProjectChanges = 0 ;
this . newStarredProjectChangesHitLimit = false ;
} ,
// Your existing methods
updateStarredProjectsUI ( data : StarredProjectsResponse ) {
updateStarredProjectsUI ( _ data : StarredProjectsResponse ) : void {
// Your existing UI update logic
} ,
getTimeSafariStorageAdapter() {
getTimeSafariStorageAdapter ( ) : unknown {
// Your existing storage adapter
return { } ;
}