2020-08-19 03:08:58 +00:00
|
|
|
import {StringUnion} from 'app/common/StringUnion';
|
2022-09-06 01:51:57 +00:00
|
|
|
import {ThemePrefs} from 'app/common/ThemePrefs';
|
2020-08-19 03:08:58 +00:00
|
|
|
|
|
|
|
export const SortPref = StringUnion("name", "date");
|
|
|
|
export type SortPref = typeof SortPref.type;
|
|
|
|
|
|
|
|
export const ViewPref = StringUnion("list", "icons");
|
|
|
|
export type ViewPref = typeof ViewPref.type;
|
|
|
|
|
2020-08-04 15:52:56 +00:00
|
|
|
// A collection of preferences related to a user or org (or combination).
|
|
|
|
export interface Prefs {
|
2022-01-14 02:55:55 +00:00
|
|
|
// A dummy field used only in tests.
|
2020-08-04 15:52:56 +00:00
|
|
|
placeholder?: string;
|
|
|
|
}
|
|
|
|
|
2022-09-06 01:51:57 +00:00
|
|
|
// A collection of preferences related to a user.
|
2022-01-14 02:55:55 +00:00
|
|
|
export interface UserPrefs extends Prefs {
|
|
|
|
// Whether to ask the user to fill out a form about their use-case, on opening the DocMenu page.
|
|
|
|
// Set to true on first login, then reset when the form is closed, so that it only shows once.
|
|
|
|
showNewUserQuestions?: boolean;
|
2022-03-11 20:35:29 +00:00
|
|
|
// Whether to record a new sign-up event via Google Tag Manager. Set to true on first login, then
|
|
|
|
// reset on first page load (after the event is sent), so that it's only recorded once.
|
|
|
|
recordSignUpEvent?: boolean;
|
2022-09-06 01:51:57 +00:00
|
|
|
// Theme-related preferences.
|
|
|
|
theme?: ThemePrefs;
|
2023-03-14 16:00:38 +00:00
|
|
|
// List of deprecated warnings user have seen. Kept for historical reasons as some users have them in their prefs.
|
2022-10-21 10:55:01 +00:00
|
|
|
seenDeprecatedWarnings?: DeprecationWarning[];
|
|
|
|
// List of dismissedPopups user have seen.
|
|
|
|
dismissedPopups?: DismissedPopup[];
|
2022-12-20 02:06:39 +00:00
|
|
|
// Behavioral prompt preferences.
|
|
|
|
behavioralPrompts?: BehavioralPromptPrefs;
|
|
|
|
// Welcome popups a user has dismissed.
|
|
|
|
dismissedWelcomePopups?: DismissedReminder[];
|
2023-01-24 13:13:18 +00:00
|
|
|
// Localization support.
|
|
|
|
locale?: string;
|
2022-01-14 02:55:55 +00:00
|
|
|
}
|
2020-08-19 03:08:58 +00:00
|
|
|
|
2022-09-06 01:51:57 +00:00
|
|
|
// A collection of preferences related to a combination of user and org.
|
2020-08-19 03:08:58 +00:00
|
|
|
export interface UserOrgPrefs extends Prefs {
|
|
|
|
docMenuSort?: SortPref;
|
|
|
|
docMenuView?: ViewPref;
|
2020-09-10 02:48:11 +00:00
|
|
|
|
|
|
|
// List of example docs that the user has seen and dismissed the welcome card for.
|
|
|
|
// The numbers are the `id` from IExampleInfo in app/client/ui/ExampleInfo.
|
|
|
|
// By living in UserOrgPrefs, this applies only to the examples-containing org.
|
|
|
|
seenExamples?: number[];
|
2021-07-27 16:03:35 +00:00
|
|
|
|
2021-07-30 15:16:33 +00:00
|
|
|
// Whether the user should see the onboarding tour of Grist. False by default, since existing
|
|
|
|
// users should not see it. New users get this set to true when the user is created. This
|
|
|
|
// applies to the personal org only; the tour is currently only shown there.
|
|
|
|
showGristTour?: boolean;
|
|
|
|
|
2021-07-27 16:03:35 +00:00
|
|
|
// List of document IDs where the user has seen and dismissed the document tour.
|
|
|
|
seenDocTours?: string[];
|
2020-08-19 03:08:58 +00:00
|
|
|
}
|
|
|
|
|
2020-08-04 15:52:56 +00:00
|
|
|
export type OrgPrefs = Prefs;
|
2022-10-21 10:55:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* List of all deprecated warnings that user can see and dismiss.
|
|
|
|
* All of them are marked as seen for new users in FlexServer.ts (welcomeNewUser handler).
|
|
|
|
* For now we use then to mark which keyboard shortcuts are deprecated, so those keys
|
|
|
|
* are also used in commandList.js.
|
2023-03-14 16:00:38 +00:00
|
|
|
*
|
|
|
|
* Source code for this feature was deprecated itself :). Here is a link to the latest revision:
|
|
|
|
* https://github.com/gristlabs/grist-core/blob/ec20e7fb68786e10979f238c16c432c50a9a7464/app/client/components/DeprecatedCommands.ts
|
2022-10-21 10:55:01 +00:00
|
|
|
*/
|
|
|
|
export const DeprecationWarning = StringUnion(
|
2023-03-14 16:00:38 +00:00
|
|
|
// Those are not checked anymore. They are kept here for historical reasons (as some users have them marked as seen
|
|
|
|
// so they should not be reused).
|
|
|
|
// 'deprecatedInsertRowBefore',
|
|
|
|
// 'deprecatedInsertRecordAfter',
|
|
|
|
// 'deprecatedDeleteRecords',
|
2022-10-21 10:55:01 +00:00
|
|
|
);
|
|
|
|
export type DeprecationWarning = typeof DeprecationWarning.type;
|
|
|
|
|
2022-12-20 02:06:39 +00:00
|
|
|
export const BehavioralPrompt = StringUnion(
|
|
|
|
'referenceColumns',
|
|
|
|
'referenceColumnsConfig',
|
|
|
|
'rawDataPage',
|
|
|
|
'accessRules',
|
|
|
|
'filterButtons',
|
|
|
|
'nestedFiltering',
|
|
|
|
'pageWidgetPicker',
|
|
|
|
'pageWidgetPickerSelectBy',
|
|
|
|
'editCardLayout',
|
2023-01-13 07:39:33 +00:00
|
|
|
'addNew',
|
2023-03-27 17:25:25 +00:00
|
|
|
'rickRow',
|
2023-04-14 10:09:50 +00:00
|
|
|
'customURL',
|
2022-12-20 02:06:39 +00:00
|
|
|
);
|
|
|
|
export type BehavioralPrompt = typeof BehavioralPrompt.type;
|
|
|
|
|
|
|
|
export interface BehavioralPromptPrefs {
|
|
|
|
/** Defaults to false. */
|
|
|
|
dontShowTips: boolean;
|
|
|
|
/** List of tips that have been dismissed. */
|
|
|
|
dismissedTips: BehavioralPrompt[];
|
|
|
|
}
|
|
|
|
|
2022-10-21 10:55:01 +00:00
|
|
|
/**
|
|
|
|
* List of all popups that user can see and dismiss
|
|
|
|
*/
|
|
|
|
export const DismissedPopup = StringUnion(
|
2023-03-28 16:11:40 +00:00
|
|
|
'deleteRecords', // confirmation for deleting records keyboard shortcut,
|
|
|
|
'deleteFields', // confirmation for deleting columns keyboard shortcut,
|
|
|
|
'tutorialFirstCard', // first card of the tutorial,
|
2023-06-02 11:25:14 +00:00
|
|
|
'formulaHelpInfo', // formula help info shown in the popup editor,
|
|
|
|
'formulaAssistantInfo', // formula assistant info shown in the popup editor,
|
2022-10-21 10:55:01 +00:00
|
|
|
);
|
|
|
|
export type DismissedPopup = typeof DismissedPopup.type;
|
2022-12-20 02:06:39 +00:00
|
|
|
|
|
|
|
export const WelcomePopup = StringUnion(
|
|
|
|
'coachingCall',
|
|
|
|
);
|
|
|
|
export type WelcomePopup = typeof WelcomePopup.type;
|
|
|
|
|
|
|
|
export interface DismissedReminder {
|
|
|
|
/** The name of the popup. */
|
|
|
|
id: WelcomePopup;
|
|
|
|
/** Unix timestamp in ms when the popup was last dismissed. */
|
|
|
|
lastDismissedAt: number;
|
|
|
|
/** If non-null, Unix timestamp in ms when the popup will reappear. */
|
|
|
|
nextAppearanceAt: number | null;
|
|
|
|
/** The number of times this popup has been dismissed. */
|
|
|
|
timesDismissed: number;
|
|
|
|
}
|