Skip to content

Commit

Permalink
Send ownerId in onReady event
Browse files Browse the repository at this point in the history
  • Loading branch information
esme committed Aug 2, 2024
1 parent 8d9dc2c commit 65f8ca4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions demos/demo-react-ts/src/hooks/useCti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export const useCti = (
},
onCreateEngagementSucceeded: (data: any, _rawEvent: any) => {
const { engagementId } = data;

setEngagementId(engagementId);
},
onCreateEngagementFailed: (data: any, _rawEvent: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/CallingExtensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CallingExtensions {
initialized(userData) {
this.sendMessage({
type: messageType.INITIALIZED,
data: { ...userData },
data: userData,
});
}

Expand Down
15 changes: 8 additions & 7 deletions src/IFrameManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ class IFrameManager {
}

static createIFrame(iFrameOptions, onLoadCallback) {
const {
src, width, height, hostElementSelector,
} = iFrameOptions;
const { src, width, height, hostElementSelector } = iFrameOptions;

if (!src || !width || !height || !hostElementSelector) {
throw new Error(
Expand Down Expand Up @@ -181,9 +179,7 @@ class IFrameManager {

onMessage(event) {
const { data, origin } = event;
const {
type, engagementId, portalId, userId,
} = event.data;
const { type, engagementId, portalId, userId, ownerId } = event.data;
if (type === messageType.SYNC) {
// The iFrame host can send this message multiple times, don't respond more than once
if (!this.isReady) {
Expand All @@ -200,7 +196,12 @@ class IFrameManager {
this.destinationHost = hostUrl || this.destinationHost;
this.logDebugMessage(prefix, debugMessageType.FROM_HUBSPOT, type, data);
this.sendMessage(message);
this.onReady({ engagementId, portalId, userId });
this.onReady({
engagementId,
portalId,
userId,
ownerId,
});
}
return;
}
Expand Down

0 comments on commit 65f8ca4

Please sign in to comment.