-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
220 additions
and
194 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
12 changes: 12 additions & 0 deletions
12
plugin-flex-ts-template-v2/src/feature-library/multi-call/flex-hooks/actions/AcceptTask.ts
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,12 @@ | ||
import * as Flex from '@twilio/flex-ui'; | ||
|
||
import { holdOtherCalls } from '../../helpers/MultiCallHelper'; | ||
import { FlexActionEvent, FlexAction } from '../../../../types/feature-loader'; | ||
|
||
export const actionEvent = FlexActionEvent.before; | ||
export const actionName = FlexAction.AcceptTask; | ||
export const actionHook = function holdOtherCallsOnAcceptTask(flex: typeof Flex) { | ||
flex.Actions.addListener(`${actionEvent}${actionName}`, async () => { | ||
holdOtherCalls(); | ||
}); | ||
}; |
12 changes: 12 additions & 0 deletions
12
plugin-flex-ts-template-v2/src/feature-library/multi-call/flex-hooks/actions/MonitorCall.ts
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,12 @@ | ||
import * as Flex from '@twilio/flex-ui'; | ||
|
||
import { holdOtherCalls } from '../../helpers/MultiCallHelper'; | ||
import { FlexActionEvent, FlexAction } from '../../../../types/feature-loader'; | ||
|
||
export const actionEvent = FlexActionEvent.before; | ||
export const actionName = FlexAction.MonitorCall; | ||
export const actionHook = function holdOtherCallsOnMonitorCall(flex: typeof Flex) { | ||
flex.Actions.addListener(`${actionEvent}${actionName}`, async () => { | ||
holdOtherCalls(); | ||
}); | ||
}; |
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
19 changes: 0 additions & 19 deletions
19
...lex-ts-template-v2/src/feature-library/multi-call/flex-hooks/events/pluginsInitialized.ts
This file was deleted.
Oops, something went wrong.
12 changes: 4 additions & 8 deletions
12
plugin-flex-ts-template-v2/src/feature-library/multi-call/flex-hooks/events/tokenUpdated.ts
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,19 +1,15 @@ | ||
import * as Flex from '@twilio/flex-ui'; | ||
import { SSOTokenPayload } from '@twilio/flex-ui/src/core/TokenStorage'; | ||
|
||
import { SecondDevice } from '../../helpers/MultiCallHelper'; | ||
import { MultiCallDevices } from '../../helpers/MultiCallHelper'; | ||
import { FlexEvent } from '../../../../types/feature-loader'; | ||
import logger from '../../../../utils/logger'; | ||
|
||
export const eventName = FlexEvent.tokenUpdated; | ||
export const eventHook = (flex: typeof Flex, manager: Flex.Manager, tokenPayload: SSOTokenPayload) => { | ||
if (!SecondDevice) return; | ||
|
||
if (SecondDevice?.state === 'destroyed') { | ||
return; | ||
} | ||
|
||
SecondDevice?.updateToken(tokenPayload.token); | ||
MultiCallDevices.forEach((device) => { | ||
device.updateToken(tokenPayload.token); | ||
}); | ||
|
||
logger.info('[multi-call] Token updated'); | ||
}; |
10 changes: 10 additions & 0 deletions
10
...v2/src/feature-library/multi-call/flex-hooks/notification-events/beforeAddNotification.ts
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,10 @@ | ||
import * as Flex from '@twilio/flex-ui'; | ||
|
||
export const eventName = Flex.NotificationEvent.beforeAddNotification; | ||
export const notificationEventHook = (flex: typeof Flex, manager: Flex.Manager, notification: any, cancel: any) => { | ||
// Normally Flex only supports 1 call, so it shows an error notification upon receiving a second call. | ||
// We want to suppress this notification when multi-call is enabled | ||
if (notification.id === 'SecondVoiceCallIncoming') { | ||
cancel(); | ||
} | ||
}; |
18 changes: 0 additions & 18 deletions
18
...-flex-ts-template-v2/src/feature-library/multi-call/flex-hooks/notifications/MultiCall.ts
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
plugin-flex-ts-template-v2/src/feature-library/multi-call/flex-hooks/strings/MultiCall.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.