Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(billing-counter) Removed iframe billing-counter callbacks (#9537)
robertpin4276f82c0304
diff --git a/connection.js b/connection.jsindex 095edf1e20..b5ab62e9a4 100644--- a/connection.js+++ b/connection.js@@ -17,8 +17,7 @@ import {JitsiConnectionErrors,JitsiConnectionEvents} from './react/features/base/lib-jitsi-meet';-import { isVpaasMeeting } from './react/features/billing-counter/functions';-import { getJaasJWT } from './react/features/jaas/functions';+import { isVpaasMeeting, getJaasJWT } from './react/features/jaas/functions';import { setPrejoinDisplayNameRequired } from './react/features/prejoin/actions';const logger = Logger.getLogger(__filename);diff --git a/react/features/app/actions.js b/react/features/app/actions.jsindex 4761164284..3d59cfd89b 100644--- a/react/features/app/actions.js+++ b/react/features/app/actions.js@@ -24,7 +24,7 @@ import {parseURIString,toURLString} from '../base/util';-import { isVpaasMeeting } from '../billing-counter/functions';+import { isVpaasMeeting } from '../jaas/functions';import { clearNotifications, showNotification } from '../notifications';import { setFatalError } from '../overlay';diff --git a/react/features/app/middlewares.any.js b/react/features/app/middlewares.any.jsindex 1b1f6dc7a3..dd75af665f 100644--- a/react/features/app/middlewares.any.js+++ b/react/features/app/middlewares.any.js@@ -18,7 +18,6 @@ import '../base/sounds/middleware';import '../base/testing/middleware';import '../base/tracks/middleware';import '../base/user-interaction/middleware';-import '../billing-counter/middleware';import '../calendar-sync/middleware';import '../chat/middleware';import '../conference/middleware';diff --git a/react/features/app/reducers.any.js b/react/features/app/reducers.any.jsindex 7a6741ff03..7a654ee019 100644--- a/react/features/app/reducers.any.js+++ b/react/features/app/reducers.any.js@@ -25,7 +25,6 @@ import '../base/sounds/reducer';import '../base/testing/reducer';import '../base/tracks/reducer';import '../base/user-interaction/reducer';-import '../billing-counter/reducer';import '../calendar-sync/reducer';import '../chat/reducer';import '../deep-linking/reducer';diff --git a/react/features/base/react/components/web/Watermarks.js b/react/features/base/react/components/web/Watermarks.jsindex afdad18a66..90375d9013 100644--- a/react/features/base/react/components/web/Watermarks.js+++ b/react/features/base/react/components/web/Watermarks.js@@ -2,7 +2,7 @@import React, { Component } from 'react';-import { isVpaasMeeting } from '../../../../billing-counter/functions';+import { isVpaasMeeting } from '../../../../jaas/functions';import { translate } from '../../../i18n';import { connect } from '../../../redux';diff --git a/react/features/billing-counter/actionTypes.js b/react/features/billing-counter/actionTypes.jsdeleted file mode 100644index 528faf0005..0000000000--- a/react/features/billing-counter/actionTypes.js+++ /dev/null@@ -1,4 +0,0 @@-/**- * Action used to store the flag signaling the endpoint has been counted.- */-export const SET_ENDPOINT_COUNTED = 'SET_ENDPOINT_COUNTED';diff --git a/react/features/billing-counter/actions.js b/react/features/billing-counter/actions.jsdeleted file mode 100644index 2243512b19..0000000000--- a/react/features/billing-counter/actions.js+++ /dev/null@@ -1,42 +0,0 @@-// @flow--import { SET_ENDPOINT_COUNTED } from './actionTypes';-import { extractVpaasTenantFromPath, getBillingId, sendCountRequest } from './functions';--/**- * Sends a billing count request when needed.- *- * @returns {Function}- */-export function countEndpoint() {- return function(dispatch: Function, getState: Function) {- const state = getState();- const baseUrl = state['features/base/config'].billingCounterUrl;- const jwt = state['features/base/jwt'].jwt;- const tenant = extractVpaasTenantFromPath(state['features/base/connection'].locationURL.pathname);- const shouldSendRequest = Boolean(baseUrl && jwt && tenant);-- if (shouldSendRequest) {- const billingId = getBillingId();-- sendCountRequest({- baseUrl,- billingId,- jwt,- tenant- });- dispatch(setEndpointCounted());- }- };-}--/**- * Action used to mark the endpoint as counted.- *- * @returns {Object}- */-function setEndpointCounted() {- return {- type: SET_ENDPOINT_COUNTED- };-}diff --git a/react/features/billing-counter/constants.js b/react/features/billing-counter/constants.jsdeleted file mode 100644index 4703198e9a..0000000000--- a/react/features/billing-counter/constants.js+++ /dev/null@@ -1,9 +0,0 @@-/**- * The key for the billing id stored in localStorage.- */-export const BILLING_ID = 'jitsiMeetId';--/**- * The prefix for the vpaas tenant.- */-export const VPAAS_TENANT_PREFIX = 'vpaas-magic-cookie-';diff --git a/react/features/billing-counter/functions.js b/react/features/billing-counter/functions.jsdeleted file mode 100644index 3f3a56938c..0000000000--- a/react/features/billing-counter/functions.js+++ /dev/null@@ -1,112 +0,0 @@-// @flow--import { jitsiLocalStorage } from '@jitsi/js-utils';-import uuid from 'uuid';--import { BILLING_ID, VPAAS_TENANT_PREFIX } from './constants';-import logger from './logger';--/**- * Returns the full vpaas tenant if available, given a path.- *- * @param {string} path - The meeting url path.- * @returns {string}- */-export function extractVpaasTenantFromPath(path: string) {- const [ , tenant ] = path.split('/');-- if (tenant.startsWith(VPAAS_TENANT_PREFIX)) {- return tenant;- }-- return '';-}--/**- * Returns the vpaas tenant.- *- * @param {Object} state - The global state.- * @returns {string}- */-export function getVpaasTenant(state: Object) {- return extractVpaasTenantFromPath(state['features/base/connection'].locationURL.pathname);-}--/**- * Returns true if the current meeting is a vpaas one.- *- * @param {Object} state - The state of the app.- * @returns {boolean}- */-export function isVpaasMeeting(state: Object) {- const { billingCounterUrl } = state['features/base/config'];-- return Boolean(- billingCounterUrl- && extractVpaasTenantFromPath(- state['features/base/connection'].locationURL.pathname)- );-}--/**- * Sends a billing counter request.- *- * @param {Object} reqData - The request info.- * @param {string} reqData.baseUrl - The base url for the request.- * @param {string} billingId - The unique id of the client.- * @param {string} jwt - The JWT token.- * @param {string} tenat - The client tenant.- * @returns {void}- */-export async function sendCountRequest({ baseUrl, billingId, jwt, tenant }: {- baseUrl: string,- billingId: string,- jwt: string,- tenant: string-}) {- const fullUrl = `${baseUrl}/${encodeURIComponent(tenant)}/${billingId}`;- const headers = {- 'Authorization': `Bearer ${jwt}`- };-- try {- const res = await fetch(fullUrl, {- method: 'GET',- headers- });-- if (!res.ok) {- logger.error('Status error:', res.status);- }- } catch (err) {- logger.error('Could not send request', err);- }-}--/**- * Returns the stored billing id (or generates a new one if none is present).- *- * @returns {string}- */-export function getBillingId() {- let billingId = jitsiLocalStorage.getItem(BILLING_ID);-- if (!billingId) {- billingId = uuid.v4();- jitsiLocalStorage.setItem(BILLING_ID, billingId);- }-- return billingId;-}--/**- * Returns the billing id for vpaas meetings.- *- * @param {Object} state - The state of the app.- * @returns {string | undefined}- */-export function getVpaasBillingId(state: Object) {- if (isVpaasMeeting(state)) {- return getBillingId();- }-}diff --git a/react/features/billing-counter/logger.js b/react/features/billing-counter/logger.jsdeleted file mode 100644index b450e6154f..0000000000--- a/react/features/billing-counter/logger.js+++ /dev/null@@ -1,5 +0,0 @@-// @flow--import { getLogger } from '../base/logging/functions';--export default getLogger('features/billing-counter');diff --git a/react/features/billing-counter/reducer.js b/react/features/billing-counter/reducer.jsdeleted file mode 100644index 70cb517cfb..0000000000--- a/react/features/billing-counter/reducer.js+++ /dev/null@@ -1,29 +0,0 @@-import { ReducerRegistry } from '../base/redux';--import {- SET_ENDPOINT_COUNTED-} from './actionTypes';--const DEFAULT_STATE = {- endpointCounted: false-};--/**- * Listen for actions that mutate the billing-counter state- */-ReducerRegistry.register(- 'features/billing-counter', (state = DEFAULT_STATE, action) => {- switch (action.type) {-- case SET_ENDPOINT_COUNTED: {- return {- ...state,- endpointCounted: true- };- }-- default:- return state;- }- },-);diff --git a/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js b/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.jsindex 903bfa28e9..f37e5ba960 100644--- a/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js+++ b/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js@@ -16,7 +16,7 @@ import { translate } from '../../base/i18n';import { Icon, IconClose } from '../../base/icons';import { browser } from '../../base/lib-jitsi-meet';import { connect } from '../../base/redux';-import { isVpaasMeeting } from '../../billing-counter/functions';+import { isVpaasMeeting } from '../../jaas/functions';import logger from '../logger';diff --git a/react/features/conference/functions.web.js b/react/features/conference/functions.web.jsindex e971ced20b..2b9aa3916a 100644--- a/react/features/conference/functions.web.js+++ b/react/features/conference/functions.web.js@@ -4,7 +4,6 @@ import { translateToHTML } from '../base/i18n';import { getLocalParticipant } from '../base/participants';import { toState } from '../base/redux';import { getBackendSafePath, getJitsiMeetGlobalNS } from '../base/util';-import { getVpaasBillingId } from '../billing-counter/functions';import { showWarningNotification } from '../notifications';import { createRnnoiseProcessor } from '../stream-effects/rnnoise';@@ -85,7 +84,6 @@ export function getConferenceOptions(stateful) {options.applicationName = getName();options.getWiFiStatsMethod = getWiFiStatsMethod;options.createVADProcessor = createRnnoiseProcessor;- options.billingId = getVpaasBillingId(state);// Disable CallStats, if requessted.if (options.disableThirdPartyRequests) {diff --git a/react/features/deep-linking/functions.js b/react/features/deep-linking/functions.jsindex 9805d1421c..bf604543c9 100644--- a/react/features/deep-linking/functions.js+++ b/react/features/deep-linking/functions.js@@ -3,7 +3,7 @@import { isMobileBrowser } from '../base/environment/utils';import { Platform } from '../base/react';import { URI_PROTOCOL_PATTERN } from '../base/util';-import { isVpaasMeeting } from '../billing-counter/functions';+import { isVpaasMeeting } from '../jaas/functions';import {DeepLinkingDesktopPage,diff --git a/react/features/feedback/actions.js b/react/features/feedback/actions.jsindex eee0ca77be..3d96ddd064 100644--- a/react/features/feedback/actions.js+++ b/react/features/feedback/actions.js@@ -4,8 +4,8 @@ import type { Dispatch } from 'redux';import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors';import { openDialog } from '../base/dialog';-import { isVpaasMeeting } from '../billing-counter/functions';import { extractFqnFromPath } from '../dynamic-branding/functions';+import { isVpaasMeeting } from '../jaas/functions';import {CANCEL_FEEDBACK,diff --git a/react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js b/react/features/invite/components/add-people-dialog/web/AddPeopleDialog.jsindex bbb87d5600..c7e7b3d4ea 100644--- a/react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js+++ b/react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js@@ -8,9 +8,9 @@ import { Dialog } from '../../../../base/dialog';import { translate } from '../../../../base/i18n';import { JitsiRecordingConstants } from '../../../../base/lib-jitsi-meet';import { connect } from '../../../../base/redux';-import { isVpaasMeeting } from '../../../../billing-counter/functions';import { isDynamicBrandingDataLoaded } from '../../../../dynamic-branding/functions';import EmbedMeetingTrigger from '../../../../embed-meeting/components/EmbedMeetingTrigger';+import { isVpaasMeeting } from '../../../../jaas/functions';import { getActiveSession } from '../../../../recording';import { updateDialInNumbers } from '../../../actions';import {diff --git a/react/features/invite/components/add-people-dialog/web/InviteContactsForm.js b/react/features/invite/components/add-people-dialog/web/InviteContactsForm.jsindex 0bb0dff06c..43f8af9ea2 100644--- a/react/features/invite/components/add-people-dialog/web/InviteContactsForm.js+++ b/react/features/invite/components/add-people-dialog/web/InviteContactsForm.js@@ -10,7 +10,7 @@ import { Icon, IconPhone } from '../../../../base/icons';import { getLocalParticipant } from '../../../../base/participants';import { MultiSelectAutocomplete } from '../../../../base/react';import { connect } from '../../../../base/redux';-import { isVpaasMeeting } from '../../../../billing-counter/functions';+import { isVpaasMeeting } from '../../../../jaas/functions';import { hideAddPeopleDialog } from '../../../actions';import { INVITE_TYPES } from '../../../constants';import AbstractAddPeopleDialog, {diff --git a/react/features/invite/functions.js b/react/features/invite/functions.jsindex 7f90da56d9..d2436ff219 100644--- a/react/features/invite/functions.js+++ b/react/features/invite/functions.js@@ -9,7 +9,7 @@ import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants';import { toState } from '../base/redux';import { doGetJSON, parseURIString } from '../base/util';-import { isVpaasMeeting } from '../billing-counter/functions';+import { isVpaasMeeting } from '../jaas/functions';import { INVITE_TYPES, SIP_ADDRESS_REGEX } from './constants';import logger from './logger';diff --git a/react/features/jaas/actions.web.js b/react/features/jaas/actions.web.jsindex 7fec5d3017..ec8bb3690a 100644--- a/react/features/jaas/actions.web.js+++ b/react/features/jaas/actions.web.js@@ -1,12 +1,11 @@// @flowimport { openDialog } from '../base/dialog';-import { VPAAS_TENANT_PREFIX } from '../billing-counter/constants';-import { getVpaasTenant } from '../billing-counter/functions';import { SET_DETAILS } from './actionTypes';import { PremiumFeatureDialog } from './components';-import { isFeatureDisabled, sendGetDetailsRequest } from './functions';+import { VPAAS_TENANT_PREFIX } from './constants';+import { getVpaasTenant, isFeatureDisabled, sendGetDetailsRequest } from './functions';import logger from './logger';/**diff --git a/react/features/jaas/constants.js b/react/features/jaas/constants.jsindex c312ede65d..c2319ee0f0 100644--- a/react/features/jaas/constants.js+++ b/react/features/jaas/constants.js@@ -23,3 +23,8 @@ export const FEATURES = {* URL for displaying JaaS upgrade options*/export const JAAS_UPGRADE_URL = 'https://jaas.8x8.vc/#/plan/upgrade';++/**+ * The prefix for the vpaas tenant.+ */+export const VPAAS_TENANT_PREFIX = 'vpaas-magic-cookie-';diff --git a/react/features/jaas/functions.js b/react/features/jaas/functions.jsindex 375cf2078c..1984a81852 100644--- a/react/features/jaas/functions.js+++ b/react/features/jaas/functions.js@@ -1,9 +1,53 @@// @flow-import { getVpaasTenant } from '../billing-counter/functions';+import { VPAAS_TENANT_PREFIX } from './constants';import logger from './logger';+/**+ * Returns the full vpaas tenant if available, given a path.+ *+ * @param {string} path - The meeting url path.+ * @returns {string}+ */+function extractVpaasTenantFromPath(path: string) {+ const [ , tenant ] = path.split('/');++ if (tenant.startsWith(VPAAS_TENANT_PREFIX)) {+ return tenant;+ }++ return '';+}++/**+ * Returns the vpaas tenant.+ *+ * @param {Object} state - The global state.+ * @returns {string}+ */+export function getVpaasTenant(state: Object) {+ return extractVpaasTenantFromPath(state['features/base/connection'].locationURL.pathname);+}++/**+ * Returns true if the current meeting is a vpaas one.+ *+ * @param {Object} state - The state of the app.+ * @returns {boolean}+ */+export function isVpaasMeeting(state: Object) {+ const connection = state['features/base/connection'];++ if (connection?.locationURL?.pathname) {+ return Boolean(+ extractVpaasTenantFromPath(connection?.locationURL?.pathname)+ );+ }++ return false;+}+/*** Sends a request for retrieving jaas customer details.*diff --git a/react/features/billing-counter/middleware.js b/react/features/jaas/middleware.any.jssimilarity index 59%rename from react/features/billing-counter/middleware.jsrename to react/features/jaas/middleware.any.jsindex 1df02ec50d..d0263c66af 100644--- a/react/features/billing-counter/middleware.js+++ b/react/features/jaas/middleware.any.js@@ -1,10 +1,8 @@import { sendAnalytics, createVpaasConferenceJoinedEvent } from '../analytics';import { CONFERENCE_JOINED } from '../base/conference/actionTypes';-import { PARTICIPANT_JOINED } from '../base/participants/actionTypes';import { MiddlewareRegistry } from '../base/redux';-import { countEndpoint } from './actions';-import { isVpaasMeeting, extractVpaasTenantFromPath } from './functions';+import { isVpaasMeeting, getVpaasTenant } from './functions';/*** The redux middleware for billing counter.@@ -20,17 +18,6 @@ MiddlewareRegistry.register(store => next => async action => {break;}-- case PARTICIPANT_JOINED: {- const shouldCount = !store.getState()['features/billing-counter'].endpointCounted- && !action.participant.local;-- if (shouldCount) {- store.dispatch(countEndpoint());- }-- break;- }}return next(action);@@ -45,7 +32,6 @@ MiddlewareRegistry.register(store => next => async action => {function _maybeTrackVpaasConferenceJoin(state) {if (isVpaasMeeting(state)) {sendAnalytics(createVpaasConferenceJoinedEvent(- extractVpaasTenantFromPath(- state['features/base/connection'].locationURL.pathname)));+ getVpaasTenant(state)));}}diff --git a/react/features/jaas/middleware.web.js b/react/features/jaas/middleware.web.jsindex 1e7bfb0123..4fa4adccd1 100644--- a/react/features/jaas/middleware.web.js+++ b/react/features/jaas/middleware.web.js@@ -3,11 +3,12 @@ import { CONFERENCE_JOINED } from '../base/conference/actionTypes';import { CONNECTION_FAILED } from '../base/connection';import { JitsiConnectionErrors } from '../base/lib-jitsi-meet';import { MiddlewareRegistry } from '../base/redux';-import { isVpaasMeeting } from '../billing-counter/functions';+import { SET_DETAILS } from './actionTypes';import { getCustomerDetails } from './actions';import { STATUSES } from './constants';+import { isVpaasMeeting } from './functions';/*** The redux middleware for jaas.diff --git a/react/features/reactions/middleware.js b/react/features/reactions/middleware.jsindex aefbeb1835..cc1cf2a5b9 100644--- a/react/features/reactions/middleware.js+++ b/react/features/reactions/middleware.js@@ -2,7 +2,7 @@import { ENDPOINT_REACTION_NAME } from '../../../modules/API/constants';import { MiddlewareRegistry } from '../base/redux';-import { isVpaasMeeting } from '../billing-counter/functions';+import { isVpaasMeeting } from '../jaas/functions';import {SET_REACTIONS_MESSAGE,diff --git a/react/features/recording/actions.any.js b/react/features/recording/actions.any.jsindex 7bdcf2eec9..141415d18e 100644--- a/react/features/recording/actions.any.js+++ b/react/features/recording/actions.any.js@@ -4,7 +4,7 @@ import { getMeetingRegion, getRecordingSharingUrl } from '../base/config';import JitsiMeetJS, { JitsiRecordingConstants } from '../base/lib-jitsi-meet';import { getLocalParticipant, getParticipantDisplayName } from '../base/participants';import { copyText } from '../base/util/helpers';-import { getVpaasTenant, isVpaasMeeting } from '../billing-counter/functions';+import { getVpaasTenant, isVpaasMeeting } from '../jaas/functions';import {NOTIFICATION_TIMEOUT,hideNotification,diff --git a/react/features/recording/components/Recording/StartRecordingDialogContent.js b/react/features/recording/components/Recording/StartRecordingDialogContent.jsindex 1e5fef9bba..1db16ae5cc 100644--- a/react/features/recording/components/Recording/StartRecordingDialogContent.js+++ b/react/features/recording/components/Recording/StartRecordingDialogContent.js@@ -21,8 +21,8 @@ import {} from '../../../base/react';import { connect } from '../../../base/redux';import { ColorPalette, StyleType } from '../../../base/styles';-import { isVpaasMeeting } from '../../../billing-counter/functions';import { authorizeDropbox, updateDropboxToken } from '../../../dropbox';+import { isVpaasMeeting } from '../../../jaas/functions';import { RECORDING_TYPES } from '../../constants';import { getRecordingDurationEstimation } from '../../functions';diff --git a/react/features/toolbox/components/DownloadButton.js b/react/features/toolbox/components/DownloadButton.jsindex 30bb1dfba3..dfc40ad324 100644--- a/react/features/toolbox/components/DownloadButton.js+++ b/react/features/toolbox/components/DownloadButton.js@@ -6,7 +6,7 @@ import { IconDownload } from '../../base/icons';import { connect } from '../../base/redux';import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';import { openURLInBrowser } from '../../base/util';-import { isVpaasMeeting } from '../../billing-counter/functions';+import { isVpaasMeeting } from '../../jaas/functions';type Props = AbstractButtonProps & {diff --git a/react/features/toolbox/components/HelpButton.js b/react/features/toolbox/components/HelpButton.jsindex 53b7c2cad9..33a2edf309 100644--- a/react/features/toolbox/components/HelpButton.js+++ b/react/features/toolbox/components/HelpButton.js@@ -7,7 +7,7 @@ import { IconHelp } from '../../base/icons';import { connect } from '../../base/redux';import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';import { openURLInBrowser } from '../../base/util';-import { isVpaasMeeting } from '../../billing-counter/functions';+import { isVpaasMeeting } from '../../jaas/functions';type Props = AbstractButtonProps & {diff --git a/react/features/toolbox/components/web/Toolbox.js b/react/features/toolbox/components/web/Toolbox.jsindex b53ed6a467..5b67754222 100644--- a/react/features/toolbox/components/web/Toolbox.js+++ b/react/features/toolbox/components/web/Toolbox.js@@ -22,12 +22,12 @@ import {} from '../../../base/participants';import { connect } from '../../../base/redux';import { getLocalVideoTrack } from '../../../base/tracks';-import { isVpaasMeeting } from '../../../billing-counter/functions';import { toggleChat } from '../../../chat';import { ChatButton } from '../../../chat/components';import { EmbedMeetingButton } from '../../../embed-meeting';import { SharedDocumentButton } from '../../../etherpad';import { FeedbackButton } from '../../../feedback';+import { isVpaasMeeting } from '../../../jaas/functions';import { KeyboardShortcutsButton } from '../../../keyboard-shortcuts';import { LocalRecordingButton } from '../../../local-recording';import {