@jitsi/react-sdk
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -5,3 +5,3 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; | ||
import { fetchExternalApi } from '../init'; | ||
import { generateComponentId } from '../utils'; | ||
import { generateComponentId, getAppId } from '../utils'; | ||
/** | ||
@@ -31,3 +31,3 @@ * Returns the JitsiMeeting Component with access to a custom External API | ||
useEffect(() => { | ||
fetchExternalApi(domain, release) | ||
fetchExternalApi(domain, release, getAppId(roomName)) | ||
.then((api) => { | ||
@@ -34,0 +34,0 @@ externalApi.current = api; |
@@ -11,4 +11,5 @@ import { JitsiMeetExternalApi } from './types'; | ||
* @param {string} release - The Jitsi Meet release. Expected format: 'release-1234' | ||
* @param {string} appId - The tenant for JaaS Meetings | ||
* @returns {Promise<JitsiMeetExternalApi>} - The JitsiMeetExternalAPI or an error | ||
*/ | ||
export declare const fetchExternalApi: (domain?: string, release?: string | undefined) => Promise<JitsiMeetExternalApi>; | ||
export declare const fetchExternalApi: (domain?: string, release?: string | undefined, appId?: string | undefined) => Promise<JitsiMeetExternalApi>; |
@@ -11,3 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { DEFAULT_DOMAIN } from './constants'; | ||
const loadExternalApi = (domain, release) => __awaiter(void 0, void 0, void 0, function* () { | ||
const loadExternalApi = (domain, release, appId) => __awaiter(void 0, void 0, void 0, function* () { | ||
return new Promise((resolve, reject) => { | ||
@@ -19,4 +19,5 @@ if (window.JitsiMeetExternalAPI) { | ||
const releaseParam = release ? `?release=${release}` : ''; | ||
const appIdPath = appId ? `${appId}/` : ''; | ||
script.async = true; | ||
script.src = `https://${domain}/external_api.js${releaseParam}`; | ||
script.src = `https://${domain}/${appIdPath}external_api.js${releaseParam}`; | ||
script.onload = () => resolve(window.JitsiMeetExternalAPI); | ||
@@ -37,10 +38,11 @@ script.onerror = () => reject(new Error(`Script load error: ${script.src}`)); | ||
* @param {string} release - The Jitsi Meet release. Expected format: 'release-1234' | ||
* @param {string} appId - The tenant for JaaS Meetings | ||
* @returns {Promise<JitsiMeetExternalApi>} - The JitsiMeetExternalAPI or an error | ||
*/ | ||
export const fetchExternalApi = (domain = DEFAULT_DOMAIN, release) => { | ||
export const fetchExternalApi = (domain = DEFAULT_DOMAIN, release, appId) => { | ||
if (scriptPromise) { | ||
return scriptPromise; | ||
} | ||
scriptPromise = loadExternalApi(domain, release); | ||
scriptPromise = loadExternalApi(domain, release, appId); | ||
return scriptPromise; | ||
}; |
@@ -10,2 +10,9 @@ /** | ||
/** | ||
* Returns the appId or tenant value | ||
* | ||
* @param {string} roomName | ||
* @returns {string|undefined} | ||
*/ | ||
export declare const getAppId: (roomName: string) => string | undefined; | ||
/** | ||
* Returns the JaaS domain | ||
@@ -12,0 +19,0 @@ * |
@@ -16,2 +16,15 @@ import { JAAS_PROD_DOMAIN, JAAS_STAGING_DOMAIN } from '../constants'; | ||
/** | ||
* Returns the appId or tenant value | ||
* | ||
* @param {string} roomName | ||
* @returns {string|undefined} | ||
*/ | ||
export const getAppId = (roomName) => { | ||
const roomParts = roomName.split('/'); | ||
if (roomParts.length <= 1) { | ||
return; | ||
} | ||
return roomParts[0]; | ||
}; | ||
/** | ||
* Returns the JaaS domain | ||
@@ -18,0 +31,0 @@ * |
{ | ||
"name": "@jitsi/react-sdk", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "React SDK for the Jitsi Meet IFrame", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
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
41604
750