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

Commit

Permalink
chore: import socket-client from modules instead of lib folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Raspincel committed Aug 14, 2024
1 parent 8fbdb03 commit e1f57e9
Show file tree
Hide file tree
Showing 36 changed files with 62 additions and 809 deletions.
2 changes: 1 addition & 1 deletion __mocks__/io.mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { jest } from '@jest/globals';
import { Room } from '../src/lib/socket';
import { Room } from '@superviz/socket-client';

export const MOCK_IO = {
ClientState: {
Expand Down
2 changes: 1 addition & 1 deletion jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ global.DOMPoint = class {
}
};

jest.mock('./src/lib/socket', () => MOCK_IO);
jest.mock('@superviz/socket-client', () => MOCK_IO);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"luxon": "^3.4.4",
"rxjs": "^7.8.1",
"semantic-release-version-file": "^1.0.2",
"socket.io-client": "^4.7.5",
"@superviz/socket-client": "^1.10.0",
"zod": "^3.23.8"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion src/common/types/cdn.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import type {
import { ParticipantType } from './participant.types';
import { SuperVizSdkOptions } from './sdk-options.types';
import { StoreType } from '../types/stores.types';
import { PresenceEvents } from '../../lib/socket/common/types/event.types';
import { PresenceEvents } from '@superviz/socket-client';
import { FieldEvents } from '../../components/form-elements/types';
import { PinMode } from '../../web-components/comments/components/types';

Expand Down
2 changes: 1 addition & 1 deletion src/components/base/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Socket from '../../lib/socket';
import * as Socket from '@superviz/socket-client';

import { ComponentLifeCycleEvent } from '../../common/types/events.types';
import { Group } from '../../common/types/participant.types';
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 type { SocketEvent } from '../../lib/socket';
import type { SocketEvent } from '@superviz/socket-client';

import { Participant } from '../../common/types/participant.types';
import { StoreType } from '../../common/types/stores.types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/form-elements/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SocketEvent } from '../../lib/socket';
import { SocketEvent } from '@superviz/socket-client';

export type FormElementsProps = {
fields?: string[] | string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/presence-mouse/canvas/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Socket from '../../../lib/socket';
import * as Socket from '@superviz/socket-client';
import { throttle } from 'lodash';

import { RealtimeEvent } from '../../../common/types/events.types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/presence-mouse/html/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Socket from '../../../lib/socket';
import * as Socket from '@superviz/socket-client';
import { isEqual } from 'lodash';
import { Subscription, fromEvent, throttleTime } from 'rxjs';

Expand Down
2 changes: 1 addition & 1 deletion src/components/realtime/channel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Socket from '../../lib/socket';
import * as Socket from '@superviz/socket-client';
import throttle from 'lodash/throttle';

import { Participant } from '../../common/types/participant.types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/realtime/presence.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PresenceEvent, PresenceEvents, Room } from '../../lib/socket';
import { PresenceEvent, PresenceEvents, Room } from '@superviz/socket-client';

import { RealtimePresence } from './presence';
import { MOCK_IO } from '../../../__mocks__/io.mock';
Expand Down
10 changes: 6 additions & 4 deletions src/components/realtime/presence.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Logger } from '../../common/utils';
import * as Socket from '../../lib/socket';
import { PresenceEventsArg } from '../../lib/socket/common/types/event.types';
import * as Socket from '@superviz/socket-client';

export class RealtimePresence {
private logger: Logger;
Expand All @@ -14,12 +13,15 @@ export class RealtimePresence {
this.room.presence.update(data);
}

public subscribe<T = unknown>(event: PresenceEventsArg, callback: Socket.PresenceCallback<T>) {
public subscribe<T = unknown>(
event: Socket.PresenceEventsArg,
callback: Socket.PresenceCallback<T>,
) {
this.logger.log('Realtime Presence @ subscribe', event);
this.room.presence.on(event, callback);
}

public unsubscribe(event: PresenceEventsArg) {
public unsubscribe(event: Socket.PresenceEventsArg) {
this.logger.log('Realtime Presence @ unsubscribe', event);
this.room.presence.off(event);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/video/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TextEncoder, TextDecoder } from 'util';

import { PresenceEvent } from '../../lib/socket';
import { PresenceEvent } from '@superviz/socket-client';

import { MOCK_CONFIG } from '../../../__mocks__/config.mock';
import { EVENT_BUS_MOCK } from '../../../__mocks__/event-bus.mock';
Expand Down
2 changes: 1 addition & 1 deletion src/components/video/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PresenceEvent, PresenceEvents, Room } from '../../lib/socket';
import { PresenceEvent, PresenceEvents, Room } from '@superviz/socket-client';

import { ColorsVariables } from '../../common/types/colors.types';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/who-is-online/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PresenceEvent, PresenceEvents } from '../../lib/socket';
import { PresenceEvent, PresenceEvents } from '@superviz/socket-client';

import { RealtimeEvent, WhoIsOnlineEvent } from '../../common/types/events.types';
import { Participant, Avatar } from '../../common/types/participant.types';
Expand Down
2 changes: 1 addition & 1 deletion src/core/launcher/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Socket from '../../lib/socket';
import * as Socket from '@superviz/socket-client';
import { isEqual } from 'lodash';

import { ParticipantEvent } from '../../common/types/events.types';
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import { ParticipantType } from './common/types/participant.types';
import { RealtimeComponentEvent, RealtimeComponentState } from './components/realtime/types';
import { StoreType } from './common/types/stores.types';
import { PresenceEvents } from './lib/socket/common/types/event.types';
import { PresenceEvents } from '@superviz/socket-client';
import { FieldEvents } from './components/form-elements/types';
import { PinMode } from './web-components/comments/components/types';

Expand Down
1 change: 0 additions & 1 deletion src/lib/socket/common/types/callbacks.types.ts

This file was deleted.

46 changes: 0 additions & 46 deletions src/lib/socket/common/types/event.types.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/lib/socket/common/types/presence.types.ts

This file was deleted.

133 changes: 0 additions & 133 deletions src/lib/socket/connection/index.ts

This file was deleted.

45 changes: 0 additions & 45 deletions src/lib/socket/connection/types.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/lib/socket/index.ts

This file was deleted.

Loading

0 comments on commit e1f57e9

Please sign in to comment.