diff --git a/tracker/tracker-assist/CHANGELOG.md b/tracker/tracker-assist/CHANGELOG.md index 464985ec8..bc41bbe33 100644 --- a/tracker/tracker-assist/CHANGELOG.md +++ b/tracker/tracker-assist/CHANGELOG.md @@ -1,3 +1,7 @@ +## 8.0.0 + +- Keeping up with major tracker release. + ## 7.0.3 - small fix for canvas context tracking diff --git a/tracker/tracker-assist/bun.lockb b/tracker/tracker-assist/bun.lockb index 7136f43be..d81b618bf 100755 Binary files a/tracker/tracker-assist/bun.lockb and b/tracker/tracker-assist/bun.lockb differ diff --git a/tracker/tracker-assist/package.json b/tracker/tracker-assist/package.json index 363e9910c..7e670cda2 100644 --- a/tracker/tracker-assist/package.json +++ b/tracker/tracker-assist/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker-assist", "description": "Tracker plugin for screen assistance through the WebRTC", - "version": "7.0.4", + "version": "8.0.0", "keywords": [ "WebRTC", "assistance", @@ -20,7 +20,7 @@ "build-cjs": "rm -Rf cjs && tsc --project tsconfig-cjs.json && echo '{ \"type\": \"commonjs\" }' > cjs/package.json && bun run replace-paths && bun run replace-req-version", "replace-paths": "replace-in-files cjs/* --string='@openreplay/tracker' --replacement='@openreplay/tracker/cjs' && replace-in-files cjs/* --string='/lib/' --replacement='/'", "replace-pkg-version": "sh pkgver.sh", - "replace-req-version": "replace-in-files lib/* cjs/* --string='REQUIRED_TRACKER_VERSION' --replacement='11.0.0'", + "replace-req-version": "replace-in-files lib/* cjs/* --string='REQUIRED_TRACKER_VERSION' --replacement='12.0.0'", "prepublishOnly": "bun run test && bun run build", "prepare": "cd ../../ && husky install tracker/.husky/", "lint-front": "lint-staged", diff --git a/tracker/tracker/package.json b/tracker/tracker/package.json index a996172db..b99cc9dfb 100644 --- a/tracker/tracker/package.json +++ b/tracker/tracker/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker", "description": "The OpenReplay tracker main package", - "version": "12.0.1-2", + "version": "12.0.0", "keywords": [ "logging", "replay" diff --git a/tracker/tracker/src/main/modules/conditionsManager.ts b/tracker/tracker/src/main/modules/conditionsManager.ts index 53ef7c52a..8344ff411 100644 --- a/tracker/tracker/src/main/modules/conditionsManager.ts +++ b/tracker/tracker/src/main/modules/conditionsManager.ts @@ -56,8 +56,18 @@ export default class ConditionsManager { filters.forEach((filter) => { let cond: Condition | undefined if (filter.type === 'fetch') { + cond = { + type: 'network_request', + subConditions: [], + name: c.name, + } filter.filters.forEach((f) => { - cond = this.createConditionFromFilter(f as unknown as Filter) + const subCond = this.createConditionFromFilter(f as unknown as Filter) + if (subCond) { + ;(cond as unknown as NetworkRequestCondition).subConditions.push( + subCond as unknown as SubCondition, + ) + } }) } else { cond = this.createConditionFromFilter(filter) @@ -155,36 +165,41 @@ export default class ConditionsManager { const reqConds = this.conditions.filter( (c) => c.type === 'network_request', ) as NetworkRequestCondition[] - const withoutAny = reqConds.filter((c) => c.operator !== 'isAny') - if (withoutAny.length) { - withoutAny.forEach((reqCond) => { - let value - switch (reqCond.key) { - case 'url': - value = message[3] - break - case 'status': - value = message[6] - break - case 'method': - value = message[2] - break - case 'duration': - value = message[8] - break - default: - break - } - const operator = operators[reqCond.operator] as (a: string, b: string[]) => boolean - // @ts-ignore - if (operator && operator(value, reqCond.value)) { + if (!reqConds.length) return + reqConds.forEach((reqCond) => { + const validSubConditions = reqCond.subConditions.filter((c) => c.operator !== 'isAny') + if (validSubConditions.length) { + const allPass = validSubConditions.every((subCond) => { + let value + switch (subCond.key) { + case 'url': + value = message[3] + break + case 'status': + value = message[6] + break + case 'method': + value = message[2] + break + case 'duration': + value = message[8] + break + default: + break + } + const operator = operators[subCond.operator] as (a: string, b: string[]) => boolean + // @ts-ignore + if (operator && operator(value, subCond.value)) { + return true + } + }) + if (allPass) { this.trigger(reqCond.name) } - }) - } - if (withoutAny.length === 0 && reqConds.length) { - this.trigger(reqConds[0].name) - } + } else if (validSubConditions.length === 0 && reqCond.subConditions.length) { + this.trigger(reqCond.name) + } + }) } customEvent(message: CustomEvent) { @@ -277,11 +292,15 @@ type SessionDurationCondition = { value: number[] name: string } -type NetworkRequestCondition = { +type SubCondition = { type: 'network_request' key: 'url' | 'status' | 'method' | 'duration' operator: keyof typeof operators value: string[] +} +type NetworkRequestCondition = { + type: 'network_request' + subConditions: SubCondition[] name: string } type Condition =