Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test migration for calling-widget to react-widget #1245

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
**/dist/**
**/es/**
**/cjs/**
**/node_modules/**
adapter-interfaces/rollup.config.js
logger/rollup.config.js
react-widgets/rollup.calling-config.js
samples
scripts
test
widgets
rollup.calling-config.js
wdio.conf.js
12 changes: 12 additions & 0 deletions adapter-interfaces/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
root: true,
// extends: ['webex-int'],
extends: '@webex/eslint-config-react',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
rules: {
'jest/no-done-callback': 'off',
},
};
51 changes: 51 additions & 0 deletions adapter-interfaces/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@webex-int/adapter-interfaces",
"private": true,
"version": "0.0.0",
"source": "src/index.ts",
"main": "./dist/cjs/webex-int-adapter-interfaces.js",
"module": "./dist/esm/webex-int-adapter-interfaces.js",
"types": "./dist/index.d.ts",
"sideEffects": false,
"license": "MIT",
"files": [
"dist/**"
],
"publishConfig": {
"access": "restricted"
},
"scripts": {
"build": "rollup -c",
"build:bundle": "tsup src/index.ts --format esm,cjs,iife --dts --sourcemap --global-name WebexIntAdapterInterfaces",
"clean:docs": "rm -rf temp etc",
"docs": "mkdir -p dist/docs && yarn docs:extract && yarn docs:build",
"docs:extract": "api-extractor run -c ./api-extractor.json --local --verbose",
"docs:build": "api-documenter markdown -i ./temp -o ./docs",
"dev": "rollup -c -w",
"lint": "TIMING=1 eslint 'src/**/*.{ts,tsx,js,jsx}'",
"lint:fix": "TIMING=1 eslint 'src/**/*.{ts,tsx,js,jsx}' --fix",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"clean:dist": "rm -rf dist",
"test": "",
"test:coverage": ""
},
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "^8.3.3",
"@types/rollup-plugin-peer-deps-external": "^2",
"eslint": "8.22.0",
"eslint-config-webex-int": "*",
"rollup": "^2.75.7",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-terser": "^7.0.2",
"ts-config-webex-int": "*",
"tsup": "5.10.1",
"typescript": "4.5.3"
},
"peerDependencies": {
"rxjs": "^7.5.6"
}
}
63 changes: 63 additions & 0 deletions adapter-interfaces/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import external from 'rollup-plugin-peer-deps-external';
import del from 'rollup-plugin-delete';
import dts from 'rollup-plugin-dts';
import { terser } from 'rollup-plugin-terser';

const packageJson = require('./package.json');
const moduleName = packageJson.name.replace('@', '').replace('/', '-');

export default [
{
input: packageJson.source,
output: [
{
file: packageJson.main,
format: 'cjs',
sourcemap: true,
name: moduleName,
globals: { rxjs: 'rxjs' },
},
{
file: `${packageJson.main.slice(0, -3)}.min.js`,
format: 'cjs',
sourcemap: true,
plugins: [terser()],
globals: { rxjs: 'rxjs' },
},
{
file: packageJson.module,
format: 'esm',
sourcemap: true,
globals: { rxjs: 'rxjs' },
},
{
file: `${packageJson.module.slice(0, -3)}.min.js`,
format: 'esm',
sourcemap: true,
plugins: [terser()],
globals: { rxjs: 'rxjs' },
},
],
external: [/rxjs/],
plugins: [
del({ targets: 'dist/*' }),
external(),
resolve(),
commonjs(),
typescript({
tsconfig: './tsconfig.json',
declarationDir: '.',
outputToFilesystem: true,
}),
],
},
{
input: 'dist/esm/src/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
external: [/\.css$/, /\.scss$/],
plugins: [dts()],
},
];
10 changes: 10 additions & 0 deletions adapter-interfaces/src/IAdapterAggregator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ICallHistoryAdapter } from './ICallHistoryAdapter';
import { ISearchContactsAdapter } from './ISearchContactsAdapter';

export abstract class IAdapterAggregator {
callHistoryAdapter?: ICallHistoryAdapter;

speedDialsAdapter?: unknown;

searchContactsAdapter?: ISearchContactsAdapter;
}
155 changes: 155 additions & 0 deletions adapter-interfaces/src/ICallHistoryAdapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import { Observable } from 'rxjs';

export enum DispositionTypes {
MISSED = 'MISSED',
CANCELLED = 'CANCELLED',
INITIATED = 'INITIATED',
}

export enum DirectionTypes {
INCOMING = 'INCOMING',
OUTGOING = 'OUTGOING',
}

export type SessionTypes = 'SPARK' | 'BROADWORKS';

export interface ISDKCallHistoryRecord {
id: string;
url?: string;
sessionId?: string;
sessionType?: SessionTypes;
startTime?: string;
endTime?: string;
durationSecs?: number;
durationSeconds?: number;
joinedDurationSeconds?: number;
participantCount?: number;
direction: DirectionTypes;
disposition: DispositionTypes;
self?: {
id: string;
name: string;
phoneNumber?: string;
incomingCallProtocols?: unknown[];
};
other: {
id: string;
name: string;
phoneNumber?: string;
isPrivate?: boolean;
callbackAddress: string;
};
links: {
callbackAddress: string;
conversationUrl: string;
locusUrl?: string;
};
isSelected?: boolean;
isDeleted?: boolean;
isPMR?: boolean;
correlationIds?: unknown[];
}

export type ICallHistoryRecords = {
lastUpdated?: string;
items?: Record<string, ICallHistoryRecord>;
};

export interface ICallHistoryRecord {
id: string;
name: string;
direction?: DirectionTypes;
disposition?: DispositionTypes;
startTime?: string;
endTime?: string;
sessionType?: string;
phoneNumber?: string;
callbackAddress?: string;
isSelected?: boolean;
}

export interface ICallHistoryAdapter {
refresh(ID?: string): void;

getAll(ID?: string): Observable<ICallHistoryRecord[]>;

getOne?(ID?: string): Observable<ICallHistoryRecord>;
}

export enum SORT {
ASC = 'ASC',
DESC = 'DESC',
DEFAULT = 'DESC',
}

export enum SORT_BY {
END_TIME = 'endTime',
DEFAULT = 'endTime',
START_TIME = 'startTime',
}

export enum DATE {
WEEK = 7,
MONTH = 30,
DEFAULT = 7,
}

export enum LIMIT {
DEFAULT = 20,
}

export interface ICallbackInfo {
callbackAddress: string;
callbackType: string;
}

export interface ISelf {
id: string;
name: string;
incomingCallProtocols: any[];
callbackInfo: ICallbackInfo;
}

export interface IOther {
phoneNumber: string;
id: string;
name: string;
isPrivate: boolean;
callbackAddress: string;
}

export interface ILinks {
locusUrl: string;
callbackAddress: string;
}

export interface IUserSession {
id: string;
durationSecs: number;
self: ISelf;
url: string;
sessionId: string;
sessionType: string;
startTime: string;
endTime: string;
direction: string;
disposition: string;
other: IOther;
durationSeconds: number;
joinedDurationSeconds: number;
participantCount: number;
links: ILinks;
isDeleted: boolean;
isPMR: boolean;
correlationIds: string[];
}

export interface IUserSessionData {
userSessions: IUserSession[];
}

export interface IWebexCallHistoryResponse {
statusCode: number;
data: IUserSessionData;
message: string;
}
3 changes: 3 additions & 0 deletions adapter-interfaces/src/IMakeCallAdapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface IMakeCallAdapter {
makeCall: (address: string, isVideo: boolean) => Promise<void>;
}
20 changes: 20 additions & 0 deletions adapter-interfaces/src/ISearchContactsAdapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { IWebexIntContact } from './shared';

export interface ISearchContactsAdapterSearchInput {
searchText: string;
}

export interface ISearchContactsAdapterSearchResponse {
count: number;
items: {
[sourceName: string]: IWebexIntContact[];
};
}

export interface ISearchContactsAdapter {
search: (
_: ISearchContactsAdapterSearchInput
) => Promise<ISearchContactsAdapterSearchResponse>;

getSources: () => string[];
}
50 changes: 50 additions & 0 deletions adapter-interfaces/src/ISpeedDialsAdapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { Observable } from 'rxjs';

export interface ISpeedDialRecord {
/** The id for reference */
id: string;

/** The display name */
displayName: string;

/** The status to display Online/Offline */
status?: string;

/** The number to display */
number?: string;

/** The call type (audio/video) */
callType?: string;

/** The phone number to display */
phone?: string;

/** The phone number type (work,mobile,mail) */
phoneType?: string;

/** Callback address to pass to call action */
currentCallAddress?: string;

mail?: string;
mobilePhone?: string;
businessPhones?: string[];
surname?: string;
givenName?: string;
photo?: string;
}

export interface ISpeedDialsAdapter {
refresh?(ID?: string): void;

getAll(ID?: string): Observable<ISpeedDialRecord[]>;

getOne(ID?: string): Observable<ISpeedDialRecord>;

getContacts?(query?: string): Observable<ISpeedDialRecord[]>;

add?(speedDial: ISpeedDialRecord): void;

update?(speedDial: ISpeedDialRecord): void;

remove?(speedDial: ISpeedDialRecord): void;
}
Loading