Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Adding new limits and new validations #730

Merged
merged 53 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
8ade2d9
feat: add new meeting colors and slots
carlossantos74 Jul 4, 2024
7c5b9ac
Merge branch 'main' of github.com:SuperViz/sdk into fix/kick-particip…
carlossantos74 Jul 4, 2024
27104a4
test: wio tests
carlossantos74 Jul 4, 2024
975c475
feat: fetch pointer image by color name
carlossantos74 Jul 4, 2024
890e6a9
Merge pull request #705 from SuperViz/fix/kick-participant-interval
carlossantos74 Jul 8, 2024
e4d3901
fix: colors names
carlossantos74 Jul 8, 2024
db26565
Merge pull request #706 from SuperViz/fix/kick-participant-interval
carlossantos74 Jul 8, 2024
5f041ca
refactor: improve local participant updates in the global state
carlossantos74 Jul 9, 2024
dd1eb8c
fix: authentication destroy errors
carlossantos74 Jul 9, 2024
5793d08
feat: only assign slot to user when it's necessary
carlossantos74 Jul 9, 2024
074f84e
fix: participant joined and list events payloads
carlossantos74 Jul 9, 2024
d36fd04
refactor: callback name
carlossantos74 Jul 10, 2024
e408b8c
Merge pull request #707 from SuperViz/feat/connection-limits-per-product
carlossantos74 Jul 10, 2024
b81c809
feat: implement connection limits by product instead of by room
carlossantos74 Jul 10, 2024
ecec227
fix: update active components list in the io
carlossantos74 Jul 10, 2024
08aaedf
Merge pull request #708 from SuperViz/feat/connection-limits-per-product
carlossantos74 Jul 11, 2024
5683f37
feat: add target to es6 in the esm config
carlossantos74 Jul 11, 2024
592f57d
Merge pull request #709 from SuperViz/feat/connection-limits-per-product
carlossantos74 Jul 11, 2024
b190876
Merge pull request #712 from SuperViz/beta
carlossantos74 Jul 11, 2024
bf30bf4
fix: dont show default avatars list to audiences
carlossantos74 Jul 11, 2024
669b29a
feat: add joined room prop to participant
carlossantos74 Jul 11, 2024
dffc25b
Merge branch 'lab' of github.com:SuperViz/sdk into fix/build-esm-files
carlossantos74 Jul 11, 2024
3ac288b
refactor: too many updates in the local participant when add or remov…
carlossantos74 Jul 11, 2024
bbace2b
Merge pull request #713 from SuperViz/fix/build-esm-files
carlossantos74 Jul 11, 2024
0ffa02d
fix: update global participant object when they enter the meeting room
carlossantos74 Jul 12, 2024
c2a881c
fix: internal video destroys don't remove component from activeCompon…
carlossantos74 Jul 12, 2024
f9fca86
Merge branch 'beta' of github.com:SuperViz/sdk into fix/build-esm-files
carlossantos74 Jul 12, 2024
b451aea
fix: sync activeComponents list and instances with list inside the store
carlossantos74 Jul 14, 2024
dc142fc
merge with beta
carlossantos74 Jul 15, 2024
5ea6525
feat: skip devices callbacks call when the participant is audience
carlossantos74 Jul 15, 2024
dd518a7
fix: ensure user has the default slot when they enters the room
carlossantos74 Jul 16, 2024
cdc1d7a
fix: wait to assign a slot before try again
carlossantos74 Jul 17, 2024
3e29e5e
fix: follow participant name and generate avatar when partcipant don'…
carlossantos74 Jul 17, 2024
ec21c51
Merge pull request #714 from SuperViz/fix/build-esm-files
carlossantos74 Jul 17, 2024
5845baa
feat: update socket client
carlossantos74 Jul 17, 2024
f4c5705
Merge pull request #719 from SuperViz/fix/build-esm-files
carlossantos74 Jul 17, 2024
b1c3a25
fix: update socket client version
carlossantos74 Jul 17, 2024
e99c89a
Merge pull request #720 from SuperViz/fix/build-esm-files
carlossantos74 Jul 17, 2024
79e99d7
fix(debug): don't force to reconect in the socket
carlossantos74 Jul 17, 2024
b19cbb9
Merge pull request #721 from SuperViz/fix/build-esm-files
carlossantos74 Jul 17, 2024
0ef223a
feat: add socket client library to SDK
carlossantos74 Jul 18, 2024
cd4f2be
Merge pull request #722 from SuperViz/fix/build-esm-files
carlossantos74 Jul 18, 2024
ce84111
merge with main
carlossantos74 Jul 19, 2024
6aeb7f0
feat: load limits from server
carlossantos74 Jul 19, 2024
d004243
Merge pull request #725 from SuperViz/feat/load-limits-from-server
carlossantos74 Jul 19, 2024
29ad1f6
feat: add same account validation
carlossantos74 Jul 22, 2024
fa3dd37
test: mock joined room
carlossantos74 Jul 22, 2024
02a0b3e
fix: only change state to disconnected when needs to disconnect
carlossantos74 Jul 22, 2024
e5082a5
refactor: improve console messages
carlossantos74 Jul 22, 2024
515bcbb
Merge pull request #726 from SuperViz/feat/same-account-error-ioc
carlossantos74 Jul 23, 2024
72237a8
feat(core): validate if the user id and room id follow the right pattern
carlossantos74 Jul 23, 2024
ac6db74
Merge pull request #727 from SuperViz/feat/new-id-pattern
carlossantos74 Jul 23, 2024
5c79577
Merge pull request #729 from SuperViz/lab
carlossantos74 Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions __mocks__/limits.mock.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { ComponentLimits } from '../src/services/limits/types';

export const LIMITS_MOCK: ComponentLimits = {
videoConference: true,
presence: true,
comments: true,
transcript: true,
presence: {
canUse: true,
maxParticipants: 50,
},
realtime: {
canUse: true,
maxParticipants: 200,
},
videoConference: {
canUse: true,
maxParticipants: 255,
canUseTranscript: true,
},
};
11 changes: 5 additions & 6 deletions __mocks__/participants.mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Avatar, Group, Participant } from '../src';
import { MeetingColors, MeetingColorsHex } from '../src/common/types/meeting-colors.types';
import { MEETING_COLORS } from '../src/common/types/meeting-colors.types';
import { ParticipantByGroupApi } from '../src/common/types/participant.types';

export const MOCK_AVATAR: Avatar = {
Expand All @@ -10,15 +10,14 @@ export const MOCK_AVATAR: Avatar = {
export const MOCK_LOCAL_PARTICIPANT: Participant = {
id: 'unit-test-local-participant-id',
name: 'unit-test-local-participant-name',
color: '#000',
avatar: {
imageUrl: 'unit-test-avatar-thumbnail.png',
model3DUrl: 'unit-test-avatar-model.glb',
},
slot: {
color: MeetingColorsHex[0],
color: MEETING_COLORS.turquoise,
index: 0,
colorName: MeetingColors[0],
colorName: 'turquoise',
textColor: '#000',
timestamp: 0,
},
Expand All @@ -36,7 +35,7 @@ export const MOCK_ABLY_PARTICIPANT_DATA_1 = {
avatar: MOCK_AVATAR,
participantId: MOCK_LOCAL_PARTICIPANT.id,
slotIndex: 0,
color: MeetingColorsHex[0],
color: MEETING_COLORS.turquoise,
};

export const MOCK_ABLY_PARTICIPANT_DATA_2 = {
Expand All @@ -46,7 +45,7 @@ export const MOCK_ABLY_PARTICIPANT_DATA_2 = {
avatar: MOCK_AVATAR,
participantId: MOCK_LOCAL_PARTICIPANT.id,
slotIndex: 1,
color: MeetingColorsHex[1],
color: MEETING_COLORS.orange,
};

export const MOCK_PARTICIPANT_LIST: ParticipantByGroupApi[] = [
Expand Down
121 changes: 84 additions & 37 deletions src/common/types/meeting-colors.types.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,88 @@
export enum MeetingColors {
'turquoise',
'orange',
'blue',
'pink',
'purple',
'green',
export const NAME_IS_WHITE_TEXT = [
'rosybrown',
'red',
'bluedark',
'pinklight',
'purplelight',
'greenlight',
'orangelight',
'bluelight',
'redlight',
'saddlebrown',
'coral',
'orange',
'brown',
'yellow',
'gray',
}
'goldenrod',
'olivegreen',
'darkolivegreen',
'seagreen',
'lightsea',
'teal',
'cadetblue',
'pastelblue',
'mediumslateblue',
'bluedark',
'navy',
'rebeccapurple',
'purple',
'vividorchid',
'darkmagenta',
'deepmagenta',
'fuchsia',
'violetred',
'pink',
'vibrantpink',
'paleredviolet',
'carmine',
'wine',
];

export const INDEX_IS_WHITE_TEXT = [1, 3, 4, 6, 7, 14, 16];
export const MEETING_COLORS = {
turquoise: '#31E0B0',
orange: '#FF5E10',
blue: '#00ABF7',
pink: '#FF00BB',
purple: '#9C29FF',
green: '#6FDD00',
red: '#E30000',
bluedark: '#304AFF',
pinklight: '#FF89C4',
purplelight: '#D597FF',
greenlight: '#C6EC5C',
orangelight: '#FFA115',
bluelight: '#75DEFE',
redlight: '#FAA291',
brown: '#BB813F',
yellow: '#FFEF33',
olivegreen: '#93A000',
lightyellow: '#FAE391',
violetred: '#C03FA3',
rosybrown: '#B58787',
cadetblue: '#2095BB',
lightsteelblue: '#ABB5FF',
seagreen: '#04B45F',
palegreen: '#8DE990',
saddlebrown: '#964C42',
pastelblue: '#77A1CC',
palesilver: '#D2BABA',
coral: '#DF6B6B',
bisque: '#FFD9C4',
goldenrod: '#DAA520',
tan: '#D2BD93',
darkolivegreen: '#536C27',
mint: '#ADE6DF',
lightsea: '#45AFAA',
teal: '#036E6E',
wine: '#760040',
cyan: '#00FFFF',
mediumslateblue: '#6674D7',
navy: '#0013BB',
rebeccapurple: '#663399',
vividorchid: '#D429FF',
darkmagenta: '#810E81',
deepmagenta: '#C303C6',
fuchsia: '#FA00FF',
lavendermagenta: '#EE82EE',
thistle: '#EEB4DD',
vibrantpink: '#FF007A',
cottoncandy: '#FFC0DE',
paleredviolet: '#D96598',
carmine: '#B50A52',
gray: '#878291',
};

export enum MeetingColorsHex {
'#31E0B0',
'#FF5E10',
'#00ABF7',
'#FF00BB',
'#9C29FF',
'#6FDD00',
'#E30000',
'#304AFF',
'#FF89C4',
'#D597FF',
'#C6EC5C',
'#FFA115',
'#75DEFE',
'#FAA291',
'#BB813F',
'#FFEF33',
'#878291',
}
export const MEETING_COLORS_ARRAY = Object.values(MEETING_COLORS);
export const MEETING_COLORS_KEYS = Object.keys(MEETING_COLORS);
7 changes: 6 additions & 1 deletion src/common/types/participant.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export interface Participant {
id: string;
name?: string;
type?: ParticipantType;
color?: string;
slot?: Slot;
avatar?: Avatar;
isHost?: boolean;
Expand All @@ -28,6 +27,12 @@ export interface Participant {
timestamp?: number;
}

export interface VideoParticipant extends Participant {
participantId?: string;
color?: string;
joinedMeeting?: boolean;
}

export type ParticipantByGroupApi = {
id: string;
name: string;
Expand Down
9 changes: 8 additions & 1 deletion src/components/base/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useGlobalStore } from '../../services/stores';
import { ComponentNames } from '../types';

import { BaseComponent } from '.';
import { LIMITS_MOCK } from '../../../__mocks__/limits.mock';

class DummyComponent extends BaseComponent {
protected logger: Logger;
Expand Down Expand Up @@ -70,6 +71,7 @@ describe('BaseComponent', () => {
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
Presence3DManagerService: Presence3DManager,
connectionLimit: LIMITS_MOCK.videoConference.maxParticipants,
useStore,
});

Expand All @@ -90,6 +92,7 @@ describe('BaseComponent', () => {
ioc: new IOC(MOCK_LOCAL_PARTICIPANT),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
connectionLimit: LIMITS_MOCK.videoConference.maxParticipants,
useStore,
});

Expand All @@ -109,6 +112,7 @@ describe('BaseComponent', () => {
ioc: new IOC(MOCK_LOCAL_PARTICIPANT),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
connectionLimit: LIMITS_MOCK.videoConference.maxParticipants,
useStore,
});

Expand All @@ -126,8 +130,9 @@ describe('BaseComponent', () => {
config: null as unknown as Configuration,
eventBus: null as unknown as EventBus,
useStore: null as unknown as typeof useStore,
connectionLimit: LIMITS_MOCK.videoConference.maxParticipants,
});
}).toThrowError();
}).toThrow();
});
});

Expand All @@ -141,6 +146,7 @@ describe('BaseComponent', () => {
ioc: new IOC(MOCK_LOCAL_PARTICIPANT),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
connectionLimit: LIMITS_MOCK.videoConference.maxParticipants,
useStore,
});

Expand All @@ -162,6 +168,7 @@ describe('BaseComponent', () => {
ioc: new IOC(MOCK_LOCAL_PARTICIPANT),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
connectionLimit: LIMITS_MOCK.videoConference.maxParticipants,
useStore,
});

Expand Down
4 changes: 3 additions & 1 deletion src/components/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { DefaultAttachComponentOptions } from './types';
export abstract class BaseComponent extends Observable {
public abstract name: ComponentNames;
protected abstract logger: Logger;
protected connectionLimit: number | 'unlimited';
protected group: Group;
protected ioc: IOC;
protected eventBus: EventBus;
Expand Down Expand Up @@ -51,7 +52,8 @@ export abstract class BaseComponent extends Observable {
this.eventBus = eventBus;
this.isAttached = true;
this.ioc = ioc;
this.room = ioc.createRoom(this.name);
this.connectionLimit = params.connectionLimit ?? 50;
this.room = ioc.createRoom(this.name, this.connectionLimit);

if (!hasJoinedRoom.value) {
this.logger.log(`${this.name} @ attach - not joined yet`);
Expand Down
1 change: 1 addition & 0 deletions src/components/base/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface DefaultAttachComponentOptions {
eventBus: EventBus;
useStore: <T extends StoreType>(name: T) => Store<T>;
Presence3DManagerService: typeof Presence3DManager;
connectionLimit: number | 'unlimited';
}

export type GlobalStore = {
Expand Down
4 changes: 4 additions & 0 deletions src/components/comments/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ComponentNames } from '../types';
import { PinAdapter, CommentsSide, Annotation, PinCoordinates } from './types';

import { Comments } from './index';
import { LIMITS_MOCK } from '../../../__mocks__/limits.mock';

const MOCK_PARTICIPANTS: ParticipantByGroupApi[] = [
{
Expand Down Expand Up @@ -83,6 +84,7 @@ describe('Comments', () => {
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
Presence3DManagerService: Presence3DManager,
connectionLimit: LIMITS_MOCK.presence.maxParticipants,
useStore,
});

Expand Down Expand Up @@ -337,6 +339,7 @@ describe('Comments', () => {
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
Presence3DManagerService: Presence3DManager,
connectionLimit: LIMITS_MOCK.presence.maxParticipants,
useStore,
});

Expand All @@ -356,6 +359,7 @@ describe('Comments', () => {
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
Presence3DManagerService: Presence3DManager,
connectionLimit: LIMITS_MOCK.presence.maxParticipants,
useStore,
});

Expand Down
2 changes: 2 additions & 0 deletions src/components/form-elements/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ComponentNames } from '../types';
import { FieldEvents } from './types';

import { FormElements } from '.';
import { LIMITS_MOCK } from '../../../__mocks__/limits.mock';

describe('form elements', () => {
let instance: any;
Expand All @@ -32,6 +33,7 @@ describe('form elements', () => {
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
Presence3DManagerService: Presence3DManager,
connectionLimit: LIMITS_MOCK.presence.maxParticipants,
useStore,
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/form-elements/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SocketEvent } from '../../lib/socket';
import type { SocketEvent } from '../../lib/socket';

import { Participant } from '../../common/types/participant.types';
import { StoreType } from '../../common/types/stores.types';
Expand Down
2 changes: 2 additions & 0 deletions src/components/presence-mouse/canvas/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MOCK_CANVAS } from '../../../../__mocks__/canvas.mock';
import { MOCK_CONFIG } from '../../../../__mocks__/config.mock';
import { EVENT_BUS_MOCK } from '../../../../__mocks__/event-bus.mock';
import { LIMITS_MOCK } from '../../../../__mocks__/limits.mock';
import { MOCK_LOCAL_PARTICIPANT } from '../../../../__mocks__/participants.mock';
import { useStore } from '../../../common/utils/use-store';
import { IOC } from '../../../services/io';
Expand Down Expand Up @@ -53,6 +54,7 @@ const createMousePointers = (): PointersCanvas => {
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
Presence3DManagerService: Presence3DManager,
connectionLimit: LIMITS_MOCK.presence.maxParticipants,
useStore,
});

Expand Down
7 changes: 4 additions & 3 deletions src/components/presence-mouse/canvas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Logger } from '../../../common/utils';
import { BaseComponent } from '../../base';
import { ComponentNames } from '../../types';
import { Camera, ParticipantMouse, PresenceMouseProps, Transform } from '../types';
import { MEETING_COLORS } from '../../../common/types/meeting-colors.types';

export class PointersCanvas extends BaseComponent {
public name: ComponentNames;
Expand Down Expand Up @@ -330,12 +331,12 @@ export class PointersCanvas extends BaseComponent {
const pointerUser = divPointer.getElementsByClassName('pointer-mouse')[0] as HTMLDivElement;

if (pointerUser) {
pointerUser.style.backgroundImage = `url(https://production.cdn.superviz.com/static/pointers-v2/${mouse.slot.index}.svg)`;
pointerUser.style.backgroundImage = `url(https://production.cdn.superviz.com/static/mouse-pointers/${mouse.slot?.colorName}.svg)`;
}

if (mouseUser) {
mouseUser.style.color = mouse.slot.textColor;
mouseUser.style.backgroundColor = mouse.slot.color;
mouseUser.style.color = mouse.slot?.textColor ?? '#fff';
mouseUser.style.backgroundColor = mouse.slot?.color ?? MEETING_COLORS.gray;
mouseUser.innerHTML = mouse.name;
}

Expand Down
Loading
Loading