@livechat/customer-sdk 3.1.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -78
- package/dist/customer-sdk.cjs.js +208 -228
- package/dist/customer-sdk.cjs.native.js +208 -228
- package/dist/customer-sdk.esm.js +202 -227
- package/dist/customer-sdk.js +222 -249
- package/dist/customer-sdk.min.js +1 -1
- package/package.json +7 -7
- package/types/actions.d.ts +331 -0
- package/types/chatHistory.d.ts +19 -0
- package/types/clientDataParsers.d.ts +55 -0
- package/types/completionValues.d.ts +4 -0
- package/types/constants/clientErrorCodes.d.ts +11 -0
- package/types/constants/connectionStatuses.d.ts +6 -0
- package/types/constants/eventTypes.d.ts +8 -0
- package/types/constants/organizationIds.d.ts +2 -0
- package/types/constants/reduxActions.d.ts +23 -0
- package/types/constants/serverDisconnectionReasons.d.ts +16 -0
- package/types/constants/serverErrorCodes.d.ts +23 -0
- package/types/constants/serverPushActions.d.ts +27 -0
- package/types/constants/serverRequestActions.d.ts +30 -0
- package/types/constants/sortOrders.d.ts +3 -0
- package/types/constants/userTypes.d.ts +3 -0
- package/types/createError.d.ts +9 -0
- package/types/createStore.d.ts +12 -0
- package/types/debug.d.ts +3 -0
- package/types/graylog/index.d.ts +14 -0
- package/types/graylog/makeGrayLogRequest.d.ts +2 -0
- package/types/graylog/makeGrayLogRequest.native.d.ts +6 -0
- package/types/index.d.ts +252 -0
- package/types/reducer.d.ts +545 -0
- package/types/sendRequestAction.d.ts +4 -0
- package/types/sendTicketForm.d.ts +14 -0
- package/types/serverDataParser.d.ts +34 -0
- package/types/serverEventParser.d.ts +12 -0
- package/types/serverFrameParser.d.ts +393 -0
- package/types/sideEffects/checkGoals.d.ts +5 -0
- package/types/sideEffects/index.d.ts +13 -0
- package/types/sideStorage.d.ts +5 -0
- package/types/socketClient.d.ts +11 -0
- package/types/socketListener.d.ts +12 -0
- package/types/thunks.d.ts +4 -0
- package/types/types/actions.d.ts +157 -0
- package/types/types/clientEntities.d.ts +376 -0
- package/types/types/frames.d.ts +644 -0
- package/types/types/serverEntities.d.ts +409 -0
- package/types/types/state.d.ts +56 -0
- package/types/uploadFile.d.ts +19 -0
- package/types/validateFile/index.d.ts +3 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CustomerSDK } from '.';
|
|
2
|
+
import * as clientEntities from './types/clientEntities';
|
|
3
|
+
type HistoryResult = {
|
|
4
|
+
done: false;
|
|
5
|
+
value: {
|
|
6
|
+
threads: clientEntities.Thread[];
|
|
7
|
+
};
|
|
8
|
+
} | {
|
|
9
|
+
done: true;
|
|
10
|
+
value: {
|
|
11
|
+
threads: clientEntities.Thread[];
|
|
12
|
+
} | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type HistoryIterator = {
|
|
15
|
+
next(): Promise<HistoryResult>;
|
|
16
|
+
};
|
|
17
|
+
declare const createChatHistoryIterator: (sdk: CustomerSDK, chatId: string) => HistoryIterator;
|
|
18
|
+
export default createChatHistoryIterator;
|
|
19
|
+
//# sourceMappingURL=chatHistory.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Any } from 'ts-toolbelt';
|
|
2
|
+
import * as clientEntities from './types/clientEntities';
|
|
3
|
+
import * as serverEntities from './types/serverEntities';
|
|
4
|
+
type RequestBodyThread = {
|
|
5
|
+
events?: clientEntities.RequestBodyEvent[];
|
|
6
|
+
properties?: clientEntities.Properties;
|
|
7
|
+
};
|
|
8
|
+
type RequestBodyChat = {
|
|
9
|
+
access?: clientEntities.Access;
|
|
10
|
+
thread?: RequestBodyThread;
|
|
11
|
+
properties?: clientEntities.Properties;
|
|
12
|
+
};
|
|
13
|
+
export type RequestBodyStartChatData = Any.Compute<{
|
|
14
|
+
active?: boolean;
|
|
15
|
+
continuous?: boolean;
|
|
16
|
+
} & {
|
|
17
|
+
chat?: Any.Compute<RequestBodyChat>;
|
|
18
|
+
}>;
|
|
19
|
+
export type RequestBodyResumeChatData = Any.Compute<{
|
|
20
|
+
active?: boolean;
|
|
21
|
+
continuous?: boolean;
|
|
22
|
+
} & {
|
|
23
|
+
chat: Any.Compute<{
|
|
24
|
+
id: string;
|
|
25
|
+
} & RequestBodyChat>;
|
|
26
|
+
}>;
|
|
27
|
+
type ChatActivationThreadData = {
|
|
28
|
+
events?: serverEntities.RequestBodyEvent[];
|
|
29
|
+
properties?: serverEntities.Properties;
|
|
30
|
+
};
|
|
31
|
+
type ChatActivationData = {
|
|
32
|
+
active?: boolean;
|
|
33
|
+
continuous?: boolean;
|
|
34
|
+
chat: {
|
|
35
|
+
access?: serverEntities.Access;
|
|
36
|
+
thread?: ChatActivationThreadData;
|
|
37
|
+
properties?: serverEntities.Properties;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare const parseEvent: (event: clientEntities.RequestBodyEvent) => serverEntities.RequestBodyEvent;
|
|
41
|
+
export declare const parseStartChatData: ({ active, chat, continuous, }: RequestBodyStartChatData) => ChatActivationData;
|
|
42
|
+
export declare const parseResumeChatData: (requestData: RequestBodyResumeChatData) => {
|
|
43
|
+
chat: {
|
|
44
|
+
id: string;
|
|
45
|
+
access?: serverEntities.Access | undefined;
|
|
46
|
+
thread?: ChatActivationThreadData | undefined;
|
|
47
|
+
properties?: serverEntities.Properties | undefined;
|
|
48
|
+
};
|
|
49
|
+
active?: boolean | undefined;
|
|
50
|
+
continuous?: boolean | undefined;
|
|
51
|
+
};
|
|
52
|
+
export declare const parseCustomerSessionFields: (sessionFields: clientEntities.CustomerSessionFields) => serverEntities.CustomerSessionFields;
|
|
53
|
+
export declare const parseCustomerUpdate: (update: clientEntities.CustomerUpdate) => serverEntities.CustomerUpdate;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=clientDataParsers.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const CONNECTION_LOST = "CONNECTION_LOST";
|
|
2
|
+
export declare const IDENTITY_MISMATCH = "IDENTITY_MISMATCH";
|
|
3
|
+
export declare const MISDIRECTED_CONNECTION = "MISDIRECTED_CONNECTION";
|
|
4
|
+
export declare const MISSING_CHAT_THREAD = "MISSING_CHAT_THREAD";
|
|
5
|
+
export declare const NO_CONNECTION = "NO_CONNECTION";
|
|
6
|
+
export declare const REQUEST_TIMEOUT = "REQUEST_TIMEOUT";
|
|
7
|
+
export declare const SDK_DESTROYED = "SDK_DESTROYED";
|
|
8
|
+
export declare const SERVICE_TEMPORARILY_UNAVAILABLE = "SERVICE_TEMPORARILY_UNAVAILABLE";
|
|
9
|
+
export declare const TOO_BIG_FILE = "TOO_BIG_FILE";
|
|
10
|
+
export declare const TOO_MANY_UNAUTHORIZED_CONNECTIONS = "TOO_MANY_UNAUTHORIZED_CONNECTIONS";
|
|
11
|
+
//# sourceMappingURL=clientErrorCodes.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CONNECTED = "connected";
|
|
2
|
+
export declare const DESTROYED = "destroyed";
|
|
3
|
+
export declare const DISCONNECTED = "disconnected";
|
|
4
|
+
export declare const PAUSED = "paused";
|
|
5
|
+
export declare const RECONNECTING = "reconnecting";
|
|
6
|
+
//# sourceMappingURL=connectionStatuses.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const FILE = "file";
|
|
2
|
+
export declare const FORM = "form";
|
|
3
|
+
export declare const FILLED_FORM = "filled_form";
|
|
4
|
+
export declare const MESSAGE = "message";
|
|
5
|
+
export declare const RICH_MESSAGE = "rich_message";
|
|
6
|
+
export declare const SYSTEM_MESSAGE = "system_message";
|
|
7
|
+
export declare const CUSTOM = "custom";
|
|
8
|
+
//# sourceMappingURL=eventTypes.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const CHANGE_REGION = "change_region";
|
|
2
|
+
export declare const CHECK_GOALS = "check_goals";
|
|
3
|
+
export declare const CONNECTION_MISDIRECTED = "connection_misdirected";
|
|
4
|
+
export declare const DESTROY = "destroy";
|
|
5
|
+
export declare const FAIL_ALL_REQUESTS = "fail_all_requests";
|
|
6
|
+
export declare const LOGIN_SUCCESS = "login_success";
|
|
7
|
+
export declare const PAUSE_CONNECTION = "pause_connection";
|
|
8
|
+
export declare const PREFETCH_TOKEN = "prefetch_token";
|
|
9
|
+
export declare const PUSH_RECEIVED = "push_received";
|
|
10
|
+
export declare const PUSH_RESPONSE_RECEIVED = "push_response_received";
|
|
11
|
+
export declare const RECONNECT = "reconnect";
|
|
12
|
+
export declare const REQUEST_FAILED = "request_failed";
|
|
13
|
+
export declare const RESPONSE_RECEIVED = "response_received";
|
|
14
|
+
export declare const SEND_REQUEST = "send_request";
|
|
15
|
+
export declare const SET_CHAT_ACTIVE = "set_chat_active";
|
|
16
|
+
export declare const SET_SELF_ID = "set_self_id";
|
|
17
|
+
export declare const SOCKET_CONNECTED = "socket_connected";
|
|
18
|
+
export declare const SOCKET_DISCONNECTED = "socket_disconnected";
|
|
19
|
+
export declare const SOCKET_RECOVERED = "socket_recovered";
|
|
20
|
+
export declare const SOCKET_UNSTABLE = "socket_unstable";
|
|
21
|
+
export declare const START_CONNECTION = "start_connection";
|
|
22
|
+
export declare const UPDATE_CUSTOMER_PAGE = "update_customer_page";
|
|
23
|
+
//# sourceMappingURL=reduxActions.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const ACCESS_TOKEN_EXPIRED = "access_token_expired";
|
|
2
|
+
export declare const CONNECTION_TIMEOUT = "connection_timeout";
|
|
3
|
+
export declare const CUSTOMER_BANNED = "customer_banned";
|
|
4
|
+
export declare const CUSTOMER_TEMPORARILY_BLOCKED = "customer_temporarily_blocked";
|
|
5
|
+
export declare const INACTIVITY_TIMEOUT = "inactivity_timeout";
|
|
6
|
+
export declare const INTERNAL_ERROR = "internal_error";
|
|
7
|
+
export declare const LICENSE_EXPIRED = "license_expired";
|
|
8
|
+
export declare const LICENSE_NOT_FOUND = "license_not_found";
|
|
9
|
+
export declare const MISDIRECTED_CONNECTION = "misdirected_connection";
|
|
10
|
+
export declare const PRODUCT_VERSION_CHANGED = "product_version_changed";
|
|
11
|
+
export declare const SERVICE_TEMPORARILY_UNAVAILABLE = "service_temporarily_unavailable";
|
|
12
|
+
export declare const TOO_MANY_CONNECTIONS = "too_many_connections";
|
|
13
|
+
export declare const TOO_MANY_UNAUTHORIZED_CONNECTIONS = "too_many_unauthorized_connections";
|
|
14
|
+
export declare const UNSUPPORTED_VERSION = "unsupported_version";
|
|
15
|
+
export declare const LOGGED_OUT_REMOTELY = "logged_out_remotely";
|
|
16
|
+
//# sourceMappingURL=serverDisconnectionReasons.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const AUTHENTICATION = "AUTHENTICATION";
|
|
2
|
+
export declare const AUTHORIZATION = "AUTHORIZATION";
|
|
3
|
+
export declare const CHAT_ALREADY_ACTIVE = "CHAT_ALREADY_ACTIVE";
|
|
4
|
+
export declare const CHAT_LIMIT_REACHED = "CHAT_LIMIT_REACHED";
|
|
5
|
+
export declare const CUSTOMER_BANNED = "CUSTOMER_BANNED";
|
|
6
|
+
export declare const CUSTOMER_SESSION_FIELDS_LIMIT_REACHED = "CUSTOMER_SESSION_FIELDS_LIMIT_REACHED";
|
|
7
|
+
export declare const ENTITY_TOO_LARGE = "ENTITY_TOO_LARGE";
|
|
8
|
+
export declare const GREETING_NOT_FOUND = "GREETING_NOT_FOUND";
|
|
9
|
+
export declare const GROUP_OFFLINE = "GROUP_OFFLINE";
|
|
10
|
+
export declare const GROUPS_OFFLINE = "GROUPS_OFFLINE";
|
|
11
|
+
export declare const GROUP_NOT_FOUND = "GROUP_NOT_FOUND";
|
|
12
|
+
export declare const GROUP_UNAVAILABLE = "GROUP_UNAVAILABLE";
|
|
13
|
+
export declare const INTERNAL = "INTERNAL";
|
|
14
|
+
export declare const LICENSE_EXPIRED = "LICENSE_EXPIRED";
|
|
15
|
+
export declare const MISDIRECTED_REQUEST = "MISDIRECTED_REQUEST";
|
|
16
|
+
export declare const PENDING_REQUESTS_LIMIT_REACHED = "PENDING_REQUESTS_LIMIT_REACHED";
|
|
17
|
+
export declare const REQUEST_TIMEOUT = "REQUEST_TIMEOUT";
|
|
18
|
+
export declare const SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE";
|
|
19
|
+
export declare const UNSUPPORTED_VERSION = "UNSUPPORTED_VERSION";
|
|
20
|
+
export declare const USERS_LIMIT_REACHED = "USERS_LIMIT_REACHED";
|
|
21
|
+
export declare const VALIDATION = "VALIDATION";
|
|
22
|
+
export declare const WRONG_PRODUCT_VERSION = "WRONG_PRODUCT_VERSION";
|
|
23
|
+
//# sourceMappingURL=serverErrorCodes.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const CHAT_DEACTIVATED = "chat_deactivated";
|
|
2
|
+
export declare const CHAT_PROPERTIES_DELETED = "chat_properties_deleted";
|
|
3
|
+
export declare const CHAT_PROPERTIES_UPDATED = "chat_properties_updated";
|
|
4
|
+
export declare const CHAT_TRANSFERRED = "chat_transferred";
|
|
5
|
+
export declare const CUSTOMER_DISCONNECTED = "customer_disconnected";
|
|
6
|
+
export declare const CUSTOMER_PAGE_UPDATED = "customer_page_updated";
|
|
7
|
+
export declare const CUSTOMER_SIDE_STORAGE_UPDATED = "customer_side_storage_updated";
|
|
8
|
+
export declare const CUSTOMER_UPDATED = "customer_updated";
|
|
9
|
+
export declare const EVENT_PROPERTIES_DELETED = "event_properties_deleted";
|
|
10
|
+
export declare const EVENT_PROPERTIES_UPDATED = "event_properties_updated";
|
|
11
|
+
export declare const EVENT_UPDATED = "event_updated";
|
|
12
|
+
export declare const EVENTS_MARKED_AS_SEEN = "events_marked_as_seen";
|
|
13
|
+
export declare const GREETING_ACCEPTED = "greeting_accepted";
|
|
14
|
+
export declare const GREETING_CANCELED = "greeting_canceled";
|
|
15
|
+
export declare const GROUPS_STATUS_UPDATED = "groups_status_updated";
|
|
16
|
+
export declare const INCOMING_CHAT = "incoming_chat";
|
|
17
|
+
export declare const INCOMING_EVENT = "incoming_event";
|
|
18
|
+
export declare const INCOMING_GREETING = "incoming_greeting";
|
|
19
|
+
export declare const INCOMING_MULTICAST = "incoming_multicast";
|
|
20
|
+
export declare const INCOMING_RICH_MESSAGE_POSTBACK = "incoming_rich_message_postback";
|
|
21
|
+
export declare const INCOMING_TYPING_INDICATOR = "incoming_typing_indicator";
|
|
22
|
+
export declare const QUEUE_POSITION_UPDATED = "queue_position_updated";
|
|
23
|
+
export declare const THREAD_PROPERTIES_DELETED = "thread_properties_deleted";
|
|
24
|
+
export declare const THREAD_PROPERTIES_UPDATED = "thread_properties_updated";
|
|
25
|
+
export declare const USER_ADDED_TO_CHAT = "user_added_to_chat";
|
|
26
|
+
export declare const USER_REMOVED_FROM_CHAT = "user_removed_from_chat";
|
|
27
|
+
//# sourceMappingURL=serverPushActions.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const ACCEPT_GREETING = "accept_greeting";
|
|
2
|
+
export declare const CANCEL_GREETING = "cancel_greeting";
|
|
3
|
+
export declare const CHECK_GOALS = "check_goals";
|
|
4
|
+
export declare const DEACTIVATE_CHAT = "deactivate_chat";
|
|
5
|
+
export declare const DELETE_CHAT_PROPERTIES = "delete_chat_properties";
|
|
6
|
+
export declare const DELETE_EVENT_PROPERTIES = "delete_event_properties";
|
|
7
|
+
export declare const DELETE_THREAD_PROPERTIES = "delete_thread_properties";
|
|
8
|
+
export declare const GET_CHAT = "get_chat";
|
|
9
|
+
export declare const GET_CUSTOMER = "get_customer";
|
|
10
|
+
export declare const GET_FORM = "get_form";
|
|
11
|
+
export declare const GET_PREDICTED_AGENT = "get_predicted_agent";
|
|
12
|
+
export declare const GET_URL_INFO = "get_url_info";
|
|
13
|
+
export declare const LIST_CHATS = "list_chats";
|
|
14
|
+
export declare const LIST_GROUP_STATUSES = "list_group_statuses";
|
|
15
|
+
export declare const LIST_THREADS = "list_threads";
|
|
16
|
+
export declare const LOGIN = "login";
|
|
17
|
+
export declare const MARK_EVENTS_AS_SEEN = "mark_events_as_seen";
|
|
18
|
+
export declare const RESUME_CHAT = "resume_chat";
|
|
19
|
+
export declare const SEND_EVENT = "send_event";
|
|
20
|
+
export declare const SEND_RICH_MESSAGE_POSTBACK = "send_rich_message_postback";
|
|
21
|
+
export declare const SEND_SNEAK_PEEK = "send_sneak_peek";
|
|
22
|
+
export declare const SET_CUSTOMER_SESSION_FIELDS = "set_customer_session_fields";
|
|
23
|
+
export declare const START_CHAT = "start_chat";
|
|
24
|
+
export declare const UPDATE_CHAT_PROPERTIES = "update_chat_properties";
|
|
25
|
+
export declare const UPDATE_CUSTOMER = "update_customer";
|
|
26
|
+
export declare const UPDATE_CUSTOMER_PAGE = "update_customer_page";
|
|
27
|
+
export declare const UPDATE_EVENT_PROPERTIES = "update_event_properties";
|
|
28
|
+
export declare const UPDATE_THREAD_PROPERTIES = "update_thread_properties";
|
|
29
|
+
export declare const UPLOAD_FILE = "upload_file";
|
|
30
|
+
//# sourceMappingURL=serverRequestActions.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { compose } from 'redux';
|
|
2
|
+
import { Store } from './types';
|
|
3
|
+
import { InitialStateData } from './types/state';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: (opts: {
|
|
7
|
+
name?: string;
|
|
8
|
+
}) => typeof compose;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export default function finalCreateStore(initialStateData: InitialStateData): Store;
|
|
12
|
+
//# sourceMappingURL=createStore.d.ts.map
|
package/types/debug.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Env } from '@livechat/customer-auth/src/types';
|
|
2
|
+
export type Config = {
|
|
3
|
+
env: Env;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
eventName: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Logs event to Graylog with provided config data.
|
|
9
|
+
* Logging request is fired only when all of those conditions are true:
|
|
10
|
+
* 1. package is used in lc production environment
|
|
11
|
+
* 2. package is used standalone because only then process.env.CUSTOMER_SDK_PACKAGE_NAME will be set to customer_sdk
|
|
12
|
+
*/
|
|
13
|
+
export declare const log: ({ env, organizationId, eventName }: Config) => Promise<void>;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import fetch from 'unfetch';
|
|
2
|
+
import { C } from 'ts-toolbelt';
|
|
3
|
+
type UnfetchResponse = C.PromiseOf<ReturnType<typeof fetch>>;
|
|
4
|
+
export declare const makeGraylogRequest: (url: string, body: string) => Promise<UnfetchResponse | void>;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=makeGrayLogRequest.native.d.ts.map
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { UploadFileOptions } from './uploadFile';
|
|
2
|
+
import * as actions from './actions';
|
|
3
|
+
import { RequestBodyResumeChatData, RequestBodyStartChatData } from './clientDataParsers';
|
|
4
|
+
import { Config, Env, Page, SortOrder } from './types';
|
|
5
|
+
import * as clientEntities from './types/clientEntities';
|
|
6
|
+
export { default as debug } from './debug';
|
|
7
|
+
import * as connectionStatuses from './constants/connectionStatuses';
|
|
8
|
+
import * as eventTypes from './constants/eventTypes';
|
|
9
|
+
import * as serverDisconnectionReasons from './constants/serverDisconnectionReasons';
|
|
10
|
+
import * as serverErrorCodes from './constants/serverErrorCodes';
|
|
11
|
+
import * as serverPushActions from './constants/serverPushActions';
|
|
12
|
+
import * as sortOrders from './constants/sortOrders';
|
|
13
|
+
import * as userTypes from './constants/userTypes';
|
|
14
|
+
export { connectionStatuses, eventTypes, serverDisconnectionReasons, serverErrorCodes, serverPushActions, sortOrders, userTypes, };
|
|
15
|
+
export * from './types/clientEntities';
|
|
16
|
+
export type { CustomerSessionFields, CustomerData, CustomerDataProvider, IdentityProvider, Config, ConnectionStatus, Page, SortOrder, SubscribablePush, } from './types/index';
|
|
17
|
+
export type { CustomerAuth, CustomerAuthToken } from '@livechat/customer-auth';
|
|
18
|
+
export * from './serverEventParser';
|
|
19
|
+
export { parseForm } from './serverFrameParser';
|
|
20
|
+
export declare const init: (config: Config, env: Env | undefined, licenseId: number) => Readonly<{
|
|
21
|
+
acceptGreeting({ greetingId, uniqueId }: {
|
|
22
|
+
greetingId: number;
|
|
23
|
+
uniqueId: string;
|
|
24
|
+
}): Promise<Readonly<{
|
|
25
|
+
readonly success: true;
|
|
26
|
+
}>>;
|
|
27
|
+
auth: import("@livechat/customer-auth/src/types").CustomerAuth;
|
|
28
|
+
cancelGreeting({ uniqueId }: {
|
|
29
|
+
uniqueId: string;
|
|
30
|
+
}): Promise<Readonly<{
|
|
31
|
+
readonly success: true;
|
|
32
|
+
}>>;
|
|
33
|
+
cancelRate(params: {
|
|
34
|
+
chatId: string;
|
|
35
|
+
properties: Array<'score' | 'comment'>;
|
|
36
|
+
}): Promise<Readonly<{
|
|
37
|
+
readonly success: true;
|
|
38
|
+
}>>;
|
|
39
|
+
connect: () => void;
|
|
40
|
+
deactivateChat({ id }: {
|
|
41
|
+
id: string;
|
|
42
|
+
}): Promise<Readonly<{
|
|
43
|
+
readonly success: true;
|
|
44
|
+
}>>;
|
|
45
|
+
deleteChatProperties({ id, properties }: {
|
|
46
|
+
id: string;
|
|
47
|
+
properties: Record<string, string[]>;
|
|
48
|
+
}): Promise<Readonly<{
|
|
49
|
+
readonly success: true;
|
|
50
|
+
}>>;
|
|
51
|
+
deleteEventProperties({ chatId, threadId, eventId, properties, }: {
|
|
52
|
+
chatId: string;
|
|
53
|
+
threadId: string;
|
|
54
|
+
eventId: string;
|
|
55
|
+
properties: Record<string, string[]>;
|
|
56
|
+
}): Promise<Readonly<{
|
|
57
|
+
readonly success: true;
|
|
58
|
+
}>>;
|
|
59
|
+
deleteThreadProperties({ chatId, threadId, properties, }: {
|
|
60
|
+
chatId: string;
|
|
61
|
+
threadId: string;
|
|
62
|
+
properties: Record<string, string[]>;
|
|
63
|
+
}): Promise<Readonly<{
|
|
64
|
+
readonly success: true;
|
|
65
|
+
}>>;
|
|
66
|
+
destroy(): void;
|
|
67
|
+
disconnect(): void;
|
|
68
|
+
getChat({ chatId, threadId }: {
|
|
69
|
+
chatId: string;
|
|
70
|
+
threadId?: string | undefined;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
thread: clientEntities.Thread | null;
|
|
73
|
+
id: string;
|
|
74
|
+
access: clientEntities.Access;
|
|
75
|
+
users: clientEntities.ChatUser[];
|
|
76
|
+
properties: import("./types/serverEntities").Properties;
|
|
77
|
+
eventsSeenUpToMap: clientEntities.EventsSeenUpToMap;
|
|
78
|
+
}>;
|
|
79
|
+
getChatHistory({ chatId }: {
|
|
80
|
+
chatId: string;
|
|
81
|
+
}): import("./chatHistory").HistoryIterator;
|
|
82
|
+
getCustomer(): Promise<{
|
|
83
|
+
type: "customer";
|
|
84
|
+
id: string;
|
|
85
|
+
name?: string | undefined;
|
|
86
|
+
email?: string | undefined;
|
|
87
|
+
avatar?: string | undefined;
|
|
88
|
+
sessionFields: clientEntities.CustomerSessionFields;
|
|
89
|
+
statistics: {
|
|
90
|
+
chatsCount: number;
|
|
91
|
+
threadsCount: number;
|
|
92
|
+
visitsCount: number;
|
|
93
|
+
pageViewsCount: number;
|
|
94
|
+
greetingsShownCount: number;
|
|
95
|
+
greetingsAcceptedCount: number;
|
|
96
|
+
};
|
|
97
|
+
}>;
|
|
98
|
+
getForm({ groupId, type }: {
|
|
99
|
+
groupId: number;
|
|
100
|
+
type: clientEntities.FormType;
|
|
101
|
+
}): Promise<{
|
|
102
|
+
enabled: false;
|
|
103
|
+
} | {
|
|
104
|
+
form: {
|
|
105
|
+
id: string;
|
|
106
|
+
fields: clientEntities.FormField[];
|
|
107
|
+
};
|
|
108
|
+
enabled: true;
|
|
109
|
+
}>;
|
|
110
|
+
getPredictedAgent(params?: {
|
|
111
|
+
groupId?: number;
|
|
112
|
+
}): Promise<clientEntities.PredictedAgent>;
|
|
113
|
+
getUrlInfo({ url }: {
|
|
114
|
+
url: string;
|
|
115
|
+
}): Promise<clientEntities.UrlInfo>;
|
|
116
|
+
listChats(params?: {
|
|
117
|
+
pageId: string;
|
|
118
|
+
} | {
|
|
119
|
+
pageId?: undefined;
|
|
120
|
+
limit?: number;
|
|
121
|
+
}): Promise<{
|
|
122
|
+
chatsSummary: clientEntities.ChatSummary[];
|
|
123
|
+
totalChats: number;
|
|
124
|
+
users: clientEntities.ChatUser[];
|
|
125
|
+
previousPageId: string | null;
|
|
126
|
+
nextPageId: string | null;
|
|
127
|
+
}>;
|
|
128
|
+
listGroupStatuses({ groupIds }?: {
|
|
129
|
+
groupIds?: number[] | undefined;
|
|
130
|
+
}): Promise<Record<number, import("./types/serverEntities").GroupStatus>>;
|
|
131
|
+
listThreads(params: {
|
|
132
|
+
chatId: string;
|
|
133
|
+
sortOrder?: SortOrder;
|
|
134
|
+
limit?: number;
|
|
135
|
+
pageId?: undefined;
|
|
136
|
+
minEventsCount?: number;
|
|
137
|
+
} | {
|
|
138
|
+
chatId: string;
|
|
139
|
+
pageId: string;
|
|
140
|
+
}): Promise<{
|
|
141
|
+
threads: clientEntities.Thread[];
|
|
142
|
+
previousPageId: string | null;
|
|
143
|
+
nextPageId: string | null;
|
|
144
|
+
}>;
|
|
145
|
+
markEventsAsSeen({ chatId, seenUpTo }: {
|
|
146
|
+
chatId: string;
|
|
147
|
+
seenUpTo: string;
|
|
148
|
+
}): Promise<Readonly<{
|
|
149
|
+
readonly success: true;
|
|
150
|
+
}>>;
|
|
151
|
+
on: {
|
|
152
|
+
<Key extends import("mitt").EventType>(type: Key, handler: import("mitt").Handler<{
|
|
153
|
+
[x: string]: unknown;
|
|
154
|
+
[x: symbol]: unknown;
|
|
155
|
+
}[Key]>): void;
|
|
156
|
+
(type: "*", handler: import("mitt").WildcardHandler<{
|
|
157
|
+
[x: string]: unknown;
|
|
158
|
+
[x: symbol]: unknown;
|
|
159
|
+
}>): void;
|
|
160
|
+
};
|
|
161
|
+
once: {
|
|
162
|
+
<Key extends import("mitt").EventType>(type: Key, handler: import("mitt").Handler<{
|
|
163
|
+
[x: string]: unknown;
|
|
164
|
+
[x: symbol]: unknown;
|
|
165
|
+
}[Key]>): void;
|
|
166
|
+
(type: "*", handler: import("mitt").WildcardHandler<{
|
|
167
|
+
[x: string]: unknown;
|
|
168
|
+
[x: symbol]: unknown;
|
|
169
|
+
}>): void;
|
|
170
|
+
};
|
|
171
|
+
off: {
|
|
172
|
+
<Key_1 extends import("mitt").EventType>(type: Key_1, handler?: import("mitt").Handler<{
|
|
173
|
+
[x: string]: unknown;
|
|
174
|
+
[x: symbol]: unknown;
|
|
175
|
+
}[Key_1]> | undefined): void;
|
|
176
|
+
(type: "*", handler: import("mitt").WildcardHandler<{
|
|
177
|
+
[x: string]: unknown;
|
|
178
|
+
[x: symbol]: unknown;
|
|
179
|
+
}>): void;
|
|
180
|
+
} & {
|
|
181
|
+
(type: "*", handler: import("mitt").WildcardHandler<{
|
|
182
|
+
[x: string]: unknown;
|
|
183
|
+
[x: symbol]: unknown;
|
|
184
|
+
}>): void;
|
|
185
|
+
(): void;
|
|
186
|
+
};
|
|
187
|
+
rateChat(params: {
|
|
188
|
+
chatId: string;
|
|
189
|
+
rating: {
|
|
190
|
+
comment?: string;
|
|
191
|
+
score?: 0 | 1;
|
|
192
|
+
};
|
|
193
|
+
}): Promise<Readonly<{
|
|
194
|
+
readonly success: true;
|
|
195
|
+
}>>;
|
|
196
|
+
resumeChat(data: RequestBodyResumeChatData): Promise<clientEntities.IncomingChat>;
|
|
197
|
+
sendEvent(params: Parameters<typeof actions.sendEvent>[0]): Promise<clientEntities.Event>;
|
|
198
|
+
sendRichMessagePostback({ chatId, threadId, eventId, postback, }: {
|
|
199
|
+
chatId: string;
|
|
200
|
+
threadId: string;
|
|
201
|
+
eventId: string;
|
|
202
|
+
postback: {
|
|
203
|
+
id: string;
|
|
204
|
+
toggled: boolean;
|
|
205
|
+
};
|
|
206
|
+
}): Promise<Readonly<{
|
|
207
|
+
readonly success: true;
|
|
208
|
+
}>>;
|
|
209
|
+
setCustomerSessionFields({ sessionFields }: {
|
|
210
|
+
sessionFields: clientEntities.CustomerSessionFields;
|
|
211
|
+
}): Promise<Readonly<{
|
|
212
|
+
readonly success: true;
|
|
213
|
+
}>>;
|
|
214
|
+
setSneakPeek: ({ chatId, sneakPeekText }: {
|
|
215
|
+
chatId: string;
|
|
216
|
+
sneakPeekText: string;
|
|
217
|
+
}) => void;
|
|
218
|
+
startChat(data?: RequestBodyStartChatData): Promise<clientEntities.IncomingChat>;
|
|
219
|
+
updateChatProperties({ id, properties }: {
|
|
220
|
+
id: string;
|
|
221
|
+
properties: clientEntities.Properties;
|
|
222
|
+
}): Promise<Readonly<{
|
|
223
|
+
readonly success: true;
|
|
224
|
+
}>>;
|
|
225
|
+
updateCustomer(update: clientEntities.CustomerUpdate): Promise<Readonly<{
|
|
226
|
+
readonly success: true;
|
|
227
|
+
}>>;
|
|
228
|
+
updateCustomerPage(page: Page): void;
|
|
229
|
+
updateEventProperties({ chatId, threadId, eventId, properties, }: {
|
|
230
|
+
chatId: string;
|
|
231
|
+
threadId: string;
|
|
232
|
+
eventId: string;
|
|
233
|
+
properties: clientEntities.Properties;
|
|
234
|
+
}): Promise<Readonly<{
|
|
235
|
+
readonly success: true;
|
|
236
|
+
}>>;
|
|
237
|
+
updateThreadProperties({ chatId, threadId, properties, }: {
|
|
238
|
+
chatId: string;
|
|
239
|
+
threadId: string;
|
|
240
|
+
properties: clientEntities.Properties;
|
|
241
|
+
}): Promise<Readonly<{
|
|
242
|
+
readonly success: true;
|
|
243
|
+
}>>;
|
|
244
|
+
uploadFile(options: UploadFileOptions): {
|
|
245
|
+
promise: Promise<{
|
|
246
|
+
url: string;
|
|
247
|
+
}>;
|
|
248
|
+
cancel(): void;
|
|
249
|
+
};
|
|
250
|
+
}>;
|
|
251
|
+
export type CustomerSDK = ReturnType<typeof init>;
|
|
252
|
+
//# sourceMappingURL=index.d.ts.map
|