Skip to content

Commit d230063

Browse files
maxwellmooney13Maxwell Mooneyjensengar
authored
Pcm 1667 (#15)
* PCM-1667 built with CRA instead * PCM-1667 another attempt * PCM-1667 correct configuration issues; touched up unit tests * PCM-1667 removing unnecessary layers * PCM-1667 touched up file structure to reduce redundancy * PCM-1667 working on ways to mock server for fetch/ajax calls * PCM-1667 attempting unit test set up * hack the jsonp testing * PCM-1667 worked on tests to almost 80% coverage for Plantronics * PCM-1667 resolve merge conflict * PCM-1667 merge conflict resolution; switching React component back to TSX * PCM-1667 fixing yarn lock * fix plantronics tests * PCM-1667 adding to unit tests * PCM-1667 added tests for headset events * PCM-1667 removed commented out code * PCM-1667 fixed issue with hold call test * PCM-1667 addressed some PR comments * PCM-1667 updated pacakge.json to have better scripting * PCM-1667 laying groundwork for Jabra * PCM-1667 Jabra functionality foundation worked out * PCM-1667 * PCM-1667 worked on unit tests for Jabra * PCM-1667 added in unit tests for Jabra headset up to ~95% coverage * PCM-1667 updated unit tests and fixed test app issues * PCM-1667 updated application-service to proper determine when app is hosted * PCM-1667 removed duplicate function and went back to deviceLabelMatchesVendor which already existed * PCM-1667 fixed unit tests to no longer check canHandleMic and flesh out deviceLabelMatchesVendor * PCM-1667 addressed pr comments and concerns * PCM-1667 updated scripts to help builds find proper directories * PCM-1667 updated Jenkinsfile * PCM-1667 removed redundant part of script for now * PCM-1667 updated lint script * PCM-1667 removed eslint config for the time * PCM-1667 updated react package json * PCM-1667 made linting changes to help pass tests * PCM-1667 test commit * PCM-1667 undo test commit * PCM-1667 renamed mock server scripts * PCM-1667 updated package.json with new script names * PCM-1667 fixed typo in package.json * PCM-1667 removed mock server scripts * PCM-1667 added in mock server test scripts * PCM-1667 added in 'bash' for scripts * PCM-1667 updated Jenkinsfile to use proper test script * PCM-1667 added install statement for 'react-app' * PCM-1667 trying new approaches in Jenkinsfile and package.json to help with package installation * PCM-1667 updated tsconfig to have 'react' rather than 'react-jsx' * PCM-1667 updated tsconfig * PCM-1667 reverted tsconfig; added module compile script for tsconfig * PCM-1667 switching around order of scripts * PCM-1667 updated include statement for both tsconfigs * PCM-1667 changed include to a ts extension rather than tsx and pointed to internal tsconfig rather than root * PCM-1667 set jsx to 'react' instead of 'react-jsx' * PCM-1667 added webpack * PCM-1667 updated webpack to point at correct entry * PCM-1667 updated webpack script * PCM-1667 update webpack script * PCM-1667 updated README.md for Github * PCM-1667 added publish config to package.json * PCM-1667 made changes to hopefully help with other apps consuming * PCM-1667 addressed a lot of pr comments; still working on Jabra WebHID permissions; updating build configs to be consumed by other apps * PCM-1667 temporarily removing test coverage check strictly for build purposes; will be added back in later * PCM-1667 typo on Jenkinsfile * PCM-1667 commented out problematic line in jabra.ts and fixed linting issues * PCM-1667 updated cjs, module, main and typings in package.json * PCM-1667 updated Call Info interface to let contact name be optional * PCM-1668 added console logs for testing purposes and updated Jenkinsfile * PCM-1667 changed headsetEvent$ to a BehaviorSubject * PCM-1667 changed headsetEvent$ to a BehaviorSubject * PCM-1667 removing isActive flag temporarily * PCM-1667 touched up Jabra implementation to add temporary timer; added showRetry and updated proper translation names; added 'retry' button to test app * PCM-1667 touched up Jabra implementation to add temporary timer; added showRetry and updated proper translation names; added 'retry' button to test app * PCM-1667 updated connectionStatus return values * PCM-1667 added in new event to be emitted when connection status changes * PCM-1667 added connection flags to event * PCM-1667 added checks to make sure connection status event doesn't fire more than once for the same flag * PCM-1667 added in device connectivity flags for other vendors (jabra and sennheiser) * PCM-1667 added in device connectivity flags for other vendors (jabra and sennheiser) * PCM-1667 removed other Jabra instances (chrome and native) temporarily * PCM-1667 fixed typo with logic * PCM-1667 removed unnecessary functions * PCM-1667 added jabra-native back in; TODO: still need to work on that * PCM-1667 made changes to hopefully help jabra native work * PCM-1667 added in a special case for call lock logging * PCM-1667 added in a special case for call lock logging * PCM-1667 removed getHeadSetEventsSubject * remove application service and update jabra native * PCM-1667 worked on jabra tests and made minor change to incoming call function * PCM-1667 addressed PR comments; removed console logs; typed message and error type * PCM-1667 replaced default value for selectedImplementation * PCM-1667 removed commented out and unused lines * add tests * fix test-utils coverage * PCM-1667 reached 100% coverage for Jabra * PCM-1667 100% test coverage * PCM-1667 updated typing in headset.ts; updated error in App.tsx * PCM-1667 updated typing in headset.ts; updated error in App.tsx * PCM-1667 fixed or ignored linting issues * update publish config * PCM-1667 added coverage thresholds * PCM-1667 addressed easier PR comments Co-authored-by: Maxwell Mooney <maxwell.mooney@genesys.com> Co-authored-by: Garrett Jensen <garrett.jensen@genesys.com>
1 parent 47e9f43 commit d230063

File tree

101 files changed

+22001
-24146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+22001
-24146
lines changed

.eslintrc.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
],
1818
"rules": {
1919
"@typescript-eslint/no-var-requires": 1,
20-
"no-prototype-builtins": 0
21-
}
20+
"no-prototype-builtins": 0,
21+
"@typescript-eslint/no-explicit-any": 0
22+
},
23+
"ignorePatterns": [
24+
"**/jabra-*/*.ts"
25+
]
2226
}

Jenkinsfile

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
// this will need to be pipeline-library@master when the pr merges
2-
@Library('pipeline-library') _
2+
@Library('pipeline-library@ui-pipeline-legacy') _
33

44
webappPipeline {
55
slaveLabel = 'dev_v2'
66
nodeVersion = '14.17.5'
77
useArtifactoryRepo = false
88
projectName = 'vendor-headsets'
9-
manifest = customManifest('dist') {
10-
sh('node ./create-manifest.js')
11-
readJSON(file: 'dist/manifest.json')
12-
}
9+
manifest = directoryManifest('dist')
1310
buildType = { (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('release/')) ? 'MAINLINE' : 'FEATURE' }
14-
publishPackage = { 'prod' }
11+
publishPackage = { 'dev' }
1512
testJob = null
1613

1714
buildStep = {
1815
sh('''
19-
export CDN_URL="$(npx cdn --ecosystem pc --name $APP_NAME --build $BUILD_ID --version $VERSION)"
20-
echo "CDN_URL $CDN_URL"
21-
npm ci && npm run lint && npm test && npm run build
22-
cd demo-app && npm ci && npm run build
16+
export CDN_URL="$(npx cdn --ecosystem pc --name \$APP_NAME --build \$BUILD_ID --version \$VERSION)"
17+
echo "CDN_URL: \$CDN_URL"
18+
npm run install:all && npm run compile:module && npm run build && npm run lint && npm run test:coverage
2319
''')
2420
}
2521

README.md

+64-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
1-
# softphone-vendor-headsets
1+
# Softphone Vendor Headsets
22

3-
Softphone integrations for vendor specific headset hardware and software
3+
### Overview
4+
This library's goal is to abstract all the different headset implementations behind a single interface.
45

5-
This project was bootstrapped with [TSDX](https://github.com/jaredpalmer/tsdx).
6+
This project has a [React](https://github.com/facebook/react/) test app bootstrapped with [create-react-app](https://reactjs.org/docs/create-a-new-react-app.html).
7+
8+
At this moment (12/10/2021) there are three supported vendors already handled with this library:
9+
- Plantronics/Poly
10+
- Sennheiser/EPOS
11+
- Jabra
12+
13+
### Installation
14+
15+
``` sh
16+
# npm
17+
npm install --save softphone-headset-vendors
18+
# yarn
19+
yarn softphone-headset-vendors
20+
```
21+
22+
### Documentation
23+
#### Structure and flow
24+
- The consuming app will first above anything else hit the HeadsetService (`headsets.ts`).
25+
- From there, the service will determine what vendor is currently selected out of the supported vendors above. This will also be a hub to call the proper functions that correspond with app to headset events (More on that later)
26+
- Once the desired vendor has been determined, an instance of that vendor's adapter/service will be created. This adapter will interact with the service or sdk the vendor requires to communicate information to and from the headset.
27+
- If an event is received from the headset itself, the vendor adapters will emit an event that `headset.ts` is listening for. This event will then be passed to the consuming app to properly reflect the state on screen to match that of the headset
28+
29+
**Example 1 - User clicks mute in the consuming app**:
30+
- From the consuming app, the user clicks on an on-screen mute button
31+
- The consuming app calls headsetService.mute(...)
32+
- Which is passed to the corresponding function of the vendor adapter that aligns with the selected device (for example, plantronics.ts -> setMute(true))
33+
- This function will then send a message to the headset itself
34+
- The user will then see the light on their device that represents the "muted" state light up.
35+
36+
**Example 2 - User presses the mute button from the headset**:
37+
- From the headset, the user presses the button which corresponds to mute
38+
- This is then received by the vendor instance (for example sennheiser.ts)
39+
- This event is then sent to `headset.ts` which in turn lets the consuming app know so that the screen properly reflect the state of the headset
40+
41+
#### WebHID
42+
One of our supported vendors has began working with a technology known as [WebHID][1]. This is a relatively newer technology with a lot of promise but with its own caveats as well - https://wicg.github.io/webhid/
43+
- At this moment, WebHID only works with Chromium browsers (Google Chrome/Microsoft Edge). Keep this in mind when developing and using the vendors we currently support
44+
- In order to use WebHID, you must grant permissions for the site you are currently on. There is a function that must be called that causes a popup to show on screen where the user is then required to select their device and approve its use for WebHID purposes. This function MUST be called with user action (i.e. clicking a button). The solution we currently have in place is after the `user` takes the `action` of changing and selecting a new microphone, we check if it is the specific vendor that supports WebHID, then we emit an event that a consuming app should listen for and then fire the WebHID consent function
45+
46+
### Contributing
47+
This repo uses [Jest][3] for tests and code coverage
48+
49+
To get started in development:
50+
```sh
51+
npm install
52+
cd react-app
53+
yarn start
54+
```
55+
Then navigate to https://localhost:8443 to see the test app. This way you can see the effects of the events from the headset on the app and vice versa.
56+
57+
### Testing
58+
Run the tests using `npm run test:watch` or `npm run test:coverage`. Both commands should be run in the folder.
59+
- `test:watch` will rerun the tests after changes to the code or the test itself
60+
- `test:coverage` will run the test suites and produce a report on coverage of the code
61+
62+
**Important Note**: Out of the box, the test scripts will not work on Windows machines. A developer will more than likely need to make modifications to the scripts in the package.json as well as the shell scripts found in the `scripts` folder. If you do not want to modify the scripts out of the box, using a Linux instance seemed to help. The author of the library used an Ubuntu instance
63+
64+
[1]: https://developer.mozilla.org/en-US/docs/Web/API/WebHID_API
65+
[2]: https://wicg.github.io/webhid/
66+
[3]: https://jestjs.io/en/

babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ["@babel/preset-env"]
3+
}

copy-version.js

-9
This file was deleted.

demo-app/.gitignore

-4
This file was deleted.

demo-app/.npmignore

-4
This file was deleted.

0 commit comments

Comments
 (0)