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

Patch 1 #13

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 12 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
"store": "0.x"
},
"billingOptions": {
"free": true,
"termsURL": "https://oct8ne.com/terms-of-service/",
"support": {
"url": "https://oct8ne.com/faqs/"
}
"url": "https://oct8ne.com/terms-of-service/"
},
"type": "free",
"availableCountries": [
"*"
]
},
"dependencies": {
"vtex.pixel-interfaces": "1.x"
Expand Down Expand Up @@ -46,6 +48,12 @@
"EU",
"USA"
]
},
"oct8neAppUrl": {
"title": "Oct8ne app url",
"description": "Enter the url to read the oct8ne app script from",
"default": "https://ecommerceproxy-cdn.oct8ne.com/scripts/vtexio/oct8neApp.js",
"type": "string"
}
}
},
Expand Down
75 changes: 26 additions & 49 deletions pixel/body.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,34 @@
<!-- GLOBAL VARIABLES AND CORE STUFF =========================================== -->
<script type="text/javascript">
(function() {
// Create global variable for oct8ne and integration variable
window.oct8neVtex = { cart: {} };
window.oct8neVtex.enableLogs = false;

// Some helper methods
window.oct8neVtex.log = function (message) {
if (window.oct8neVtex.enableLogs === false) return;
console.log(message);
};
})();
</script>

<!-- OCT8NE SCRIPT =========================================== -->
<script type="text/javascript">
console.log('Loading oct8ne script');
(function() {
(function name(params) {
// Validate inputs
var licenseId = "{{settings.licenseId}}";
if (typeof licenseId !== 'string' || licenseId === '') throw 'Oct8ne app: licenseId must be provided and must be a non empty string'

var baseUrl = "{{settings.baseUrl}}";
if (typeof baseUrl !== 'string' || baseUrl === '') throw 'Oct8ne app: baseUrl must be provided and must be a non empty string'
baseUrl = decodeURIComponent(baseUrl);

var server = "{{settings.server}}";
var actualBaseUrl = decodeURIComponent(baseUrl);
var actualServer = decodeURIComponent(server);
var locale = document.querySelector('html').lang;
var isEu = server.includes('-eu');
var srcStaticPart = isEu ? "static-eu.oct8ne.com" : "static.oct8ne.com";
var src = (document.location.protocol == "https:" ? "https://" : "http://") + srcStaticPart + "/api/v2/oct8ne-api-2.3.js?" + (Math.round(new Date().getTime() / 86400000));
if (typeof server !== 'string' || server === '' ) throw 'Oct8ne app: server must be provided and must be a non empty string'
server = decodeURIComponent(server);

// For debugging purposes - remove when done =====================================
//actualServer = "localhost:44348/";
//src = (document.location.protocol == "https:" ? "https://" : "http://") + "localhost:44348/api/source/js/api/v2/2.3/debug/oct8ne-api-V2.3.js?" + (Math.round(new Date().getTime() / 86400000));
// For debugging purposes - remove when done =====================================
var oct8neAppUrl = "{{settings.oct8neAppUrl}}";
if (typeof oct8neAppUrl !== 'string' || oct8neAppUrl === '' ) throw 'Oct8ne app: oct8neAppUrl must be provided and must be a non empty string'
oct8neAppUrl = decodeURIComponent(oct8neAppUrl);

if (!licenseId) {
console.error('Warning: No Oct8ne License ID is defined. Please configure it in the apps admin');
return;
}
// Prepare oct8ne app options
window.oct8neAppOptions = { licenseId, baseUrl, server, oct8neAppUrl}

var oct8ne = document.createElement("script");
oct8ne.type = "text/javascript";
oct8ne.async = true;
oct8ne.id = 'vtexio_app_oct8neScript';
oct8ne.platform = "vtexio";
oct8ne.apiVersion = "2.4";
oct8ne.server = actualServer;
oct8ne.license = licenseId;
oct8ne.locale = locale;
oct8ne.baseUrl = actualBaseUrl;
oct8ne.src = src;
oct8ne.options = { vtexioInfo: { } };
// Prepare src
var separator = "?";
if (window.oct8neAppOptions.oct8neAppUrl.indexOf('?') > -1 ) separator = '&';
var cacheReload = 'v=' + (Math.round(new Date().getTime() / 86400000));// To make sure it is not cache for more than 24h
var src = window.oct8neAppOptions.oct8neAppUrl + separator + cacheReload;

var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(oct8ne, s);
window.oct8ne = oct8ne;
})();
</script>
// Load script in dom
var scriptTag = document.createElement('script');
scriptTag.type = "text/javascript";
scriptTag.src = src;
document.body.append(scriptTag)
}());
</script>
47 changes: 0 additions & 47 deletions public/metadata/en-US/full_description.txt

This file was deleted.

2 changes: 0 additions & 2 deletions public/metadata/en-US/short_description.txt

This file was deleted.

48 changes: 0 additions & 48 deletions public/metadata/es-AR/full_description.txt

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions public/metadata/es-AR/short_description.txt

This file was deleted.

File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading