mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-17 11:45:05 +02:00
Chore/v2/onboarding flow cleanup (#5065)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import type { LicenseNotice } from '@app/types/types';
|
||||
|
||||
export const ONBOARDING_SESSION_BLOCK_KEY = 'stirling-onboarding-session-active';
|
||||
export const ONBOARDING_SESSION_EVENT = 'stirling:onboarding-session-started';
|
||||
export const SERVER_LICENSE_REQUEST_EVENT = 'stirling:server-license-requested';
|
||||
export const UPGRADE_BANNER_TEST_EVENT = 'stirling:upgrade-banner-test';
|
||||
export const UPGRADE_BANNER_ALERT_EVENT = 'stirling:upgrade-banner-alert';
|
||||
export const START_TOUR_EVENT = 'stirling:start-tour';
|
||||
export const TOUR_STATE_EVENT = 'stirling:tour-state';
|
||||
|
||||
export interface ServerLicenseRequestPayload {
|
||||
licenseNotice?: Partial<LicenseNotice>;
|
||||
@@ -25,3 +25,29 @@ export interface UpgradeBannerAlertPayload {
|
||||
freeTierLimit?: number;
|
||||
}
|
||||
|
||||
export type TourType = 'admin' | 'tools';
|
||||
|
||||
export interface StartTourPayload {
|
||||
tourType: TourType;
|
||||
}
|
||||
|
||||
export interface TourStatePayload {
|
||||
isOpen: boolean;
|
||||
}
|
||||
|
||||
/** Helper to dispatch the start tour event */
|
||||
export function requestStartTour(tourType: TourType): void {
|
||||
if (typeof window === 'undefined') return;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent<StartTourPayload>(START_TOUR_EVENT, { detail: { tourType } })
|
||||
);
|
||||
}
|
||||
|
||||
/** Helper to dispatch tour state changes (for hiding cookie consent during tour) */
|
||||
export function dispatchTourState(isOpen: boolean): void {
|
||||
if (typeof window === 'undefined') return;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent<TourStatePayload>(TOUR_STATE_EVENT, { detail: { isOpen } })
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Route constants used across the application
|
||||
*/
|
||||
|
||||
/**
|
||||
* Routes where onboarding, cookie consent, and upgrade banners should not appear.
|
||||
* These are authentication-related pages where users are not yet logged in or
|
||||
* the main app chrome is not displayed.
|
||||
*/
|
||||
export const AUTH_ROUTES = [
|
||||
'/login',
|
||||
'/signup',
|
||||
'/auth',
|
||||
'/invite',
|
||||
'/forgot-password',
|
||||
'/reset-password',
|
||||
];
|
||||
|
||||
/**
|
||||
* Check if a pathname matches any auth route
|
||||
*/
|
||||
export function isAuthRoute(pathname: string): boolean {
|
||||
return AUTH_ROUTES.some((route) => pathname.startsWith(route));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user