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

Commit 52cdebf

Browse files
authored
Merge pull request #16 from SuperViz/feat/organization-info
feat: adds the user organization fields to the sdk
2 parents 186dade + 8c383c7 commit 52cdebf

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

src/common/types/sdk-options.types.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface SuperVizSdkOptions {
2+
debug?: boolean;
3+
roomId: string;
4+
externalUserId: string;
5+
organizationId: string;
6+
organizationName: string;
7+
}

src/index.ts

+6-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
import SdkFacade from './SdkFacade';
22
import { MessageTypes } from './common/types/messages.types';
3+
import { SuperVizSdkOptions } from './common/types/sdk-options.types';
34
import { logger } from './common/utils';
45
import AuthService from './service/AuthService';
56
import { FrameSizeType } from './service/VideoConferenceManager.types';
67
import ApiService from './service/api/ApiService';
78
import Communicator from './service/communicator/Communicator';
89

9-
interface IConfig {
10-
debug?: boolean;
11-
roomId: string;
12-
externalUserId: string;
13-
}
14-
15-
export default async (apiKey: string, options: IConfig) => {
10+
export default async (apiKey: string, options: SuperVizSdkOptions) => {
1611
if (options.debug) {
17-
logger.enable();
12+
logger.enable('@superviz/*');
1813
}
1914

2015
const isValid = await AuthService(apiKey);
@@ -30,15 +25,9 @@ export default async (apiKey: string, options: IConfig) => {
3025
}
3126

3227
const { photonAppId } = environment;
28+
const CommunicatorService = new Communicator(Object.assign({}, options, { apiKey, photonAppId }));
3329

34-
return new SdkFacade(
35-
new Communicator(
36-
Object.assign({}, options, {
37-
apiKey,
38-
photonAppId,
39-
}),
40-
),
41-
);
30+
return new SdkFacade(CommunicatorService);
4231
};
4332

44-
export { MessageTypes, FrameSizeType };
33+
export { MessageTypes, FrameSizeType, SuperVizSdkOptions };

src/service/communicator/Communicator.ts

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export default class Communicator {
1515
private externalUserId: string;
1616
private photonAppId: string;
1717
private realtime: PhotonRealtimeService;
18+
private organizationId: string;
19+
private organizationName: string;
1820

1921
constructor({
2022
apiKey,
@@ -23,12 +25,16 @@ export default class Communicator {
2325
roomId,
2426
externalUserId,
2527
photonAppId,
28+
organizationId,
29+
organizationName,
2630
}: ICommunicatorTypes) {
2731
this.debug = debug;
2832
this.language = language;
2933
this.roomId = roomId;
3034
this.externalUserId = externalUserId;
3135
this.photonAppId = photonAppId;
36+
this.organizationId = organizationId;
37+
this.organizationName = organizationName;
3238

3339
this.realtime = RealtimeService.build();
3440

@@ -52,6 +58,8 @@ export default class Communicator {
5258
this.videoManager.start({
5359
roomId: this.roomId,
5460
externalUserId: this.externalUserId,
61+
organizationId: this.organizationId,
62+
organizationName: this.organizationName,
5563
});
5664
this.realtime.start(
5765
this.roomId,
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
import { SuperVizSdkOptions } from '../../common/types/sdk-options.types';
2+
13
export type Language = 'pt' | 'en' | 'zh';
24

3-
export interface ICommunicatorTypes {
5+
export interface ICommunicatorTypes extends SuperVizSdkOptions {
46
apiKey: string;
5-
debug?: boolean;
67
language?: Language;
7-
roomId: string;
8-
externalUserId: string;
98
photonAppId: string;
109
}

0 commit comments

Comments
 (0)