UNPKG

@xapp/chat-widget

Version:
77 lines (76 loc) 3 kB
import 'rollup-plugin-inject-process-env'; import { DateTime, DateTimeRange, Duration, DurationFormat, RequestSlotValues } from "./models"; export declare enum ListDelimiter { or = 0, and = 1 } /** * Based on the provided slot value, it will return the appropriate <say-as> tag. * * {@link https://cloud.google.com/text-to-speech/docs/ssml#say%E2%80%91as} * {@link https://developer.amazon.com/en-US/docs/alexa/custom-skills/speech-synthesis-markup-language-ssml-reference.html#say-as} * {@link https://docs.aws.amazon.com/polly/latest/dg/supportedtags.html#say-as-tag} * * @param value * @returns */ export declare function slotValueToSpeech(value: RequestSlotValues, type?: "ssml" | "displayText"): string; /** * Determine if the request slot value is a DateTime * * @public * @param slotValue - Slot value to check */ export declare function isDateTime(slotValue: RequestSlotValues): slotValue is DateTime; /** * Determine if the request slot value is a DateTimeRange * * @public * @param slotValue - Slot value to check */ export declare function isDateTimeRange(slotValue: RequestSlotValues): slotValue is DateTimeRange; /** * Determine if the request slot value is a Duration * * @public * @param slotValue - Slot value to check */ export declare function isDuration(slotValue: RequestSlotValues): slotValue is Duration; /** * Converts a date time object to a string that can be used in either SSML or display text. * * @privateRemarks * We will want to consider how we tackle localization of dates. date-fns * can handle it we just need to pass in the locale. Additionally, when generating * a response for display, we may want to support a short and long form. * * @beta * @param value * @param type */ export declare function dateTimeToSpeech(value: DateTime, type?: "ssml" | "displayText"): string; export declare function dateTimeRangeToSpeech(value: DateTimeRange, type?: "ssml" | "displayText"): string; export declare function durationToSpeech(duration: Duration, type?: "ssml" | "displayText"): string; /** * Converts a date time object to a string. * * Either a single date (2020-07-19T23:59:59) or a range (2019-07-19T00:00:00 --> 2020-07-19T23:59:59). * * @param dateTime - Either DateTime or DateTimeRange to convert to a string */ export declare function dateTimeToString(dateTime: DateTime | DateTimeRange): string; export type DurationFormatToMSMultiplier = Record<DurationFormat, number>; /** * Lookup table to convert a duration format to a multiplier that will convert it to milliseconds */ export declare const DURATION_FORMAT_TO_MS_MULTIPLIER: DurationFormatToMSMultiplier; /** * Builds a speakable and readable list from a set of items. * * For example, ["one", "two", "three", "four"] will be transformed * to "one, two, three or four". * * @param {string[]} items * @param {ListisizeDelimiter} [delimiter] */ export declare function listisize(items: string[], preferredDelimiter?: ListDelimiter): string;