fix(ui): some t&w fixes
This commit is contained in:
parent
b22d9433d0
commit
463ca8f908
8 changed files with 36 additions and 27 deletions
|
|
@ -82,10 +82,6 @@ function TagWatch() {
|
|||
<div className={'text-disabled-text text-sm'}>
|
||||
Create and filter sessions by ‘watch elements’ to determine if they rendered or not.
|
||||
</div>
|
||||
<div className={'w-full border border-b-light-gray'} />
|
||||
<Button type={'link'} icon={<SearchOutlined />}>
|
||||
Find session with selector
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ function CaptureRate(props: Props) {
|
|||
updateCaptureConditions(projectId!, {
|
||||
rate: parseInt(captureRate, 10),
|
||||
conditionalCapture: conditionalCapture,
|
||||
conditions: conditions.map((c) => c.toCaptureCondition()),
|
||||
conditions: isEnterprise ? conditions.map((c) => c.toCaptureCondition()) : [],
|
||||
}).finally(() => setChanged(false));
|
||||
};
|
||||
|
||||
const updateDisabled = !changed || !isAdmin || (conditionalCapture && conditions.length === 0);
|
||||
const updateDisabled = !changed || !isAdmin || (isEnterprise && (conditionalCapture && conditions.length === 0));
|
||||
return (
|
||||
<Drawer
|
||||
size={'large'}
|
||||
|
|
@ -104,7 +104,7 @@ function CaptureRate(props: Props) {
|
|||
<Switch
|
||||
checked={conditionalCapture}
|
||||
onChange={toggleRate}
|
||||
checkedChildren={'Conditional'}
|
||||
checkedChildren={isEnterprise ? 'All' : 'Conditional'}
|
||||
disabled={!isAdmin}
|
||||
unCheckedChildren={'Capture Rate'}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@openreplay/tracker-assist",
|
||||
"description": "Tracker plugin for screen assistance through the WebRTC",
|
||||
"version": "8.0.0",
|
||||
"version": "8.0.0-beta.9",
|
||||
"keywords": [
|
||||
"WebRTC",
|
||||
"assistance",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export const pkgVersion = '7.0.4'
|
||||
export const pkgVersion = '8.0.0-beta.9'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@openreplay/tracker",
|
||||
"description": "The OpenReplay tracker main package",
|
||||
"version": "12.0.0",
|
||||
"version": "12.0.0-beta.10",
|
||||
"keywords": [
|
||||
"logging",
|
||||
"replay"
|
||||
|
|
|
|||
|
|
@ -205,16 +205,9 @@ export default class ConditionsManager {
|
|||
customEvent(message: CustomEvent) {
|
||||
// name - 1, payload - 2
|
||||
const evConds = this.conditions.filter((c) => c.type === 'custom_event') as CommonCondition[]
|
||||
console.log(message, evConds)
|
||||
if (evConds.length) {
|
||||
evConds.forEach((evCond) => {
|
||||
const operator = operators[evCond.operator] as (a: string, b: string[]) => boolean
|
||||
console.log(
|
||||
operator,
|
||||
evCond,
|
||||
operator(message[1], evCond.value),
|
||||
operator(message[2], evCond.value),
|
||||
)
|
||||
if (
|
||||
operator &&
|
||||
(operator(message[1], evCond.value) || operator(message[2], evCond.value))
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ class TagWatcher {
|
|||
.then(({ tags }: { tags: { id: number; selector: string }[] }) => {
|
||||
if (tags && tags.length) {
|
||||
this.setTags(tags)
|
||||
this.sessionStorage.setItem(WATCHED_TAGS_KEY, JSON.stringify(tags) || '')
|
||||
const tagString = JSON.stringify(tags)
|
||||
this.sessionStorage.setItem(WATCHED_TAGS_KEY, tagString || '')
|
||||
}
|
||||
})
|
||||
.catch((e) => this.errLog(e))
|
||||
|
|
|
|||
|
|
@ -47,24 +47,43 @@ describe('TagWatcher', () => {
|
|||
|
||||
test('constructor initializes with tags from sessionStorage', () => {
|
||||
// @ts-ignore
|
||||
sessionStorageMock.getItem.mockReturnValue('div,span')
|
||||
sessionStorageMock.getItem.mockReturnValue(
|
||||
'[{"id":1,"selector":"div"},{"id":2,"selector":"span"}]',
|
||||
)
|
||||
const watcher = new TagWatcher(sessionStorageMock, errLogMock, onTag)
|
||||
expect(watcher.tags).toEqual(['div', 'span'])
|
||||
expect(watcher.intervals).toHaveProperty('div')
|
||||
expect(watcher.intervals).toHaveProperty('span')
|
||||
expect(watcher.tags).toEqual([
|
||||
{ id: 1, selector: 'div' },
|
||||
{ id: 2, selector: 'span' },
|
||||
])
|
||||
expect(watcher.intervals).toHaveProperty('1')
|
||||
expect(watcher.intervals).toHaveProperty('2')
|
||||
})
|
||||
|
||||
test('fetchTags sets tags and updates sessionStorage', async () => {
|
||||
// @ts-ignore
|
||||
global.fetch = jest.fn(() =>
|
||||
Promise.resolve({
|
||||
json: () => Promise.resolve(['div', 'span', 'p']),
|
||||
json: () =>
|
||||
Promise.resolve({
|
||||
tags: [
|
||||
{ id: 1, selector: 'div' },
|
||||
{ id: 2, selector: 'span' },
|
||||
{ id: 3, selector: 'p' },
|
||||
],
|
||||
}),
|
||||
}),
|
||||
)
|
||||
const watcher = new TagWatcher(sessionStorageMock, errLogMock, onTag)
|
||||
await watcher.fetchTags('https://localhost.com', '123')
|
||||
expect(watcher.tags).toEqual(['div', 'span', 'p'])
|
||||
expect(sessionStorageMock.setItem).toHaveBeenCalledWith(WATCHED_TAGS_KEY, 'div,span,p')
|
||||
expect(watcher.tags).toEqual([
|
||||
{ id: 1, selector: 'div' },
|
||||
{ id: 2, selector: 'span' },
|
||||
{ id: 3, selector: 'p' },
|
||||
])
|
||||
expect(sessionStorageMock.setItem).toHaveBeenCalledWith(
|
||||
WATCHED_TAGS_KEY,
|
||||
'[{"id":1,"selector":"div"},{"id":2,"selector":"span"},{"id":3,"selector":"p"}]',
|
||||
)
|
||||
})
|
||||
|
||||
test('setTags sets intervals for each tag', () => {
|
||||
|
|
@ -73,8 +92,8 @@ describe('TagWatcher', () => {
|
|||
{ id: 1, selector: 'div' },
|
||||
{ id: 2, selector: 'p' },
|
||||
])
|
||||
expect(watcher.intervals).toHaveProperty('div')
|
||||
expect(watcher.intervals).toHaveProperty('p')
|
||||
expect(watcher.intervals).toHaveProperty('1')
|
||||
expect(watcher.intervals).toHaveProperty('2')
|
||||
expect(mockObserve).not.toHaveBeenCalled() // No elements to observe initially
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue