courier-vue-embedded
Version:
Vue 3 wrapper for trycourier
119 lines (117 loc) • 3.59 kB
TypeScript
import { CSSObject } from 'styled-components';
import { IInboxMessagePreview, Brand } from './core';
declare namespace MarkdownToJSX {
type Options = any;
}
type MarkdownToJSX = {
Options: any;
};
type TippyProps = {
placement: 'top' | 'left' | 'right' | 'bottom';
trigger: 'click' | 'hover';
};
type IGetInboxMessagesParams = {
tenantId?: string;
archived?: boolean;
from?: string | number;
limit?: number;
status?: 'read' | 'unread';
tags?: string[];
};
type OnEvent = any;
type FilterView = {
id: string;
label: string;
params?: IGetInboxMessagesParams;
};
type PreferenceView = {
id: 'preferences';
label: string;
};
export type View = FilterView | PreferenceView;
export type InboxLabels = {
archiveMessage?: string;
backToInbox?: string;
closeInbox?: string;
emptyState?: string;
markAllAsRead?: string;
markAsRead?: string;
markAsUnread?: string;
scrollTop?: string | ((count: string) => string);
};
export interface InboxProps {
brand?: Brand;
className?: string;
defaultIcon?: false | string;
from?: number;
isOpen?: boolean;
markdownOptions?: MarkdownToJSX.Options;
tenantId?: string;
views?: Array<View>;
formatDate?: (isoDate: string) => string;
appendTo?: string;
labels?: InboxLabels;
onEvent?: OnEvent;
openLinksInNewTab?: boolean;
placement?: TippyProps['placement'];
showUnreadMessageCount?: boolean;
theme?: InboxTheme;
title?: string;
trigger?: TippyProps['trigger'];
}
export interface InboxTheme {
brand?: Brand;
colorMode?: 'light' | 'dark';
variables?: {
background: string;
};
container?: CSSObject;
emptyState?: CSSObject;
footer?: CSSObject;
header?: CSSObject;
menu?: CSSObject;
tooltip?: CSSObject;
icon?: CSSObject & {
open?: string;
closed?: string;
};
messageList?: {
container?: CSSObject;
scrollTop?: CSSObject;
};
message?: {
actionElement?: CSSObject;
clickableContainer?: CSSObject;
container?: CSSObject;
content?: CSSObject;
icon?: CSSObject;
textElement?: CSSObject;
timeAgo?: CSSObject;
title?: CSSObject;
unreadIndicator?: CSSObject;
};
root?: CSSObject;
unreadIndicator?: CSSObject;
}
export type IFetchMessagesParams = any;
export interface InboxSdk {
fetchMessages: (params?: IFetchMessagesParams) => void;
getUnreadMessageCount: (params?: IGetInboxMessagesParams) => void;
init: (inbox?: InboxProps) => void;
markAllAsRead: (fromWS?: boolean) => void;
markMessageArchived: (messageId: string, fromWS?: boolean) => Promise<void>;
markMessageOpened: (messageId: string, fromWS?: boolean) => Promise<void>;
markMessageRead: (messageId: string, fromWS?: boolean) => Promise<void>;
markMessageUnread: (messageId: string, fromWS?: boolean) => Promise<void>;
newMessage: (transportMessage: IInboxMessagePreview) => void;
resetLastFetched: () => void;
setView: (view: string | 'preferences') => void;
toggleInbox: (isOpen?: boolean) => void;
unpinMessage: (messageId: string, fromWS?: boolean) => Promise<void>;
addTag: (messageId: string, tag: string, fromWS?: boolean) => Promise<void>;
removeTag: (messageId: string, tag: string, fromWS?: boolean) => Promise<void>;
trackClick: (messageId: string, trackingId: string) => Promise<void>;
setConfig: (config: InboxProps) => void;
mergeConfig: (config: InboxProps) => void;
}
export {};