2023-07-02 09:28:41 +00:00
|
|
|
import type Shepherd from "shepherd.js";
|
|
|
|
|
2023-07-02 10:04:29 +00:00
|
|
|
/** All available tour IDs. */
|
2023-07-02 09:28:41 +00:00
|
|
|
export enum TourId {
|
|
|
|
InterfaceAccountSettings = "interface-account-settings",
|
|
|
|
InterfaceHomepage = "interface-homepage",
|
|
|
|
Introduction = "introduction",
|
|
|
|
}
|
|
|
|
|
2023-07-02 10:04:29 +00:00
|
|
|
/** Requirements of a tour to be checked before the tour is started. */
|
2023-07-02 09:28:41 +00:00
|
|
|
export type TourRequirement = {
|
2023-07-02 10:04:29 +00:00
|
|
|
/**
|
|
|
|
* This tour requires that the user must be logged in. Only set this to true
|
|
|
|
* if the tour goes to pages only accessible by logged in users.
|
|
|
|
*/
|
2023-07-02 09:28:41 +00:00
|
|
|
mustBeLoggedIn: boolean;
|
2023-07-02 10:04:29 +00:00
|
|
|
|
|
|
|
/** The {@link URL.pathname} to run the tour at. */
|
2023-07-02 09:28:41 +00:00
|
|
|
path: string;
|
|
|
|
};
|
|
|
|
|
2023-07-02 10:04:29 +00:00
|
|
|
/** An individual tour step event handler. */
|
2023-07-02 09:28:41 +00:00
|
|
|
export type TourStepEvent = {
|
2023-07-02 10:04:29 +00:00
|
|
|
/**
|
|
|
|
* - The "show" event will be called when the step is displayed.
|
|
|
|
* - The "destroy" event will be called when the step is finished.
|
|
|
|
*/
|
2023-07-02 09:28:41 +00:00
|
|
|
event: "show" | "destroy";
|
2023-07-02 10:04:29 +00:00
|
|
|
/** The handler for this step event. */
|
2023-07-02 09:28:41 +00:00
|
|
|
handler: Parameters<Shepherd.Step["on"]>[1];
|
|
|
|
};
|
|
|
|
|
2023-07-02 10:04:29 +00:00
|
|
|
/** All the tour data collected in one place. */
|
2023-07-02 09:28:41 +00:00
|
|
|
export type TourData = {
|
2023-07-02 10:04:29 +00:00
|
|
|
/** A short description of the tour for use in the options page. */
|
2023-07-02 09:28:41 +00:00
|
|
|
description: string;
|
2023-07-02 10:04:29 +00:00
|
|
|
|
|
|
|
/** Whether this tour should be shown in the options page. */
|
2023-07-02 09:28:41 +00:00
|
|
|
displayInOptionsPage: boolean;
|
2023-07-02 10:04:29 +00:00
|
|
|
|
|
|
|
/** All event handlers to be added to this tour's steps. */
|
2023-07-02 09:28:41 +00:00
|
|
|
eventHandlers: Array<{
|
|
|
|
eventHandlers: TourStepEvent[];
|
|
|
|
stepId: string;
|
|
|
|
}>;
|
2023-07-02 10:04:29 +00:00
|
|
|
|
|
|
|
/** The unique ID for this tour. */
|
2023-07-02 09:28:41 +00:00
|
|
|
id: TourId;
|
2023-07-02 10:04:29 +00:00
|
|
|
|
|
|
|
/** The requirements this tour must match before starting it. */
|
2023-07-02 09:28:41 +00:00
|
|
|
requirements: TourRequirement;
|
2023-07-02 10:04:29 +00:00
|
|
|
|
2023-07-03 12:11:46 +00:00
|
|
|
/** A function that returns all the steps this tour will take. */
|
|
|
|
steps: () => Shepherd.Step.StepOptions[];
|
2023-07-02 10:04:29 +00:00
|
|
|
|
|
|
|
/** The title of the tour for use in the options page. */
|
2023-07-02 09:28:41 +00:00
|
|
|
title: string;
|
|
|
|
};
|