Skip to content
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

Modularization #458

Merged
merged 97 commits into from
Jun 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
c61c0b3
[tools] modification of the rollup configuration
Jun 23, 2023
b2f40c4
[parser] Removing fectchVAST and getAndParseVAST methods from the vas…
Jun 23, 2023
6a73db8
adding new Fetcher class including the fetchVAST method
Jun 23, 2023
2acf7da
[client] changing get method to use fetchVAST method from the Fetcher…
Jun 23, 2023
6ec4bce
adding supported browsers list, modification of the entry point, and …
Jun 23, 2023
4d360bc
[parser] removing unnecessary comments
Jun 23, 2023
7e6f9f7
[client] add parseVAST method to be able to perform fetching from a g…
Jul 20, 2023
06f729a
[test] tests for the modularization
Jul 26, 2023
3d303d6
[test] moving mocha tests to jest
Aug 17, 2023
f6229fb
removing mocha command from package.json
Aug 17, 2023
8ccc8d5
[tools] Removing mocha
Aug 25, 2023
3c23daf
Removing unnecessary comment
Aug 25, 2023
f169bc5
[parser] checking Inline first to prevent VASTAdTagURI to be in the f…
Aug 29, 2023
f5a5575
[client] rootURL should be set when the first VAST is fetch
Aug 29, 2023
06be203
[tools] updating rollup config since there is no need to have one bun…
Aug 30, 2023
be2907f
[docs] WIP/modifying documentations for modularization
Aug 31, 2023
2c665d2
[docs] WIP/ updating documentations
Aug 31, 2023
41ae3a7
[docs] removing unnecessary documentation
Aug 31, 2023
33c34ef
[docs] updating docs
Aug 31, 2023
ae5f7ce
[docs] updating documentations
Sep 1, 2023
5f7ade1
[docs] updating README
Sep 1, 2023
a26ab51
[docs] updating README
Sep 4, 2023
fb4830c
[docs] updating readme
Sep 4, 2023
9cd9f7b
[test] updating vast version in tests files
Sep 12, 2023
5409cb6
[test] updating tests
Sep 12, 2023
33e0e79
[client] updating get method
Sep 12, 2023
1dbcc80
[parser] updating fetchingCallback
Sep 12, 2023
0ca5915
[tools] adding new command including --watch
Sep 12, 2023
a129967
[tools] replacing functions by arrow functions
Sep 12, 2023
f49be0c
[docs] updating documentations
Sep 12, 2023
8a43120
updating fetchVAST method
Sep 12, 2023
a54fc76
[test] removing console.log
Sep 12, 2023
7a1b823
[tests] removing unnecessary files related to mocha
Sep 12, 2023
4c31d60
minor code update
Sep 13, 2023
2b2869f
modifying fetchVAST jsdoc
Oct 4, 2023
ab8dba0
[test] removing duplicate complete key
Oct 4, 2023
a8bd502
[test] removing unused variables
Oct 4, 2023
74b3e1c
[doc] updating documentation
Oct 4, 2023
b41edc3
[test] correcting typo error
Oct 4, 2023
531ad8a
[docs] updating documentations
Oct 6, 2023
24b2c68
fix typo and update formatting
Oct 6, 2023
b68037b
[client] Pass fetcher as argument of VASTParser
Nov 6, 2023
c8b4f2c
[parser] add fetcher in the constructor
Nov 6, 2023
04c582f
updated comments and variables names
Nov 6, 2023
56ecbcc
[test] update tests cases
Nov 6, 2023
11e0876
minor code update
Nov 7, 2023
83f5464
remove unnecessary file in dist folder
Nov 7, 2023
83fae5b
wip/upgrating urlhandler
Sep 8, 2023
78eb751
[tools] modifying rollup configuration for node
Sep 13, 2023
554792c
upgrade urlhandler from XMLHttpRequest to fetch
Sep 13, 2023
fa2fe1e
[test] updating tests for new fetching method
Sep 13, 2023
5964765
removing file related to node urlhandler and modifications for new ur…
Sep 18, 2023
4b7f2a6
[test] modifying tests for new urlHandler
Sep 18, 2023
03d2545
[tools] removing unused import
Sep 18, 2023
0d1786b
[test] correcting vast sample and test
Sep 19, 2023
3822db7
fixing error handling
Sep 25, 2023
63cdae9
[test] fixing failing test
Oct 4, 2023
f6bd002
[test] fix inconsistent test
Oct 5, 2023
d2e9bde
[parser] Improving code readability
Sep 22, 2023
d62cde2
[parser] fix unparsed VerificationParameters
Oct 5, 2023
be09e55
[client] refactor constructor default values
Oct 5, 2023
a3a74d2
[test] adding tests for new error logs
Oct 4, 2023
817a8ac
[tracker] adding error logs in public methods
Oct 4, 2023
d65171d
[util] filtering url to return arrays of valid and unvalid url
Oct 4, 2023
412b1ef
[parser] adding error logs in case Wrapper or InLine node is malformed
Oct 4, 2023
3112014
[test] adding blockedAdCategories node to a sample file
Oct 4, 2023
e6b6354
fix bug where wrapper where not parsed if creatives node was missing …
Jan 24, 2024
af7bcc0
correct typos errors
Jan 25, 2024
c594041
adding raw xml to the object returned by the urlhandler
Jan 25, 2024
bf0e460
[test] fix inconsistent test
Jan 26, 2024
d470fd7
[test] fix comments related to tests
Mar 18, 2024
c359cad
[parser] fix comments related to the vastparser
Mar 18, 2024
904e794
create folder for fetching related file
Mar 18, 2024
49f2e8a
[tracker] fix comments related to vasttracker
Mar 18, 2024
c51abd4
[utils] add two utils function to check browser environment and forma…
Mar 18, 2024
b3b6822
[client] fix import
Mar 18, 2024
074067e
[doc] add doc for new error tracking
Mar 18, 2024
cf254d2
[tool] fix rollup configuration to handle dynamic imports and fix get…
Mar 18, 2024
bbd2fc4
[parser] fix comments related to parseWrapper function
Mar 18, 2024
fefb556
fix comments
Mar 22, 2024
89a6b39
add a full example with a player using the vast-client
Apr 9, 2024
cb49bb5
adding package.json
Apr 9, 2024
4d343b7
update readme + VAST url
Apr 9, 2024
0ce2697
fix comments
Apr 12, 2024
70dfd51
removing safe operator for codesandbox compatibility
Apr 12, 2024
918c7d3
Update README.md
Rapha0511 Apr 12, 2024
ba5bcd8
Merge pull request #467 from dailymotion/adding-error-logs
ZacharieTFR Apr 25, 2024
4bc57ca
fix lint and comments
Apr 26, 2024
1754223
fix comments
Apr 26, 2024
1381daf
changing fetchVAST method to async
May 6, 2024
f3b596c
fix lint
May 6, 2024
955ab7a
correct html , add h1, title and alt text for the image
May 6, 2024
c5f03f0
fix typo
Rapha0511 May 6, 2024
8adf88f
play event refactorization
May 28, 2024
feec407
add package-lock and modify gitignore
May 28, 2024
fe7172c
Merge pull request #470 from dailymotion/adding-vast-client-use-case-…
Rapha0511 Jun 27, 2024
c1c8b42
fix lint in examples/utils.js
Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[util] filtering url to return arrays of valid and unvalid url
  • Loading branch information
Raphael Levin committed Jan 26, 2024
commit d65171db77347133663142d2cc4c4e7223a167f6
35 changes: 24 additions & 11 deletions src/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,34 @@ function extractURLsFromTemplates(URLTemplates) {
}

/**
* Filter URLTemplates elements to keep only valid and safe URL templates.
* Filter URLTemplates elements .
* To be valid, urls should:
* - have the same protocol as the client
* or
* - be protocol-relative urls
*
* Returns an object with two arrays
* - validUrls : An array of valid URLs
* - invalidUrls: An array of invalid URLs
*
* @param {Array} URLTemplates - A Array of string/object containing urls templates.
* @returns {Object}
*
*/
function filterValidUrlTemplates(URLTemplates) {
if (Array.isArray(URLTemplates)) {
return URLTemplates.filter(urlTemplate => {
const url = urlTemplate.hasOwnProperty('url') ? urlTemplate.url : urlTemplate;
return isValidUrl(url);
})
}
return isValidUrl(URLTemplates);
function filterUrlTemplates(URLTemplates) {
return URLTemplates.reduce(
(acc, urlTemplate) => {
const url = urlTemplate.hasOwnProperty('url')
? urlTemplate.url
: urlTemplate;

let urlVerification = isValidUrl(url);

urlVerification ? acc.validUrls.push(url) : acc.unvalidUrls.push(url);
return acc;
},
{ validUrls: [], unvalidUrls: [] }
);
}

function isValidUrl(url) {
Expand Down Expand Up @@ -251,14 +263,14 @@ function joinArrayOfUniqueTemplateObjs(arr1 = [], arr2 = []) {
* @return {Boolean}
*/
function isValidTimeValue(time) {
return Number.isFinite(time) && time >= -2
return Number.isFinite(time) && time >= -2;
}

export const util = {
track,
resolveURLTemplates,
extractURLsFromTemplates,
filterValidUrlTemplates,
filterUrlTemplates,
containsTemplateObject,
isTemplateObjectEqual,
encodeURIComponentRFC3986,
Expand All @@ -268,4 +280,5 @@ export const util = {
joinArrayOfUniqueTemplateObjs,
isValidTimeValue,
addLeadingZeros,
isValidUrl,
};