@webex/plugin-meetings 3.0.0-beta.10 → 3.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/meeting/index.js +41 -0
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/request.js +28 -0
- package/dist/meeting/request.js.map +1 -1
- package/dist/reactions/reactions.js +111 -0
- package/dist/reactions/reactions.js.map +1 -0
- package/dist/reactions/reactions.type.js +40 -0
- package/dist/reactions/reactions.type.js.map +1 -0
- package/package.json +18 -18
- package/src/meeting/index.ts +34 -2
- package/src/meeting/request.ts +23 -0
- package/src/reactions/reactions.ts +104 -0
- package/src/reactions/reactions.type.ts +36 -0
- package/test/unit/spec/meeting/index.js +87 -0
- package/test/unit/spec/meeting/request.js +25 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
export type EmoticonData = {
|
|
3
|
+
type: string;
|
|
4
|
+
codepoints?: string;
|
|
5
|
+
shortcodes?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type SkinTone = EmoticonData;
|
|
9
|
+
export type Reaction = EmoticonData & {
|
|
10
|
+
tone?: SkinTone;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export enum ReactionType {
|
|
14
|
+
smile = 'smile',
|
|
15
|
+
sad = 'sad',
|
|
16
|
+
wow = 'wow',
|
|
17
|
+
haha = 'haha',
|
|
18
|
+
celebrate = 'celebrate',
|
|
19
|
+
clap = 'clap',
|
|
20
|
+
thumbs_up = 'thumbs_up',
|
|
21
|
+
thumbs_down = 'thumbs_down',
|
|
22
|
+
heart = 'heart',
|
|
23
|
+
fire = 'fire',
|
|
24
|
+
prayer = 'prayer',
|
|
25
|
+
speed_up = 'speed_up',
|
|
26
|
+
slow_down = 'slow_down',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum SkinToneType {
|
|
30
|
+
normal = 'normal',
|
|
31
|
+
light = 'light',
|
|
32
|
+
medium_light = 'medium_light',
|
|
33
|
+
medium = 'medium',
|
|
34
|
+
medium_dark = 'medium_dark',
|
|
35
|
+
dark = 'dark',
|
|
36
|
+
}
|
|
@@ -4922,6 +4922,93 @@ describe('plugin-meetings', () => {
|
|
|
4922
4922
|
meeting.stopKeepAlive();
|
|
4923
4923
|
});
|
|
4924
4924
|
});
|
|
4925
|
+
|
|
4926
|
+
describe('#sendReaction', () => {
|
|
4927
|
+
it('should have #sendReaction', () => {
|
|
4928
|
+
assert.exists(meeting.sendReaction);
|
|
4929
|
+
});
|
|
4930
|
+
|
|
4931
|
+
beforeEach(() => {
|
|
4932
|
+
meeting.meetingRequest.sendReaction = sinon.stub().returns(Promise.resolve());
|
|
4933
|
+
});
|
|
4934
|
+
|
|
4935
|
+
it('should send reaction with the right data and return a promise', async () => {
|
|
4936
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
4937
|
+
|
|
4938
|
+
const reactionPromise = meeting.sendReaction('thumbs_down', 'light');
|
|
4939
|
+
|
|
4940
|
+
assert.exists(reactionPromise.then);
|
|
4941
|
+
await reactionPromise;
|
|
4942
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
4943
|
+
reactionChannelUrl: 'Fake URL',
|
|
4944
|
+
reaction: {
|
|
4945
|
+
type: 'thumb_down',
|
|
4946
|
+
codepoints: '1F44E',
|
|
4947
|
+
shortcodes: ':thumbsdown:',
|
|
4948
|
+
tone: {
|
|
4949
|
+
type: 'light_skin_tone',
|
|
4950
|
+
codepoints: '1F3FB',
|
|
4951
|
+
shortcodes: ':skin-tone-2:'
|
|
4952
|
+
}
|
|
4953
|
+
},
|
|
4954
|
+
participantId: meeting.members.selfId,
|
|
4955
|
+
});
|
|
4956
|
+
});
|
|
4957
|
+
|
|
4958
|
+
it('should fail sending a reaction if data channel is undefined', async () => {
|
|
4959
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: undefined}};
|
|
4960
|
+
|
|
4961
|
+
await assert.isRejected(meeting.sendReaction('thumbs_down', 'light'), Error, 'Error sending reaction, service url not found.');
|
|
4962
|
+
|
|
4963
|
+
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
4964
|
+
});
|
|
4965
|
+
|
|
4966
|
+
it('should fail sending a reaction if reactionType is invalid ', async () => {
|
|
4967
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
4968
|
+
|
|
4969
|
+
await assert.isRejected(meeting.sendReaction('invalid_reaction', 'light'), Error, 'invalid_reaction is not a valid reaction.');
|
|
4970
|
+
|
|
4971
|
+
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
4972
|
+
});
|
|
4973
|
+
|
|
4974
|
+
it('should send a reaction with default skin tone if provided skinToneType is invalid ', async () => {
|
|
4975
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
4976
|
+
|
|
4977
|
+
const reactionPromise = meeting.sendReaction('thumbs_down', 'invalid_skin_tone');
|
|
4978
|
+
|
|
4979
|
+
assert.exists(reactionPromise.then);
|
|
4980
|
+
await reactionPromise;
|
|
4981
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
4982
|
+
reactionChannelUrl: 'Fake URL',
|
|
4983
|
+
reaction: {
|
|
4984
|
+
type: 'thumb_down',
|
|
4985
|
+
codepoints: '1F44E',
|
|
4986
|
+
shortcodes: ':thumbsdown:',
|
|
4987
|
+
tone: {type: 'normal_skin_tone', codepoints: '', shortcodes: ''}
|
|
4988
|
+
},
|
|
4989
|
+
participantId: meeting.members.selfId,
|
|
4990
|
+
});
|
|
4991
|
+
});
|
|
4992
|
+
|
|
4993
|
+
it('should send a reaction with default skin tone if none provided', async () => {
|
|
4994
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
4995
|
+
|
|
4996
|
+
const reactionPromise = meeting.sendReaction('thumbs_down');
|
|
4997
|
+
|
|
4998
|
+
assert.exists(reactionPromise.then);
|
|
4999
|
+
await reactionPromise;
|
|
5000
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
5001
|
+
reactionChannelUrl: 'Fake URL',
|
|
5002
|
+
reaction: {
|
|
5003
|
+
type: 'thumb_down',
|
|
5004
|
+
codepoints: '1F44E',
|
|
5005
|
+
shortcodes: ':thumbsdown:',
|
|
5006
|
+
tone: {type: 'normal_skin_tone', codepoints: '', shortcodes: ''}
|
|
5007
|
+
},
|
|
5008
|
+
participantId: meeting.members.selfId,
|
|
5009
|
+
});
|
|
5010
|
+
});
|
|
5011
|
+
});
|
|
4925
5012
|
});
|
|
4926
5013
|
});
|
|
4927
5014
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import sinon from 'sinon';
|
|
2
2
|
import {assert} from '@webex/test-helper-chai';
|
|
3
3
|
import MockWebex from '@webex/test-helper-mock-webex';
|
|
4
|
-
|
|
5
4
|
import Meetings from '@webex/plugin-meetings';
|
|
6
5
|
import MeetingRequest from '@webex/plugin-meetings/src/meeting/request';
|
|
7
6
|
|
|
@@ -278,5 +277,30 @@ describe('plugin-meetings', () => {
|
|
|
278
277
|
assert.equal(requestParams.uri, keepAliveUrl);
|
|
279
278
|
});
|
|
280
279
|
});
|
|
280
|
+
|
|
281
|
+
describe('#sendReaction', () => {
|
|
282
|
+
it('sends request to sendReaction', async () => {
|
|
283
|
+
const reactionChannelUrl = 'reactionChannelUrl';
|
|
284
|
+
const participantId = 'participantId';
|
|
285
|
+
const reaction = {
|
|
286
|
+
type: 'thumb_down',
|
|
287
|
+
codepoints: '1F44E',
|
|
288
|
+
shortcodes: ':thumbsdown:',
|
|
289
|
+
tone: {type: 'normal_skin_tone', codepoints: '', shortcodes: ''}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
await meetingsRequest.sendReaction({
|
|
293
|
+
reactionChannelUrl,
|
|
294
|
+
reaction,
|
|
295
|
+
participantId
|
|
296
|
+
});
|
|
297
|
+
const requestParams = meetingsRequest.request.getCall(0).args[0];
|
|
298
|
+
|
|
299
|
+
assert.equal(requestParams.method, 'POST');
|
|
300
|
+
assert.equal(requestParams.uri, reactionChannelUrl);
|
|
301
|
+
assert.equal(requestParams.body.sender.participantId, participantId);
|
|
302
|
+
assert.equal(requestParams.body.reaction, reaction);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
281
305
|
});
|
|
282
306
|
});
|