Files
Stirling-PDF/frontend/src/core/constants/events.ts
T
0064c1866e Shorten onbaording (#5198)
Also added `enableDesktopInstallSlide` flag in `settings.yml` to hide
the download for desktop page in the onboarding.

---------

Co-authored-by: James Brunton <[email protected]>
2025-12-15 09:31:41 +00:00

54 lines
1.6 KiB
TypeScript

import type { LicenseNotice } from '@app/types/types';
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>;
deferUntilTourComplete?: boolean;
selfReportedAdmin?: boolean;
}
export type UpgradeBannerTestScenario = 'friendly' | 'urgent-admin' | 'urgent-user' | null;
export interface UpgradeBannerTestPayload {
scenario: UpgradeBannerTestScenario;
}
export interface UpgradeBannerAlertPayload {
active: boolean;
audience?: 'admin' | 'user';
totalUsers?: number | null;
freeTierLimit?: number;
}
export type TourType = 'admin' | 'tools' | 'whatsnew';
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 } })
);
}