fix(vpaas): Store billing id in parent lolcaStorage on Safari
This commit is contained in:
parent
ec3130af0e
commit
23574e9edc
|
@ -3325,9 +3325,9 @@
|
|||
}
|
||||
},
|
||||
"@jitsi/js-utils": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@jitsi/js-utils/-/js-utils-1.0.3.tgz",
|
||||
"integrity": "sha512-m6mZz7R716mHP21lTKQffyM0nNFu3Fe/EHCaOVLFY/vdPsaUl9DhypJqtPIYzRUfPnmnugdaxcxrUeSZQXQzVA==",
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@jitsi/js-utils/-/js-utils-1.0.5.tgz",
|
||||
"integrity": "sha512-1APQyuqQaYDR+W7cdgzsaBo6x8dpF8sfelcBf3ngNU3Jd+DzuuwUvCMTbr2+cCuy6w59ZAuQ7e2ixCnnOXOW4Q==",
|
||||
"requires": {
|
||||
"bowser": "2.7.0",
|
||||
"js-md5": "0.7.3"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"@atlaskit/theme": "7.0.2",
|
||||
"@atlaskit/toggle": "5.0.14",
|
||||
"@atlaskit/tooltip": "12.1.13",
|
||||
"@jitsi/js-utils": "1.0.3",
|
||||
"@jitsi/js-utils": "1.0.5",
|
||||
"@microsoft/microsoft-graph-client": "1.1.0",
|
||||
"@react-native-async-storage/async-storage": "1.13.2",
|
||||
"@react-native-community/google-signin": "3.0.1",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import { jitsiLocalStorage } from '@jitsi/js-utils/jitsi-local-storage';
|
||||
|
||||
import { browser } from '../lib-jitsi-meet';
|
||||
import { parseURLParams } from '../util/parseURLParams';
|
||||
|
||||
import logger from './logger';
|
||||
|
@ -23,7 +24,7 @@ function onFakeLocalStorageChanged() {
|
|||
* @returns {void}
|
||||
*/
|
||||
function setupJitsiLocalStorage() {
|
||||
if (jitsiLocalStorage.isLocalStorageDisabled()) {
|
||||
if (jitsiLocalStorage.isLocalStorageDisabled() || browser.isSafari()) {
|
||||
const urlParams = parseURLParams(window.location);
|
||||
|
||||
try {
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
/**
|
||||
* Action used to store the billing id.
|
||||
*/
|
||||
export const SET_BILLING_ID = 'SET_BILLING_ID';
|
||||
|
||||
/**
|
||||
* Action used to store the flag signaling the endpoint has been counted.
|
||||
*/
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
// @flow
|
||||
|
||||
import uuid from 'uuid';
|
||||
|
||||
import { SET_BILLING_ID, SET_ENDPOINT_COUNTED } from './actionTypes';
|
||||
import { SET_ENDPOINT_COUNTED } from './actionTypes';
|
||||
import { extractVpaasTenantFromPath, getBillingId, sendCountRequest } from './functions';
|
||||
|
||||
/**
|
||||
* Sends a billing count request when needed.
|
||||
* If there is no billingId, it presists one first and sends the request after.
|
||||
*
|
||||
* @returns {Function}
|
||||
*/
|
||||
|
@ -20,12 +17,7 @@ export function countEndpoint() {
|
|||
const shouldSendRequest = Boolean(baseUrl && jwt && tenant);
|
||||
|
||||
if (shouldSendRequest) {
|
||||
let billingId = getBillingId();
|
||||
|
||||
if (!billingId) {
|
||||
billingId = uuid.v4();
|
||||
dispatch(setBillingId(billingId));
|
||||
}
|
||||
const billingId = getBillingId();
|
||||
|
||||
sendCountRequest({
|
||||
baseUrl,
|
||||
|
@ -38,19 +30,6 @@ export function countEndpoint() {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Action used to set the user billing id.
|
||||
*
|
||||
* @param {string} value - The uid.
|
||||
* @returns {Object}
|
||||
*/
|
||||
function setBillingId(value) {
|
||||
return {
|
||||
type: SET_BILLING_ID,
|
||||
value
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Action used to mark the endpoint as counted.
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// @flow
|
||||
|
||||
import { jitsiLocalStorage } from '@jitsi/js-utils';
|
||||
import uuid from 'uuid';
|
||||
|
||||
import { BILLING_ID, VPAAS_TENANT_PREFIX } from './constants';
|
||||
import logger from './logger';
|
||||
|
@ -72,20 +73,18 @@ export async function sendCountRequest({ baseUrl, billingId, jwt, tenant }: {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the stored billing id.
|
||||
* Returns the stored billing id (or generates a new one if none is present).
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getBillingId() {
|
||||
return jitsiLocalStorage.getItem(BILLING_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the billing id.
|
||||
*
|
||||
* @param {string} value - The id to be stored.
|
||||
* @returns {void}
|
||||
*/
|
||||
export function setBillingId(value: string) {
|
||||
jitsiLocalStorage.setItem(BILLING_ID, value);
|
||||
let billingId = jitsiLocalStorage.getItem(BILLING_ID);
|
||||
|
||||
if (!billingId) {
|
||||
billingId = uuid.v4();
|
||||
jitsiLocalStorage.setItem(BILLING_ID, billingId);
|
||||
}
|
||||
|
||||
return billingId;
|
||||
}
|
||||
|
|
|
@ -3,9 +3,8 @@ import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
|
|||
import { PARTICIPANT_JOINED } from '../base/participants/actionTypes';
|
||||
import { MiddlewareRegistry } from '../base/redux';
|
||||
|
||||
import { SET_BILLING_ID } from './actionTypes';
|
||||
import { countEndpoint } from './actions';
|
||||
import { isVpaasMeeting, extractVpaasTenantFromPath, setBillingId } from './functions';
|
||||
import { isVpaasMeeting, extractVpaasTenantFromPath } from './functions';
|
||||
|
||||
/**
|
||||
* The redux middleware for billing counter.
|
||||
|
@ -21,11 +20,6 @@ MiddlewareRegistry.register(store => next => async action => {
|
|||
|
||||
break;
|
||||
}
|
||||
case SET_BILLING_ID: {
|
||||
setBillingId(action.value);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PARTICIPANT_JOINED: {
|
||||
const shouldCount = !store.getState()['features/billing-counter'].endpointCounted
|
||||
|
|
Loading…
Reference in New Issue