Make onboarding tour install-wide instead of per-browser
Persist onboardingCompleted flag server-side via /api/v1/config so the tour only auto-starts once per DashCaddy installation, not on every new browser that connects. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
constructor(storageKey = 'dashcaddy_onboarding') {
|
||||
this.storageKey = storageKey;
|
||||
this.storageVersion = '1.0';
|
||||
this.installOnboardingCompleted = typeof SITE !== 'undefined' && SITE.onboardingCompleted === true;
|
||||
|
||||
// Initialize storage if it doesn't exist
|
||||
this._initializeStorage();
|
||||
@@ -159,6 +160,36 @@
|
||||
return state.tourCompleted === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if onboarding has already been consumed for this install.
|
||||
* @returns {boolean} True if auto-onboarding should stay suppressed
|
||||
*/
|
||||
isInstallOnboardingCompleted() {
|
||||
return this.installOnboardingCompleted === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist install-wide onboarding completion so it only auto-starts once.
|
||||
* Manual Help Tour restarts are still allowed via local state reset.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async markInstallOnboardingCompleted() {
|
||||
if (this.installOnboardingCompleted) return;
|
||||
|
||||
this.installOnboardingCompleted = true;
|
||||
if (typeof SITE !== 'undefined') SITE.onboardingCompleted = true;
|
||||
|
||||
try {
|
||||
await secureFetch('/api/v1/config', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ onboardingCompleted: true })
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('[ProgressTracker] Failed to persist install onboarding state:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the entire tour as completed
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user