@guardian/commercial-core 0.35.0 → 0.36.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.
- package/dist/cjs/ad-sizes.d.ts +2 -0
- package/dist/cjs/ad-sizes.js +7 -1
- package/dist/esm/ad-sizes.d.ts +2 -0
- package/dist/esm/ad-sizes.js +5 -0
- package/package.json +1 -1
package/dist/cjs/ad-sizes.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ export declare type AdSize = Readonly<{
|
|
|
4
4
|
height: number;
|
|
5
5
|
toString: () => AdSizeString;
|
|
6
6
|
}>;
|
|
7
|
+
export declare type AdSizeTuple = [width: number, height: number];
|
|
7
8
|
export declare type SizeKeys = 'billboard' | 'leaderboard' | 'mpu' | 'halfPage' | 'portrait' | 'skyscraper' | 'mobilesticky' | 'fluid' | 'outOfPage' | 'googleCard' | 'video' | 'outstreamDesktop' | 'outstreamGoogleDesktop' | 'outstreamMobile' | 'merchandisingHighAdFeature' | 'merchandisingHigh' | 'merchandising' | 'inlineMerchandising' | 'fabric' | 'empty' | '970x250' | '728x90' | '300x250' | '300x600' | '300x1050' | '160x600';
|
|
8
9
|
export declare const adSizes: Record<SizeKeys, AdSize>;
|
|
10
|
+
export declare const getTuple: (size: SizeKeys) => AdSizeTuple;
|
|
9
11
|
export declare const _: {
|
|
10
12
|
getAdSize: (width: number, height: number) => AdSize;
|
|
11
13
|
};
|
package/dist/cjs/ad-sizes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._ = exports.adSizes = void 0;
|
|
3
|
+
exports._ = exports.getTuple = exports.adSizes = void 0;
|
|
4
4
|
const getAdSize = (width, height) => {
|
|
5
5
|
const toString = () => width === 0 && height === 0 ? 'fluid' : `${width},${height}`;
|
|
6
6
|
return Object.freeze({
|
|
@@ -43,5 +43,11 @@ exports.adSizes = {
|
|
|
43
43
|
'300x1050': adSizesPartial.portrait,
|
|
44
44
|
'160x600': adSizesPartial.skyscraper,
|
|
45
45
|
};
|
|
46
|
+
const getTuple = (size) => {
|
|
47
|
+
const { width, height } = exports.adSizes[size];
|
|
48
|
+
const tuple = [width, height];
|
|
49
|
+
return tuple;
|
|
50
|
+
};
|
|
51
|
+
exports.getTuple = getTuple;
|
|
46
52
|
// Export for testing
|
|
47
53
|
exports._ = { getAdSize };
|
package/dist/esm/ad-sizes.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ export declare type AdSize = Readonly<{
|
|
|
4
4
|
height: number;
|
|
5
5
|
toString: () => AdSizeString;
|
|
6
6
|
}>;
|
|
7
|
+
export declare type AdSizeTuple = [width: number, height: number];
|
|
7
8
|
export declare type SizeKeys = 'billboard' | 'leaderboard' | 'mpu' | 'halfPage' | 'portrait' | 'skyscraper' | 'mobilesticky' | 'fluid' | 'outOfPage' | 'googleCard' | 'video' | 'outstreamDesktop' | 'outstreamGoogleDesktop' | 'outstreamMobile' | 'merchandisingHighAdFeature' | 'merchandisingHigh' | 'merchandising' | 'inlineMerchandising' | 'fabric' | 'empty' | '970x250' | '728x90' | '300x250' | '300x600' | '300x1050' | '160x600';
|
|
8
9
|
export declare const adSizes: Record<SizeKeys, AdSize>;
|
|
10
|
+
export declare const getTuple: (size: SizeKeys) => AdSizeTuple;
|
|
9
11
|
export declare const _: {
|
|
10
12
|
getAdSize: (width: number, height: number) => AdSize;
|
|
11
13
|
};
|
package/dist/esm/ad-sizes.js
CHANGED
|
@@ -40,5 +40,10 @@ export const adSizes = {
|
|
|
40
40
|
'300x1050': adSizesPartial.portrait,
|
|
41
41
|
'160x600': adSizesPartial.skyscraper,
|
|
42
42
|
};
|
|
43
|
+
export const getTuple = (size) => {
|
|
44
|
+
const { width, height } = adSizes[size];
|
|
45
|
+
const tuple = [width, height];
|
|
46
|
+
return tuple;
|
|
47
|
+
};
|
|
43
48
|
// Export for testing
|
|
44
49
|
export const _ = { getAdSize };
|