fix ui: fixes for permissions in assist and devtools

This commit is contained in:
nick-delirium 2024-05-28 17:22:15 +02:00
parent aff49b5390
commit 1d31900c9f
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
10 changed files with 26 additions and 18 deletions

View file

@ -44,7 +44,7 @@ function AssistSearchField(props: Props) {
{props.isEnterprise && props.modules.includes(MODULES.OFFLINE_RECORDINGS)
? <Button variant="outline" onClick={showRecords}>Training Videos</Button> : null
}
<Button variant="outline" onClick={showStats}>Co-Browsing Reports</Button>
<Button variant="outline" onClick={showStats} disabled={!props.modules.includes(MODULES.ASSIST_STATS) || !props.modules.includes(MODULES.ASSIST)}>Co-Browsing Reports</Button>
<Button
variant="text-primary"
className="ml-auto font-medium"

View file

@ -63,6 +63,7 @@ function Controls(props: any) {
previousSessionId,
nextSessionId,
siteId,
disableDevtools,
} = props;
const disabled = messagesLoading;
@ -84,6 +85,7 @@ function Controls(props: any) {
openNextSession: nextHandler,
openPrevSession: prevHandler,
setActiveTab,
disableDevtools
});
const forthTenSeconds = () => {
@ -284,7 +286,7 @@ export default connect(
const permissions = state.getIn(['user', 'account', 'permissions']) || [];
const isEnterprise = state.getIn(['user', 'account', 'edition']) === 'ee';
return {
disabledRedux: isEnterprise && !permissions.includes('DEV_TOOLS'),
disableDevtools: isEnterprise && !permissions.includes('DEV_TOOLS'),
fullscreen: state.getIn(['components', 'player', 'fullscreen']),
bottomBlock: state.getIn(['components', 'player', 'bottomBlock']),
showStorageRedux: !state.getIn([

View file

@ -12,6 +12,7 @@ function useShortcuts({
openNextSession,
openPrevSession,
setActiveTab,
disableDevtools,
}: {
skipInterval: keyof typeof SKIP_INTERVALS;
fullScreenOn: () => void;
@ -20,6 +21,7 @@ function useShortcuts({
openNextSession: () => void;
openPrevSession: () => void;
setActiveTab: (tab: string) => void;
disableDevtools?: boolean;
}) {
const { player } = useContext(PlayerContext);
@ -47,17 +49,17 @@ function useShortcuts({
case 'F':
return fullScreenOn();
case 'X':
return toggleBottomBlock(blocks.overview);
return disableDevtools ? null : toggleBottomBlock(blocks.overview);
case 'P':
return toggleBottomBlock(blocks.performance);
return disableDevtools ? null : toggleBottomBlock(blocks.performance);
case 'N':
return toggleBottomBlock(blocks.network);
return disableDevtools ? null : toggleBottomBlock(blocks.network);
case 'C':
return toggleBottomBlock(blocks.console);
return disableDevtools ? null : toggleBottomBlock(blocks.console);
case 'R':
return toggleBottomBlock(blocks.storage);
return disableDevtools ? null : toggleBottomBlock(blocks.storage);
case 'E':
return toggleBottomBlock(blocks.stackEvents);
return disableDevtools ? null : toggleBottomBlock(blocks.stackEvents);
case '>':
return openNextSession();
case '<':
@ -98,4 +100,4 @@ function useShortcuts({
}, [forthTenSeconds, backTenSeconds, player, fullScreenOn, fullScreenOff]);
}
export default useShortcuts;
export default useShortcuts

View file

@ -91,7 +91,7 @@ function Controls(props: any) {
fullscreen,
changeSkipInterval,
skipInterval,
disabledRedux,
disableDevtools,
showStorageRedux,
session,
previousSessionId,
@ -101,7 +101,7 @@ function Controls(props: any) {
} = props;
const disabled =
disabledRedux || messagesLoading || inspectorMode || markedTargets;
disableDevtools || messagesLoading || inspectorMode || markedTargets;
const sessionTz = session?.timezone;
const nextHandler = () => {
@ -120,6 +120,7 @@ function Controls(props: any) {
openNextSession: nextHandler,
openPrevSession: prevHandler,
setActiveTab,
disableDevtools,
});
const forthTenSeconds = () => {
@ -425,7 +426,7 @@ export default connect(
const permissions = state.getIn(['user', 'account', 'permissions']) || [];
const isEnterprise = state.getIn(['user', 'account', 'edition']) === 'ee';
return {
disabledRedux: isEnterprise && !permissions.includes('DEV_TOOLS'),
disableDevtools: isEnterprise && !permissions.includes('DEV_TOOLS'),
fullscreen: state.getIn(['components', 'player', 'fullscreen']),
bottomBlock: state.getIn(['components', 'player', 'bottomBlock']),
showStorageRedux: !state.getIn([

View file

@ -137,6 +137,7 @@ export interface ISession {
videoURL?: string[]
isMobileNative?: boolean
audio?: string;
assistOnly?: boolean;
}
const emptyValues = {
@ -347,7 +348,7 @@ export default class Session {
uxtVideo: uxtVideo[0],
durationMs: session.duration,
audio: session.audio,
liveOnly: true,
liveOnly: session.assistOnly,
});
}

View file

@ -1,6 +1,7 @@
## 9.0.0
- support for message compression inside plugin (requires v1.18 frontend)
- support for assist-only mode (requires EE license)
- open peer connection dynamically on call
## 8.0.4

Binary file not shown.

View file

@ -35,7 +35,7 @@
"socket.io-client": "^4.7.2"
},
"peerDependencies": {
"@openreplay/tracker": "^12.0.1"
"@openreplay/tracker": "^13.0.0"
},
"devDependencies": {
"@openreplay/tracker": "file:../tracker",

View file

@ -240,6 +240,7 @@ export default class Assist {
'uxtId': this.app.getUxtId() ?? undefined,
pageTitle: document.title,
active: true,
assistOnly: this.app.socketMode,
...this.app.getSessionInfo(),
}),
},

View file

@ -174,17 +174,17 @@ export default class App {
private readonly version = 'TRACKER_VERSION' // TODO: version compatability check inside each plugin.
private readonly worker?: TypedWorker
public attributeSender: AttributeSender
public featureFlags: FeatureFlags
public socketMode = false
private compressionThreshold = 24 * 1000
private restartAttempts = 0
private readonly bc: BroadcastChannel | null = null
private readonly contextId
public attributeSender: AttributeSender
private canvasRecorder: CanvasRecorder | null = null
private uxtManager: UserTestManager
private conditionsManager: ConditionsManager | null = null
public featureFlags: FeatureFlags
private tagWatcher: TagWatcher
private socketMode = false
private readonly tagWatcher: TagWatcher
constructor(
projectKey: string,