Skip to content

Commit

Permalink
Merge pull request #924 from vpogudina/master
Browse files Browse the repository at this point in the history
adding typescript support
  • Loading branch information
vpogudina authored Sep 4, 2024
2 parents 073ac34 + febc014 commit b8f213e
Show file tree
Hide file tree
Showing 13 changed files with 301 additions and 216 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# CHANGELOG.md
## [2.14.6] - 2024-08-02
Added:
- typescript support for onSoftphoneSessionInit
- updated typescript definition for AttributeDictionary, SegmentAttributeDictionary, ReferenceDictionary
- typescript SYSTEM and ERROR types for AgentStateType
- Agent and Contact events subscriptions now return subscription

## [2.14.5] - 2024-08-02
Added:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amazon-connect-streams",
"version": "2.14.5",
"version": "2.14.6",
"description": "Amazon Connect Streams Library",
"engines": {
"node": ">=12.0.0"
Expand Down
2 changes: 1 addition & 1 deletion release/connect-streams-dr-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/connect-streams-dr.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/connect-streams-min.js

Large diffs are not rendered by default.

102 changes: 40 additions & 62 deletions release/connect-streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,81 +737,71 @@
};

Agent.prototype.onRefresh = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.REFRESH, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.REFRESH, f);
};

Agent.prototype.onRoutable = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.ROUTABLE, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.ROUTABLE, f);
};

Agent.prototype.onNotRoutable = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.NOT_ROUTABLE, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.NOT_ROUTABLE, f);
};

Agent.prototype.onOffline = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.OFFLINE, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.OFFLINE, f);
};

Agent.prototype.onError = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.ERROR, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.ERROR, f);
};

Agent.prototype.onSoftphoneError = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.SOFTPHONE_ERROR, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.SOFTPHONE_ERROR, f);
};

Agent.prototype.onWebSocketConnectionLost = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_LOST, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_LOST, f);
}

Agent.prototype.onWebSocketConnectionGained = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_GAINED, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_GAINED, f);
}

Agent.prototype.onAfterCallWork = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.ACW, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.ACW, f);
};

Agent.prototype.onStateChange = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.STATE_CHANGE, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.STATE_CHANGE, f);
};

Agent.prototype.onMuteToggle = function (f) {
connect.core.getUpstream().onUpstream(connect.AgentEvents.MUTE_TOGGLE, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.MUTE_TOGGLE, f);
};

Agent.prototype.onLocalMediaStreamCreated = function (f) {
connect.core.getUpstream().onUpstream(connect.AgentEvents.LOCAL_MEDIA_STREAM_CREATED, f);
return connect.core.getEventBus().subscribe(connect.AgentEvents.LOCAL_MEDIA_STREAM_CREATED, f);
};

Agent.prototype.onSpeakerDeviceChanged = function (f) {
connect.core.getUpstream().onUpstream(connect.ConfigurationEvents.SPEAKER_DEVICE_CHANGED, f);
return connect.core.getEventBus().subscribe(connect.ConfigurationEvents.SPEAKER_DEVICE_CHANGED, f);
}

Agent.prototype.onMicrophoneDeviceChanged = function (f) {
connect.core.getUpstream().onUpstream(connect.ConfigurationEvents.MICROPHONE_DEVICE_CHANGED, f);
return connect.core.getEventBus().subscribe(connect.ConfigurationEvents.MICROPHONE_DEVICE_CHANGED, f);
}

Agent.prototype.onRingerDeviceChanged = function (f) {
connect.core.getUpstream().onUpstream(connect.ConfigurationEvents.RINGER_DEVICE_CHANGED, f);
return connect.core.getEventBus().subscribe(connect.ConfigurationEvents.RINGER_DEVICE_CHANGED, f);
}

Agent.prototype.onCameraDeviceChanged = function (f) {
connect.core.getUpstream().onUpstream(connect.ConfigurationEvents.CAMERA_DEVICE_CHANGED, f);
return connect.core.getEventBus().subscribe(connect.ConfigurationEvents.CAMERA_DEVICE_CHANGED, f);
}

Agent.prototype.onBackgroundBlurChanged = function (f) {
connect.core.getUpstream().onUpstream(connect.ConfigurationEvents.BACKGROUND_BLUR_CHANGED, f);
return connect.core.getEventBus().subscribe(connect.ConfigurationEvents.BACKGROUND_BLUR_CHANGED, f);
}

Agent.prototype.mute = function () {
Expand Down Expand Up @@ -1128,58 +1118,47 @@
};

Contact.prototype.onRefresh = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.REFRESH), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.REFRESH), f);
};

Contact.prototype.onIncoming = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.INCOMING), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.INCOMING), f);
};

Contact.prototype.onConnecting = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.CONNECTING), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTING), f);
};

Contact.prototype.onPending = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.PENDING), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.PENDING), f);
};

Contact.prototype.onAccepted = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.ACCEPTED), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACCEPTED), f);
};

Contact.prototype.onMissed = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.MISSED), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.MISSED), f);
};

Contact.prototype.onEnded = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.ENDED), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ENDED), f);
};

Contact.prototype.onDestroy = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.DESTROYED), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.DESTROYED), f);
};

Contact.prototype.onACW = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.ACW), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACW), f);
};

Contact.prototype.onConnected = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.CONNECTED), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTED), f);
};

Contact.prototype.onError = function (f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.ERROR), f);
return connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ERROR), f);
}

Contact.prototype.getContactId = function () {
Expand Down Expand Up @@ -26896,7 +26875,7 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-

connect.core = {};
connect.core.initialized = false;
connect.version = "2.14.5";
connect.version = "2.14.6";
connect.outerContextStreamsVersion = null;
connect.DEFAULT_BATCH_SIZE = 500;

Expand Down Expand Up @@ -28447,7 +28426,7 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
};

connect.core.onIframeRetriesExhausted = function(f) {
connect.core.getEventBus().subscribe(connect.EventType.IFRAME_RETRIES_EXHAUSTED, f);
return connect.core.getEventBus().subscribe(connect.EventType.IFRAME_RETRIES_EXHAUSTED, f);
}

connect.core._refreshIframeOnTimeout = function(initCCPParams, containerDiv) {
Expand Down Expand Up @@ -28940,7 +28919,7 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
/** ----- minimal view layer event handling **/

connect.core.onViewContact = function (f) {
connect.core.getUpstream().onUpstream(connect.ContactEvents.VIEW, f);
return connect.core.getEventBus().subscribe(connect.ContactEvents.VIEW, f);
};

/**
Expand All @@ -28959,7 +28938,7 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
/** ----- minimal view layer event handling **/

connect.core.onActivateChannelWithViewType = function (f) {
connect.core.getUpstream().onUpstream(connect.ChannelViewEvents.ACTIVATE_CHANNEL_WITH_VIEW_TYPE, f);
return connect.core.getEventBus().subscribe(connect.ChannelViewEvents.ACTIVATE_CHANNEL_WITH_VIEW_TYPE, f);
};

/**
Expand Down Expand Up @@ -29000,18 +28979,18 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
* to handle the access denied use case.
*/
connect.core.onAccessDenied = function (f) {
connect.core.getUpstream().onUpstream(connect.EventType.ACCESS_DENIED, f);
return connect.core.getEventBus().subscribe(connect.EventType.ACCESS_DENIED, f);
};

/**
* This will be helpful for SAML use cases to handle the custom logins.
*/
connect.core.onAuthFail = function (f) {
connect.core.getUpstream().onUpstream(connect.EventType.AUTH_FAIL, f);
return connect.core.getEventBus().subscribe(connect.EventType.AUTH_FAIL, f);
};

connect.core.onAuthorizeSuccess = function (f) {
connect.core.getUpstream().onUpstream(connect.EventType.AUTHORIZE_SUCCESS, f);
return connect.core.getEventBus().subscribe(connect.EventType.AUTHORIZE_SUCCESS, f);
}

connect.core._handleAuthorizeSuccess = function() {
Expand Down Expand Up @@ -29096,11 +29075,11 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
}

connect.core.onAuthorizeRetriesExhausted = function(f) {
connect.core.getEventBus().subscribe(connect.EventType.AUTHORIZE_RETRIES_EXHAUSTED, f);
return connect.core.getEventBus().subscribe(connect.EventType.AUTHORIZE_RETRIES_EXHAUSTED, f);
}

connect.core.onCTIAuthorizeRetriesExhausted = function(f) {
connect.core.getEventBus().subscribe(connect.EventType.CTI_AUTHORIZE_RETRIES_EXHAUSTED, f);
return connect.core.getEventBus().subscribe(connect.EventType.CTI_AUTHORIZE_RETRIES_EXHAUSTED, f);
}

/** ------------------------------------------------- */
Expand All @@ -29118,18 +29097,17 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
*/

connect.core.onSoftphoneSessionInit = function (f) {
connect.core.getUpstream().onUpstream(connect.ConnectionEvents.SESSION_INIT, f);
return connect.core.getEventBus().subscribe(connect.ConnectionEvents.SESSION_INIT, f);
};

/**-----------------------------------------------------------------------*/
connect.core.onConfigure = function(f) {
connect.core.getUpstream().onUpstream(connect.ConfigurationEvents.CONFIGURE, f);
return connect.core.getEventBus().subscribe(connect.ConfigurationEvents.CONFIGURE, f);
}

/**-----------------------------------------------------------------------*/
connect.core.onInitialized = function(f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.EventType.INIT, f);
return connect.core.getEventBus().subscribe(connect.EventType.INIT, f);
}

/**-----------------------------------------------------------------------*/
Expand Down
Loading

0 comments on commit b8f213e

Please sign in to comment.