// Copyright 2018 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import type { IntlShape } from 'react-intl'; import type { AciString } from './ServiceId'; import type { LocaleDirection } from '../../app/locale'; import type { ICUJSXMessageParamsByKeyType, ICUStringMessageParamsByKeyType, } from '../../build/ICUMessageParams.d'; import type { HourCyclePreference, LocaleMessagesType } from './I18N'; export type StoryContextType = { authorAci?: AciString; timestamp: number; }; export type RenderTextCallbackType = (options: { text: string; key: number; }) => JSX.Element | string; export { ICUJSXMessageParamsByKeyType, ICUStringMessageParamsByKeyType }; export type LocalizerOptions = { /** * - 'default' will fence all string parameters with unicode bidi isolates * and balance the control characters within them * - 'strip' should only be used when all of the parameters are not * user-generated and should not contain any control characters. */ bidi?: 'default' | 'strip'; }; export type LocalizerType = { ( key: Key, ...values: ICUStringMessageParamsByKeyType[Key] extends undefined ? [params?: undefined, options?: LocalizerOptions] : [ params: ICUStringMessageParamsByKeyType[Key], options?: LocalizerOptions, ] ): string; getIntl(): IntlShape; getLocale(): string; getLocaleMessages(): LocaleMessagesType; getLocaleDirection(): LocaleDirection; getHourCyclePreference(): HourCyclePreference; // Storybook trackUsage(): void; stopTrackingUsage(): Array<[string, string]>; }; export enum SentMediaQualityType { 'standard' = 'standard', 'high' = 'high', } export enum ThemeType { 'light' = 'light', 'dark' = 'dark', } export enum SystemThemeType { light = 'light', dark = 'dark', } // These are strings so they can be interpolated into class names. export enum ScrollBehavior { Default = 'default', Hard = 'hard', } type InternalAssertProps< Result, Value, Missing = Omit, > = keyof Missing extends never ? Result : Result & { [key in keyof Required]: [ never, 'AssertProps: missing property', ]; }; export type AssertProps = InternalAssertProps; export type UnwrapPromise = Value extends Promise ? T : Value; export type BytesToStrings = Value extends Uint8Array ? string : { [Key in keyof Value]: BytesToStrings }; export type JSONWithUnknownFields = Value extends Record ? Readonly< { [Key in keyof Value]: JSONWithUnknownFields; } & { // Make sure that rest property is required to handle. __rest: never; } > : Value extends Array ? ReadonlyArray> : Value; export type WithRequiredProperties = Omit & Required>;