apptise-component
Version:
React components for Apprise notification channel configuration
105 lines • 2.82 kB
TypeScript
/**
* Types for Apprise notification channel configuration
*/
export interface TemplateToken {
name: string;
type: 'string' | 'int' | 'float' | 'bool' | 'list:string';
required?: boolean;
private?: boolean;
default?: any;
min?: number;
max?: number;
regex?: [string, string];
map_to?: string;
prefix?: string;
alias_of?: string | string[];
}
export interface TemplateArg {
name: string;
type: 'string' | 'int' | 'float' | 'bool' | 'list:string' | 'choice:string';
default?: any;
min?: number;
max?: number;
map_to?: string;
alias_of?: string | string[];
values?: readonly string[];
}
export interface NotificationChannel {
service_name: string;
service_url?: string;
setup_url?: string;
protocol: string;
protocols: string[];
templates: string[];
template_tokens: Record<string, TemplateToken>;
template_args: Record<string, TemplateArg>;
}
export interface FieldValue {
[key: string]: string | number | boolean | string[];
}
export interface ValidationError {
field: string;
message: string;
}
export interface NotificationChannelConfigProps {
channel: NotificationChannel;
onUrlChange?: (_url: string) => void;
onValidationChange?: (_isValid: boolean, _errors: ValidationError[]) => void;
initialValues?: FieldValue;
className?: string;
labels?: ComponentLabels;
styles?: ComponentStyles;
}
export interface ComponentLabels {
required?: string;
optional?: string;
placeholder?: string;
fieldRequired?: string;
fieldOptional?: string;
fieldPrivate?: string;
selectChannel?: string;
searchChannels?: string;
noChannelsFound?: string;
configureChannel?: string;
cancel?: string;
confirm?: string;
save?: string;
enterUrl?: string;
configureButton?: string;
fieldRequiredError?: string;
invalidValue?: string;
invalidUrl?: string;
[key: string]: string | undefined;
}
export interface ComponentStyles {
container?: string;
input?: string;
inputFocused?: string;
inputError?: string;
inputDisabled?: string;
button?: string;
buttonPrimary?: string;
buttonSecondary?: string;
buttonDisabled?: string;
label?: string;
labelRequired?: string;
labelOptional?: string;
error?: string;
errorMessage?: string;
dropdown?: string;
dropdownItem?: string;
dropdownItemSelected?: string;
modal?: string;
modalOverlay?: string;
modalContent?: string;
modalHeader?: string;
modalBody?: string;
modalFooter?: string;
[key: string]: string | undefined;
}
export interface BaseComponentProps {
className?: string;
labels?: ComponentLabels;
styles?: ComponentStyles;
}
//# sourceMappingURL=types.d.ts.map