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-3878: Migrate to TS and add CJS & ESM Builds #174

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
962c859
Create incoming call method to test inbound calling (#130)
esme Jun 16, 2023
8b52322
Merge remote-tracking branch 'origin/master' into proj-inbound-calling
alonso-cadenas Jun 27, 2023
4a6a1c4
Introduce inbound calling availability events (#138)
alonso-cadenas Jul 10, 2023
f2d1495
Send incoming call event with data to create an engagement (#140)
esme Jul 10, 2023
2279f8a
Merge remote-tracking branch 'origin/master' into proj-inbound-calling
esme Jul 28, 2023
4280940
Add to number for inbound calling
esme Jul 28, 2023
4aa4ff6
Initialize demo widget when ready event is received from HubSpot (#145)
esme Aug 3, 2023
2f7b794
Revert "Initialize demo widget when ready event is received from HubS…
alonso-cadenas Aug 4, 2023
6e23fd6
Extensions inbound lifecycle (#148)
alonso-cadenas Aug 4, 2023
2314a69
0.1.8-alpha.0
alonso-cadenas Sep 1, 2023
9ed1a8e
Use next tag of SDK
alonso-cadenas Sep 8, 2023
1c8d87e
Use 0.1.8
esme Oct 23, 2023
ed0f0b8
Merge remote-tracking branch 'origin/master' into proj-inbound-calling
esme Oct 31, 2023
12676c3
0.2.1-alpha.0
esme Oct 31, 2023
f69179c
Use latest sdk version
esme Oct 31, 2023
928f8e2
Caller id match (#156)
esme Nov 14, 2023
f395416
0.2.1-alpha.1
esme Nov 14, 2023
47b1284
Use next tag of SDK
esme Nov 14, 2023
284a43a
Merge remote-tracking branch 'origin/master' into proj-inbound-calling
esme Nov 28, 2023
6411ce0
0.2.1-alpha.2
esme Nov 28, 2023
b599f25
Use next tag of SDK
esme Nov 28, 2023
1ee6bcb
Add support for inbound calling to react demo app (#157)
hemang-thakkar Nov 30, 2023
f13841b
Add publish script for inbound branch (#162)
esme Nov 30, 2023
dd42354
Send navigate_to_record event when we receive an existing call id (#158)
esme Dec 1, 2023
bc7afd7
Configure workflow to run on workflow_dispatch event
esme Dec 5, 2023
e81b6b8
Merge remote-tracking branch 'origin/master' into proj-inbound-calling
esme Dec 5, 2023
da7ff56
React Demo App: Set incoming number and contact name in localstorage …
hemang-thakkar Dec 8, 2023
2f95f17
Merge branch 'master' into proj-inbound-calling
hemang-thakkar Jan 3, 2024
0968e7a
0.2.2-alpha.0
hemang-thakkar Jan 3, 2024
a24c526
0.2.2-beta.0
hemang-thakkar Jan 3, 2024
6e41342
Support NAVIGATE_TO_RECORD_FAILED event (#171)
alonso-cadenas Feb 8, 2024
a336a23
Restore master version
alonso-cadenas Feb 8, 2024
603bc29
0.3.0-0
alonso-cadenas Feb 8, 2024
13766ee
0.3.0-rc.0
alonso-cadenas Feb 8, 2024
3507529
0.3.0-alpha.0
alonso-cadenas Feb 8, 2024
b0c410b
0.3.0-beta.0
alonso-cadenas Feb 8, 2024
b64aa65
Update dependents
alonso-cadenas Feb 8, 2024
fd1ce63
Merge remote-tracking branch 'origin/proj-inbound-calling' into call-…
hemang-thakkar Feb 9, 2024
3e344e0
Migrate to TS and add CJS and ESM builds
hemang-thakkar Feb 8, 2024
f242a40
Add error to message types
alonso-cadenas Feb 9, 2024
4b631fb
Fix demo-react-ts unit tests
hemang-thakkar Feb 9, 2024
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 .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
- reopened
- synchronize
paths:
- 'demos/**'
- "demos/**"
workflow_dispatch:

defaults:
run:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ lib
demos/build/*
!demos/build/.gitkeep
dist-test
.yalc
yalc.lock
107 changes: 105 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ const options = {
},
onUpdateEngagementFailed: event => {
/* HubSpot has failed to update an engagement for this call. */
},
onCallerIdMatchSucceeded: event => {
/* HubSpot has fetched caller id matches for this call. */
},
onCallerIdMatchFailed: event => {
/* HubSpot has failed to fetch caller id matches for this call. */
}
onVisibilityChanged: event => {
/* Call widget's visibility is changed. */
Expand Down Expand Up @@ -217,6 +223,42 @@ extensions.outgoingCall(callInfo);
</p>
</details>

<details>
<summary>incomingCall</summary>
<p>

```ts
// Sends a message to notify HubSpot that an outgoing call has started.

const callInfo = {
fromNumber: string, // Required: The caller's number
toNumber: string, // Required: The recipient's number
createEngagement: boolean, // Whether HubSpot should create an engagement for this call
};
extensions.incomingCall(callInfo);
```

</p>
</details>

<details>
<summary>navigateToRecord</summary>
<p>

```ts
// Sends a message to notify HubSpot that we need to navigate to a record page for a caller id match.
type ObjectCoordinates = {
portalId: number;
objectTypeId: string;
objectId: number;
}

extensions.navigateToRecord({ objectCoordinates });
```

</p>
</details>

<details>
<summary>callAnswered</summary>
<p>
Expand Down Expand Up @@ -304,11 +346,20 @@ extensions.resizeWidget(data);
<summary>onReady</summary>
<p>

```js
```ts
// Receive an engagementId for an existing inbound call
type Payload = {
engagementId: number | undefined
}

// Message indicating that HubSpot is ready to receive messages
onReady() {
onReady(payload) {
// Send initialized message to HubSpot to indicate that the call widget is also ready
extensions.initialized(payload);
if (payload.engagementId) {
// Initialize calling state in the app for existing inbound call
...
}
...
}
```
Expand Down Expand Up @@ -408,6 +459,58 @@ onDialNumber(data) {
</p>
</details>

<details>
<summary>onCallerIdMatchSucceeded</summary>
<p>

```js
// Message indicating that HubSpot has updated an engagement
onCallerIdMatchSucceeded(data) {
const {
callerIdMatches: (ContactIdMatch | CompanyIdMatch)[];
} = data;
...
}

type ObjectCoordinates = {
portalId: number;
objectTypeId: string;
objectId: number;
}

type ContactIdMatch = {
callerIdType: 'CONTACT';
objectCoordinates: ObjectCoordinates;
firstName: string;
lastName: string;
email: string;
}

type CompanyIdMatch = {
callerIdType: 'COMPANY';
objectCoordinates: ObjectCoordinates;
name: string;
}
```
</p>
</details>

<details>
<summary>onCallerIdMatchFailed</summary>
<p>

```js
// Message indicating that HubSpot has failed to update an engagement
onCallerIdMatchFailed(data) {
const {
error: { message: string }
} = data;
...
}
```
</p>
</details>

<details>
<summary>onVisibilityChanged</summary>
<p>
Expand Down
33 changes: 29 additions & 4 deletions demos/demo-minimal-js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
font-weight: 300;
margin-bottom: 1rem;
}
p.other-events {
border-top: 1px solid rgba(0, 0, 0, 0.1);
padding-top: 0.5rem;
}
</style>
</head>

Expand Down Expand Up @@ -120,7 +124,29 @@
type="button"
value="log out"
/>
<p>3. Start a call</p>
<p>3. Set inbound calling availability</p>
<input
disabled
id="useravailable"
onclick="userAvailable()"
type="button"
value="user available"
/>
<input
disabled
id="userunavailable"
onclick="userUnavailable()"
type="button"
value="user unavailable"
/>
<p>4. Start a call</p>
<input
disabled
id="incomingcall"
onclick="incomingCall()"
type="button"
value="incoming call started"
/>
<input
disabled
id="outgoingcall"
Expand All @@ -135,7 +161,7 @@
type="button"
value="call answered"
/>
<p>4. End a call</p>
<p>5. End a call</p>
<input
disabled
id="endcall"
Expand All @@ -150,8 +176,7 @@
type="button"
value="call completed"
/>
<hr />
<p>Other events</p>
<p class="other-events">Other events</p>
<input
disabled
id="senderror"
Expand Down
Loading
Loading