@financial-times/n-tracking
Advanced tools
Comparing version 7.2.1 to 7.2.2
@@ -118,3 +118,3 @@ import oTracking from '@financial-times/o-tracking'; | ||
async function getConsentData() { | ||
async function getConsentData () { | ||
const consentValues = (await getPersonalisedConsent()).isAllowed(); | ||
@@ -757,3 +757,3 @@ const usprivacy = getUsPrivacyForTracking(); | ||
// eslint-disable-next-line no-console | ||
console.warn("Could not get consent data", err); | ||
console.warn('Could not get consent data', err); | ||
oTracking.page(pageViewEventParams); | ||
@@ -768,3 +768,3 @@ }); | ||
// eslint-disable-next-line no-console | ||
console.warn("An oTracking instance already exists on window, skipping", { currentInstance: window.oTracking, ourInstance: oTracking }); | ||
console.warn('An oTracking instance already exists on window, skipping', { currentInstance: window.oTracking, ourInstance: oTracking }); | ||
} else { | ||
@@ -771,0 +771,0 @@ window.oTracking = oTracking; |
@@ -6,3 +6,3 @@ { | ||
"browser": "dist/browser.js", | ||
"version": "7.2.1", | ||
"version": "7.2.2", | ||
"license": "MIT", | ||
@@ -39,7 +39,7 @@ "repository": "Financial-Times/n-tracking.git", | ||
"dependencies": { | ||
"@financial-times/ads-personalised-consent": "^5.2.3", | ||
"@financial-times/ads-personalised-consent": "^5.2.8", | ||
"@financial-times/o-grid": "^5.0.0", | ||
"@financial-times/o-tracking": "^4.5.0", | ||
"@financial-times/o-viewport": "^4.0.0", | ||
"@financial-times/privacy-us-privacy": "1.0.0", | ||
"@financial-times/privacy-us-privacy": "^2.1.0", | ||
"ready-state": "^2.0.5", | ||
@@ -46,0 +46,0 @@ "web-vitals": "^3.4.0" |
@@ -30,4 +30,4 @@ jest.mock('@financial-times/o-tracking', () => { | ||
getConsentData.mockResolvedValue({}); | ||
window.console.warn = jest.fn() | ||
}) | ||
window.console.warn = jest.fn(); | ||
}); | ||
@@ -37,3 +37,3 @@ afterEach(() => { | ||
// Clean global instance left on the window after each init() call | ||
delete window.oTracking | ||
delete window.oTracking; | ||
}); | ||
@@ -60,7 +60,7 @@ | ||
it("warns the user in case an instance of o-tracking is already attached to the window without overriding the value", () => { | ||
window.oTracking = "initialValue"; | ||
it('warns the user in case an instance of o-tracking is already attached to the window without overriding the value', () => { | ||
window.oTracking = 'initialValue'; | ||
const ourInstance = init({ appContext }); | ||
expect(window.console.warn).toHaveBeenCalledWith( | ||
"An oTracking instance already exists on window, skipping", | ||
'An oTracking instance already exists on window, skipping', | ||
{ | ||
@@ -71,3 +71,3 @@ currentInstance: 'initialValue', | ||
); | ||
expect(window.oTracking).toBe("initialValue"); | ||
expect(window.oTracking).toBe('initialValue'); | ||
}); | ||
@@ -74,0 +74,0 @@ |
@@ -48,3 +48,3 @@ import oTracking from '@financial-times/o-tracking'; | ||
// eslint-disable-next-line no-console | ||
console.warn("Could not get consent data", err); | ||
console.warn('Could not get consent data', err); | ||
oTracking.page(pageViewEventParams); | ||
@@ -59,3 +59,3 @@ }); | ||
// eslint-disable-next-line no-console | ||
console.warn("An oTracking instance already exists on window, skipping", { currentInstance: window.oTracking, ourInstance: oTracking }); | ||
console.warn('An oTracking instance already exists on window, skipping', { currentInstance: window.oTracking, ourInstance: oTracking }); | ||
} else { | ||
@@ -62,0 +62,0 @@ window.oTracking = oTracking; |
@@ -1,15 +0,15 @@ | ||
jest.mock("@financial-times/privacy-us-privacy", () => ({ | ||
jest.mock('@financial-times/privacy-us-privacy', () => ({ | ||
getUsPrivacyForTracking: jest.fn(), | ||
})); | ||
jest.mock("@financial-times/ads-personalised-consent", () => ({ | ||
jest.mock('@financial-times/ads-personalised-consent', () => ({ | ||
getPersonalisedConsent: jest.fn(), | ||
})); | ||
import { getUsPrivacyForTracking } from "@financial-times/privacy-us-privacy"; | ||
import { getPersonalisedConsent } from "@financial-times/ads-personalised-consent"; | ||
import { getUsPrivacyForTracking } from '@financial-times/privacy-us-privacy'; | ||
import { getPersonalisedConsent } from '@financial-times/ads-personalised-consent'; | ||
import getConsentData from "../getConsentData"; | ||
import getConsentData from '../getConsentData'; | ||
describe("getConsentData", () => { | ||
describe('getConsentData', () => { | ||
@@ -23,4 +23,4 @@ beforeEach(() => { | ||
}); | ||
getUsPrivacyForTracking.mockReturnValue("usprivacy"); | ||
}) | ||
getUsPrivacyForTracking.mockReturnValue('usprivacy'); | ||
}); | ||
afterEach(() => { | ||
@@ -31,3 +31,3 @@ jest.clearAllMocks(); | ||
it("returns the consent data and awaits for getPersonalisedConsent.isAllowed()", async () => { | ||
it('returns the consent data and awaits for getPersonalisedConsent.isAllowed()', async () => { | ||
const consentData = await getConsentData(); | ||
@@ -38,19 +38,19 @@ | ||
consent2: false, | ||
usprivacy: "usprivacy", | ||
usprivacy: 'usprivacy', | ||
}); | ||
}); | ||
it("Errors if getPersonalisedConsent.isAllowed() rejects", async () => { | ||
getPersonalisedConsent.mockRejectedValue(new Error("no consent")); | ||
it('Errors if getPersonalisedConsent.isAllowed() rejects', async () => { | ||
getPersonalisedConsent.mockRejectedValue(new Error('no consent')); | ||
await expect(getConsentData()).rejects.toThrow("no consent"); | ||
await expect(getConsentData()).rejects.toThrow('no consent'); | ||
}); | ||
it("Errors if getUsPrivacyForTracking rejects", async () => { | ||
it('Errors if getUsPrivacyForTracking rejects', async () => { | ||
getUsPrivacyForTracking.mockImplementation(() => { | ||
throw new Error("us privacy error"); | ||
throw new Error('us privacy error'); | ||
}); | ||
await expect(getConsentData()).rejects.toThrow("us privacy error"); | ||
await expect(getConsentData()).rejects.toThrow('us privacy error'); | ||
}); | ||
}); |
@@ -1,5 +0,5 @@ | ||
import { getUsPrivacyForTracking } from "@financial-times/privacy-us-privacy"; | ||
import { getPersonalisedConsent } from "@financial-times/ads-personalised-consent"; | ||
import { getUsPrivacyForTracking } from '@financial-times/privacy-us-privacy'; | ||
import { getPersonalisedConsent } from '@financial-times/ads-personalised-consent'; | ||
export default async function getConsentData() { | ||
export default async function getConsentData () { | ||
const consentValues = (await getPersonalisedConsent()).isAllowed(); | ||
@@ -6,0 +6,0 @@ const usprivacy = getUsPrivacyForTracking(); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
686672
18021
+ Added@financial-times/privacy-legislation-client@2.2.2(transitive)
+ Added@financial-times/privacy-us-privacy@2.2.1(transitive)
- Removed@financial-times/privacy-us-privacy@1.0.0(transitive)