@whereby.com/browser-sdk 2.0.0-alpha → 2.0.0-alpha10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -2
- package/dist/lib.cjs +5868 -0
- package/dist/lib.esm.js +5850 -0
- package/dist/types.d.ts +308 -0
- package/dist/v2-alpha10.js +43 -0
- package/package.json +12 -6
- package/.eslintrc +0 -23
- package/.github/actions/build/action.yml +0 -17
- package/.github/workflows/deploy.yml +0 -102
- package/.github/workflows/test.yml +0 -24
- package/.prettierignore +0 -7
- package/.prettierrc +0 -4
- package/.storybook/main.cjs +0 -16
- package/.storybook/preview.js +0 -9
- package/jest.config.js +0 -6
- package/rollup.config.js +0 -70
- package/src/lib/RoomConnection.ts +0 -516
- package/src/lib/RoomParticipant.ts +0 -77
- package/src/lib/__tests__/embed.unit.ts +0 -77
- package/src/lib/api/ApiClient.ts +0 -111
- package/src/lib/api/Credentials.ts +0 -45
- package/src/lib/api/HttpClient.ts +0 -95
- package/src/lib/api/MultipartHttpClient.ts +0 -53
- package/src/lib/api/OrganizationApiClient.ts +0 -64
- package/src/lib/api/Response.ts +0 -34
- package/src/lib/api/credentialsService/index.ts +0 -159
- package/src/lib/api/credentialsService/test/index.spec.ts +0 -181
- package/src/lib/api/deviceService/index.ts +0 -42
- package/src/lib/api/deviceService/tests/index.spec.ts +0 -74
- package/src/lib/api/extractUtils.ts +0 -160
- package/src/lib/api/index.ts +0 -8
- package/src/lib/api/localStorageWrapper/index.ts +0 -15
- package/src/lib/api/models/Account.ts +0 -48
- package/src/lib/api/models/Meeting.ts +0 -42
- package/src/lib/api/models/Organization.ts +0 -186
- package/src/lib/api/models/Room.ts +0 -44
- package/src/lib/api/models/account/EmbeddedFreeTierStatus.ts +0 -34
- package/src/lib/api/models/tests/Account.spec.ts +0 -128
- package/src/lib/api/models/tests/Organization.spec.ts +0 -161
- package/src/lib/api/models/tests/Room.spec.ts +0 -74
- package/src/lib/api/modules/AbstractStore.ts +0 -18
- package/src/lib/api/modules/ChromeStorageStore.ts +0 -44
- package/src/lib/api/modules/LocalStorageStore.ts +0 -57
- package/src/lib/api/modules/tests/ChromeStorageStore.spec.ts +0 -67
- package/src/lib/api/modules/tests/LocalStorageStore.spec.ts +0 -79
- package/src/lib/api/modules/tests/__mocks__/storage.ts +0 -24
- package/src/lib/api/organizationService/index.ts +0 -284
- package/src/lib/api/organizationService/tests/index.spec.ts +0 -781
- package/src/lib/api/organizationServiceCache/index.ts +0 -28
- package/src/lib/api/organizationServiceCache/tests/index.spec.ts +0 -101
- package/src/lib/api/parameterAssertUtils.ts +0 -166
- package/src/lib/api/roomService/index.ts +0 -310
- package/src/lib/api/roomService/tests/index.spec.ts +0 -668
- package/src/lib/api/test/ApiClient.spec.ts +0 -139
- package/src/lib/api/test/HttpClient.spec.ts +0 -120
- package/src/lib/api/test/MultipartHttpClient.spec.ts +0 -145
- package/src/lib/api/test/OrganizationApiClient.spec.ts +0 -132
- package/src/lib/api/test/extractUtils.spec.ts +0 -357
- package/src/lib/api/test/helpers.ts +0 -41
- package/src/lib/api/test/parameterAssertUtils.spec.ts +0 -265
- package/src/lib/api/types.ts +0 -6
- package/src/lib/embed.ts +0 -172
- package/src/lib/index.ts +0 -3
- package/src/lib/react/VideoElement.tsx +0 -16
- package/src/lib/react/index.ts +0 -3
- package/src/lib/react/useLocalMedia.ts +0 -25
- package/src/lib/react/useRoomConnection.ts +0 -92
- package/src/lib/reducer.ts +0 -142
- package/src/stories/custom-ui.stories.tsx +0 -133
- package/src/stories/prebuilt-ui.stories.tsx +0 -131
- package/src/stories/styles.css +0 -74
- package/src/types.d.ts +0 -175
- package/tsconfig.json +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/browser-sdk",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-alpha10",
|
|
4
4
|
"description": "Modules for integration Whereby video in web apps",
|
|
5
5
|
"author": "Whereby AS",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,9 +10,13 @@
|
|
|
10
10
|
},
|
|
11
11
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
12
12
|
"source": "src/index.js",
|
|
13
|
-
"main": "dist/lib.cjs
|
|
13
|
+
"main": "dist/lib.cjs",
|
|
14
14
|
"module": "dist/lib.esm.js",
|
|
15
15
|
"type": "module",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/**/*.js",
|
|
18
|
+
"dist/*.d.ts"
|
|
19
|
+
],
|
|
16
20
|
"types": "dist/types.d.ts",
|
|
17
21
|
"scripts": {
|
|
18
22
|
"prebuild": "rimraf dist",
|
|
@@ -39,6 +43,7 @@
|
|
|
39
43
|
"@storybook/builder-webpack5": "^6.5.14",
|
|
40
44
|
"@storybook/manager-webpack5": "^6.5.14",
|
|
41
45
|
"@storybook/react": "^6.5.14",
|
|
46
|
+
"@testing-library/react": "^14.0.0",
|
|
42
47
|
"@types/btoa": "^1.2.3",
|
|
43
48
|
"@types/chrome": "^0.0.210",
|
|
44
49
|
"@types/jest": "^29.2.4",
|
|
@@ -48,8 +53,8 @@
|
|
|
48
53
|
"babel-loader": "^8.2.5",
|
|
49
54
|
"eslint": "^8.29.0",
|
|
50
55
|
"eslint-plugin-jest": "^26.5.3",
|
|
51
|
-
"jest": "
|
|
52
|
-
"jest-environment-jsdom": "
|
|
56
|
+
"jest": "29.4.3",
|
|
57
|
+
"jest-environment-jsdom": "29.4.3",
|
|
53
58
|
"lit-html": "^2.5.0",
|
|
54
59
|
"prettier": "^2.7.1",
|
|
55
60
|
"react": "^18.2.0",
|
|
@@ -59,13 +64,14 @@
|
|
|
59
64
|
"rollup-plugin-dts": "^5.1.1",
|
|
60
65
|
"rollup-plugin-terser": "^7.0.2",
|
|
61
66
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
62
|
-
"ts-jest": "
|
|
67
|
+
"ts-jest": "29.0.5",
|
|
63
68
|
"tslib": "^2.4.1",
|
|
64
69
|
"typescript": "^4.9.4"
|
|
65
70
|
},
|
|
66
71
|
"dependencies": {
|
|
67
72
|
"@swc/helpers": "^0.3.13",
|
|
68
|
-
"@whereby/jslib-media": "whereby/jslib-media.git",
|
|
73
|
+
"@whereby/jslib-media": "whereby/jslib-media.git#0.2.0",
|
|
74
|
+
"assert": "^2.0.0",
|
|
69
75
|
"axios": "^1.2.3",
|
|
70
76
|
"btoa": "^1.2.1",
|
|
71
77
|
"heresy": "^1.0.4"
|
package/.eslintrc
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es6": true,
|
|
5
|
-
"jest": true,
|
|
6
|
-
"node": true
|
|
7
|
-
},
|
|
8
|
-
"ignorePatterns": ["dist/*"],
|
|
9
|
-
"parserOptions": {
|
|
10
|
-
"ecmaVersion": "latest",
|
|
11
|
-
"sourceType": "module",
|
|
12
|
-
"ecmaFeatures": {
|
|
13
|
-
"experimentalObjectRestSpread": true
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
17
|
-
"plugins": ["jest"],
|
|
18
|
-
"rules": {
|
|
19
|
-
"no-console": ["error", { "allow": ["warn", "error"] }],
|
|
20
|
-
"@typescript-eslint/ban-ts-comment": 0,
|
|
21
|
-
"@typescript-eslint/no-namespace": "off"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
name: "Build"
|
|
2
|
-
description: "Installs dependencies and builds lib"
|
|
3
|
-
runs:
|
|
4
|
-
using: "composite"
|
|
5
|
-
steps:
|
|
6
|
-
- uses: actions/setup-node@v2
|
|
7
|
-
with:
|
|
8
|
-
node-version: "16"
|
|
9
|
-
cache: "yarn"
|
|
10
|
-
|
|
11
|
-
- name: Install dependencies
|
|
12
|
-
run: yarn install --frozen-lockfile
|
|
13
|
-
shell: bash
|
|
14
|
-
|
|
15
|
-
- name: Build
|
|
16
|
-
run: yarn build
|
|
17
|
-
shell: bash
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Build, test & deploy
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [created]
|
|
6
|
-
jobs:
|
|
7
|
-
build_and_test:
|
|
8
|
-
concurrency: build_and_test_main_${{ github.head_ref }}
|
|
9
|
-
name: Build & test
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
env:
|
|
12
|
-
GITHUB_TOKEN: ${{ secrets.WHEREBY_GITHUB_TOKEN }}
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout source code
|
|
15
|
-
uses: actions/checkout@v2
|
|
16
|
-
|
|
17
|
-
- name: Build
|
|
18
|
-
uses: ./.github/actions/build
|
|
19
|
-
|
|
20
|
-
- name: Test
|
|
21
|
-
run: yarn test
|
|
22
|
-
get_version_tag:
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
needs: build_and_test
|
|
25
|
-
outputs:
|
|
26
|
-
tag: ${{ steps.tag_check.outputs.tag }}
|
|
27
|
-
steps:
|
|
28
|
-
- uses: actions/checkout@v3
|
|
29
|
-
- name: Get version tag
|
|
30
|
-
id: tag_check
|
|
31
|
-
# 1st sed: remove major.minor.patch numbers
|
|
32
|
-
# 2nd sed: remove wrapper quotes
|
|
33
|
-
# 3rd sed: remove "-" and tag version if exists
|
|
34
|
-
run: |
|
|
35
|
-
TAG=$(npm pkg get version \
|
|
36
|
-
| sed 's/\([0-9]*\.[0-9]*\.[0-9]*\)//' \
|
|
37
|
-
| sed 's/^"\(.*\)"$/\1/' \
|
|
38
|
-
| sed 's/-\([a-z]*\)\([0-9]*\)/\1/')
|
|
39
|
-
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
40
|
-
deploy_cdn:
|
|
41
|
-
concurrency: deploy_cdn_main_${{ github.head_ref }}
|
|
42
|
-
name: Deploy to CDN
|
|
43
|
-
needs: get_version_tag
|
|
44
|
-
# Only run when there's no version tag (e.g. -beta) specified
|
|
45
|
-
if: ${{ needs.get_version_tag.outputs.tag == 0 }}
|
|
46
|
-
runs-on: ubuntu-latest
|
|
47
|
-
env:
|
|
48
|
-
GITHUB_TOKEN: ${{ secrets.WHEREBY_GITHUB_TOKEN }}
|
|
49
|
-
steps:
|
|
50
|
-
- name: Checkout source code
|
|
51
|
-
uses: actions/checkout@v2
|
|
52
|
-
|
|
53
|
-
- name: Build
|
|
54
|
-
uses: ./.github/actions/build
|
|
55
|
-
|
|
56
|
-
- name: Configure AWS Credentials
|
|
57
|
-
uses: aws-actions/configure-aws-credentials@v1
|
|
58
|
-
with:
|
|
59
|
-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
60
|
-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
61
|
-
aws-region: eu-west-1
|
|
62
|
-
|
|
63
|
-
- uses: jakejarvis/s3-sync-action@master
|
|
64
|
-
with:
|
|
65
|
-
args: --acl public-read --follow-symlinks
|
|
66
|
-
env:
|
|
67
|
-
AWS_S3_BUCKET: whereby-cdn
|
|
68
|
-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
69
|
-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
70
|
-
AWS_REGION: "es-west-1"
|
|
71
|
-
SOURCE_DIR: "dist/"
|
|
72
|
-
DEST_DIR: "embed/"
|
|
73
|
-
|
|
74
|
-
- name: Invalidate cloudfront publication
|
|
75
|
-
run: aws cloudfront create-invalidation --distribution-id=E6H48QPJYYL39 --paths "/embed/*"
|
|
76
|
-
deploy_npm:
|
|
77
|
-
concurrency: deploy_npm_main_${{ github.head_ref }}
|
|
78
|
-
name: Deploy to npm
|
|
79
|
-
needs: get_version_tag
|
|
80
|
-
runs-on: ubuntu-latest
|
|
81
|
-
steps:
|
|
82
|
-
- name: Checkout source code
|
|
83
|
-
uses: actions/checkout@v3
|
|
84
|
-
|
|
85
|
-
# Setup .npmrc file to publish to npm
|
|
86
|
-
- uses: actions/setup-node@v3
|
|
87
|
-
with:
|
|
88
|
-
node-version: "16.x"
|
|
89
|
-
registry-url: "https://registry.npmjs.org"
|
|
90
|
-
|
|
91
|
-
- name: Publish on npm
|
|
92
|
-
run: |
|
|
93
|
-
TAG=${{ needs.get_version_tag.outputs.tag }}
|
|
94
|
-
if [[ -z ${TAG} ]]; then
|
|
95
|
-
echo "deploy with latest tag"
|
|
96
|
-
npm publish
|
|
97
|
-
else
|
|
98
|
-
echo "deploy with ${{ needs.get_version_tag.outputs.tag }} tag"
|
|
99
|
-
npm publish --tag ${{ needs.get_version_tag.outputs.tag }}
|
|
100
|
-
fi
|
|
101
|
-
env:
|
|
102
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Test
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
|
-
jobs:
|
|
11
|
-
test:
|
|
12
|
-
name: Test
|
|
13
|
-
concurrency: test_${{ github.head_ref }}
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout source code
|
|
18
|
-
uses: actions/checkout@v2
|
|
19
|
-
|
|
20
|
-
- name: Build
|
|
21
|
-
uses: ./.github/actions/build
|
|
22
|
-
|
|
23
|
-
- name: Test
|
|
24
|
-
run: yarn test
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
package/.storybook/main.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
core: { builder: "webpack5" },
|
|
3
|
-
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
4
|
-
addons: ["@storybook/addon-links", "@storybook/addon-essentials"],
|
|
5
|
-
framewkork: "@storybook/react",
|
|
6
|
-
webpackFinal: async (config) => {
|
|
7
|
-
config.module.rules.push({
|
|
8
|
-
resolve: {
|
|
9
|
-
fullySpecified: false,
|
|
10
|
-
extensions: [".js", ".ts", ".tsx"],
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
return config;
|
|
15
|
-
},
|
|
16
|
-
};
|
package/.storybook/preview.js
DELETED
package/jest.config.js
DELETED
package/rollup.config.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
2
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
3
|
-
import json from "@rollup/plugin-json";
|
|
4
|
-
import replace from "@rollup/plugin-replace";
|
|
5
|
-
import { terser } from "rollup-plugin-terser";
|
|
6
|
-
import pkg from "./package.json";
|
|
7
|
-
import typescript from "rollup-plugin-typescript2";
|
|
8
|
-
import dts from "rollup-plugin-dts";
|
|
9
|
-
|
|
10
|
-
const replaceValues = {
|
|
11
|
-
preventAssignment: true,
|
|
12
|
-
values: {
|
|
13
|
-
__SDK_VERSION__: pkg.version,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const peerDependencies = [...Object.keys(pkg.peerDependencies || {})];
|
|
18
|
-
|
|
19
|
-
function makeCdnFilename() {
|
|
20
|
-
const major = pkg.version.split(".")[0];
|
|
21
|
-
const preRelease = pkg.version.split("-")[1];
|
|
22
|
-
let tag = "";
|
|
23
|
-
|
|
24
|
-
if (preRelease) {
|
|
25
|
-
tag = `-${preRelease.split(".")[0]}`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return `v${major}${tag}.js`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default [
|
|
32
|
-
// Commonjs build of lib, to be used with bundlers
|
|
33
|
-
{
|
|
34
|
-
input: "src/lib/index.ts",
|
|
35
|
-
output: {
|
|
36
|
-
exports: "named",
|
|
37
|
-
file: "dist/lib.cjs.js",
|
|
38
|
-
format: "cjs",
|
|
39
|
-
},
|
|
40
|
-
external: ["heresy", ...peerDependencies],
|
|
41
|
-
plugins: [nodeResolve({ resolveOnly: [/jslib-media/] }), replace(replaceValues), typescript()],
|
|
42
|
-
},
|
|
43
|
-
// Esm build of lib, to be used with bundlers
|
|
44
|
-
{
|
|
45
|
-
input: "src/lib/index.ts",
|
|
46
|
-
output: {
|
|
47
|
-
exports: "named",
|
|
48
|
-
file: "dist/lib.esm.js",
|
|
49
|
-
format: "esm",
|
|
50
|
-
},
|
|
51
|
-
external: ["heresy", ...peerDependencies],
|
|
52
|
-
plugins: [nodeResolve({ resolveOnly: [/jslib-media/] }), replace(replaceValues), typescript()],
|
|
53
|
-
},
|
|
54
|
-
// Legacy build of lib in ESM format, bundling the dependencies
|
|
55
|
-
{
|
|
56
|
-
input: "src/lib/index.ts",
|
|
57
|
-
output: {
|
|
58
|
-
exports: "named",
|
|
59
|
-
file: `dist/${makeCdnFilename()}`,
|
|
60
|
-
format: "esm",
|
|
61
|
-
},
|
|
62
|
-
plugins: [nodeResolve(), commonjs(), json(), terser(), replace(replaceValues), typescript()],
|
|
63
|
-
},
|
|
64
|
-
// Roll-up .d.ts definition files
|
|
65
|
-
{
|
|
66
|
-
input: "./dist/lib/index.d.ts",
|
|
67
|
-
output: [{ file: "dist/types.d.ts", format: "es" }],
|
|
68
|
-
plugins: [dts()],
|
|
69
|
-
},
|
|
70
|
-
];
|