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

CALL-6780: Update jsdocs and typedefs to make callId deprecated #222

Merged
merged 22 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 18 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
19 changes: 13 additions & 6 deletions demos/demo-minimal-js/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable import/no-relative-packages */
import CallingExtensions from "../../src/CallingExtensions";
import { messageType, callEndStatus } from "../../src/Constants";
// import CallingExtensions, { Constants } from "@hubspot/calling-extensions-sdk";
// const { messageType, callEndStatus } = Constants;
import CallingExtensions, { Constants } from "@hubspot/calling-extensions-sdk";
import { v4 as uuidv4 } from "uuid";
const { messageType, callEndStatus } = Constants;

export const state = {
externalCallId: "",
engagementId: 0,
fromNumber: "+123456",
incomingContactName: "",
Expand Down Expand Up @@ -55,6 +54,7 @@ function enableButtons(ids) {
const cti = new CallingExtensions({
debugMode: true,
eventHandlers: {
// eslint-disable-next-line object-curly-newline
onReady: ({ engagementId, portalId, userId, ownerId } = {}) => {
cti.initialized({
engagementId,
Expand Down Expand Up @@ -220,37 +220,42 @@ export function userUnavailable() {
}

export function incomingCall() {
state.externalCallId = uuidv4();
window.setTimeout(() => {
cti.incomingCall({
createEngagement: true,
fromNumber: state.fromNumber,
toNumber: state.toNumber,
externalCallId: state.externalCallId,
});
}, 500);
disableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);
enableButtons([ANSWER_CALL, END_CALL]);
}

export function outgoingCall() {
state.externalCallId = uuidv4();
window.setTimeout(() => {
cti.outgoingCall({
createEngagement: true,
toNumber: state.toNumber,
fromNumber: state.fromNumber,
externalCallId: state.externalCallId,
});
}, 500);
disableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);
enableButtons([ANSWER_CALL, END_CALL]);
}

export function answerCall() {
cti.callAnswered();
cti.callAnswered({ externalCallId: state.externalCallId });
disableButtons([ANSWER_CALL]);
}

export function endCall() {
cti.callEnded({
callEndStatus: callEndStatus.INTERNAL_COMPLETED,
externalCallId: state.externalCallId,
});
disableButtons([ANSWER_CALL, END_CALL]);
enableButtons([COMPLETE_CALL]);
Expand All @@ -259,12 +264,14 @@ export function endCall() {
export function completeCall() {
cti.callCompleted({
engagementId: state.engagementId,
externalCallId: state.externalCallId,
hideWidget: false,
engagementProperties: {
hs_call_title: "Demo call",
hs_call_body: "Resolved issue",
},
});
state.externalCallId = "";
disableButtons([COMPLETE_CALL]);
enableButtons([OUTGOING_CALL, INCOMING_CALL, USER_UNAVAILABLE]);
}
Expand Down
29 changes: 21 additions & 8 deletions demos/demo-minimal-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion demos/demo-minimal-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"webpack-dev-server": "^4.11.1"
},
"dependencies": {
"@hubspot/calling-extensions-sdk": "^0.6.3"
"@hubspot/calling-extensions-sdk": "^0.6.4-alpha.9",
"uuid": "^10.0.0"
}
}
Loading
Loading