Skip to content

Commit

Permalink
Merge pull request #94 from MisterPhilip/development
Browse files Browse the repository at this point in the history
v1.13.1
  • Loading branch information
MisterPhilip authored Dec 5, 2019
2 parents 9b0685c + 6cac321 commit 5f058d2
Show file tree
Hide file tree
Showing 12 changed files with 1,202 additions and 38 deletions.
56 changes: 29 additions & 27 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals module, require */
module.exports = function(grunt) {
module.exports = function (grunt) {

grunt.config.init({
"extension": {
Expand All @@ -12,7 +12,7 @@ module.exports = function(grunt) {
},
"production": {
"name": "Omnibug",
"version": "1.13.0",
"version": "1.13.1",
"storageKey": "omnibug",
"feedbackUrl": "https://omnibug.io/feedback",
"analyticsID": "UA-114343677-2"
Expand Down Expand Up @@ -148,14 +148,14 @@ module.exports = function(grunt) {

grunt.registerTask("build-beta", "Build the beta version", (browsers = "") => {
let allowedBrowsers = ["chrome", "firefox"];
if(browsers === "") {
if (browsers === "") {
browsers = allowedBrowsers;
} else {
browsers = browsers.split(",");
}
grunt.task.run("build-providers");
browsers.forEach((b) => {
if(allowedBrowsers.indexOf(b) > -1) {
if (allowedBrowsers.indexOf(b) > -1) {
grunt.task.run(
"clean:" + b + ":beta",
"sass",
Expand All @@ -174,14 +174,14 @@ module.exports = function(grunt) {

grunt.registerTask("build-production", "Build the extensions", (browsers = "") => {
let allowedBrowsers = ["chrome", "firefox"];
if(browsers === "") {
if (browsers === "") {
browsers = allowedBrowsers;
} else {
browsers = browsers.split(",");
}
grunt.task.run("build-providers");
browsers.forEach((b) => {
if(allowedBrowsers.indexOf(b) > -1) {
if (allowedBrowsers.indexOf(b) > -1) {
grunt.task.run(
"clean:" + b + ":production",
"sass",
Expand All @@ -197,7 +197,7 @@ module.exports = function(grunt) {
});
});

grunt.registerTask("chrome-manifest", "Build the Chrome manifest.json file", function(version = "production") {
grunt.registerTask("chrome-manifest", "Build the Chrome manifest.json file", function (version = "production") {
grunt.config.requires(`extension.${version}.version`);

let browserOptions = grunt.config("chrome"),
Expand All @@ -215,7 +215,7 @@ module.exports = function(grunt) {
grunt.log.write("Created Chrome's manifest.json. ").ok();
});

grunt.registerTask("firefox-manifest", "Build the Firefox manifest.json file", function(version = "production") {
grunt.registerTask("firefox-manifest", "Build the Firefox manifest.json file", function (version = "production") {
grunt.config.requires(`extension.${version}.version`, "firefox.gecko");

let browserOptions = grunt.config("firefox"),
Expand All @@ -235,7 +235,7 @@ module.exports = function(grunt) {
grunt.log.write("Created Firefox's manifest.json. ").ok();
});

grunt.registerTask("build-copy", "Copy over the source files to the build directory", function(browser) {
grunt.registerTask("build-copy", "Copy over the source files to the build directory", function (browser) {
grunt.config.requires(browser);
let options = grunt.config(browser),
filesToCopy = ["eventPage.js", "providers.js", "options/*.*", "devtools/*.*", "assets/**", "libs/*.*", "!libs/OmnibugTracker.*", "popup/*.*", "!**/*.scss", "!assets/styles/**"],
Expand All @@ -244,11 +244,11 @@ module.exports = function(grunt) {
cwd: "src/libs/",
src: [],
dest: "./platform/" + options.folder + "/libs",
rename: function(path, name) {
rename: function (path, name) {
return path + "/OmnibugTracker.js";
}
};
if(options.tracking) {
if (options.tracking) {
trackingLib.src.push("OmnibugTracker.js");
} else {
trackingLib.src.push("OmnibugTracker.disabled.js");
Expand All @@ -263,11 +263,12 @@ module.exports = function(grunt) {
dest: "./platform/" + options.folder
},
trackingLib
]});
]
});
grunt.task.run("copy:" + browser);
});

grunt.registerTask("build-concat", "Concat build files for a browser", function(browser) {
grunt.registerTask("build-concat", "Concat build files for a browser", function (browser) {
grunt.config.requires(browser);
let options = grunt.config(browser);
let destFiles = {},
Expand All @@ -282,7 +283,7 @@ module.exports = function(grunt) {
grunt.task.run("concat:" + browser);
});

grunt.registerTask("build-placeholders", "Update placeholders in built files", function(browser, version = "production") {
grunt.registerTask("build-placeholders", "Update placeholders in built files", function (browser, version = "production") {
grunt.config.requires(browser, `extension.${version}`);
let browserOptions = grunt.config(browser),
extensionOptions = grunt.config(`extension.${version}`),
Expand Down Expand Up @@ -328,7 +329,7 @@ module.exports = function(grunt) {
grunt.task.run("replace:" + browser);
});

grunt.registerTask("build-compress", "Compress build files into extension .zip", function(browser, version = "production") {
grunt.registerTask("build-compress", "Compress build files into extension .zip", function (browser, version = "production") {
grunt.config.requires(browser, `extension.${version}`);
let options = grunt.config(browser),
extensionOptions = grunt.config(`extension.${version}`);
Expand All @@ -349,7 +350,7 @@ module.exports = function(grunt) {
grunt.task.run("compress:" + browser);
});

grunt.registerTask("build-test-files", "Build everything for testing", function() {
grunt.registerTask("build-test-files", "Build everything for testing", function () {

grunt.config.set("concat.test-port", {
"options": {
Expand Down Expand Up @@ -404,15 +405,15 @@ module.exports = function(grunt) {
*/
grunt.config.set("concat.providers-test-individual", {
"options": {
"banner": "const { URL } = require(\"url\");\n" +
"const URLSearchParams = require(\"@ungap/url-search-params\");\n",
"process": function(source, filepath) {
"banner": "const { URL } = require(\"url\");\n" +
"const URLSearchParams = require(\"@ungap/url-search-params\");\n",
"process": function (source, filepath) {
var className = filepath.replace("./src/providers/", "").split(".")[0],
exportString = "";
if(className === "OmnibugProvider") {
if (className === "OmnibugProvider") {
source = `const BaseProvider = require("./BaseProvider.js").default;\n` + source;
source = source.replace("var OmnibugProvider", "export var OmnibugProvider");
} else if(className === "BaseProvider") {
} else if (className === "BaseProvider") {
// do nothing for now
} else {
className += "Provider";
Expand Down Expand Up @@ -446,15 +447,15 @@ module.exports = function(grunt) {
// Load our providers into OmnibugProvider
let providerInclude = [];
providers.forEach((provider) => {
if(["OmnibugProvider", "BaseProvider"].indexOf(provider) === -1) {
if (["OmnibugProvider", "BaseProvider"].indexOf(provider) === -1) {
providerInclude.push(`OmnibugProvider.addProvider(new ${provider}());`);
}
});

grunt.config.set("concat.providers-test", {
"options": {
"banner": "const { URL } = require(\"url\");\n" +
"var URLSearchParams = require(\"@ungap/url-search-params\");\n",
"banner": "const { URL } = require(\"url\");\n" +
"var URLSearchParams = require(\"@ungap/url-search-params\");\n",
"footer": `\n${providerInclude.join("\n")}\nexport { OmnibugProvider };`
},
"files": {
Expand All @@ -463,7 +464,8 @@ module.exports = function(grunt) {
sourceBasePath + "OmnibugProvider.js",
sourceBasePath + "*.js",
ignoreFile
]}
]
}
});

grunt.task.run(["clean:test", "concat:providers-test", "concat:providers-test-individual", "concat:test-port", "concat:test-settings", "concat:test-helpers", "concat:test-tracker"]);
Expand All @@ -474,7 +476,7 @@ module.exports = function(grunt) {
*
* This will build the providers for use within the plugin, NOT for testing
*/
grunt.registerTask("build-providers", "Combine providers into a single file", function() {
grunt.registerTask("build-providers", "Combine providers into a single file", function () {
grunt.task.run("clean:providers");

const sourceBasePath = "./src/providers/",
Expand All @@ -489,7 +491,7 @@ module.exports = function(grunt) {
// Load our providers into OmnibugProvider
let providerInclude = [];
providers.forEach((provider) => {
if(["OmnibugProvider", "BaseProvider"].indexOf(provider) === -1) {
if (["OmnibugProvider", "BaseProvider"].indexOf(provider) === -1) {
providerInclude.push(`OmnibugProvider.addProvider(new ${provider}());`);
}
});
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "omnibug",
"version": "1.13.0",
"version": "1.13.1",
"description": "Omnibug Extension",
"main": "Gruntfile.js",
"scripts": {
Expand Down Expand Up @@ -132,4 +132,4 @@
"node": ">=10.0.0",
"npm": ">=6.0.0"
}
}
}
Binary file added src/assets/images/icons/MATOMO16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/icons/PIWIKPRO16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/styles/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ $icons: (
"Google Ads": $iconPath + "GOOGLEADS16x16.png",
"Google DoubleClick": $iconPath + "DOUBLECLICK16x16.png",
"Google Tag Manager": $iconPath + "GOOGLETAGMANAGER16x16.png",
"Matomo": $iconPath + "MATOMO16x16.png",
"Mparticle": $iconPath + "MPARTICLE16x16.png",
"Optimizely X": $iconPath + "OPTIMIZELY16x16.png",
"Piwik PRO": $iconPath + "PIWIKPRO16x16.png",
"Piwik PRO Tag Manager": $iconPath + "PIWIKPRO16x16.png",
"Segment": $iconPath + "SEGMENT16x16.png",
"Tealium IQ": $iconPath + "TEALIUM16x16.png",
"Universal Analytics": $iconPath + "GOOGLEANALYTICS16x16.png",
Expand Down
17 changes: 10 additions & 7 deletions src/providers/Matomo.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class MatomoProvider extends BaseProvider {
"name": "Latitude",
"group": "general"
},
"lat": {
"long": {
"name": "Longitude",
"group": "general"
},
Expand Down Expand Up @@ -383,10 +383,6 @@ class MatomoProvider extends BaseProvider {
"ma_se": {
"name": "Media Positions Played",
"group": "media"
},
"ma_fs": {
"name": "Fullscreen Media",
"group": "media"
}
};
}
Expand Down Expand Up @@ -470,6 +466,7 @@ class MatomoProvider extends BaseProvider {
if (_cvar) {
try {
let customVars = JSON.parse(_cvar);
/* istanbul ignore else: do nothing when it's null/empty */
if (typeof customVars === "object" && customVars) {
Object.entries(customVars).forEach(([key, [name, value]]) => {
results.push({
Expand All @@ -486,7 +483,7 @@ class MatomoProvider extends BaseProvider {
})
}
} catch (e) {
// do nothing
/* istanbul ignore next: push the full value to the key */
results.push({
"key": "_cvar",
"field": "Custom Variables",
Expand All @@ -500,6 +497,7 @@ class MatomoProvider extends BaseProvider {
if (ec_items) {
try {
let products = JSON.parse(ec_items);
/* istanbul ignore else: do nothing when it's null/empty */
if (typeof products === "object" && products.length) {
products.forEach(([sku, name, category, price, qty], i) => {
let j = i + 1;
Expand Down Expand Up @@ -532,7 +530,7 @@ class MatomoProvider extends BaseProvider {
})
}
} catch (e) {
// do nothing
/* istanbul ignore next: push the full value to the key */
results.push({
"key": "ec_items",
"field": "Products",
Expand All @@ -555,7 +553,12 @@ class MatomoProvider extends BaseProvider {
requestType = "Download Click";
} else if (params.get("c_i")) {
requestType = "Content Interaction";
} else if (params.get("e_c")) {
requestType = "Custom Event"
} else if (params.get("ping")) {
requestType = "Ping";
}

results.push({
"key": "requestType",
"value": requestType,
Expand Down
Loading

0 comments on commit 5f058d2

Please sign in to comment.