@whereby.com/browser-sdk 2.0.0-alpha → 2.0.0-alpha1

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.
Files changed (72) hide show
  1. package/dist/lib.cjs.js +5467 -0
  2. package/dist/lib.esm.js +5451 -0
  3. package/dist/types.d.ts +104 -0
  4. package/dist/v2-alpha1.js +105 -0
  5. package/package.json +2 -1
  6. package/.eslintrc +0 -23
  7. package/.github/actions/build/action.yml +0 -17
  8. package/.github/workflows/deploy.yml +0 -102
  9. package/.github/workflows/test.yml +0 -24
  10. package/.prettierignore +0 -7
  11. package/.prettierrc +0 -4
  12. package/.storybook/main.cjs +0 -16
  13. package/.storybook/preview.js +0 -9
  14. package/jest.config.js +0 -6
  15. package/rollup.config.js +0 -70
  16. package/src/lib/RoomConnection.ts +0 -516
  17. package/src/lib/RoomParticipant.ts +0 -77
  18. package/src/lib/__tests__/embed.unit.ts +0 -77
  19. package/src/lib/api/ApiClient.ts +0 -111
  20. package/src/lib/api/Credentials.ts +0 -45
  21. package/src/lib/api/HttpClient.ts +0 -95
  22. package/src/lib/api/MultipartHttpClient.ts +0 -53
  23. package/src/lib/api/OrganizationApiClient.ts +0 -64
  24. package/src/lib/api/Response.ts +0 -34
  25. package/src/lib/api/credentialsService/index.ts +0 -159
  26. package/src/lib/api/credentialsService/test/index.spec.ts +0 -181
  27. package/src/lib/api/deviceService/index.ts +0 -42
  28. package/src/lib/api/deviceService/tests/index.spec.ts +0 -74
  29. package/src/lib/api/extractUtils.ts +0 -160
  30. package/src/lib/api/index.ts +0 -8
  31. package/src/lib/api/localStorageWrapper/index.ts +0 -15
  32. package/src/lib/api/models/Account.ts +0 -48
  33. package/src/lib/api/models/Meeting.ts +0 -42
  34. package/src/lib/api/models/Organization.ts +0 -186
  35. package/src/lib/api/models/Room.ts +0 -44
  36. package/src/lib/api/models/account/EmbeddedFreeTierStatus.ts +0 -34
  37. package/src/lib/api/models/tests/Account.spec.ts +0 -128
  38. package/src/lib/api/models/tests/Organization.spec.ts +0 -161
  39. package/src/lib/api/models/tests/Room.spec.ts +0 -74
  40. package/src/lib/api/modules/AbstractStore.ts +0 -18
  41. package/src/lib/api/modules/ChromeStorageStore.ts +0 -44
  42. package/src/lib/api/modules/LocalStorageStore.ts +0 -57
  43. package/src/lib/api/modules/tests/ChromeStorageStore.spec.ts +0 -67
  44. package/src/lib/api/modules/tests/LocalStorageStore.spec.ts +0 -79
  45. package/src/lib/api/modules/tests/__mocks__/storage.ts +0 -24
  46. package/src/lib/api/organizationService/index.ts +0 -284
  47. package/src/lib/api/organizationService/tests/index.spec.ts +0 -781
  48. package/src/lib/api/organizationServiceCache/index.ts +0 -28
  49. package/src/lib/api/organizationServiceCache/tests/index.spec.ts +0 -101
  50. package/src/lib/api/parameterAssertUtils.ts +0 -166
  51. package/src/lib/api/roomService/index.ts +0 -310
  52. package/src/lib/api/roomService/tests/index.spec.ts +0 -668
  53. package/src/lib/api/test/ApiClient.spec.ts +0 -139
  54. package/src/lib/api/test/HttpClient.spec.ts +0 -120
  55. package/src/lib/api/test/MultipartHttpClient.spec.ts +0 -145
  56. package/src/lib/api/test/OrganizationApiClient.spec.ts +0 -132
  57. package/src/lib/api/test/extractUtils.spec.ts +0 -357
  58. package/src/lib/api/test/helpers.ts +0 -41
  59. package/src/lib/api/test/parameterAssertUtils.spec.ts +0 -265
  60. package/src/lib/api/types.ts +0 -6
  61. package/src/lib/embed.ts +0 -172
  62. package/src/lib/index.ts +0 -3
  63. package/src/lib/react/VideoElement.tsx +0 -16
  64. package/src/lib/react/index.ts +0 -3
  65. package/src/lib/react/useLocalMedia.ts +0 -25
  66. package/src/lib/react/useRoomConnection.ts +0 -92
  67. package/src/lib/reducer.ts +0 -142
  68. package/src/stories/custom-ui.stories.tsx +0 -133
  69. package/src/stories/prebuilt-ui.stories.tsx +0 -131
  70. package/src/stories/styles.css +0 -74
  71. package/src/types.d.ts +0 -175
  72. 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-alpha",
3
+ "version": "2.0.0-alpha1",
4
4
  "description": "Modules for integration Whereby video in web apps",
5
5
  "author": "Whereby AS",
6
6
  "license": "MIT",
@@ -13,6 +13,7 @@
13
13
  "main": "dist/lib.cjs.js",
14
14
  "module": "dist/lib.esm.js",
15
15
  "type": "module",
16
+ "files": ["dist/**/*.js", "dist/*.d.ts"],
16
17
  "types": "dist/types.d.ts",
17
18
  "scripts": {
18
19
  "prebuild": "rimraf dist",
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
@@ -1,7 +0,0 @@
1
- build/
2
- dist/
3
- node_modules/
4
- *.css
5
- *.json
6
- *.html
7
- *.md
package/.prettierrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "tabWidth": 4,
3
- "printWidth": 120
4
- }
@@ -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
- };
@@ -1,9 +0,0 @@
1
- export const parameters = {
2
- actions: { argTypesRegex: "^on[A-Z].*" },
3
- controls: {
4
- matchers: {
5
- color: /(background|color)$/i,
6
- date: /Date$/,
7
- },
8
- },
9
- };
package/jest.config.js DELETED
@@ -1,6 +0,0 @@
1
- export default {
2
- preset: "ts-jest",
3
- testEnvironment: "jest-environment-node",
4
- testMatch: ["<rootDir>/src/**/__tests__/**/*.[jt]s?(x)", "<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)"],
5
- transform: {},
6
- };
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
- ];