-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] Add new endpoint 'livechat/agent.status' & deprecate changeLive…
…chatStatus meteor method (#27047) Co-authored-by: Kevin Aleman <11577696+KevLehman@users.noreply.github.com>
- Loading branch information
1 parent
4c68a32
commit a00b3f7
Showing
17 changed files
with
634 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
apps/meteor/client/sidebar/sections/actions/OmnichannelLivechatToggle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { api, credentials, methodCall, request } from "../api-data"; | ||
import { updateSetting } from "../permissions.helper" | ||
|
||
export const makeDefaultBusinessHourActiveAndClosed = async () => { | ||
// enable settings | ||
await updateSetting('Livechat_enable_business_hours', true); | ||
await updateSetting('Livechat_business_hour_type', 'Single'); | ||
|
||
// create business hours | ||
const { body: { businessHour } } = await request | ||
.get(api('livechat/business-hour?type=default')) | ||
.set(credentials) | ||
.send(); | ||
|
||
const workHours = businessHour.workHours as { start: string; finish: string; day: string, open: boolean }[]; | ||
const allEnabledWorkHours = workHours.map((workHour) => { | ||
workHour.open = true; | ||
workHour.start = '00:00'; | ||
workHour.finish = '00:01'; // if a job runs between 00:00 and 00:01, then this test will fail :P | ||
return workHour; | ||
}); | ||
|
||
const enabledBusinessHour = { | ||
...businessHour, | ||
workHours: allEnabledWorkHours, | ||
} | ||
|
||
await request.post(methodCall('livechat:saveBusinessHour')) | ||
.set(credentials) | ||
.send({ | ||
message: JSON.stringify({ | ||
method: 'livechat:saveBusinessHour', | ||
params: [enabledBusinessHour], | ||
id: 'id', | ||
msg: 'method', | ||
}), | ||
}); | ||
} | ||
|
||
export const disableDefaultBusinessHour = async () => { | ||
// disable settings | ||
await updateSetting('Livechat_enable_business_hours', false); | ||
await updateSetting('Livechat_business_hour_type', 'Single'); | ||
|
||
// create business hours | ||
const { body: { businessHour } } = await request | ||
.get(api('livechat/business-hour?type=default')) | ||
.set(credentials) | ||
.send(); | ||
|
||
const workHours = businessHour.workHours as { start: string; finish: string; day: string, open: boolean }[]; | ||
const allDisabledWorkHours = workHours.map((workHour) => { | ||
workHour.open = false; | ||
workHour.start = '00:00'; | ||
workHour.finish = '23:59'; | ||
return workHour; | ||
}); | ||
|
||
const disabledBusinessHour = { | ||
...businessHour, | ||
workHours: allDisabledWorkHours, | ||
} | ||
|
||
await request.post(methodCall('livechat:saveBusinessHour')) | ||
.set(credentials) | ||
.send({ | ||
message: JSON.stringify({ | ||
method: 'livechat:saveBusinessHour', | ||
params: [disabledBusinessHour], | ||
id: 'id', | ||
msg: 'method', | ||
}), | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.