@daily-co/daily-js
Advanced tools
Comparing version 0.31.0 to 0.32.0
@@ -116,3 +116,4 @@ // Type definitions for daily-js | ||
| 'exp-room' | ||
| 'exp-token'; | ||
| 'exp-token' | ||
| 'meeting-full'; | ||
@@ -241,2 +242,4 @@ export type DailyNonFatalErrorType = | ||
userData?: unknown; | ||
startVideoOff?: boolean; | ||
startAudioOff?: boolean; | ||
} | ||
@@ -468,3 +471,4 @@ | ||
enable_advanced_chat?: boolean; | ||
enable_audience_reactions?: boolean; | ||
enable_breakout_rooms?: boolean; | ||
enable_emoji_reactions?: boolean; | ||
enable_chat?: boolean; | ||
@@ -505,4 +509,6 @@ enable_hand_raising?: boolean; | ||
max_live_streams?: number; | ||
max_streaming_instances_per_room?: number; | ||
enable_advanced_chat?: boolean; | ||
enable_audience_reactions?: boolean; | ||
enable_breakout_rooms?: boolean; | ||
enable_emoji_reactions?: boolean; | ||
enable_chat?: boolean; | ||
@@ -634,2 +640,3 @@ enable_hand_raising?: boolean; | ||
instanceId?: string; | ||
actionTraceId?: string; | ||
} | ||
@@ -707,2 +714,3 @@ | ||
instanceId?: string; | ||
actionTraceId?: string; | ||
} | ||
@@ -1035,2 +1043,4 @@ | ||
fps?: number; | ||
videoBitrate?: number; | ||
audioBitrate?: number; | ||
minIdleTimeOut?: number; | ||
@@ -1058,3 +1068,6 @@ backgroundColor?: string; | ||
export interface DailyRemoteMediaPlayerSettings { | ||
state: DailyRemoteMediaPlayerSettingPlay | DailyRemoteMediaPlayerSettingPause; | ||
state?: | ||
| DailyRemoteMediaPlayerSettingPlay | ||
| DailyRemoteMediaPlayerSettingPause; | ||
volume?: number; | ||
simulcastEncodings?: RemoteMediaPlayerSimulcastEncoding[]; | ||
@@ -1061,0 +1074,0 @@ } |
{ | ||
"name": "@daily-co/daily-js", | ||
"version": "0.31.0", | ||
"version": "0.32.0", | ||
"engines": { | ||
@@ -46,2 +46,3 @@ "node": ">=10.0.0" | ||
"conventional-changelog-conventionalcommits": "^5.0.0", | ||
"dotenv": "^16.0.3", | ||
"jest": "^27.4.7", | ||
@@ -48,0 +49,0 @@ "prettier": "^2.5.1", |
@@ -0,1 +1,4 @@ | ||
import * as dotenv from 'dotenv'; | ||
dotenv.config(); | ||
import replace from '@rollup/plugin-replace'; | ||
@@ -9,2 +12,5 @@ import resolve from 'rollup-plugin-node-resolve'; | ||
const mode = process.env.NODE_ENV || 'production'; | ||
const devCallMachineUrl = | ||
process.env.DEV_CALL_MACHINE_URL || | ||
'https://khk-local.wss.daily.co:8000/static/call-machine-object-bundle.js'; | ||
@@ -22,2 +28,3 @@ export default [ | ||
__dailyJsVersion__: JSON.stringify(version), | ||
__devCallMachineUrl__: JSON.stringify(devCallMachineUrl), | ||
}), | ||
@@ -24,0 +31,0 @@ babel({ |
@@ -28,5 +28,2 @@ import { isReactNative } from './shared-with-pluot-core/Environment'; | ||
* | ||
* @param meetingOrBaseUrl Meeting URL (like https://somecompany.daily.co/hello) | ||
* or base URL (like https://somecompany.daily.co), used to determine where | ||
* to load the bundle from. | ||
* @param callFrameId A string identifying this "call frame", to distinguish it | ||
@@ -42,9 +39,3 @@ * from other iframe-based calls for message channel purposes. | ||
*/ | ||
load( | ||
meetingOrBaseUrl, | ||
callFrameId, | ||
avoidEval, | ||
successCallback, | ||
failureCallback | ||
) { | ||
load(callFrameId, avoidEval, successCallback, failureCallback) { | ||
if (this.loaded) { | ||
@@ -62,9 +53,5 @@ window._dailyCallObjectSetup(callFrameId); | ||
// Start a new load | ||
this._currentLoad = new LoadOperation( | ||
meetingOrBaseUrl, | ||
() => { | ||
successCallback(false); // false = "this load() wasn't a no-op" | ||
}, | ||
failureCallback | ||
); | ||
this._currentLoad = new LoadOperation(() => { | ||
successCallback(false); // false = "this load() wasn't a no-op" | ||
}, failureCallback); | ||
this._currentLoad.start(); | ||
@@ -101,7 +88,6 @@ } | ||
// and successCallback takes no parameters. | ||
constructor(meetingOrBaseUrl, successCallback, failureCallback) { | ||
constructor(successCallback, failureCallback) { | ||
this._attemptsRemaining = LOAD_ATTEMPTS; | ||
this._currentAttempt = null; | ||
this._meetingOrBaseUrl = meetingOrBaseUrl; | ||
this._successCallback = successCallback; | ||
@@ -139,3 +125,2 @@ this._failureCallback = failureCallback; | ||
this._currentAttempt = new LoadAttempt( | ||
this._meetingOrBaseUrl, | ||
this._successCallback, | ||
@@ -149,3 +134,2 @@ retryOrFailureCallback | ||
this._currentAttempt = new LoadAttempt( | ||
this._meetingOrBaseUrl, | ||
this._successCallback, | ||
@@ -196,15 +180,7 @@ retryOrFailureCallback | ||
class LoadAttempt { | ||
constructor(meetingOrBaseUrl, successCallback, failureCallback) { | ||
constructor(successCallback, failureCallback) { | ||
this._loadAttemptImpl = | ||
isReactNative() || !_dailyConfig.avoidEval | ||
? new LoadAttempt_ReactNative( | ||
meetingOrBaseUrl, | ||
successCallback, | ||
failureCallback | ||
) | ||
: new LoadAttempt_Web( | ||
meetingOrBaseUrl, | ||
successCallback, | ||
failureCallback | ||
); | ||
? new LoadAttempt_ReactNative(successCallback, failureCallback) | ||
: new LoadAttempt_Web(successCallback, failureCallback); | ||
} | ||
@@ -237,3 +213,3 @@ | ||
// single error message parameter. | ||
constructor(meetingOrBaseUrl, successCallback, failureCallback) { | ||
constructor(successCallback, failureCallback) { | ||
this.cancelled = false; | ||
@@ -250,3 +226,2 @@ this.succeeded = false; | ||
this._meetingOrBaseUrl = meetingOrBaseUrl; | ||
this._successCallback = successCallback; | ||
@@ -258,11 +233,3 @@ this._failureCallback = failureCallback; | ||
// console.log("[LoadAttempt_ReactNative] starting..."); | ||
let url; | ||
try { | ||
url = callObjectBundleUrl(this._meetingOrBaseUrl); | ||
} catch (e) { | ||
this._failureCallback( | ||
`Failed to get call object bundle for URL ${this._meetingOrBaseUrl}: ${e}` | ||
); | ||
return; | ||
} | ||
const url = callObjectBundleUrl(); | ||
const loadedFromIOSCache = await this._tryLoadFromIOSCache(url); | ||
@@ -440,7 +407,6 @@ !loadedFromIOSCache && this._loadFromNetwork(url); | ||
class LoadAttempt_Web { | ||
constructor(meetingOrBaseUrl, successCallback, failureCallback) { | ||
constructor(successCallback, failureCallback) { | ||
this.cancelled = false; | ||
this.succeeded = false; | ||
this._meetingOrBaseUrl = meetingOrBaseUrl; | ||
this._successCallback = successCallback; | ||
@@ -461,11 +427,3 @@ this._failureCallback = failureCallback; | ||
// Get call machine bundle URL | ||
let url; | ||
try { | ||
url = callObjectBundleUrl(this._meetingOrBaseUrl); | ||
} catch (e) { | ||
this._failureCallback( | ||
`Failed to get call object bundle for URL ${this._meetingOrBaseUrl}: ${e}` | ||
); | ||
return; | ||
} | ||
const url = callObjectBundleUrl(); | ||
@@ -472,0 +430,0 @@ // Sanity check that we're running in a DOM/web context |
@@ -43,2 +43,3 @@ // | ||
export const DAILY_FATAL_ERROR_EXP_TOKEN = 'exp-token'; | ||
export const DAILY_FATAL_ERROR_MEETING_FULL = 'meeting-full'; | ||
@@ -45,0 +46,0 @@ export const DAILY_CAMERA_ERROR_CAM_IN_USE = 'cam-in-use'; |
@@ -284,70 +284,1 @@ // This method should be used instead of window.navigator.userAgent, which | ||
} | ||
//-------------------------------- | ||
// daily-js version helpers | ||
// Daily supports the last 6 months of versions. | ||
// These variable should be updated as part of each release as needed. | ||
// OLDEST should match the oldest version that is exactly 6 months or | ||
// less at the time of each release. | ||
const OLDEST_SUPPORTED_DAILY_JS_VERSION = { | ||
major: 0, | ||
minor: 24, | ||
patch: 0, | ||
}; | ||
// NEARING should be a version roughly 1 month out from being unsupported | ||
// to give customers ample time to upgrade. | ||
const NEARING_EOS_DAILY_JS_VERSION = { | ||
major: 0, | ||
minor: 25, | ||
patch: 0, | ||
}; | ||
export function getDailyJsVersion() { | ||
let major = 0, | ||
minor = 0, | ||
patch = 0; | ||
if (typeof _dailyConfig !== 'undefined' && _dailyConfig.dailyJsVersion) { | ||
const versionParts = _dailyConfig.dailyJsVersion.split('.'); | ||
major = parseInt(versionParts[0], 10); | ||
minor = parseInt(versionParts[1], 10); | ||
patch = parseInt(versionParts[2], 10); | ||
} | ||
return { major, minor, patch }; | ||
} | ||
export function isThisDailyJsVersionAtLeastThat(thisV, thatV) { | ||
if (thisV.major != thatV.major) { | ||
return thisV.major > thatV.major; | ||
} | ||
if (thisV.minor != thatV.minor) { | ||
return thisV.minor > thatV.minor; | ||
} | ||
return thisV.patch >= thatV.patch; | ||
} | ||
export function isThisDailyJsVersionNewerThanThat(thisV, thatV) { | ||
if (thisV.major != thatV.major) { | ||
return thisV.major > thatV.major; | ||
} | ||
if (thisV.minor != thatV.minor) { | ||
return thisV.minor > thatV.minor; | ||
} | ||
return thisV.patch > thatV.patch; | ||
} | ||
export function isCurrentDailyJsSupported() { | ||
return isThisDailyJsVersionAtLeastThat( | ||
getDailyJsVersion(), | ||
OLDEST_SUPPORTED_DAILY_JS_VERSION | ||
); | ||
} | ||
export function isCurrentDailyJsNearEndOfSupport() { | ||
return !isThisDailyJsVersionNewerThanThat( | ||
getDailyJsVersion(), | ||
NEARING_EOS_DAILY_JS_VERSION | ||
); | ||
} |
@@ -9,3 +9,3 @@ export function randomStringId() { | ||
export function callObjectBundleUrl(meetingOrBaseUrl) { | ||
export function callObjectBundleUrl() { | ||
// ADVANCED: if a custom bundle URL override is specified, use that. | ||
@@ -16,41 +16,11 @@ if (window._dailyConfig && window._dailyConfig.callObjectBundleUrlOverride) { | ||
// Take the provided URL, which is either a meeting URL (like | ||
// https://somecompany.daily.co/hello) or a base URL (like | ||
// https://somecompany.daily.co), and make it a base URL. | ||
let baseUrl = meetingOrBaseUrl ? new URL(meetingOrBaseUrl).origin : null; | ||
function bundleUrlFromBaseUrl(url) { | ||
return `${url}/static/call-machine-object-bundle.js`; | ||
} | ||
function cdnBundleUrl({ isStaging = false } = {}) { | ||
return `https://c${ | ||
isStaging ? '.staging' : '' | ||
}.daily.co/call-machine/versioned/${__dailyJsVersion__}/static/call-machine-object-bundle.js`; | ||
} | ||
// 1. No URL --> load bundle from prod CDN | ||
// 2. Prod URL --> load bundle from prod CDN | ||
// 3. Preview URL --> load bundle from preview web app | ||
// 4. Staging URL --> load bundle from staging CDN | ||
// 5. Other URL --> load bundle from web app (same origin as meetingOrBaseUrl) | ||
// ----- | ||
// 1. | ||
if (!baseUrl) { | ||
return cdnBundleUrl(); | ||
} | ||
// 2. | ||
if (baseUrl.match(/https:\/\/[^.]+\.daily\.co/)) { | ||
return cdnBundleUrl(); | ||
} | ||
// 3. | ||
if (baseUrl.match(/https:\/\/preview-[^.]+\.staging\.daily\.co/)) { | ||
return bundleUrlFromBaseUrl(baseUrl); | ||
} | ||
// 4. | ||
if (baseUrl.match(/https:\/\/[^.]+\.staging\.daily\.co/)) { | ||
return cdnBundleUrl({ isStaging: true }); | ||
} | ||
// 5. | ||
return bundleUrlFromBaseUrl(baseUrl); | ||
// 1. Dev build of daily-js --> load bundle from __devCallMachineUrl__, which | ||
// is either: | ||
// - DEV_CALL_MACHINE_URL env variable (read at build time) | ||
// - default local dev URL | ||
// See webpack or rollup config for details. | ||
// 2. Prod build of daily-js --> load bundle from version-specific prod URL. | ||
return process.env.NODE_ENV === 'development' | ||
? __devCallMachineUrl__ | ||
: `https://c.daily.co/call-machine/versioned/${__dailyJsVersion__}/static/call-machine-object-bundle.js`; | ||
} | ||
@@ -57,0 +27,0 @@ |
// todo: add debug target | ||
require('dotenv').config(); | ||
const path = require('path'); | ||
@@ -7,2 +9,5 @@ const webpack = require('webpack'); | ||
const mode = process.env.NODE_ENV || 'production'; | ||
const devCallMachineUrl = | ||
process.env.DEV_CALL_MACHINE_URL || | ||
'https://khk-local.wss.daily.co:8000/static/call-machine-object-bundle.js'; | ||
@@ -33,2 +38,3 @@ // whether to build with React Native Hermes support (only necessary in dev; prod already supports it) | ||
__dailyJsVersion__: JSON.stringify(version), | ||
__devCallMachineUrl__: JSON.stringify(devCallMachineUrl), | ||
global: 'window', | ||
@@ -35,0 +41,0 @@ }), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
554128
38
7855
27
7