Skip to content

Commit abbfb48

Browse files
committed
add @guardian to package name and improve variables in Metrics component
1 parent fa4c14a commit abbfb48

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

ab-testing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "ab-testing",
2+
"name": "@guardian/ab-testing",
33
"version": "1.0.0",
44
"description": "A/B test definitions and configuration",
55
"main": "index.ts",

dotcom-rendering/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@emotion/react": "11.14.0",
2828
"@emotion/server": "11.11.0",
2929
"@guardian/ab-core": "8.0.0",
30+
"@guardian/ab-testing": "workspace:ab-testing",
3031
"@guardian/braze-components": "22.2.0",
3132
"@guardian/bridget": "8.7.0",
3233
"@guardian/browserslist-config": "6.1.0",
@@ -98,7 +99,6 @@
9899
"@types/webpack-env": "1.18.8",
99100
"@types/webpack-node-externals": "3.0.4",
100101
"@types/youtube": "0.0.50",
101-
"ab-testing": "workspace:ab-testing",
102102
"ajv": "8.17.1",
103103
"ajv-formats": "2.1.1",
104104
"amphtml-validator": "1.0.35",

dotcom-rendering/src/components/Metrics.importable.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ABTest, ABTestAPI } from '@guardian/ab-core';
2+
import { ABTests } from '@guardian/ab-testing';
23
import {
34
bypassCommercialMetricsSampling,
45
EventTimer,
@@ -9,7 +10,6 @@ import {
910
initCoreWebVitals,
1011
} from '@guardian/core-web-vitals';
1112
import { getCookie, isString, isUndefined } from '@guardian/libs';
12-
import { ABTests } from 'ab-testing';
1313
import { useCallback, useEffect, useState } from 'react';
1414
import { useAB, useBetaAB } from '../lib/useAB';
1515
import { useAdBlockInUse } from '../lib/useAdBlockInUse';
@@ -32,11 +32,11 @@ const clientSideTestsToForceMetrics: ABTest[] = [
3232
/* keep array multi-line */
3333
];
3434

35-
const shouldCollectMetricsForBetaTests = (testParticipations: string[]) => {
36-
const participationConfigs = ABTests.filter((test) =>
37-
testParticipations.includes(test.name),
35+
const shouldCollectMetricsForBetaTests = (userTestParticipations: string[]) => {
36+
const userParticipationConfigs = ABTests.filter((test) =>
37+
userTestParticipations.includes(test.name),
3838
);
39-
return participationConfigs.some(
39+
return userParticipationConfigs.some(
4040
(test) => test.shouldForceMetricsCollection,
4141
);
4242
};
@@ -99,10 +99,10 @@ export const Metrics = ({ commercialMetricsEnabled, tests }: Props) => {
9999

100100
const userInServerSideTest = Object.keys(tests).length > 0;
101101

102-
const betaParticipations = betaABTest?.getParticipations() ?? {};
102+
const userBetaParticipations = betaABTest?.getParticipations() ?? {};
103103

104104
const collectBetaTestMetrics = shouldCollectMetricsForBetaTests(
105-
Object.keys(betaParticipations),
105+
Object.keys(userBetaParticipations),
106106
);
107107

108108
const shouldBypassSampling = useCallback(

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)