twilio-ccai-fulfillment-tools
Version:
A collection of tools to assist in the creation of Twilio CCAI Integration cards via fulfillment scripts
74 lines (73 loc) • 1.96 kB
TypeScript
export declare enum SIZES {
FULL = "full",
HALF = "half",
TWO_THIRD = "two-third",
THIRD = "third"
}
export declare enum ITEMS {
BOOLEAN = "boolean",
IMAGE = "image",
PHONE_NUMBER = "phoneNumber",
TEXT = "text"
}
export interface IItem<T extends ITEMS> {
title?: string;
type: T;
width: SIZES;
data: string;
}
export declare type TItemBoolean = IItem<ITEMS.BOOLEAN>;
export declare type TItemImage = IItem<ITEMS.IMAGE>;
export declare type TItemPhoneNumber = IItem<ITEMS.PHONE_NUMBER>;
export declare type TItemText = IItem<ITEMS.TEXT>;
export declare type TItems = TItemBoolean | TItemImage | TItemPhoneNumber | TItemText;
export declare enum TEMPLATES {
CARD = "card",
DETAIL = "detail",
IFRAME = "iframe",
MAP = "map",
NOTIFICATION = "notification",
PROFILE = "profile",
TIMELINE = "timeline"
}
export interface ITemplate<T extends TEMPLATES> {
title?: string;
position?: number;
template: T;
}
export declare type TCard = ITemplate<TEMPLATES.CARD> & {
width: SIZES;
items: TItems[];
};
export declare type TDetail = ITemplate<TEMPLATES.DETAIL> & {
width: SIZES;
items: TItems[];
};
export declare type TIframe = ITemplate<TEMPLATES.IFRAME> & {
width: SIZES;
height: string;
url: string;
};
export declare type TNotification = ITemplate<TEMPLATES.NOTIFICATION> & {
type: 'success' | 'error';
text: string;
};
export declare type TMap = ITemplate<TEMPLATES.MAP> & {
width: SIZES;
geolocation: {
lat: number;
lng: number;
};
};
export declare type TProfile = ITemplate<TEMPLATES.PROFILE> & {
width: SIZES;
items: TItems[];
};
export declare type TTimeline = ITemplate<TEMPLATES.TIMELINE> & {
width: SIZES;
items: Array<{
title: string;
subtitle: string;
}>;
};
export declare type TTemplates = TCard | TDetail | TIframe | TNotification | TMap | TProfile | TTimeline;