Skip to content

Commit

Permalink
Fixed session without location
Browse files Browse the repository at this point in the history
  • Loading branch information
knrt10 committed Aug 18, 2019
1 parent a4683de commit f610680
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,11 @@ export interface ILivechatLocationAPI {
deviceInfo: Device
}

export interface ILivechatUserAPI {
token: string
deviceInfo: Device
}

/** Browser and device info */
export interface Device {
os: string
Expand Down
8 changes: 6 additions & 2 deletions src/lib/api/Livechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
ILivechatRoom,
INewLivechatRoomCredentialAPI,
ILivechatUploadAPI,
ILivechatLocationAPI
ILivechatLocationAPI,
ILivechatUserAPI
} from '../../interfaces'

import ApiBase from './api'
Expand All @@ -38,7 +39,7 @@ export default class ApiLivechat extends ApiBase {
}
return visitor
}
updateVisitorSession (guest: INewLivechatGuestAPI) {
updateVisitorSessionOnRegister (guest: INewLivechatGuestAPI) {
return this.post('livechat/session.updateVisitorSessionOnRegister', guest, false)
}
async deleteVisitor () {
Expand All @@ -58,6 +59,9 @@ export default class ApiLivechat extends ApiBase {
sendLocationData (locationData: ILivechatLocationAPI) {
return (this.post('livechat/session.addLocationData', { ...locationData }, false))
}
sendUserDataWithoutLocation (userData: ILivechatUserAPI) {
return (this.post('livechat/session.addLocationData', { ...userData }, false))
}
async updateSessionStatus (status: string, token: string) { return (await this.post(`livechat/session.updateSessionStatus`, { token: token, status })).status }
checkLocationUser (token: string) { return this.get(`livechat/session.userLocation/${token}`) }
updateVisitCount (token: string) { return this.post(`livechat/session.updateVisitCount/${token}`) }
Expand Down

0 comments on commit f610680

Please sign in to comment.