New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing node to the parsing #444
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, thanks for your work👍 I left some comments
docs/api/vast-parser.md
Outdated
|
||
### parseDuration(duration) | ||
|
||
Parses a duration in the format `HH:MM:SS`, `HH:MM:SS.mmm` or `SS` and returns a duration in seconds. | ||
|
||
```javascript | ||
|
||
const a = parseDuration('00:01:30.000'); | ||
console.log(a); // output: 90 | ||
|
||
const b = parseDuration('30'); | ||
console.log(b); // output: 30 | ||
|
||
const c = parseDuration(30); | ||
console.log(c); // output: 30 | ||
|
||
const d = parseDuration('thirty'); | ||
console.log(d); // output -1 | ||
|
||
``` | ||
|
||
#### Parameter | ||
|
||
- **`duration: String`** - The duration represented as a string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should move this to the public methods section above
spec/parser_utils.spec.js
Outdated
type: 'image/jpeg', | ||
staticResource: 'link', | ||
htmlResource: | ||
'<!DOCTYPE html>\r\n <html lang="en">\r\n <head>\r\n <meta charset="UTF-8">\r\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\r\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\r\n <title>Document</title>\r\n </head>\r\n <body>\r\n <h1>titre</h1>\r\n </body>\r\n </html>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you replace the htmlResource with a dummy value to make it easier to read ?
spec/parser_utils.spec.js
Outdated
type: 'image/jpeg', | ||
staticResource: 'link', | ||
htmlResource: | ||
'<!DOCTYPE html>\r\n <html lang="en">\r\n <head>\r\n <meta charset="UTF-8">\r\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\r\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\r\n <title>Document</title>\r\n </head>\r\n <body>\r\n <h1>titre</h1>\r\n </body>\r\n </html>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
src/parser/creative_linear_parser.js
Outdated
) | ||
.forEach((iconClickFallbackImageElement, id) => { | ||
icon.iconClickFallbackImages.push({ | ||
id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why adding the id
attribute ? As there is no reference to it in the VAST specs
docs/api/class-reference.md
Outdated
## iconClickFallbackImages <a name="iconclickfallbackimages"></a> | ||
|
||
- `id: Number` | ||
- `url: String` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missleading as iconClickFallbackImages is an array and the object correspond to the iconClickFallbackImage
(singular)
Also, can the url equal to null or will it be an empty string ?
spec/samples/creatives.js
Outdated
<IconClickFallbackImages> | ||
<IconClickFallbackImage width="10px" height="10px"> | ||
<![CDATA[http://adserver.com/fallback.png]]> | ||
</IconClickFallbackImage> | ||
</IconClickFallbackImages> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need a use case with multiple to fully cover use cases
docs/api/class-reference.md
Outdated
## adParameters<a name="adparameters"></a> | ||
|
||
- `value: String` | ||
- `xmlEncoded: String|null` | ||
|
||
## survey<a name="survey"></a> | ||
|
||
- `value: String` | ||
- `type: String|null` | ||
|
||
## iconClickFallbackImage <a name="iconclickfallbackimage"></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To stay coherent with other sections can you put titles in uppercase ? 🙏
src/parser/vast_parser.js
Outdated
@@ -27,6 +27,7 @@ export class VASTParser extends EventEmitter { | |||
constructor() { | |||
super(); | |||
|
|||
this.parseDuration = parserUtils.parseDuration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One discutions we had about exposing/exporting util functions is that we can either do like you did but then we need to create a new instance of vastParser otherwise the second solution would be to export utils function as a standalone then we could use it without creating a new instance and in addition if we don't use it we could benefit from tree-shaking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! Just a small nitpicking
docs/api/vast-parser.md
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too many breaklines here 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! Great work !
Description
The
mergeWrapperAdData
function has been modified to keep track of the <icon> elements contained in a wrapper's creative. If a creative contain <icon>, the whole creative will be included in the final response.Since the VASTTracker allow users to convert seconds to timecode with the
convertToTimecode
function, theparseDuration
function has been exposed publicly as a VASTParser method to allow users to convert timecode to seconds if neededxmlEncoded is now considered as an attribute of the <adParameters> node, instead of a node by itself. The value of <adParameters> is now an Object of type
{value: String, xmlEncoded: String}
.The type attribute of the <survey> node has been added to the parsing. The value of survey is now an Object of type
{value: String, type: String}
.<iconClickFallbackImages> node has been added to the parsing as an array of Object of type
{url: String, width: String, height: String}
.Tests have been added for changes and the addition of the missing nodes. Some of them have been moved from Mocha to Jest
For companions, the parameter
adSlotID
has been modified toadSlotId
to follow the VAST specsVAST 4.3 features
Type