@webex/plugin-meetings 3.0.0-beta.10 → 3.0.0-beta.12
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/media/index.js +6 -2
- package/dist/media/index.js.map +1 -1
- 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/media/index.ts +6 -2
- 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 +94 -0
- package/test/unit/spec/meeting/request.js +25 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {Reaction, ReactionType, SkinTone, SkinToneType} from './reactions.type';
|
|
2
|
+
|
|
3
|
+
const Reactions: Record<ReactionType, Reaction> = {
|
|
4
|
+
smile: {
|
|
5
|
+
type: 'smile',
|
|
6
|
+
codepoints: '1F642',
|
|
7
|
+
shortcodes: ':slightly_smiling_face:'
|
|
8
|
+
},
|
|
9
|
+
sad: {
|
|
10
|
+
type: 'sad',
|
|
11
|
+
codepoints: '1F625',
|
|
12
|
+
shortcodes: ':sad_but_relieved_face:',
|
|
13
|
+
},
|
|
14
|
+
wow: {
|
|
15
|
+
type: 'wow',
|
|
16
|
+
codepoints: '1F62E',
|
|
17
|
+
shortcodes: ':open_mouth:',
|
|
18
|
+
},
|
|
19
|
+
haha: {
|
|
20
|
+
type: 'haha',
|
|
21
|
+
codepoints: '1F603',
|
|
22
|
+
shortcodes: ':smiley:'
|
|
23
|
+
},
|
|
24
|
+
celebrate: {
|
|
25
|
+
type: 'celebrate',
|
|
26
|
+
codepoints: '1F389',
|
|
27
|
+
shortcodes: ':party_popper:',
|
|
28
|
+
},
|
|
29
|
+
clap: {
|
|
30
|
+
type: 'clap',
|
|
31
|
+
codepoints: '1F44F',
|
|
32
|
+
shortcodes: ':clap:',
|
|
33
|
+
},
|
|
34
|
+
thumbs_up: {
|
|
35
|
+
type: 'thumb_up',
|
|
36
|
+
codepoints: '1F44D',
|
|
37
|
+
shortcodes: ':thumbsup:',
|
|
38
|
+
},
|
|
39
|
+
thumbs_down: {
|
|
40
|
+
type: 'thumb_down',
|
|
41
|
+
codepoints: '1F44E',
|
|
42
|
+
shortcodes: ':thumbsdown:',
|
|
43
|
+
},
|
|
44
|
+
heart: {
|
|
45
|
+
type: 'heart',
|
|
46
|
+
codepoints: '2764',
|
|
47
|
+
shortcodes: ':heart:',
|
|
48
|
+
},
|
|
49
|
+
fire: {
|
|
50
|
+
type: 'fire',
|
|
51
|
+
codepoints: '1F525',
|
|
52
|
+
shortcodes: ':fire:',
|
|
53
|
+
},
|
|
54
|
+
prayer: {
|
|
55
|
+
type: 'prayer',
|
|
56
|
+
codepoints: '1F64F',
|
|
57
|
+
shortcodes: ':pray:',
|
|
58
|
+
},
|
|
59
|
+
speed_up: {
|
|
60
|
+
type: 'speed_up',
|
|
61
|
+
codepoints: '1F407',
|
|
62
|
+
shortcodes: ':rabbit:',
|
|
63
|
+
},
|
|
64
|
+
slow_down: {
|
|
65
|
+
type: 'slow_down',
|
|
66
|
+
codepoints: '1F422',
|
|
67
|
+
shortcodes: ':turtle:',
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const SkinTones: Record<SkinToneType, SkinTone> = {
|
|
72
|
+
normal: {
|
|
73
|
+
type: 'normal_skin_tone',
|
|
74
|
+
codepoints: '',
|
|
75
|
+
shortcodes: '',
|
|
76
|
+
},
|
|
77
|
+
light: {
|
|
78
|
+
type: 'light_skin_tone',
|
|
79
|
+
codepoints: '1F3FB',
|
|
80
|
+
shortcodes: ':skin-tone-2:',
|
|
81
|
+
},
|
|
82
|
+
medium_light: {
|
|
83
|
+
type: 'medium_light_skin_tone',
|
|
84
|
+
codepoints: '1F3FC',
|
|
85
|
+
shortcodes: ':skin-tone-3:',
|
|
86
|
+
},
|
|
87
|
+
medium: {
|
|
88
|
+
type: 'medium_skin_tone',
|
|
89
|
+
codepoints: '1F3FD',
|
|
90
|
+
shortcodes: ':skin-tone-4:',
|
|
91
|
+
},
|
|
92
|
+
medium_dark: {
|
|
93
|
+
type: 'medium_dark_skin_tone',
|
|
94
|
+
codepoints: '1F3FE',
|
|
95
|
+
shortcodes: ':skin-tone-5:',
|
|
96
|
+
},
|
|
97
|
+
dark: {
|
|
98
|
+
type: 'dark_skin_tone',
|
|
99
|
+
codepoints: '1F3FF',
|
|
100
|
+
shortcodes: ':skin-tone-6:',
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export {Reactions, SkinTones};
|
|
@@ -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
|
+
}
|
|
@@ -714,6 +714,13 @@ describe('plugin-meetings', () => {
|
|
|
714
714
|
height: {
|
|
715
715
|
max: 200,
|
|
716
716
|
ideal: 200
|
|
717
|
+
},
|
|
718
|
+
frameRate: {
|
|
719
|
+
ideal: 15,
|
|
720
|
+
max: 30
|
|
721
|
+
},
|
|
722
|
+
facingMode: {
|
|
723
|
+
ideal: 'user'
|
|
717
724
|
}
|
|
718
725
|
}
|
|
719
726
|
};
|
|
@@ -4922,6 +4929,93 @@ describe('plugin-meetings', () => {
|
|
|
4922
4929
|
meeting.stopKeepAlive();
|
|
4923
4930
|
});
|
|
4924
4931
|
});
|
|
4932
|
+
|
|
4933
|
+
describe('#sendReaction', () => {
|
|
4934
|
+
it('should have #sendReaction', () => {
|
|
4935
|
+
assert.exists(meeting.sendReaction);
|
|
4936
|
+
});
|
|
4937
|
+
|
|
4938
|
+
beforeEach(() => {
|
|
4939
|
+
meeting.meetingRequest.sendReaction = sinon.stub().returns(Promise.resolve());
|
|
4940
|
+
});
|
|
4941
|
+
|
|
4942
|
+
it('should send reaction with the right data and return a promise', async () => {
|
|
4943
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
4944
|
+
|
|
4945
|
+
const reactionPromise = meeting.sendReaction('thumbs_down', 'light');
|
|
4946
|
+
|
|
4947
|
+
assert.exists(reactionPromise.then);
|
|
4948
|
+
await reactionPromise;
|
|
4949
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
4950
|
+
reactionChannelUrl: 'Fake URL',
|
|
4951
|
+
reaction: {
|
|
4952
|
+
type: 'thumb_down',
|
|
4953
|
+
codepoints: '1F44E',
|
|
4954
|
+
shortcodes: ':thumbsdown:',
|
|
4955
|
+
tone: {
|
|
4956
|
+
type: 'light_skin_tone',
|
|
4957
|
+
codepoints: '1F3FB',
|
|
4958
|
+
shortcodes: ':skin-tone-2:'
|
|
4959
|
+
}
|
|
4960
|
+
},
|
|
4961
|
+
participantId: meeting.members.selfId,
|
|
4962
|
+
});
|
|
4963
|
+
});
|
|
4964
|
+
|
|
4965
|
+
it('should fail sending a reaction if data channel is undefined', async () => {
|
|
4966
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: undefined}};
|
|
4967
|
+
|
|
4968
|
+
await assert.isRejected(meeting.sendReaction('thumbs_down', 'light'), Error, 'Error sending reaction, service url not found.');
|
|
4969
|
+
|
|
4970
|
+
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
4971
|
+
});
|
|
4972
|
+
|
|
4973
|
+
it('should fail sending a reaction if reactionType is invalid ', async () => {
|
|
4974
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
4975
|
+
|
|
4976
|
+
await assert.isRejected(meeting.sendReaction('invalid_reaction', 'light'), Error, 'invalid_reaction is not a valid reaction.');
|
|
4977
|
+
|
|
4978
|
+
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
4979
|
+
});
|
|
4980
|
+
|
|
4981
|
+
it('should send a reaction with default skin tone if provided skinToneType is invalid ', async () => {
|
|
4982
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
4983
|
+
|
|
4984
|
+
const reactionPromise = meeting.sendReaction('thumbs_down', 'invalid_skin_tone');
|
|
4985
|
+
|
|
4986
|
+
assert.exists(reactionPromise.then);
|
|
4987
|
+
await reactionPromise;
|
|
4988
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
4989
|
+
reactionChannelUrl: 'Fake URL',
|
|
4990
|
+
reaction: {
|
|
4991
|
+
type: 'thumb_down',
|
|
4992
|
+
codepoints: '1F44E',
|
|
4993
|
+
shortcodes: ':thumbsdown:',
|
|
4994
|
+
tone: {type: 'normal_skin_tone', codepoints: '', shortcodes: ''}
|
|
4995
|
+
},
|
|
4996
|
+
participantId: meeting.members.selfId,
|
|
4997
|
+
});
|
|
4998
|
+
});
|
|
4999
|
+
|
|
5000
|
+
it('should send a reaction with default skin tone if none provided', async () => {
|
|
5001
|
+
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
5002
|
+
|
|
5003
|
+
const reactionPromise = meeting.sendReaction('thumbs_down');
|
|
5004
|
+
|
|
5005
|
+
assert.exists(reactionPromise.then);
|
|
5006
|
+
await reactionPromise;
|
|
5007
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
5008
|
+
reactionChannelUrl: 'Fake URL',
|
|
5009
|
+
reaction: {
|
|
5010
|
+
type: 'thumb_down',
|
|
5011
|
+
codepoints: '1F44E',
|
|
5012
|
+
shortcodes: ':thumbsdown:',
|
|
5013
|
+
tone: {type: 'normal_skin_tone', codepoints: '', shortcodes: ''}
|
|
5014
|
+
},
|
|
5015
|
+
participantId: meeting.members.selfId,
|
|
5016
|
+
});
|
|
5017
|
+
});
|
|
5018
|
+
});
|
|
4925
5019
|
});
|
|
4926
5020
|
});
|
|
4927
5021
|
});
|
|
@@ -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
|
});
|