Commit 3d526e36 authored by Renato Becker's avatar Renato Becker
Browse files

New Livechat files compiled.

parent e834ce89
This diff is collapsed.
This diff is collapsed.
......@@ -2,8 +2,8 @@
export interface ILivechatTokenAPI {
token: string;
}
/** Structure for livechat room credencial api */
export interface ILivechatRoomCredencialAPI {
/** Structure for livechat room credential api */
export interface ILivechatRoomCredentialAPI {
token: string;
rid?: string;
department?: string;
......@@ -182,3 +182,71 @@ export interface ILivechatOfflineMessageResultAPI {
message: string;
success: boolean;
}
/** Navigation object structure for livechat endpoints */
export interface ILivechatNavigation {
change: string;
title: string;
location: {
href: string;
};
token?: string;
}
/** Payload structure for new Livechat Visitor Navigation */
export interface INewLivechatNavigationAPI {
token: string;
rid: string;
pageInfo: ILivechatNavigation;
}
/** Result structure for Livechat Navigation */
export interface ILivechatNavigationResultAPI {
page?: {
msg: string;
navigation: ILivechatNavigation;
};
success: boolean;
}
/** Result structure for Livechat Transcript */
export interface ILivechatTranscriptResultAPI {
message: string;
success: boolean;
}
/** Livechat VideoCall object structure */
export interface ILivechatVideoCallAPI {
rid: string;
domain: string;
provider: string;
room: string;
}
/** Result structure for Livechat VideoCall */
export interface ILivechatVideoCallResultAPI {
videoCall: ILivechatVideoCallAPI;
success: boolean;
}
/** Payload structure for new Livechat CustomField */
export interface ILivechaCustomFieldAPI {
key: string;
value: string;
overwrite: boolean;
}
/** Livechat CustomField object structure */
export interface INewLivechatCustomFieldAPI {
token: string;
key: string;
value: string;
overwrite: boolean;
}
/** Result structure for Livechat CustomField */
export interface ILivechatCustomFieldResultAPI {
field: ILivechaCustomFieldAPI;
success: boolean;
}
/** Structure for Livechat CustomFields api */
export interface INewLivechatCustomFieldsAPI {
token: string;
customFields: ILivechaCustomFieldAPI[];
}
/** Result structure for Livechat CustomFields */
export interface ILivechatCustomFieldsResultAPI {
fields: ILivechaCustomFieldAPI[];
success: boolean;
}
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/livechat/lib/Interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/** Structure for livechat token field api */\nexport interface ILivechatTokenAPI {\n token: string\n}\n\n/** Structure for livechat room credencial api */\nexport interface ILivechatRoomCredencialAPI {\n token: string\n rid?: string\n department?: string\n}\n\n/** Structure for livechat room messages api */\nexport interface ILivechatRoomMessagesAPI {\n\ttoken: string //Visitor token\n ts?: string // ISO timestamp\n end?: string // ISO timestamp\n limit: number // number of messages to load\n}\n\n/** Payload structure for livechat `room.transfer` endpoint */\nexport interface ILivechatRoomTransferAPI {\n token: string\n department: string\n}\n\n/** Payload structure for livechat survey values */\nexport interface ILivechatSurveyAPI {\n name: 'satisfaction' | 'agentKnowledge' | 'agentResposiveness' | 'agentFriendliness'\n value: '1' | '2' | '3' | '4' | '5'\n}\n\n/** Payload structure for livechat `room.transfer` endpoint */\nexport interface ILivechatRoomSurveyAPI {\n token: string\n rid: string\n data?: ILivechatSurveyAPI[] // See surcvey interface above\n}\n\n/** Livechat New Room object structure */\nexport interface ILivechatNewRoomAPI {\n _id: string // Room ID\n _updatedAt: string // ISO timestamp\n t: 'r' // Room type (channel, private, direct, livechat)\n msgs: number // Count of messages in room\n ts: string // ISO timestamp (current time in room?)\n lm?: string // ISO timestamp (last message)\n open?: boolean // Room status\n departmentId?: string // Livechat Department _id\n fname: string // Room display name\n v: {\n\t _id: number // Visitor ID\n\t token: string // Visitor token\n\t username: number // Visitor username\n }\n}\n\n/** Result structure for room creation (e.g. DM) */\nexport interface ILivechatNewRoomResultAPI {\n room: ILivechatNewRoomAPI\n newRoom: boolean\n success: boolean\n}\n\n/** Custom Field object structure for livechat endpoints */\nexport interface ILivechatGuestCustomFieldAPI {\n key: string\n value: string\n overwrite: boolean\n}\n\n/** Payload structure for new Livechat Visitors */\nexport interface ILivechatGuestAPI {\n token: string\n name?: string\n email?: string\n department?: string\n phone?: string\n username?: string\n customFields?: ILivechatGuestCustomFieldAPI[]\n}\n\n/** Visitor object structure for livechat endpoints */\nexport interface INewLivechatGuestAPI {\n visitor: ILivechatGuestAPI\n}\n\n/** Payload structure for new Livechat Message */\nexport interface INewLivechatMessageAPI {\n _id?: string // Message ID\n msg: string // Message text\n token: string // Livechat Token\n rid: string // Room ID\n agent?: {\n agentId: string\n username: string\n }\n}\n\n/** Result structure for visitor emails */\nexport interface ILivechatEmailAPI {\n address: string,\n verified?: boolean\n}\n\n/** Result structure for visitor phones */\nexport interface ILivechatVisitorPhoneAPI {\n phoneNumber: string\n}\n\n/** Result structure for visitor prop */\nexport interface ILivechatVisitorAPI {\n token: string\n _updatedAt: string\n name?: string\n phone?: ILivechatVisitorPhoneAPI[]\n username: string\n visitorEmails?: ILivechatEmailAPI[]\n livechatData?: object\n}\n\n/** Result structure for visitor creation */\nexport interface ILivechatVisitorResultAPI {\n visitor: ILivechatVisitorAPI\n success: boolean\n}\n\n/** Result structure for config survey */\nexport interface ILivechatConfigSurveyAPI {\n items: ['satisfaction', 'agentKnowledge', 'agentResposiveness', 'agentFriendliness']\n values: ['1', '2', '3', '4', '5']\n}\n\n/** Result structure for config prop */\nexport interface ILivechatConfigAPI {\n enabled: boolean\n online?: boolean\n settings?: object\n theme?: object\n messages?: object\n survey?: ILivechatConfigSurveyAPI,\n guest?: ILivechatGuestAPI\n}\n\n/** Result structure for Livechat config */\nexport interface ILivechatConfigResultAPI {\n config: ILivechatConfigAPI\n success: boolean\n}\n\n/** Livechat Room object structure */\nexport interface ILivechatRoomAPI {\n _id: string // Room ID\n open?: boolean // Room status\n departmentId?: string // Livechat Department _id\n servedBy: {\n\t _id: number // Agent ID\n username: number // Agent username\n }\n}\n\n/** Result structure for room */\nexport interface ILivechatRoomResultAPI {\n room: ILivechatRoomAPI\n success: boolean\n}\n\n/** Livechat Agent object structure */\nexport interface ILivechatAgentAPI {\n _id: string // Agent ID\n name: string // Agent name\n username: string // Agent username\n emails: ILivechatEmailAPI[]\n}\n\n/** Result structure for agent */\nexport interface ILivechatAgentResultAPI {\n agent: ILivechatAgentAPI\n success: boolean\n}\n\n/** Livechat Message object structure */\nexport interface ILivechatMessageAPI {\n msg: string\n u: {\n _id: string\n username: string\n name: string\n }\n ts: string\n}\n\n/** Result structure for Livechat Message */\nexport interface ILivechatMessageResultAPI {\n message: ILivechatMessageAPI\n success: boolean\n}\n\n/** Payload structure for new Livechat Offline Message */\nexport interface INewLivechatOfflineMessageAPI {\n\tname: string // Message Name\n\temail: string // Message email\n\tmessage: string // Message text\n }\n\n/** Result structure for Livechat Offline Message */\nexport interface ILivechatOfflineMessageResultAPI {\n\tmessage: string\n\tsuccess: boolean\n }\n"]}
\ No newline at end of file
{"version":3,"file":"Interfaces.js","sourceRoot":"","sources":["../../../src/livechat/lib/Interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/** Structure for livechat token field api */\nexport interface ILivechatTokenAPI {\n token: string\n}\n\n/** Structure for livechat room credential api */\nexport interface ILivechatRoomCredentialAPI {\n token: string\n rid?: string\n department?: string\n}\n\n/** Structure for livechat room messages api */\nexport interface ILivechatRoomMessagesAPI {\n token: string // Visitor token\n ts?: string // ISO timestamp\n end?: string // ISO timestamp\n limit: number // number of messages to load\n}\n\n/** Payload structure for livechat `room.transfer` endpoint */\nexport interface ILivechatRoomTransferAPI {\n token: string\n department: string\n}\n\n/** Payload structure for livechat survey values */\nexport interface ILivechatSurveyAPI {\n name: 'satisfaction' | 'agentKnowledge' | 'agentResposiveness' | 'agentFriendliness'\n value: '1' | '2' | '3' | '4' | '5'\n}\n\n/** Payload structure for livechat `room.transfer` endpoint */\nexport interface ILivechatRoomSurveyAPI {\n token: string\n rid: string\n data?: ILivechatSurveyAPI[] // See surcvey interface above\n}\n\n/** Livechat New Room object structure */\nexport interface ILivechatNewRoomAPI {\n _id: string // Room ID\n _updatedAt: string // ISO timestamp\n t: 'r' // Room type (channel, private, direct, livechat)\n msgs: number // Count of messages in room\n ts: string // ISO timestamp (current time in room?)\n lm?: string // ISO timestamp (last message)\n open?: boolean // Room status\n departmentId?: string // Livechat Department _id\n fname: string // Room display name\n v: {\n\t _id: number // Visitor ID\n\t token: string // Visitor token\n\t username: number // Visitor username\n }\n}\n\n/** Result structure for room creation (e.g. DM) */\nexport interface ILivechatNewRoomResultAPI {\n room: ILivechatNewRoomAPI\n newRoom: boolean\n success: boolean\n}\n\n/** Custom Field object structure for livechat endpoints */\nexport interface ILivechatGuestCustomFieldAPI {\n key: string\n value: string\n overwrite: boolean\n}\n\n/** Payload structure for new Livechat Visitors */\nexport interface ILivechatGuestAPI {\n token: string\n name?: string\n email?: string\n department?: string\n phone?: string\n username?: string\n customFields?: ILivechatGuestCustomFieldAPI[]\n}\n\n/** Visitor object structure for livechat endpoints */\nexport interface INewLivechatGuestAPI {\n visitor: ILivechatGuestAPI\n}\n\n/** Payload structure for new Livechat Message */\nexport interface INewLivechatMessageAPI {\n _id?: string // Message ID\n msg: string // Message text\n token: string // Livechat Token\n rid: string // Room ID\n agent?: {\n agentId: string\n username: string\n }\n}\n\n/** Result structure for visitor emails */\nexport interface ILivechatEmailAPI {\n address: string,\n verified?: boolean\n}\n\n/** Result structure for visitor phones */\nexport interface ILivechatVisitorPhoneAPI {\n phoneNumber: string\n}\n\n/** Result structure for visitor prop */\nexport interface ILivechatVisitorAPI {\n token: string\n _updatedAt: string\n name?: string\n phone?: ILivechatVisitorPhoneAPI[]\n username: string\n visitorEmails?: ILivechatEmailAPI[]\n livechatData?: object\n}\n\n/** Result structure for visitor creation */\nexport interface ILivechatVisitorResultAPI {\n visitor: ILivechatVisitorAPI\n success: boolean\n}\n\n/** Result structure for config survey */\nexport interface ILivechatConfigSurveyAPI {\n items: ['satisfaction', 'agentKnowledge', 'agentResposiveness', 'agentFriendliness']\n values: ['1', '2', '3', '4', '5']\n}\n\n/** Result structure for config prop */\nexport interface ILivechatConfigAPI {\n enabled: boolean\n online?: boolean\n settings?: object\n theme?: object\n messages?: object\n survey?: ILivechatConfigSurveyAPI,\n guest?: ILivechatGuestAPI\n}\n\n/** Result structure for Livechat config */\nexport interface ILivechatConfigResultAPI {\n config: ILivechatConfigAPI\n success: boolean\n}\n\n/** Livechat Room object structure */\nexport interface ILivechatRoomAPI {\n _id: string // Room ID\n open?: boolean // Room status\n departmentId?: string // Livechat Department _id\n servedBy: {\n\t _id: number // Agent ID\n username: number // Agent username\n }\n}\n\n/** Result structure for room */\nexport interface ILivechatRoomResultAPI {\n room: ILivechatRoomAPI\n success: boolean\n}\n\n/** Livechat Agent object structure */\nexport interface ILivechatAgentAPI {\n _id: string // Agent ID\n name: string // Agent name\n username: string // Agent username\n emails: ILivechatEmailAPI[]\n}\n\n/** Result structure for agent */\nexport interface ILivechatAgentResultAPI {\n agent: ILivechatAgentAPI\n success: boolean\n}\n\n/** Livechat Message object structure */\nexport interface ILivechatMessageAPI {\n msg: string\n u: {\n _id: string\n username: string\n name: string\n }\n ts: string\n}\n\n/** Result structure for Livechat Message */\nexport interface ILivechatMessageResultAPI {\n message: ILivechatMessageAPI\n success: boolean\n}\n\n/** Payload structure for new Livechat Offline Message */\nexport interface INewLivechatOfflineMessageAPI {\n name: string // Message Name\n email: string // Message email\n message: string // Message text\n}\n\n/** Result structure for Livechat Offline Message */\nexport interface ILivechatOfflineMessageResultAPI {\n message: string\n success: boolean\n}\n\n/** Navigation object structure for livechat endpoints */\nexport interface ILivechatNavigation {\n change: string // Action (Url or Page Title)\n title: string // Page Title\n location: {\n href: string\n }\n token?: string\n}\n\n/** Payload structure for new Livechat Visitor Navigation */\nexport interface INewLivechatNavigationAPI {\n token: string // Livechat Token\n rid: string // Room ID\n pageInfo: ILivechatNavigation\n}\n\n/** Result structure for Livechat Navigation */\nexport interface ILivechatNavigationResultAPI {\n page?: {\n msg: string\n navigation: ILivechatNavigation\n }\n success: boolean\n}\n\n/** Result structure for Livechat Transcript */\nexport interface ILivechatTranscriptResultAPI {\n message: string\n success: boolean\n}\n\n/** Livechat VideoCall object structure */\nexport interface ILivechatVideoCallAPI {\n rid: string // Room ID\n domain: string // Video Call provider domain\n provider: string // Video Call provider name\n room: string // Video Call room\n}\n\n/** Result structure for Livechat VideoCall */\nexport interface ILivechatVideoCallResultAPI {\n videoCall: ILivechatVideoCallAPI\n success: boolean\n}\n\n/** Payload structure for new Livechat CustomField */\nexport interface ILivechaCustomFieldAPI {\n key: string\n value: string\n overwrite: boolean\n}\n\n/** Livechat CustomField object structure */\nexport interface INewLivechatCustomFieldAPI {\n token: string // Visitor token\n key: string // CustomField key\n value: string // CustomField value\n overwrite: boolean // Overwrite CustomField value if exists\n}\n\n/** Result structure for Livechat CustomField */\nexport interface ILivechatCustomFieldResultAPI {\n field: ILivechaCustomFieldAPI\n success: boolean\n}\n\n/** Structure for Livechat CustomFields api */\nexport interface INewLivechatCustomFieldsAPI {\n token: string // Visitor token\n customFields: ILivechaCustomFieldAPI[]\n}\n\n/** Result structure for Livechat CustomFields */\nexport interface ILivechatCustomFieldsResultAPI {\n fields: ILivechaCustomFieldAPI[]\n success: boolean\n}\n"]}
\ No newline at end of file
......@@ -10,19 +10,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
const api = __importStar(require("../../lib/api"));
/** Query helpers for livechat REST requests */
exports.livechat = {
config: (params) => api.get(`livechat/config/${params && params.token}`).then((r) => r),
room: (params) => api.get('livechat/room', params).then((r) => r),
closeChat: (params) => (api.post(`livechat/room.close/${params.rid}`, { token: params.token }, false)).then((r) => r),
transferChat: (params) => (api.post(`livechat/room.transfer/${params.rid}`, { token: params.token, department: params.department }, false)).then((r) => r),
chatSurvey: (params) => (api.post(`livechat/room.survey/${params.rid}`, { token: params.token, data: params.data }, false)).then((r) => r),
config: (params) => api.get('livechat/config', params).then((r) => r),
room: (credentials) => api.get('livechat/room', credentials).then((r) => r),
closeChat: (credentials) => (api.post('livechat/room.close', { rid: credentials.rid, token: credentials.token }, false)).then((r) => r),
transferChat: (credentials) => (api.post('livechat/room.transfer', { rid: credentials.rid, token: credentials.token, department: credentials.department }, false)).then((r) => r),
chatSurvey: (survey) => (api.post('livechat/room.survey', { rid: survey.rid, token: survey.token, data: survey.data }, false)).then((r) => r),
visitor: (params) => api.get(`livechat/visitor/${params.token}`).then((r) => r),
grantVisitor: (visitor) => (api.post('livechat/visitor', visitor, false)).then((r) => r),
agent: (params) => api.get(`livechat/agent.info/${params && params.rid}/${params && params.token}`).then((r) => r),
nextAgent: (params) => api.get(`livechat/agent.next/${params && params.token}`, { department: params.department }).then((r) => r),
grantVisitor: (guest) => (api.post('livechat/visitor', guest, false)).then((r) => r),
agent: (credentials) => api.get(`livechat/agent.info/${credentials && credentials.rid}/${credentials && credentials.token}`).then((r) => r),
nextAgent: (credentials) => api.get(`livechat/agent.next/${credentials && credentials.token}`, { department: credentials.department }).then((r) => r),
sendMessage: (message) => (api.post('livechat/message', message, false)).then((r) => r),
editMessage: (id, message) => (api.put(`livechat/message/${id}`, message, false)).then((r) => r),
deleteMessage: (id, params) => (api.del(`livechat/message/${id}`, params, false)).then((r) => r),
deleteMessage: (id, credentials) => (api.del(`livechat/message/${id}`, credentials, false)).then((r) => r),
loadMessages: (id, params) => api.get(`livechat/messages.history/${id}`, params).then((r) => r),
sendOfflineMessage: (message) => (api.post('livechat/offline.message', message, false)).then((r) => r),
sendVisitorNavigation: (credentials, page) => (api.post('livechat/page.visited', Object.assign({ token: credentials.token, rid: credentials.rid }, page), false)).then((r) => r),
requestTranscript: (email, credentials) => (api.post('livechat/transcript', { token: credentials.token, rid: credentials.rid, email }, false)).then((r) => r),
videoCall: (credentials) => (api.get(`livechat/video.call/${credentials.token}`, { rid: credentials.rid }, false)).then((r) => r),
sendCustomField: (field) => (api.post('livechat/custom.field', field, false)).then((r) => r),
sendCustomFields: (fields) => (api.post('livechat/custom.fields', fields, false)).then((r) => r)
};
//# sourceMappingURL=api.js.map
\ No newline at end of file
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/livechat/lib/api.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAoC;AAiBpC,+CAA+C;AAClC,QAAA,QAAQ,GAAQ;IAC3B,MAAM,EAAE,CAAC,MAAyB,EAAE,EAAE,CAAC,GAAG,CAAC,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AC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACtI,YAAY,EAAE,CAAC,EAAU,EAAE,MAAgC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,6BAA8B,EAAG,EAAE,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACnI,kBAAkB,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,0BAA0B,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAmC,EAAE,EAAE,CAAC,CAAC,CAAC;CACxK,CAAA","sourcesContent":["import * as api from '../../lib/api'\nimport {\n ILivechatTokenAPI,\n ILivechatRoomCredencialAPI,\n ILivechatRoomResultAPI,\n INewLivechatGuestAPI,\n ILivechatVisitorResultAPI,\n ILivechatConfigResultAPI,\n ILivechatRoomSurveyAPI,\n ILivechatAgentResultAPI,\n INewLivechatMessageAPI,\n ILivechatMessageResultAPI,\n ILivechatRoomMessagesAPI,\n INewLivechatOfflineMessageAPI,\n ILivechatOfflineMessageResultAPI\n} from './Interfaces'\n\n/** Query helpers for livechat REST requests */\nexport const livechat: any = {\n config: (params: ILivechatTokenAPI) => api.get(`livechat/config/${ params && params.token }`).then((r: ILivechatConfigResultAPI) => r),\n room: (params: ILivechatRoomCredencialAPI) => api.get('livechat/room', params).then((r: ILivechatRoomResultAPI) => r),\n closeChat: (params: ILivechatRoomCredencialAPI) => (api.post(`livechat/room.close/${ params.rid }`, { token: params.token }, false)).then((r) => r),\n transferChat: (params: ILivechatRoomCredencialAPI) => (api.post(`livechat/room.transfer/${ params.rid }`, { token: params.token, department: params.department }, false)).then((r) => r),\n chatSurvey: (params: ILivechatRoomSurveyAPI) => (api.post(`livechat/room.survey/${ params.rid }`, { token: params.token, data: params.data }, false)).then((r) => r),\n visitor: (params: ILivechatTokenAPI) => api.get(`livechat/visitor/${ params.token }`).then((r: ILivechatVisitorResultAPI) => r),\n grantVisitor: (visitor: INewLivechatGuestAPI) => (api.post('livechat/visitor', visitor, false)).then((r: ILivechatVisitorResultAPI) => r),\n agent: (params: ILivechatRoomCredencialAPI) => api.get(`livechat/agent.info/${ params && params.rid }/${ params && params.token }`).then((r: ILivechatAgentResultAPI) => r),\n nextAgent: (params: ILivechatRoomCredencialAPI) => api.get(`livechat/agent.next/${ params && params.token }`, { department: params.department}).then((r: ILivechatAgentResultAPI) => r),\n sendMessage: (message: INewLivechatMessageAPI) => (api.post('livechat/message', message, false)).then((r: ILivechatMessageResultAPI) => r),\n editMessage: (id: string, message: INewLivechatMessageAPI) => (api.put(`livechat/message/${ id }`, message, false)).then((r: ILivechatMessageResultAPI) => r),\n deleteMessage: (id: string, params: ILivechatRoomCredencialAPI) => (api.del(`livechat/message/${ id }`, params, false)).then((r) => r),\n loadMessages: (id: string, params: ILivechatRoomMessagesAPI) => api.get(`livechat/messages.history/${ id }`, params).then((r) => r),\n sendOfflineMessage: (message: INewLivechatOfflineMessageAPI) => (api.post('livechat/offline.message', message, false)).then((r: ILivechatOfflineMessageResultAPI) => r),\n}\n"]}
\ No newline at end of file
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/livechat/lib/api.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAoC;AAyBpC,+CAA+C;AAClC,QAAA,QAAQ,GAAQ;IAC3B,MAAM,EAAE,CAAC,MAAyB,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAA2B,EAAE,EAAE,CAAC,CAAC,CAAC;IAClH,IAAI,EAAE,CAAC,WAAuC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAyB,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/H,SAAS,EAAE,CAAC,WAAuC,EAAE,EAAE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AAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAiC,EAAE,EAAE,CAAC,CAAC,CAAC;CAC9J,CAAA","sourcesContent":["import * as api from '../../lib/api'\nimport {\n ILivechatTokenAPI,\n ILivechatRoomCredentialAPI,\n ILivechatRoomResultAPI,\n INewLivechatGuestAPI,\n ILivechatVisitorResultAPI,\n ILivechatConfigResultAPI,\n ILivechatRoomSurveyAPI,\n ILivechatAgentResultAPI,\n INewLivechatMessageAPI,\n ILivechatMessageResultAPI,\n ILivechatRoomMessagesAPI,\n INewLivechatOfflineMessageAPI,\n ILivechatOfflineMessageResultAPI,\n INewLivechatNavigationAPI,\n ILivechatNavigationResultAPI,\n ILivechatTranscriptResultAPI,\n ILivechatVideoCallResultAPI,\n INewLivechatCustomFieldAPI,\n ILivechatCustomFieldResultAPI,\n INewLivechatCustomFieldsAPI,\n ILivechatCustomFieldsResultAPI\n} from './Interfaces'\n\n/** Query helpers for livechat REST requests */\nexport const livechat: any = {\n config: (params: ILivechatTokenAPI) => api.get('livechat/config', params).then((r: ILivechatConfigResultAPI) => r),\n room: (credentials: ILivechatRoomCredentialAPI) => api.get('livechat/room', credentials).then((r: ILivechatRoomResultAPI) => r),\n closeChat: (credentials: ILivechatRoomCredentialAPI) => (api.post('livechat/room.close', { rid: credentials.rid, token: credentials.token }, false)).then((r) => r),\n transferChat: (credentials: ILivechatRoomCredentialAPI) => (api.post('livechat/room.transfer', { rid: credentials.rid, token: credentials.token, department: credentials.department }, false)).then((r) => r),\n chatSurvey: (survey: ILivechatRoomSurveyAPI) => (api.post('livechat/room.survey', { rid: survey.rid, token: survey.token, data: survey.data }, false)).then((r) => r),\n visitor: (params: ILivechatTokenAPI) => api.get(`livechat/visitor/${params.token}`).then((r: ILivechatVisitorResultAPI) => r),\n grantVisitor: (guest: INewLivechatGuestAPI) => (api.post('livechat/visitor', guest, false)).then((r: ILivechatVisitorResultAPI) => r),\n agent: (credentials: ILivechatRoomCredentialAPI) => api.get(`livechat/agent.info/${credentials && credentials.rid}/${credentials && credentials.token}`).then((r: ILivechatAgentResultAPI) => r),\n nextAgent: (credentials: ILivechatRoomCredentialAPI) => api.get(`livechat/agent.next/${credentials && credentials.token}`, { department: credentials.department }).then((r: ILivechatAgentResultAPI) => r),\n sendMessage: (message: INewLivechatMessageAPI) => (api.post('livechat/message', message, false)).then((r: ILivechatMessageResultAPI) => r),\n editMessage: (id: string, message: INewLivechatMessageAPI) => (api.put(`livechat/message/${id}`, message, false)).then((r: ILivechatMessageResultAPI) => r),\n deleteMessage: (id: string, credentials: ILivechatRoomCredentialAPI) => (api.del(`livechat/message/${id}`, credentials, false)).then((r) => r),\n loadMessages: (id: string, params: ILivechatRoomMessagesAPI) => api.get(`livechat/messages.history/${id}`, params).then((r) => r),\n sendOfflineMessage: (message: INewLivechatOfflineMessageAPI) => (api.post('livechat/offline.message', message, false)).then((r: ILivechatOfflineMessageResultAPI) => r),\n sendVisitorNavigation: (credentials: ILivechatRoomCredentialAPI, page: INewLivechatNavigationAPI) => (api.post('livechat/page.visited', { token: credentials.token, rid: credentials.rid, ...page }, false)).then((r: ILivechatNavigationResultAPI) => r),\n requestTranscript: (email: string, credentials: ILivechatRoomCredentialAPI) => (api.post('livechat/transcript', { token: credentials.token, rid: credentials.rid, email }, false)).then((r: ILivechatTranscriptResultAPI) => r),\n videoCall: (credentials: ILivechatRoomCredentialAPI) => (api.get(`livechat/video.call/${credentials.token}`, { rid: credentials.rid }, false)).then((r: ILivechatVideoCallResultAPI) => r),\n sendCustomField: (field: INewLivechatCustomFieldAPI) => (api.post('livechat/custom.field', field, false)).then((r: ILivechatCustomFieldResultAPI) => r),\n sendCustomFields: (fields: INewLivechatCustomFieldsAPI) => (api.post('livechat/custom.fields', fields, false)).then((r: ILivechatCustomFieldsResultAPI) => r)\n}\n"]}
\ No newline at end of file
import { INewLivechatGuestAPI, ILivechatSurveyAPI, INewLivechatOfflineMessageAPI } from './Interfaces';
import { INewLivechatGuestAPI, ILivechatSurveyAPI, INewLivechatOfflineMessageAPI, INewLivechatNavigationAPI, INewLivechatCustomFieldAPI, INewLivechatCustomFieldsAPI } from './Interfaces';
export declare const mockVisitor: INewLivechatGuestAPI;
export declare const mockSurvey: ILivechatSurveyAPI[];
export declare const mockOfflineMessage: INewLivechatOfflineMessageAPI;
export declare const mockVisitorNavigation: INewLivechatNavigationAPI;
export declare const mockCustomField: INewLivechatCustomFieldAPI;
export declare const mockCustomFields: INewLivechatCustomFieldsAPI;
......@@ -28,4 +28,36 @@ exports.mockOfflineMessage = {
email: 'sample@rocket.chat',
message: 'This is a Message!'
};
exports.mockVisitorNavigation = {
token: '123456789',
rid: '',
pageInfo: {
change: 'url',
title: 'Livechat Demo Page',
location: {
href: 'http://localhost:3000/assets/demo.html#page-1'
}
}
};
exports.mockCustomField = {
token: '123456789',
key: 'address',
value: 'Rocket.Chat Avenue',
overwrite: true
};
exports.mockCustomFields = {
token: '123456789',
customFields: [
{
key: 'address',
value: 'Rocket.Chat Avenue - Porto Alegre',
overwrite: true
},
{
key: 'state',
value: 'RS',
overwrite: true
}
]
};
//# sourceMappingURL=mock.js.map
\ No newline at end of file
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../../../src/livechat/lib/mock.ts"],"names":[],"mappings":";;AAMa,QAAA,WAAW,GAAyB;IAC/C,OAAO,EAAE;QACP,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,qBAAqB;QAC5B,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,iBAAiB;QACxB,YAAY,EAAE,CAAC;gBACb,GAAG,EAAE,SAAS;gBACd,KAAK,EAAE,oBAAoB;gBAC3B,SAAS,EAAE,IAAI;aAChB,CAAC;KACH;CACF,CAAA;AAEY,QAAA,UAAU,GAAyB;IAC5C;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,GAAG;KACX;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,GAAG;KACX;CACJ,CAAA;AAEY,QAAA,kBAAkB,GAAkC;IAC/D,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,oBAAoB;IAC3B,OAAO,EAAE,oBAAoB;CAC9B,CAAA","sourcesContent":["import {\n INewLivechatGuestAPI,\n ILivechatSurveyAPI,\n INewLivechatOfflineMessageAPI\n} from './Interfaces'\n\nexport const mockVisitor: INewLivechatGuestAPI = {\n visitor: {\n name: 'Livechat Visitor',\n email: 'visitor@rocket.chat',\n token: '123456789',\n phone: '55 51 5555-5555',\n customFields: [{\n key: 'address',\n value: 'Rocket.Chat street',\n overwrite: true\n }]\n }\n}\n\nexport const mockSurvey: ILivechatSurveyAPI[] = [\n {\n name: 'satisfaction',\n value: '3'\n },\n {\n name: 'agentResposiveness',\n value: '5'\n }\n]\n\nexport const mockOfflineMessage: INewLivechatOfflineMessageAPI = {\n name: 'Livechat Visitor',\n email: 'sample@rocket.chat',\n message: 'This is a Message!'\n}\n\n\n"]}
\ No newline at end of file
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../../../src/livechat/lib/mock.ts"],"names":[],"mappings":";;AASa,QAAA,WAAW,GAAyB;IAC/C,OAAO,EAAE;QACP,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,qBAAqB;QAC5B,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,iBAAiB;QACxB,YAAY,EAAE,CAAC;gBACb,GAAG,EAAE,SAAS;gBACd,KAAK,EAAE,oBAAoB;gBAC3B,SAAS,EAAE,IAAI;aAChB,CAAC;KACH;CACF,CAAA;AAEY,QAAA,UAAU,GAAyB;IAC9C;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,GAAG;KACX;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,GAAG;KACX;CACF,CAAA;AAEY,QAAA,kBAAkB,GAAkC;IAC/D,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,oBAAoB;IAC3B,OAAO,EAAE,oBAAoB;CAC9B,CAAA;AAEY,QAAA,qBAAqB,GAA8B;IAC9D,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE,EAAE;IACP,QAAQ,EAAE;QACR,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,oBAAoB;QAC3B,QAAQ,EAAE;YACR,IAAI,EAAE,+CAA+C;SACtD;KACF;CACF,CAAA;AAEY,QAAA,eAAe,GAA+B;IACzD,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,IAAI;CAChB,CAAA;AAEY,QAAA,gBAAgB,GAAgC;IAC3D,KAAK,EAAE,WAAW;IAClB,YAAY,EAAE;QACZ;YACE,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,mCAAmC;YAC1C,SAAS,EAAE,IAAI;SAChB;QACD;YACE,GAAG,EAAE,OAAO;YACZ,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,IAAI;SAChB;KACF;CACF,CAAA","sourcesContent":["import {\n INewLivechatGuestAPI,\n ILivechatSurveyAPI,\n INewLivechatOfflineMessageAPI,\n INewLivechatNavigationAPI,\n INewLivechatCustomFieldAPI,\n INewLivechatCustomFieldsAPI\n} from './Interfaces'\n\nexport const mockVisitor: INewLivechatGuestAPI = {\n visitor: {\n name: 'Livechat Visitor',\n email: 'visitor@rocket.chat',\n token: '123456789',\n phone: '55 51 5555-5555',\n customFields: [{\n key: 'address',\n value: 'Rocket.Chat street',\n overwrite: true\n }]\n }\n}\n\nexport const mockSurvey: ILivechatSurveyAPI[] = [\n {\n name: 'satisfaction',\n value: '3'\n },\n {\n name: 'agentResposiveness',\n value: '5'\n }\n]\n\nexport const mockOfflineMessage: INewLivechatOfflineMessageAPI = {\n name: 'Livechat Visitor',\n email: 'sample@rocket.chat',\n message: 'This is a Message!'\n}\n\nexport const mockVisitorNavigation: INewLivechatNavigationAPI = {\n token: '123456789',\n rid: '',\n pageInfo: {\n change: 'url',\n title: 'Livechat Demo Page',\n location: {\n href: 'http://localhost:3000/assets/demo.html#page-1'\n }\n }\n}\n\nexport const mockCustomField: INewLivechatCustomFieldAPI = {\n token: '123456789',\n key: 'address',\n value: 'Rocket.Chat Avenue',\n overwrite: true\n}\n\nexport const mockCustomFields: INewLivechatCustomFieldsAPI = {\n token: '123456789',\n customFields: [\n {\n key: 'address',\n value: 'Rocket.Chat Avenue - Porto Alegre',\n overwrite: true\n },\n {\n key: 'state',\n value: 'RS',\n overwrite: true\n }\n ]\n}\n"]}
\ No newline at end of file
......@@ -55,6 +55,8 @@ function messages() {
};
const result = yield api.livechat.sendMessage(newMessage);
const _id = result && result.message && result.message._id;
const roomCredential = { token, rid };
const pageInfo = Object.assign({}, mock_1.mockVisitorNavigation, { rid });
console.log(`
Demo of API livechat query helpers
......@@ -74,6 +76,9 @@ ${JSON.stringify(yield api.livechat.deleteMessage(_id, { token, rid }), null, '\
Send Livechat Offline Message \`api.livechat.sendOfflineMessage()\`:
${JSON.stringify(yield api.livechat.sendOfflineMessage(mock_1.mockOfflineMessage), null, '\t')}
Send Livechat Visitor Navigation \`api.livechat.sendVisitorNavigation()\`:
${JSON.stringify(yield api.livechat.sendVisitorNavigation(roomCredential, pageInfo), null, '\t')}
`);
});
}
......
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/livechat/messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oCAAoC;AACpC,qCAA4D;AAC5D,yDAA0C;AAE1C,aAAO,EAAE,CAAA;AAET,SAAe,eAAe;;QAC5B,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAA;QACrD,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,EAAE,EAAE;YAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,kBAAW,CAAC,CAAA;YAChE,KAAK,GAAG,OAAO,IAAI,OAAO,CAAC,KAAK,CAAA;SACjC;QAED,O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QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;;EAGjF,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC,yBAAkB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;GAEpF,CAAC,CAAA;IACJ,CAAC;CAAA;AAED,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import * as api from './lib/api'\nimport { silence } from '../lib/log'\nimport { mockVisitor, mockOfflineMessage } from './lib/mock'\nimport * as settings from './lib/settings'\n\nsilence()\n\nasync function getVisitorToken () {\n console.log('\\nPreparing visitor token for tests...')\n let token = settings.token\n if (!token || token === '') {\n const { visitor } = await api.livechat.grantVisitor(mockVisitor)\n token = visitor && visitor.token\n }\n\n return token\n}\n\nasync function getRoom (token: string) {\n console.log('\\nPreparing room for tests...')\n const { room } = await api.livechat.room({ token })\n return room\n}\n\nasync function messages () {\n const token = await getVisitorToken()\n\n const room = await getRoom(token)\n const rid = room && room._id\n\n const newMessage = {\n\t token,\n\t rid,\n\t msg: 'sending livechat message..'\n }\n\n const editMessage = {\n\t token,\n\t rid,\n\t msg: 'editing livechat message..'\n }\n\n const result = await api.livechat.sendMessage(newMessage)\n const _id = result && result.message && result.message._id\n console.log(`\n\nDemo of API livechat query helpers\n\nSend Livechat Message \\`api.livechat.sendMessage()\\`:\n${JSON.stringify(result, null, '\\t')}\n\nEdit Livechat Message \\`api.livechat.editMessage()\\`:\n${JSON.stringify(await api.livechat.editMessage(_id, editMessage), null, '\\t')}\n\nLoad Livechat Messages \\`api.livechat.loadMessages()\\`:\n${JSON.stringify(await api.livechat.loadMessages(rid, { token }), null, '\\t')}\n\nDelete Livechat Message \\`api.livechat.deleteMessage()\\`:\n${JSON.stringify(await api.livechat.deleteMessage(_id, { token, rid }), null, '\\t')}\n\nSend Livechat Offline Message \\`api.livechat.sendOfflineMessage()\\`:\n${JSON.stringify(await api.livechat.sendOfflineMessage(mockOfflineMessage), null, '\\t')}\n\n `)\n}\n\nmessages().catch((e) => console.error(e))\n"]}
\ No newline at end of file
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/livechat/messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oCAAoC;AACpC,qCAAmF;AACnF,yDAA0C;AAE1C,aAAO,EAAE,CAAA;AAET,SAAe,eAAe;;QAC5B,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAA;QACrD,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,EAAE,EAAE;YAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,kBAAW,CAAC,CAAA;YAChE,KAAK,GAAG,OAAO,IAAI,OAAO,CAAC,KAAK,CAAA;SACjC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;CAAA;AAED,SAAe,OAAO,CAAE,KAAa;;QACnC,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;QAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AAED,SAAe,QAAQ;;QACrB,MAAM,KAAK,GAAG,MAAM,eAAe,EAAE,CAAA;QAErC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;QACjC,MAAM,GAAG,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,CAAA;QAE5B,MAAM,UAAU,GAAG;YAClB,KAAK;YACL,GAAG;YACH,GAAG,EAAE,4BAA4B;SACjC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E7F,CAAC,CAAA;IACJ,CAAC;CAAA;AAED,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import * as api from './lib/api'\nimport { silence } from '../lib/log'\nimport { mockVisitor, mockOfflineMessage, mockVisitorNavigation } from './lib/mock'\nimport * as settings from './lib/settings'\n\nsilence()\n\nasync function getVisitorToken () {\n console.log('\\nPreparing visitor token for tests...')\n let token = settings.token\n if (!token || token === '') {\n const { visitor } = await api.livechat.grantVisitor(mockVisitor)\n token = visitor && visitor.token\n }\n\n return token\n}\n\nasync function getRoom (token: string) {\n console.log('\\nPreparing room for tests...')\n const { room } = await api.livechat.room({ token })\n return room\n}\n\nasync function messages () {\n const token = await getVisitorToken()\n\n const room = await getRoom(token)\n const rid = room && room._id\n\n const newMessage = {\n\t token,\n\t rid,\n\t msg: 'sending livechat message..'\n }\n\n const editMessage = {\n\t token,\n\t rid,\n\t msg: 'editing livechat message..'\n }\n\n const result = await api.livechat.sendMessage(newMessage)\n const _id = result && result.message && result.message._id\n\n const roomCredential = { token, rid }\n const pageInfo = Object.assign({}, mockVisitorNavigation, { rid })\n\n console.log(`\n\nDemo of API livechat query helpers\n\nSend Livechat Message \\`api.livechat.sendMessage()\\`:\n${JSON.stringify(result, null, '\\t')}\n\nEdit Livechat Message \\`api.livechat.editMessage()\\`:\n${JSON.stringify(await api.livechat.editMessage(_id, editMessage), null, '\\t')}\n\nLoad Livechat Messages \\`api.livechat.loadMessages()\\`:\n${JSON.stringify(await api.livechat.loadMessages(rid, { token }), null, '\\t')}\n\nDelete Livechat Message \\`api.livechat.deleteMessage()\\`:\n${JSON.stringify(await api.livechat.deleteMessage(_id, { token, rid }), null, '\\t')}\n\nSend Livechat Offline Message \\`api.livechat.sendOfflineMessage()\\`:\n${JSON.stringify(await api.livechat.sendOfflineMessage(mockOfflineMessage), null, '\\t')}\n\nSend Livechat Visitor Navigation \\`api.livechat.sendVisitorNavigation()\\`:\n${JSON.stringify(await api.livechat.sendVisitorNavigation(roomCredential, pageInfo), null, '\\t')}\n\n `)\n}\n\nmessages().catch((e) => console.error(e))\n"]}
\ No newline at end of file
......@@ -44,6 +44,7 @@ function rooms() {
const room = yield getRoom(token);
const rid = room && room._id;
const department = settings.deparmentId;
const email = 'sample@rocket.chat';
console.log(`
Demo of API livechat query helpers
......@@ -57,9 +58,15 @@ ${JSON.stringify(yield api.livechat.transferChat({ rid, token, department }), nu
Livechat Survey \`api.livechat.chatSurvey()\`:
${JSON.stringify(yield api.livechat.chatSurvey({ rid, token, data: mock_1.mockSurvey }), null, '\t')}
Request Livechat VideoCall \`api.livechat.videoCall()\`:
${JSON.stringify(yield api.livechat.videoCall({ rid, token }), null, '\t')}
Close Livechat Room \`api.livechat.closeChat()\`:
${JSON.stringify(yield api.livechat.closeChat({ rid, token }), null, '\t')}
Request Livechat Transcript \`api.livechat.requestTranscript()\`:
${JSON.stringify(yield api.livechat.requestTranscript(email, { rid, token }), null, '\t')}
`);
});
}
......
{"version":3,"file":"rooms.js","sourceRoot":"","sources":["../../src/livechat/rooms.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oCAAoC;AACpC,qCAAoD;AACpD,yDAA0C;AAE1C,aAAO,EAAE,CAAA;AAET,SAAe,eAAe;;QAC5B,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAA;QACrD,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,EAAE,EAAE;YAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,kBAAW,CAAC,CAAA;YAChE,KAAK,GAAG,OAAO,IAAI,OAAO,CAAC,KAAK,CAAA;SACjC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;CAAA;AAED,SAAe,OAAO,CAAE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ey } from './lib/mock'\nimport * as settings from './lib/settings'\n\nsilence()\n\nasync function getVisitorToken () {\n console.log('\\nPreparing visitor token for tests...')\n let token = settings.token\n if (!token || token === '') {\n const { visitor } = await api.livechat.grantVisitor(mockVisitor)\n token = visitor && visitor.token\n }\n\n return token\n}\n\nasync function getRoom (token: string) {\n console.log('\\nPreparing room for tests...')\n const { room } = await api.livechat.room({ token })\n return room\n}\n\nasync function rooms () {\n const token = await getVisitorToken()\n\n const room = await getRoom(token)\n const rid = room && room._id\n\n const department = settings.deparmentId\n\n console.log(`\n\nDemo of API livechat query helpers\n\n\\`api.livechat.room()\\`:\n${JSON.stringify(room, null, '\\t')}\n\nTransfer Livechat \\`api.livechat.tranferChat()\\`:\n${JSON.stringify(await api.livechat.transferChat({ rid, token, department }), null, '\\t')}\n\nLivechat Survey \\`api.livechat.chatSurvey()\\`:\n${JSON.stringify(await api.livechat.chatSurvey({ rid, token, data: mockSurvey }), null, '\\t')}\n\nClose Livechat Room \\`api.livechat.closeChat()\\`:\n${JSON.stringify(await api.livechat.closeChat({ rid, token }), null, '\\t')}\n\n `)\n}\n\nrooms().catch((e) => console.error(e))\n"]}
\ No newline at end of file
{"version":3,"file":"rooms.js","sourceRoot":"","sources":["../../src/livechat/rooms.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oCAAoC;AACpC,qCAAoD;AACpD,yDAA0C;AAE1C,aAAO,EAAE,CAAA;AAET,SAAe,eAAe;;QAC5B,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAA;QACrD,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,EAAE,EAAE;YAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,kBAAW,CAAC,CAAA;YAChE,KAAK,GAAG,OAAO,IAAI,OAAO,CAAC,KAAK,CAAA;SACjC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EAAE,IAAI,EAAE,IAAI,CAAC;;;EAGxE,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;GAEtF,CAAC,CAAA;IACJ,CAAC;CAAA;AAED,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import * as api from './lib/api'\nimport { silence } from '../lib/log'\nimport { mockVisitor, mockSurvey } from './lib/mock'\nimport * as settings from './lib/settings'\n\nsilence()\n\nasync function getVisitorToken () {\n console.log('\\nPreparing visitor token for tests...')\n let token = settings.token\n if (!token || token === '') {\n const { visitor } = await api.livechat.grantVisitor(mockVisitor)\n token = visitor && visitor.token\n }\n\n return token\n}\n\nasync function getRoom (token: string) {\n console.log('\\nPreparing room for tests...')\n const { room } = await api.livechat.room({ token })\n return room\n}\n\nasync function rooms () {\n const token = await getVisitorToken()\n\n const room = await getRoom(token)\n const rid = room && room._id\n\n const department = settings.deparmentId\n\n const email = 'sample@rocket.chat'\n\n console.log(`\n\nDemo of API livechat query helpers\n\n\\`api.livechat.room()\\`:\n${JSON.stringify(room, null, '\\t')}\n\nTransfer Livechat \\`api.livechat.tranferChat()\\`:\n${JSON.stringify(await api.livechat.transferChat({ rid, token, department }), null, '\\t')}\n\nLivechat Survey \\`api.livechat.chatSurvey()\\`:\n${JSON.stringify(await api.livechat.chatSurvey({ rid, token, data: mockSurvey }), null, '\\t')}\n\nRequest Livechat VideoCall \\`api.livechat.videoCall()\\`:\n${JSON.stringify(await api.livechat.videoCall({ rid, token }), null, '\\t')}\n\nClose Livechat Room \\`api.livechat.closeChat()\\`:\n${JSON.stringify(await api.livechat.closeChat({ rid, token }), null, '\\t')}\n\nRequest Livechat Transcript \\`api.livechat.requestTranscript()\\`:\n${JSON.stringify(await api.livechat.requestTranscript(email, { rid, token }), null, '\\t')}\n\n `)\n}\n\nrooms().catch((e) => console.error(e))\n"]}
\ No newline at end of file
......@@ -29,6 +29,12 @@ Demo of API livechat query helpers
Create Livechat Visitor \`api.livechat.grantVisitor()\`:
${JSON.stringify(yield api.livechat.grantVisitor(mock_1.mockVisitor), null, '\t')}
Add new Livechat CustomField \`api.livechat.sendCustomField()\`:
${JSON.stringify(yield api.livechat.sendCustomField(mock_1.mockCustomField), null, '\t')}
Add new Livechat CustomFields \`api.livechat.sendCustomFields()\`:
${JSON.stringify(yield api.livechat.sendCustomFields(mock_1.mockCustomFields), null, '\t')}
\`api.livechat.visitor()\`:
${JSON.stringify(yield api.livechat.visitor({ token }), null, '\t')}
......
{"version":3,"file":"visitors.js","sourceRoot":"","sources":["../../src/livechat/visitors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oCAAoC;AACpC,qCAAwC;AAExC,aAAO,EAAE,CAAA;AAET,MAAM,EAAE,KAAK,EAAE,GAAG,kBAAW,CAAC,OAAO,CAAA;AAErC,SAAe,QAAQ;;QACrB,OAAO,CAAC,GAAG,CAAC;;;;;EAKZ,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,kBAAW,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;;EAGxE,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;EAEjE,CAAC,CAAA;IACH,CAAC;CAAA;AAED,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import * as api from './lib/api'\nimport { silence } from '../lib/log'\nimport { mockVisitor } from './lib/mock'\n\nsilence()\n\nconst { token } = mockVisitor.visitor\n\nasync function visitors () {\n console.log(`\n\nDemo of API livechat query helpers\n\nCreate Livechat Visitor \\`api.livechat.grantVisitor()\\`:\n${JSON.stringify(await api.livechat.grantVisitor(mockVisitor), null, '\\t')}\n\n\\`api.livechat.visitor()\\`:\n${JSON.stringify(await api.livechat.visitor({ token }), null, '\\t')}\n\n\t`)\n}\n\nvisitors().catch((e) => console.error(e))\n"]}
\ No newline at end of file
{"version":3,"file":"visitors.js","sourceRoot":"","sources":["../../src/livechat/visitors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oCAAoC;AACpC,qCAA2E;AAE3E,aAAO,EAAE,CAAA;AAET,MAAM,EAAE,KAAK,EAAE,GAAG,kBAAW,CAAC,OAAO,CAAA;AAErC,SAAe,QAAQ;;QACrB,OAAO,CAAC,GAAG,CAAC;;;;;EAKZ,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,kBAAW,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;;EAGxE,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,sBAAe,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;;EAG/E,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,uBAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;;EAGjF,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;;EAEjE,CAAC,CAAA;IACH,CAAC;CAAA;AAED,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import * as api from './lib/api'\nimport { silence } from '../lib/log'\nimport { mockVisitor, mockCustomField, mockCustomFields } from './lib/mock'\n\nsilence()\n\nconst { token } = mockVisitor.visitor\n\nasync function visitors () {\n console.log(`\n\nDemo of API livechat query helpers\n\nCreate Livechat Visitor \\`api.livechat.grantVisitor()\\`:\n${JSON.stringify(await api.livechat.grantVisitor(mockVisitor), null, '\\t')}\n\nAdd new Livechat CustomField \\`api.livechat.sendCustomField()\\`:\n${JSON.stringify(await api.livechat.sendCustomField(mockCustomField), null, '\\t')}\n\nAdd new Livechat CustomFields \\`api.livechat.sendCustomFields()\\`:\n${JSON.stringify(await api.livechat.sendCustomFields(mockCustomFields), null, '\\t')}\n\n\\`api.livechat.visitor()\\`:\n${JSON.stringify(await api.livechat.visitor({ token }), null, '\\t')}\n\n\t`)\n}\n\nvisitors().catch((e) => console.error(e))\n"]}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment