Skip to content

Commit

Permalink
Merge branch 'webex:next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
rishigupta1606 authored Dec 10, 2024
2 parents 1dee2ea + d545259 commit 6392da8
Show file tree
Hide file tree
Showing 115 changed files with 4,947 additions and 1,104 deletions.
2 changes: 1 addition & 1 deletion docs/changelog/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Handlebars.registerHelper('github_linking', function(string, type) {
});

Handlebars.registerHelper('convertDate', function(timestamp) {
return `${new Date(1723028345568).toDateString()} ${new Date(1723028345568).toTimeString()}`;
return `${new Date(timestamp).toDateString()} ${new Date(timestamp).toTimeString()}`;
});


Expand Down
2 changes: 1 addition & 1 deletion docs/samples/browser-plugin-meetings/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function collectMeetings() {

createMeetingSelectElm.addEventListener('change', (event) => {
if (event.target.value === 'CONVERSATION_URL') {
createMeetingActionElm.innerText = 'Create Adhoc Meeting';
createMeetingActionElm.innerText = 'Create Adhoc Meeting using conversation URL (INTERNAL-USE ONLY)';
}
else {
createMeetingActionElm.innerText = 'Create Meeting';
Expand Down
26 changes: 23 additions & 3 deletions docs/samples/calling/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,11 @@ function endSecondCall() {
}

function muteUnmute() {
muteElm.value = muteElm.value === 'Mute' ? 'Unmute' : 'Mute';
if (callTransferObj){
callTransferObj.mute(localAudioStream)
callTransferObj.mute(localAudioStream, 'user_mute');
}
else {
call.mute(localAudioStream);
call.mute(localAudioStream, 'user_mute');
}
}

Expand Down Expand Up @@ -619,6 +618,17 @@ function createCall(e) {
document.getElementById('remote-audio').srcObject = new MediaStream([track]);
});

localAudioStream.on('system-mute-state-change', (systemMuted) => {
call.mute(localAudioStream, 'system_mute');
if (!localAudioStream.userMuted) {
muteElm.value = systemMuted && muteElm.value === 'Mute' ? 'Unmute' : 'Mute';
}
});

localAudioStream.on('user-mute-state-change', (userMuted) => {
muteElm.value = userMuted && muteElm.value === 'Mute' ? 'Unmute' : 'Mute';
});

call.dial(localAudioStream);
}

Expand Down Expand Up @@ -804,6 +814,16 @@ function answer() {
document.getElementById('remote-audio').srcObject = new MediaStream([track]);
});

localAudioStream.on('system-mute-state-change', (muted) => {
muteElm.value = muteElm.value === 'Mute' ? 'Unmute' : 'Mute';
console.log('system mute received');
});

localAudioStream.on('user-mute-state-change', (muted) => {
muteElm.value = muteElm.value === 'Mute' ? 'Unmute' : 'Mute';
console.log('user mute received');
});

call.answer(localAudioStream);
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/calling/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ <h2 class="collapsible">Authentication</h2>
<legend>Advanced Settings</legend>

<p class="text-color" style="margin-top: 0; padding: 0;">
Following options allow to set the type of registration, service domain (e.g. cisco.webex.com), server region (e.g. east) and the country (e.g. us).
Following options allow to set the type of registration, service domain (only needed for contactcenter - rtw.prod-us1.rtmsprod.net ), server region (e.g. US-EAST) and the country (e.g. US).
<br><br>
<strong>Note:</strong> Please update these before <mark>Initialize Calling</mark> if want to use different values.
<strong>Note:</strong> Please set these fields before <mark>Initialize Calling</mark> to customize the registration behavior.
</p>

<div class="u-mv">
Expand Down
17 changes: 13 additions & 4 deletions packages/@webex/http-core/src/request/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@ export default function request(options) {
options.upload = new EventEmitter();

return intercept(options, options.interceptors, 'Request')
.then((...args) => _request(options, ...args))
.then((...args) =>
intercept(options, options.interceptors.slice().reverse(), 'Response', ...args)
);
.then((...args) => {
// if provided own request function, use that instead
// there are use cases where developer may want to provide whatever request promise they wish
// for example, may even use window.postMessages for parent iframe uses cases
if (options.request) {
return options.request(options, ...args);
}

return _request(options, ...args);
})
.then((...args) => {
return intercept(options, options.interceptors.slice().reverse(), 'Response', ...args);
});
}
1 change: 0 additions & 1 deletion packages/@webex/http-core/test/unit/spec/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {assert} from '@webex/test-helper-chai';
import sinon from 'sinon';

import * as utils from '@webex/http-core/src/request/utils';
import WebexTrackingIdInterceptor from '@webex/webex-core/src/interceptors/webex-tracking-id';
import UserAgentInterceptor from '@webex/webex-core/src/interceptors/webex-user-agent';
import {protoprepareFetchOptions, setTimingsAndFetch} from '@webex/http-core/src/index';
Expand Down
58 changes: 58 additions & 0 deletions packages/@webex/http-core/test/unit/spec/request/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {assert} from '@webex/test-helper-chai';
import sinon from 'sinon';
import {EventEmitter} from 'events';
import request from '@webex/http-core/src/request';
import * as requestModule from '../../../../src/request/request';
import * as utils from '../../../../src/request/utils';

describe('request', () => {
let interceptStub;
let requestStub;

beforeEach(() => {
interceptStub = sinon.spy(utils, 'intercept');
requestStub = sinon.stub(requestModule, 'default');
});

afterEach(() => {
sinon.restore();
});

it('should modify options and call _request if no custom request function is provided', async () => {
const options = {
url: 'http://example.com',
headers: {},
interceptors: [],
};

requestStub.resolves('response');

const result = await request(options);

assert.strictEqual(result, 'response');
assert.strictEqual(options.uri, 'http://example.com');
assert.isNull(options.url);
assert.deepEqual(options.headers, {});
assert.instanceOf(options.download, EventEmitter);
assert.instanceOf(options.upload, EventEmitter);
assert.isTrue(interceptStub.calledTwice);
assert.isTrue(requestStub.calledOnceWith(options));
});

it('should use custom request function if provided', async () => {
const customRequest = sinon.stub().resolves('custom response');
const options = {
url: 'http://example.com',
headers: {},
interceptors: [],
request: customRequest,
};

const result = await request(options);

assert.strictEqual(result, 'custom response');
assert.isTrue(customRequest.calledOnceWith(options));
assert.isTrue(interceptStub.calledTwice);
assert.isFalse(requestStub.called);
});
});
10 changes: 10 additions & 0 deletions packages/@webex/internal-plugin-conversation/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,15 @@ export default {
*/
keepEncryptedProperties: false,
decryptionFailureMessage: 'This message cannot be decrypted',

/**
* config value to perform decryption on inbound conversations and activities
*/
includeDecryptionTransforms: true,

/**
* config value to perform decryption on outbound conversations and activities
*/
includeEncryptionTransforms: true,
},
};
15 changes: 14 additions & 1 deletion packages/@webex/internal-plugin-conversation/src/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
} from 'lodash';
import {readExifData} from '@webex/helper-image';
import uuid from 'uuid';
import {transforms as encryptionTransforms} from './encryption-transforms';
import {transforms as decryptionTransforms} from './decryption-transforms';

import {InvalidUserCreation} from './convo-error';
import ShareActivity from './share-activity';
Expand Down Expand Up @@ -66,8 +68,9 @@ const getConvoLimit = (options = {}) => {
let limit;

if (options.conversationsLimit) {
const value = Math.max(options.conversationsLimit, 0);
limit = {
value: options.conversationsLimit,
value,
name: 'conversationsLimit',
};
}
Expand All @@ -77,6 +80,16 @@ const getConvoLimit = (options = {}) => {

const Conversation = WebexPlugin.extend({
namespace: 'Conversation',
initialize() {
this.listenToOnce(this.webex, 'ready', () => {
if (Array.isArray(this.webex.config.payloadTransformer?.transforms)) {
this.webex.config.payloadTransformer.transforms =
this.webex.config.payloadTransformer.transforms
.concat(this.config.includeDecryptionTransforms ? decryptionTransforms : [])
.concat(this.config.includeEncryptionTransforms ? encryptionTransforms : []);
}
});
},

/**
* @param {String} cluster the cluster containing the id
Expand Down
6 changes: 1 addition & 5 deletions packages/@webex/internal-plugin-conversation/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import {capitalize, get, has} from 'lodash';

import Conversation from './conversation';
import config from './config';
import {transforms as encryptionTransforms} from './encryption-transforms';
import {transforms as decryptionTransforms} from './decryption-transforms';

registerInternalPlugin('conversation', Conversation, {
payloadTransformer: {
Expand Down Expand Up @@ -315,9 +313,7 @@ registerInternalPlugin('conversation', Conversation, {
});
},
},
]
.concat(decryptionTransforms)
.concat(encryptionTransforms),
],
},
config,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,15 @@ describe('plugin-conversation', function () {
assert.include(map(conversations, 'url'), conversation2.url);
}));

it('retrieves no conversations', () =>
webex.internal.conversation
.list({
conversationsLimit: -100,
})
.then((conversations) => {
assert.lengthOf(conversations, 0);
}));

it('retrieves a paginated set of conversations', () =>
webex.internal.conversation
.paginate({
Expand Down
Loading

0 comments on commit 6392da8

Please sign in to comment.