@guardian/commercial-core 33.0.0 → 34.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkConsent = exports._ = void 0;
4
4
  exports.bypassCommercialMetricsSampling = bypassCommercialMetricsSampling;
5
5
  exports.initCommercialMetrics = initCommercialMetrics;
6
+ const consent_manager_1 = require("@guardian/consent-manager");
6
7
  const libs_1 = require("@guardian/libs");
7
8
  const event_timer_1 = require("./event-timer.js");
8
9
  var Endpoints;
@@ -129,7 +130,7 @@ const addVisibilityListeners = () => {
129
130
  window.addEventListener('pagehide', listener, { once: true });
130
131
  };
131
132
  const checkConsent = async () => {
132
- const consentState = await (0, libs_1.onConsent)();
133
+ const consentState = await (0, consent_manager_1.onConsent)();
133
134
  if (consentState.tcfv2) {
134
135
  // TCFv2 mode - check for consent
135
136
  const consents = consentState.tcfv2.consents;
@@ -1,4 +1,5 @@
1
- import type { ConsentState, CountryCode } from '@guardian/libs';
1
+ import type { ConsentState } from '@guardian/consent-manager';
2
+ import type { CountryCode } from '@guardian/libs';
2
3
  import type { AdManagerGroup, Frequency } from './personalised.js';
3
4
  import type { SharedTargeting } from './shared.js';
4
5
  import { getLocalHour } from './shared.js';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLocalHour = exports.filterValues = exports.buildPageTargeting = void 0;
4
+ const consent_manager_1 = require("@guardian/consent-manager");
4
5
  const libs_1 = require("@guardian/libs");
5
6
  const event_timer_1 = require("../event-timer.js");
6
7
  const get_locale_1 = require("../geo/get-locale.js");
@@ -86,14 +87,14 @@ const buildPageTargeting = ({ adFree, abTestParticipations, consentState, isSign
86
87
  };
87
88
  const viewportTargeting = (0, viewport_1.getViewportTargeting)({
88
89
  viewPortWidth: getViewport().width,
89
- cmpBannerWillShow: !libs_1.cmp.hasInitialised() || libs_1.cmp.willShowPrivacyMessageSync(),
90
+ cmpBannerWillShow: !consent_manager_1.cmp.hasInitialised() || consent_manager_1.cmp.willShowPrivacyMessageSync(),
90
91
  });
91
92
  const personalisedTargeting = (0, personalised_1.getPersonalisedTargeting)({
92
93
  state: consentState,
93
94
  youtube,
94
95
  });
95
96
  const consentlessTargeting = {};
96
- if (!(0, libs_1.getConsentFor)('googletag', consentState)) {
97
+ if (!(0, consent_manager_1.getConsentFor)('googletag', consentState)) {
97
98
  consentlessTargeting.firstvisit = isFirstVisit(referrer) ? 't' : 'f';
98
99
  }
99
100
  const pageTargets = {
@@ -1,4 +1,4 @@
1
- import type { ConsentState, TCEventStatusCode } from '@guardian/libs';
1
+ import type { ConsentState, TCEventStatusCode } from '@guardian/consent-manager';
2
2
  import type { False, NotApplicable, True } from './types.js';
3
3
  declare const frequency: readonly ["0", "1", "2", "3", "4", "5", "6-9", "10-15", "16-19", "20-29", "30plus"];
4
4
  type Frequency = (typeof frequency)[number];
@@ -1,4 +1,4 @@
1
- import type { ConsentState } from '@guardian/libs';
1
+ import type { ConsentState } from '@guardian/consent-manager';
2
2
  import type { CustomParams } from './types.js';
3
3
  type BuildImaAdTagUrl = {
4
4
  adUnit: string;
@@ -1,4 +1,5 @@
1
- import { getMeasures, isNonNullable, log, onConsent } from '@guardian/libs';
1
+ import { onConsent } from '@guardian/consent-manager';
2
+ import { getMeasures, isNonNullable, log } from '@guardian/libs';
2
3
  import { EventTimer } from './event-timer.js';
3
4
  var Endpoints;
4
5
  (function (Endpoints) {
@@ -1,4 +1,5 @@
1
- import type { ConsentState, CountryCode } from '@guardian/libs';
1
+ import type { ConsentState } from '@guardian/consent-manager';
2
+ import type { CountryCode } from '@guardian/libs';
2
3
  import type { AdManagerGroup, Frequency } from './personalised.js';
3
4
  import type { SharedTargeting } from './shared.js';
4
5
  import { getLocalHour } from './shared.js';
@@ -1,4 +1,5 @@
1
- import { cmp, getConsentFor, getCookie, isString } from '@guardian/libs';
1
+ import { cmp, getConsentFor } from '@guardian/consent-manager';
2
+ import { getCookie, isString } from '@guardian/libs';
2
3
  import { supportsPerformanceAPI } from '../event-timer.js';
3
4
  import { getLocale } from '../geo/get-locale.js';
4
5
  import { getContentTargeting } from './content.js';
@@ -1,4 +1,4 @@
1
- import type { ConsentState, TCEventStatusCode } from '@guardian/libs';
1
+ import type { ConsentState, TCEventStatusCode } from '@guardian/consent-manager';
2
2
  import type { False, NotApplicable, True } from './types.js';
3
3
  declare const frequency: readonly ["0", "1", "2", "3", "4", "5", "6-9", "10-15", "16-19", "20-29", "30plus"];
4
4
  type Frequency = (typeof frequency)[number];
@@ -1,4 +1,4 @@
1
- import type { ConsentState } from '@guardian/libs';
1
+ import type { ConsentState } from '@guardian/consent-manager';
2
2
  import type { CustomParams } from './types.js';
3
3
  type BuildImaAdTagUrl = {
4
4
  adUnit: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/commercial-core",
3
- "version": "33.0.0",
3
+ "version": "34.0.0",
4
4
  "description": "Guardian advertising business logic",
5
5
  "homepage": "https://github.com/guardian/commercial#readme",
6
6
  "bugs": {
@@ -32,21 +32,23 @@
32
32
  "./package.json": "./package.json"
33
33
  },
34
34
  "peerDependencies": {
35
- "@guardian/libs": "^31.0.0"
35
+ "@guardian/libs": "^32.0.0",
36
+ "@guardian/consent-manager": "^1.0.0"
36
37
  },
37
38
  "dependencies": {
38
- "@guardian/libs": "31.0.0"
39
+ "@guardian/libs": "32.0.0",
40
+ "@guardian/consent-manager": "1.0.0"
39
41
  },
40
42
  "devDependencies": {
41
43
  "@guardian/ophan-tracker-js": "2.8.0",
42
44
  "@types/jest": "30.0.0",
43
- "@types/node": "25.4.0",
44
- "jest": "^30.3.0",
45
- "jest-environment-jsdom": "^30.3.0",
46
- "jest-environment-jsdom-global": "~4.0.0",
47
- "ts-jest": "^29.4.6",
45
+ "@types/node": "25.6.0",
46
+ "jest": "30.3.0",
47
+ "jest-environment-jsdom": "30.3.0",
48
+ "jest-environment-jsdom-global": "4.0.0",
49
+ "ts-jest": "29.4.9",
48
50
  "tsc-alias": "1.8.16",
49
- "type-fest": "^5.4.3",
51
+ "type-fest": "5.6.0",
50
52
  "typescript": "5.9.3"
51
53
  },
52
54
  "publishConfig": {