@vgs/collect-js
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -5,4 +5,2 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
require('core-js/modules/es.object.to-string.js'); | ||
@@ -13,3 +11,2 @@ require('core-js/modules/es.promise.js'); | ||
require('core-js/modules/es.object.assign.js'); | ||
var axios = _interopDefault(require('axios')); | ||
var uuid = require('uuid'); | ||
@@ -126,10 +123,9 @@ require('core-js/modules/es.regexp.exec.js'); | ||
} | ||
axios({ | ||
fetch(VGS_COLLECT_KEEPER + "/vgs", { | ||
method: 'POST', | ||
url: VGS_COLLECT_KEEPER + "/vgs", | ||
data: payload | ||
body: payload | ||
}).then(function () { | ||
return true; | ||
})["catch"](function () { | ||
return; | ||
return true; | ||
}); | ||
@@ -136,0 +132,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.date.now.js"),require("core-js/modules/es.date.to-string.js"),require("core-js/modules/es.object.assign.js");var e,t=(e=require("axios"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("uuid");require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.starts-with.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.parse-int.js");var o=n.v4(),r={vaultId:"",environment:"sandbox",version:"canary"},i=function(e){return e+" is undefined."},s=r,c=function(){return s},u={vaultId:function(e){return"string"==typeof e&&/^tnt.{8}$/.test(e)},environment:function(e){return"string"==typeof e&&/^(sandbox|live)((-eu)-\d{1})?$/.test(e)},version:function(e){return"canary"===e||"string"==typeof e&&/^\d{1,2}\.\d{1,2}(\.\d{1,2})?$/.test(e)&&!e.startsWith("1.")}},a=function(e){throw new Error(e+" is required.")},d=function(e){(function(e){!function(e,t){if(e){var n=Object.keys(e).filter((function(n){return!e[n](t[n])})).map((function(e){return new Error(e+" is invalid.")}));if(n.length)throw n[0]}}(u,e)})(e),function(e){e&&(s=Object.assign({},e))}(e),l({type:"LoadedFromPackage"})},l=function(e){var n=c(),r="",i={env:n.environment,tnt:n.vaultId,userAgent:window.navigator.userAgent,version:n.version,timestamp:Date.now(),vgsCollectSessionId:o};try{r=window.btoa(JSON.stringify(Object.assign({},e,i)))}catch(e){return}t({method:"POST",url:"https://vgs-collect-keeper.apps.verygood.systems/vgs",data:r}).then((function(){return!0})).catch((function(){}))},v=function(e){var t=document.head||document.body;if(!t)throw new Error("Unable to find document.head or document.body");return t.appendChild(e),e},f=function(e,t){var n=document.createElement("link");n.rel=e,n.href=t,v(n)},m=function(e){var t=e.split(".");return{major:parseInt(t[0])||0,minor:parseInt(t[1])||0,patch:parseInt(t[2])||0}},p="https://js.verygoodvault.com",w=function(e,t){window.VGSCollect.init=function(n){return void 0===n&&(n=function(){}),window.VGSCollect.create(e,t,n)}};Promise.resolve().then((function(){"undefined"==typeof window||window.VGSCollect||(f("dns-prefetch","https://js.verygoodvault.com"),f("dns-prefetch","https://js3.verygoodvault.com"),f("preconnect","https://js.verygoodvault.com"),f("preconnect","https://js3.verygoodvault.com"))})),exports.loadVGSCollect=function(e){void 0===e&&(e=a("config"));var t=e,n=t.vaultId,s=void 0===n?a("vaultId"):n,u=t.environment,f=void 0===u?r.environment:u,j=t.version,g=void 0===j?r.version:j;return"canary"===g&&console.warn("Please explicitly set locked VGS Collect.js version before going live. Check out the changelog https://www.verygoodsecurity.com/docs/vgs-collect/js/changelog"),d({vaultId:s,environment:f,version:g}),new Promise((function(e,t){"undefined"!=typeof window?(window.VGSCollect&&(w(s,f),e(window.VGSCollect)),function e(t){return void 0===t&&(t=!0),new Promise((function(n,r){var s=c().version;if(function(){try{return document.querySelectorAll('script[src^="'+p+'/vgs-collect/"]').length>0}catch(e){return!1}}()&&window.VGSCollect&&n(window.VGSCollect),!t&&function(e,t){if("canary"===e)return!0;var n=m(e),o=m("2.3.0");return n.major!==o.major?n.major>o.major:n.minor!==o.minor?n.minor>o.minor:n.patch!==o.patch&&n.patch>o.patch}(s)&&(p="https://js3.verygoodvault.com"),!window.VGSCollect){var u=function(){var e=c(),t=e.vaultId,n=e.environment,r=e.version,i=document.createElement("script");return i.src=p+"/vgs-collect/"+r+"/vgs-collect.js?sessionId="+o+"&tenantId="+t+"&env="+n,v(i),i}();u&&(u.onload=function(){window.VGSCollect||(l({type:"InstanceUndefined",status:"OK",mainCDN:t}),r(i("VGS Collect"))),l({type:"ScriptLoad",status:"OK",mainCDN:t}),n(window.VGSCollect)},u.onerror=function(){l({type:"ScriptLoad",status:"Failed",mainCDN:t}),t?n(e(!1)):r("VGS Collect.js script was not loaded.")})}}))}().then((function(){w(s,f),e(window.VGSCollect)})).catch((function(e){t(e)}))):t(i("window"))}))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.date.now.js"),require("core-js/modules/es.date.to-string.js"),require("core-js/modules/es.object.assign.js");var e=require("uuid");require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.starts-with.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.parse-int.js");var t=e.v4(),n={vaultId:"",environment:"sandbox",version:"canary"},o=function(e){return e+" is undefined."},r=n,i=function(){return r},s={vaultId:function(e){return"string"==typeof e&&/^tnt.{8}$/.test(e)},environment:function(e){return"string"==typeof e&&/^(sandbox|live)((-eu)-\d{1})?$/.test(e)},version:function(e){return"canary"===e||"string"==typeof e&&/^\d{1,2}\.\d{1,2}(\.\d{1,2})?$/.test(e)&&!e.startsWith("1.")}},c=function(e){throw new Error(e+" is required.")},u=function(e){(function(e){!function(e,t){if(e){var n=Object.keys(e).filter((function(n){return!e[n](t[n])})).map((function(e){return new Error(e+" is invalid.")}));if(n.length)throw n[0]}}(s,e)})(e),function(e){e&&(r=Object.assign({},e))}(e),a({type:"LoadedFromPackage"})},a=function(e){var n=i(),o="",r={env:n.environment,tnt:n.vaultId,userAgent:window.navigator.userAgent,version:n.version,timestamp:Date.now(),vgsCollectSessionId:t};try{o=window.btoa(JSON.stringify(Object.assign({},e,r)))}catch(e){return}fetch("https://vgs-collect-keeper.apps.verygood.systems/vgs",{method:"POST",body:o}).then((function(){return!0})).catch((function(){return!0}))},d=function(e){var t=document.head||document.body;if(!t)throw new Error("Unable to find document.head or document.body");return t.appendChild(e),e},l=function(e,t){var n=document.createElement("link");n.rel=e,n.href=t,d(n)},v=function(e){var t=e.split(".");return{major:parseInt(t[0])||0,minor:parseInt(t[1])||0,patch:parseInt(t[2])||0}},f="https://js.verygoodvault.com",m=function(e,t){window.VGSCollect.init=function(n){return void 0===n&&(n=function(){}),window.VGSCollect.create(e,t,n)}};Promise.resolve().then((function(){"undefined"==typeof window||window.VGSCollect||(l("dns-prefetch","https://js.verygoodvault.com"),l("dns-prefetch","https://js3.verygoodvault.com"),l("preconnect","https://js.verygoodvault.com"),l("preconnect","https://js3.verygoodvault.com"))})),exports.loadVGSCollect=function(e){void 0===e&&(e=c("config"));var r=e,s=r.vaultId,l=void 0===s?c("vaultId"):s,p=r.environment,w=void 0===p?n.environment:p,j=r.version,g=void 0===j?n.version:j;return"canary"===g&&console.warn("Please explicitly set locked VGS Collect.js version before going live. Check out the changelog https://www.verygoodsecurity.com/docs/vgs-collect/js/changelog"),u({vaultId:l,environment:w,version:g}),new Promise((function(e,n){"undefined"!=typeof window?(window.VGSCollect&&(m(l,w),e(window.VGSCollect)),function e(n){return void 0===n&&(n=!0),new Promise((function(r,s){var c=i().version;if(function(){try{return document.querySelectorAll('script[src^="'+f+'/vgs-collect/"]').length>0}catch(e){return!1}}()&&window.VGSCollect&&r(window.VGSCollect),!n&&function(e,t){if("canary"===e)return!0;var n=v(e),o=v("2.3.0");return n.major!==o.major?n.major>o.major:n.minor!==o.minor?n.minor>o.minor:n.patch!==o.patch&&n.patch>o.patch}(c)&&(f="https://js3.verygoodvault.com"),!window.VGSCollect){var u=function(){var e=i(),n=e.vaultId,o=e.environment,r=e.version,s=document.createElement("script");return s.src=f+"/vgs-collect/"+r+"/vgs-collect.js?sessionId="+t+"&tenantId="+n+"&env="+o,d(s),s}();u&&(u.onload=function(){window.VGSCollect||(a({type:"InstanceUndefined",status:"OK",mainCDN:n}),s(o("VGS Collect"))),a({type:"ScriptLoad",status:"OK",mainCDN:n}),r(window.VGSCollect)},u.onerror=function(){a({type:"ScriptLoad",status:"Failed",mainCDN:n}),n?r(e(!1)):s("VGS Collect.js script was not loaded.")})}}))}().then((function(){m(l,w),e(window.VGSCollect)})).catch((function(e){n(e)}))):n(o("window"))}))}; | ||
//# sourceMappingURL=collect-js.cjs.production.min.js.map |
@@ -6,3 +6,2 @@ import 'core-js/modules/es.object.to-string.js'; | ||
import 'core-js/modules/es.object.assign.js'; | ||
import axios from 'axios'; | ||
import { v4 } from 'uuid'; | ||
@@ -119,10 +118,9 @@ import 'core-js/modules/es.regexp.exec.js'; | ||
} | ||
axios({ | ||
fetch(VGS_COLLECT_KEEPER + "/vgs", { | ||
method: 'POST', | ||
url: VGS_COLLECT_KEEPER + "/vgs", | ||
data: payload | ||
body: payload | ||
}).then(function () { | ||
return true; | ||
})["catch"](function () { | ||
return; | ||
return true; | ||
}); | ||
@@ -129,0 +127,0 @@ }; |
{ | ||
"name": "@vgs/collect-js", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "VGS Collect.js script loading module", | ||
@@ -44,5 +44,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"axios": "^1.6.0", | ||
"core-js": "^3.30.0", | ||
"setasap": "^2.0.1", | ||
"uuid": "^8.3.2" | ||
@@ -54,8 +52,3 @@ }, | ||
} | ||
}, | ||
"jest": { | ||
"moduleNameMapper": { | ||
"axios": "axios/dist/node/axios.cjs" | ||
} | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
import axios from 'axios'; | ||
import { | ||
@@ -38,6 +37,5 @@ SESSION_ID, | ||
axios({ | ||
fetch(`${VGS_COLLECT_KEEPER}/vgs`, { | ||
method: 'POST', | ||
url: `${VGS_COLLECT_KEEPER}/vgs`, | ||
data: payload, | ||
body: payload, | ||
}) | ||
@@ -48,3 +46,3 @@ .then(() => { | ||
.catch(() => { | ||
return; | ||
return true; | ||
}); | ||
@@ -51,0 +49,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
2
98634
999
3
- Removedaxios@^1.6.0
- Removedsetasap@^2.0.1
- Removedasynckit@0.4.0(transitive)
- Removedaxios@1.7.9(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedfollow-redirects@1.15.9(transitive)
- Removedform-data@4.0.1(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedproxy-from-env@1.1.0(transitive)
- Removedsetasap@2.0.1(transitive)