@guardian/commercial-core 5.0.1 → 5.1.1

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.
@@ -27,7 +27,7 @@ declare class AdSize extends Array<number> {
27
27
  get width(): number;
28
28
  get height(): number;
29
29
  }
30
- type SizeKeys = '160x600' | '300x1050' | '300x250' | '300x600' | '728x90' | '970x250' | 'billboard' | 'empty' | 'fabric' | 'fluid' | 'googleCard' | 'halfPage' | 'inlineMerchandising' | 'leaderboard' | 'merchandising' | 'merchandisingHigh' | 'merchandisingHighAdFeature' | 'mobilesticky' | 'mpu' | 'outOfPage' | 'outstreamDesktop' | 'outstreamGoogleDesktop' | 'outstreamMobile' | 'portrait' | 'skyscraper' | 'cascade';
30
+ type SizeKeys = '160x600' | '300x1050' | '300x250' | '300x600' | '728x90' | '970x250' | 'billboard' | 'cascade' | 'empty' | 'fabric' | 'fluid' | 'googleCard' | 'halfPage' | 'inlineMerchandising' | 'leaderboard' | 'merchandising' | 'merchandisingHigh' | 'merchandisingHighAdFeature' | 'mobilesticky' | 'mpu' | 'outOfPage' | 'outstreamDesktop' | 'outstreamGoogleDesktop' | 'outstreamMobile' | 'portrait' | 'portraitInterstitial' | 'skyscraper';
31
31
  type SlotName = 'right' | 'comments' | 'top-above-nav' | 'mostpop' | 'merchandising' | 'merchandising-high' | 'merchandising-high-lucky' | 'survey' | 'im' | 'inline' | 'mostpop' | 'comments' | 'top-above-nav' | 'carrot' | 'epic' | 'mobile-sticky' | 'crossword-banner' | 'exclusion';
32
32
  type SizeMapping = Partial<Record<Breakpoint, AdSize[]>>;
33
33
  type SlotSizeMappings = Record<SlotName, SizeMapping>;
@@ -61,6 +61,7 @@ const namedStandardAdSizes = {
61
61
  portrait: createAdSize(300, 1050),
62
62
  skyscraper: createAdSize(160, 600),
63
63
  cascade: createAdSize(940, 230),
64
+ portraitInterstitial: createAdSize(320, 480),
64
65
  };
65
66
  const standardAdSizes = {
66
67
  '970x250': namedStandardAdSizes.billboard,
@@ -77,11 +78,17 @@ const outstreamSizes = {
77
78
  outstreamMobile: createAdSize(300, 197),
78
79
  };
79
80
  exports.outstreamSizes = outstreamSizes;
80
- const dfpProprietaryAdSizes = {
81
+ /**
82
+ * Ad sizes commonly associated with third parties
83
+ */
84
+ const proprietaryAdSizes = {
81
85
  fluid: createAdSize(0, 0),
82
86
  googleCard: createAdSize(300, 274),
83
87
  outOfPage: createAdSize(1, 1),
84
88
  };
89
+ /**
90
+ * Ad sizes associated with in-house formats
91
+ */
85
92
  const guardianProprietaryAdSizes = {
86
93
  empty: createAdSize(2, 2),
87
94
  fabric: createAdSize(88, 71),
@@ -94,7 +101,7 @@ const adSizes = {
94
101
  ...namedStandardAdSizes,
95
102
  ...standardAdSizes,
96
103
  ...outstreamSizes,
97
- ...dfpProprietaryAdSizes,
104
+ ...proprietaryAdSizes,
98
105
  ...guardianProprietaryAdSizes,
99
106
  };
100
107
  exports.adSizes = adSizes;
@@ -112,6 +119,7 @@ const slotSizeMappings = {
112
119
  adSizes.mpu,
113
120
  adSizes.googleCard,
114
121
  adSizes.fluid,
122
+ adSizes.portraitInterstitial,
115
123
  ],
116
124
  phablet: [
117
125
  adSizes.outOfPage,
@@ -10,8 +10,9 @@ const findBreakpoint = (width) => {
10
10
  return 'mobile';
11
11
  };
12
12
  const getViewportTargeting = ({ viewPortWidth, cmpBannerWillShow, }) => {
13
- // Don’t show inskin if if a privacy message will be shown
14
- const inskin = cmpBannerWillShow ? 'f' : 't';
13
+ // Don’t show inskin if if a privacy message will be shown or on preview
14
+ const isPreview = window.guardian.config.page.isPreview;
15
+ const inskin = cmpBannerWillShow || isPreview ? 'f' : 't';
15
16
  return {
16
17
  bp: findBreakpoint(viewPortWidth),
17
18
  skinsize: viewPortWidth >= 1560 ? 'l' : 's',
@@ -32,16 +32,17 @@ export type GuardianWindowConfig = {
32
32
  googleAnalytics?: GuardianAnalyticsConfig;
33
33
  isDotcomRendering: boolean;
34
34
  ophan: {
35
- pageViewId: string;
36
35
  browserId?: string;
36
+ pageViewId: string;
37
37
  };
38
38
  page: {
39
- sharedAdTargeting?: Record<string, string | string[]>;
39
+ edition: Edition;
40
+ isPreview: boolean;
40
41
  isSensitive: boolean;
41
42
  pageId: string;
42
43
  section: string;
44
+ sharedAdTargeting?: Record<string, string | string[]>;
43
45
  videoDuration: number;
44
- edition: Edition;
45
46
  };
46
47
  tests?: {
47
48
  [key: `${string}Control`]: 'control';
@@ -27,7 +27,7 @@ declare class AdSize extends Array<number> {
27
27
  get width(): number;
28
28
  get height(): number;
29
29
  }
30
- type SizeKeys = '160x600' | '300x1050' | '300x250' | '300x600' | '728x90' | '970x250' | 'billboard' | 'empty' | 'fabric' | 'fluid' | 'googleCard' | 'halfPage' | 'inlineMerchandising' | 'leaderboard' | 'merchandising' | 'merchandisingHigh' | 'merchandisingHighAdFeature' | 'mobilesticky' | 'mpu' | 'outOfPage' | 'outstreamDesktop' | 'outstreamGoogleDesktop' | 'outstreamMobile' | 'portrait' | 'skyscraper' | 'cascade';
30
+ type SizeKeys = '160x600' | '300x1050' | '300x250' | '300x600' | '728x90' | '970x250' | 'billboard' | 'cascade' | 'empty' | 'fabric' | 'fluid' | 'googleCard' | 'halfPage' | 'inlineMerchandising' | 'leaderboard' | 'merchandising' | 'merchandisingHigh' | 'merchandisingHighAdFeature' | 'mobilesticky' | 'mpu' | 'outOfPage' | 'outstreamDesktop' | 'outstreamGoogleDesktop' | 'outstreamMobile' | 'portrait' | 'portraitInterstitial' | 'skyscraper';
31
31
  type SlotName = 'right' | 'comments' | 'top-above-nav' | 'mostpop' | 'merchandising' | 'merchandising-high' | 'merchandising-high-lucky' | 'survey' | 'im' | 'inline' | 'mostpop' | 'comments' | 'top-above-nav' | 'carrot' | 'epic' | 'mobile-sticky' | 'crossword-banner' | 'exclusion';
32
32
  type SizeMapping = Partial<Record<Breakpoint, AdSize[]>>;
33
33
  type SlotSizeMappings = Record<SlotName, SizeMapping>;
@@ -57,6 +57,7 @@ const namedStandardAdSizes = {
57
57
  portrait: createAdSize(300, 1050),
58
58
  skyscraper: createAdSize(160, 600),
59
59
  cascade: createAdSize(940, 230),
60
+ portraitInterstitial: createAdSize(320, 480),
60
61
  };
61
62
  const standardAdSizes = {
62
63
  '970x250': namedStandardAdSizes.billboard,
@@ -71,11 +72,17 @@ const outstreamSizes = {
71
72
  outstreamGoogleDesktop: createAdSize(550, 310),
72
73
  outstreamMobile: createAdSize(300, 197),
73
74
  };
74
- const dfpProprietaryAdSizes = {
75
+ /**
76
+ * Ad sizes commonly associated with third parties
77
+ */
78
+ const proprietaryAdSizes = {
75
79
  fluid: createAdSize(0, 0),
76
80
  googleCard: createAdSize(300, 274),
77
81
  outOfPage: createAdSize(1, 1),
78
82
  };
83
+ /**
84
+ * Ad sizes associated with in-house formats
85
+ */
79
86
  const guardianProprietaryAdSizes = {
80
87
  empty: createAdSize(2, 2),
81
88
  fabric: createAdSize(88, 71),
@@ -88,7 +95,7 @@ const adSizes = {
88
95
  ...namedStandardAdSizes,
89
96
  ...standardAdSizes,
90
97
  ...outstreamSizes,
91
- ...dfpProprietaryAdSizes,
98
+ ...proprietaryAdSizes,
92
99
  ...guardianProprietaryAdSizes,
93
100
  };
94
101
  /**
@@ -105,6 +112,7 @@ const slotSizeMappings = {
105
112
  adSizes.mpu,
106
113
  adSizes.googleCard,
107
114
  adSizes.fluid,
115
+ adSizes.portraitInterstitial,
108
116
  ],
109
117
  phablet: [
110
118
  adSizes.outOfPage,
@@ -7,8 +7,9 @@ const findBreakpoint = (width) => {
7
7
  return 'mobile';
8
8
  };
9
9
  const getViewportTargeting = ({ viewPortWidth, cmpBannerWillShow, }) => {
10
- // Don’t show inskin if if a privacy message will be shown
11
- const inskin = cmpBannerWillShow ? 'f' : 't';
10
+ // Don’t show inskin if if a privacy message will be shown or on preview
11
+ const isPreview = window.guardian.config.page.isPreview;
12
+ const inskin = cmpBannerWillShow || isPreview ? 'f' : 't';
12
13
  return {
13
14
  bp: findBreakpoint(viewPortWidth),
14
15
  skinsize: viewPortWidth >= 1560 ? 'l' : 's',
@@ -32,16 +32,17 @@ export type GuardianWindowConfig = {
32
32
  googleAnalytics?: GuardianAnalyticsConfig;
33
33
  isDotcomRendering: boolean;
34
34
  ophan: {
35
- pageViewId: string;
36
35
  browserId?: string;
36
+ pageViewId: string;
37
37
  };
38
38
  page: {
39
- sharedAdTargeting?: Record<string, string | string[]>;
39
+ edition: Edition;
40
+ isPreview: boolean;
40
41
  isSensitive: boolean;
41
42
  pageId: string;
42
43
  section: string;
44
+ sharedAdTargeting?: Record<string, string | string[]>;
43
45
  videoDuration: number;
44
- edition: Edition;
45
46
  };
46
47
  tests?: {
47
48
  [key: `${string}Control`]: 'control';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/commercial-core",
3
- "version": "5.0.1",
3
+ "version": "5.1.1",
4
4
  "description": "Guardian advertising business logic",
5
5
  "homepage": "https://github.com/guardian/commercial-core#readme",
6
6
  "bugs": {