-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cc-store): receive webex on init, add store types (#341)
- Loading branch information
1 parent
9b3c5ac
commit 9648969
Showing
11 changed files
with
283 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const widgetsContainer = document.getElementById('widgets-container'); | ||
const accessTokenElem = document.getElementById('access_token_elem'); | ||
const ccStationLogin = document.getElementById('cc-station-login'); | ||
|
||
function switchButtonState(){ | ||
const buttonElem = document.querySelector('button'); | ||
buttonElem.disabled = accessTokenElem.value.trim() === ''; | ||
} | ||
|
||
function initWidgets(){ | ||
const webexConfig = { | ||
fedramp: false, | ||
logger: { | ||
level: 'log' | ||
}, | ||
} | ||
store.init({ | ||
webexConfig, | ||
access_token: accessTokenElem.value.trim() | ||
}).then(() => { | ||
ccStationLogin.onLogin = loginSuccess; | ||
ccStationLogin.onLogout = logoutSuccess; | ||
widgetsContainer.classList.remove('disabled'); | ||
}).catch((error) => { | ||
console.error('Failed to initialize widgets:', error); | ||
}); | ||
} | ||
|
||
function loginSuccess(){ | ||
console.log('Agent login has been succesful'); | ||
} | ||
|
||
function logoutSuccess(){ | ||
console.log('Agent logout has been succesful'); | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
import store from './store'; | ||
export * from './store.types'; | ||
export default store; |
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,31 @@ | ||
import {AgentLogin, IContactCenter, Profile, Team} from '@webex/plugin-cc'; | ||
|
||
interface WithWebex { | ||
webex: { cc: IContactCenter }; | ||
} | ||
|
||
interface WithWebexConfig { | ||
webexConfig: any; // Replace 'any' with the actual type of webexConfig | ||
access_token: string; | ||
} | ||
|
||
type InitParams = WithWebex | WithWebexConfig; | ||
|
||
interface IStore { | ||
teams: Team[]; | ||
loginOptions: string[]; | ||
cc: IContactCenter; | ||
|
||
registerCC(webex: WithWebex['webex']): Promise<Profile>; | ||
init(params: InitParams): Promise<void>; | ||
} | ||
|
||
export type { | ||
IContactCenter, | ||
Profile, | ||
Team, | ||
AgentLogin, | ||
WithWebex, | ||
InitParams, | ||
IStore | ||
} |
Oops, something went wrong.