Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send callStartTime in outgoingCall message #108

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ extensions.userLoggedOut();

const callInfo = {
phoneNumber: string, // optional unless call is initiated by the widget
createEngagement: true // whether HubSpot should create an engagement for this call
createEngagement: true, // whether HubSpot should create an engagement for this call
callStartTime: number // optional unless call is initiated by the widget
};
extensions.outgoingCall(callInfo);
```
Expand Down
4 changes: 3 additions & 1 deletion demos/demo-react-ts/src/components/screens/KeypadScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ function KeypadScreen({
};

const handleStartCall = useCallback(() => {
const callStartTime = Date.now();
cti.outgoingCall({
createEngagement: true,
phoneNumber: dialNumber,
callStartTime,
});
startTimer(Date.now());
startTimer(callStartTime);
handleNextScreen();
}, [cti]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe("KeypadScreen", () => {

it("Handles start call button click", () => {
const { getByRole, getByTestId } = renderWithContext(
<KeypadScreen {...props} />
<KeypadScreen {...props} dialNumber="+1617" />
);

const input = getByTestId("VizExInput-Input");
Expand All @@ -96,7 +96,12 @@ describe("KeypadScreen", () => {
name: /start-call/i,
});
button.click();
expect(cti.outgoingCall).toHaveBeenCalled();

expect(cti.outgoingCall).toHaveBeenCalledWith({
createEngagement: true,
phoneNumber: "+1617",
callStartTime: jasmine.anything(),
});
expect(props.handleNextScreen).toHaveBeenCalled();
});
});
Expand Down