@denimlabs/fb-position-validation
Advanced tools
Comparing version 1.0.17 to 1.0.18
@@ -13,3 +13,3 @@ "use strict"; | ||
var VALID_DEVICE_PLATFORMS = ['mobile', 'desktop']; | ||
var VALID_FACEBOOK_POSITIONS = ['feed', 'instant_article', 'instream_video', 'marketplace', 'right_hand_column', 'suggested_video', 'story']; | ||
var VALID_FACEBOOK_POSITIONS = ['feed', 'instant_article', 'instream_video', 'marketplace', 'right_hand_column', 'video_feeds', 'story']; | ||
var VALID_PUBLISHER_PLATFORMS = ['facebook', 'instagram', 'messenger', 'audience_network']; | ||
@@ -49,3 +49,3 @@ var VALID_INSTAGRAM_POSTIONS = ['story', 'stream']; | ||
publisher_platforms: ['facebook', 'instagram', 'audience_network', 'messenger'], | ||
facebook_positions: ['feed', 'instant_article', 'suggested_video', 'story', 'instream_video'], | ||
facebook_positions: ['feed', 'instant_article', 'video_feeds', 'story', 'instream_video'], | ||
instagram_positions: ['stream'], | ||
@@ -59,3 +59,3 @@ audience_network_positions: ['classic', 'instream_video'], | ||
publisher_platforms: ['facebook', 'instagram', 'messenger'], | ||
facebook_positions: ['feed', 'instant_article', 'suggested_video', 'marketplace', 'story', 'instream_video'], | ||
facebook_positions: ['feed', 'instant_article', 'video_feeds', 'marketplace', 'story', 'instream_video'], | ||
instagram_positions: ['story', 'stream'], | ||
@@ -134,3 +134,5 @@ audience_network_positions: [], | ||
if (facebook_positions.includes('feed') || instagram_positions.includes('story')) { | ||
if ((device_platforms || []).length === 0 || device_platforms.includes('mobile')) {} else { | ||
if ((device_platforms || []).length === 0 || device_platforms.includes('mobile')) { | ||
return true; | ||
} else { | ||
throw ERRORS.STORY_DEVICE; | ||
@@ -168,2 +170,6 @@ } | ||
} | ||
if (instagram_positions.includes('stream') && instagram_positions.includes('story')) { | ||
throw ERRORS.INSTAGRAM_STORY_STREAM; | ||
} | ||
} | ||
@@ -202,2 +208,6 @@ | ||
} | ||
if ((publisher_platforms || []).length > 0 && !publisher_platforms.includes('facebook')) { | ||
throw ERRORS.PUBLISHER_PLATFORMS_FACEBOOK; | ||
} | ||
} | ||
@@ -204,0 +214,0 @@ |
33
index.js
@@ -13,3 +13,3 @@ // Optional | ||
'right_hand_column', | ||
'suggested_video', | ||
'video_feeds', | ||
'story' | ||
@@ -123,3 +123,3 @@ ] | ||
'instant_article', | ||
'suggested_video', | ||
'video_feeds', | ||
'story', | ||
@@ -141,3 +141,3 @@ 'instream_video' | ||
'instant_article', | ||
'suggested_video', | ||
'video_feeds', | ||
'marketplace', | ||
@@ -282,8 +282,8 @@ 'story', | ||
} | ||
// if ( | ||
// instagram_positions.includes('stream') && | ||
// instagram_positions.includes('story') | ||
// ) { | ||
// throw ERRORS.INSTAGRAM_STORY_STREAM | ||
// } | ||
if ( | ||
instagram_positions.includes('stream') && | ||
instagram_positions.includes('story') | ||
) { | ||
throw ERRORS.INSTAGRAM_STORY_STREAM | ||
} | ||
} | ||
@@ -343,11 +343,8 @@ // END VALIDATE Instagram Positions | ||
// Removing this. misunderstood the docs. The validation that needs to happen is that publisher_platforms must | ||
// include facebook IF facebook_positions are selected, but we ensure that anyways so I will just comment this | ||
// out and fix any tests. 01-03-19 MWC | ||
// if ( | ||
// (publisher_platforms || []).length > 0 && | ||
// !publisher_platforms.includes('facebook') | ||
// ) { | ||
// throw ERRORS.PUBLISHER_PLATFORMS_FACEBOOK | ||
// } | ||
if ( | ||
(publisher_platforms || []).length > 0 && | ||
!publisher_platforms.includes('facebook') | ||
) { | ||
throw ERRORS.PUBLISHER_PLATFORMS_FACEBOOK | ||
} | ||
} | ||
@@ -354,0 +351,0 @@ |
@@ -25,3 +25,3 @@ import { | ||
"instant_article", | ||
"suggested_video", | ||
"video_feeds", | ||
"story", | ||
@@ -55,3 +55,3 @@ "instream_video", | ||
"instant_article", | ||
"suggested_video", | ||
"video_feeds", | ||
"marketplace", | ||
@@ -91,3 +91,3 @@ "story", | ||
"right_hand_column", | ||
"suggested_video", | ||
"video_feeds", | ||
"story", | ||
@@ -235,7 +235,7 @@ ], | ||
// expect(() => | ||
// validatePositioningRules({ | ||
// publisher_platforms: ['instagram'] | ||
// }) | ||
// ).toThrowError(ERRORS.PUBLISHER_PLATFORMS_FACEBOOK) | ||
expect(() => | ||
validatePositioningRules({ | ||
publisher_platforms: ['instagram'] | ||
}) | ||
).toThrowError(ERRORS.PUBLISHER_PLATFORMS_FACEBOOK) | ||
@@ -270,2 +270,8 @@ expect(() => | ||
validatePositioningRules({ | ||
instagram_positions: ['story', 'stream'] | ||
}) | ||
).toThrowError(ERRORS.INSTAGRAM_STORY_STREAM) | ||
expect(() => | ||
validatePositioningRules({ | ||
instagram_positions: ['story', 'feed'] | ||
@@ -363,3 +369,3 @@ }) | ||
'instant_article', | ||
'suggested_video', | ||
'video_feeds', | ||
'instream_video', | ||
@@ -366,0 +372,0 @@ 'right_hand_column', |
{ | ||
"name": "@denimlabs/fb-position-validation", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"description": "Validate facebook positions against denim campaign objectives.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -18,3 +18,3 @@ # fb-position-validation | ||
'feed', | ||
'suggested_video', | ||
'video_feeds', | ||
'instant_article', | ||
@@ -21,0 +21,0 @@ 'instream_video', |
Sorry, the diff of this file is not supported yet
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
63654
999