@edx/frontend-analytics
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,13 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["frontend-analytics"]=t():e["frontend-analytics"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict"; | ||
/*! | ||
* cookie | ||
* Copyright(c) 2012-2014 Roman Shtylman | ||
* Copyright(c) 2015 Douglas Christopher Wilson | ||
* MIT Licensed | ||
*/t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},o=t||{},u=e.split(i),c=o.decode||r,f=0;f<u.length;f++){var s=u[f],l=s.indexOf("=");if(!(l<0)){var d=s.substr(0,l).trim(),p=s.substr(++l,s.length).trim();'"'==p[0]&&(p=p.slice(1,-1)),null==n[d]&&(n[d]=a(p,c))}}return n},t.serialize=function(e,t,n){var r=n||{},i=r.encode||o;if("function"!=typeof i)throw new TypeError("option encode is invalid");if(!u.test(e))throw new TypeError("argument name is invalid");var a=i(t);if(a&&!u.test(a))throw new TypeError("argument val is invalid");var c=e+"="+a;if(null!=r.maxAge){var f=r.maxAge-0;if(isNaN(f))throw new Error("maxAge should be a Number");c+="; Max-Age="+Math.floor(f)}if(r.domain){if(!u.test(r.domain))throw new TypeError("option domain is invalid");c+="; Domain="+r.domain}if(r.path){if(!u.test(r.path))throw new TypeError("option path is invalid");c+="; Path="+r.path}if(r.expires){if("function"!=typeof r.expires.toUTCString)throw new TypeError("option expires is invalid");c+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(c+="; HttpOnly"),r.secure&&(c+="; Secure"),r.sameSite)switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"strict":c+="; SameSite=Strict";break;default:throw new TypeError("option sameSite is invalid")}return c};var r=decodeURIComponent,o=encodeURIComponent,i=/; */,u=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function a(e,t){try{return t(e)}catch(t){return e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sendTrackingLogEvent=t.sendTrackEvent=t.sendPageEvent=t.initializeSegment=t.identifyAuthenticatedUser=t.identifyAnonymousUser=t.configureAnalytics=void 0;var r=n(2),o=n(8);t.configureAnalytics=r.configureAnalytics,t.identifyAnonymousUser=r.identifyAnonymousUser,t.identifyAuthenticatedUser=r.identifyAuthenticatedUser,t.initializeSegment=o.initializeSegment,t.sendPageEvent=r.sendPageEvent,t.sendTrackEvent=r.sendTrackEvent,t.sendTrackingLogEvent=r.sendTrackingLogEvent},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sendTrackingLogEvent=t.sendTrackEvent=t.sendPageEvent=t.identifyAuthenticatedUser=t.identifyAnonymousUser=t.configureAnalytics=void 0;var r=u(n(3)),o=u(n(9)),i=n(5);function u(e){return e&&e.__esModule?e:{default:e}}var a={},c=!1;function f(){if(!a.authApiClient)throw Error("You must configure the authApiClient.");return a.authApiClient}function s(){if(!a.loggingService)throw Error("You must configure the loggingService.");return a.loggingService}function l(){var e=s();c||e.logError("Identify must be called before other tracking events.")}t.configureAnalytics=function(e){c=!1,a={loggingService:e.loggingService,authApiClient:e.authApiClient,analyticsApiBaseUrl:e.analyticsApiBaseUrl}},t.identifyAnonymousUser=function(e){window.analytics.identify(e),c=!0},t.identifyAuthenticatedUser=function(e){var t=f(),n=t.getAuthenticationState(),r=s();if(n.authentication&&n.authentication.userId)window.analytics.identify(n.authentication.userId,e),c=!0;else{var i=(new o.default).get(t.accessTokenCookieName),u="authState: "+JSON.stringify(n)+" accessToken: "+i;r.logError("Failed to sendAuthenticatedIdentify. "+u)}},t.sendPageEvent=function(e,t,n){l(),window.analytics.page(e,t,n)},t.sendTrackEvent=function(e,t){l(),window.analytics.track(e,t)},t.sendTrackingLogEvent=function(e,t){var n=(0,i.snakeCaseObject)(t,{deep:!0}),o={event_type:e,event:JSON.stringify(n),page:window.location.href},u=s();return f().post(a.analyticsApiBaseUrl+"/event",(0,r.default)(o),{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).catch(function(e){u.logAPIErrorResponse(e)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Boolean(t.sorted),o=Boolean(t.skipIndex),i=Boolean(t.ignorenull),u=function(e){return String(e).replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,function(e){return"%"+e.charCodeAt().toString(16).slice(-2).toUpperCase()})},a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(e);return n?t.sort():t},c=function(e){return e.filter(function(e){return e}).join("&")},f=function(e,t){return t.length?c(t.map(function(t,n){return s(o?e+"[]":e+"["+n+"]",t)})):u(e+"[]")},s=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0===t?"undefined":r(t),o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return t===o?o=i?o:u(e)+"="+o:/string|number|boolean/.test(n)?o=u(e)+"="+u(t):Array.isArray(t)?o=f(e,t):"object"===n&&(o=function(e,t){return c(a(t).map(function(n){return s(e+"["+n+"]",t[n])}))}(e,t)),o};return e&&c(a(e).map(function(t){return s(t,e[t])}))}},function(e,t,n){"use strict"; | ||
/* | ||
object-assign | ||
(c) Sindre Sorhus | ||
@license MIT | ||
*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var f in n=Object(arguments[c]))o.call(n,f)&&(a[f]=n[f]);if(r){u=r(n);for(var s=0;s<u.length;s++)i.call(n,u[s])&&(a[u[s]]=n[u[s]])}}return a}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.snakeCaseObject=void 0;var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(e){return e&&e.__esModule?e:{default:e}}(n(6));t.snakeCaseObject=function(e){return function e(t,n){if(null==t||"object"!==(void 0===t?"undefined":o(t))&&!Array.isArray(t))return t;if(Array.isArray(t))return t.map(function(t){return e(t,n)});var i={};return Object.entries(t).forEach(function(t){var o=r(t,2),u=o[0],a=o[1];i[n(u)]=e(a,n)}),i}(e,i.default)}},function(e,t,n){(function(t){var n=1/0,r="[object Symbol]",o=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",a="["+u+"]",c="\\d+",f="[a-z\\xdf-\\xf6\\xf8-\\xff]",s="[^\\ud800-\\udfff"+u+c+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",p="[A-Z\\xc0-\\xd6\\xd8-\\xde]",y="(?:"+f+"|"+s+")",g="(?:"+p+"|"+s+")",h="(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?",v="[\\ufe0e\\ufe0f]?"+h+"(?:\\u200d(?:"+["[^\\ud800-\\udfff]",l,d].join("|")+")[\\ufe0e\\ufe0f]?"+h+")*",m="(?:"+["[\\u2700-\\u27bf]",l,d].join("|")+")"+v,b=RegExp("['’]","g"),x=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),O=RegExp([p+"?"+f+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[a,p,"$"].join("|")+")",g+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[a,p+y,"$"].join("|")+")",p+"?"+y+"+(?:['’](?:d|ll|m|re|s|t|ve))?",p+"+(?:['’](?:D|LL|M|RE|S|T|VE))?",c,m].join("|"),"g"),S=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,w="object"==typeof t&&t&&t.Object===Object&&t,E="object"==typeof self&&self&&self.Object===Object&&self,j=w||E||Function("return this")(),A=function(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"}),k=Object.prototype.toString,C=j.Symbol,T=C?C.prototype:void 0,_=T?T.toString:void 0;function U(e){return null==e?"":function(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&k.call(e)==r}(e))return _?_.call(e):"";var t=e+"";return"0"==t&&1/e==-n?"-0":t}(e)}var I=function(e){return function(t){return function(e,t,n,r){for(var o=-1,i=e?e.length:0;++o<i;)n=t(n,e[o],o,e);return n}(function(e,t,n){return e=U(e),void 0===(t=t)?function(e){return S.test(e)}(e)?function(e){return e.match(O)||[]}(e):function(e){return e.match(o)||[]}(e):e.match(t)||[]}(function(e){return(e=U(e))&&e.replace(i,A).replace(x,"")}(t).replace(b,"")),e,"")}}(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});e.exports=I}).call(this,n(7))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initializeSegment=function(e){var t=window.analytics=window.analytics||[];if(!t.initialize)if(t.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{t.invoked=!0,t.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"],t.factory=function(e){return function(){var n=Array.prototype.slice.call(arguments);return n.unshift(e),t.push(n),t}};for(var n=0;n<t.methods.length;n++){var r=t.methods[n];t[r]=t.factory(r)}t.load=function(e,n){var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.segment.com/analytics.js/v1/"+e+"/analytics.min.js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(r,o),t._loadOptions=n},t.SNIPPET_VERSION="4.1.0",t.load(e)}}},function(e,t,n){"use strict";n.r(t);var r=n(0);function o(e,t){void 0===t&&(t={});var n=function(e){return e&&"j"===e[0]&&":"===e[1]?e.substr(2):e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var i=n(4),u=function(){function e(e){this.changeListeners=[],this.TESTING_ONETWO=2,this.cookies=function(e){return"string"==typeof e?r.parse(e):"object"==typeof e&&null!==e?e:{}}(e),this.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie}return e.prototype._updateBrowserValues=function(){this.HAS_DOCUMENT_COOKIE&&(this.cookies=r.parse(document.cookie))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t){return void 0===t&&(t={}),this._updateBrowserValues(),o(this.cookies[e],t)},e.prototype.getAll=function(e){void 0===e&&(e={}),this._updateBrowserValues();var t={};for(var n in this.cookies)t[n]=o(this.cookies[n],e);return t},e.prototype.set=function(e,t,n){var o;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=i({},this.cookies,((o={})[e]=t,o)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=i({},t,{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=i({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}();t.default=u}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["frontend-analytics"]=t():e["frontend-analytics"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sendTrackingLogEvent=t.sendTrackEvent=t.sendPageEvent=t.initializeSegment=t.identifyAuthenticatedUser=t.identifyAnonymousUser=t.configureAnalytics=void 0;var r=n(1),o=n(6);t.configureAnalytics=r.configureAnalytics,t.identifyAnonymousUser=r.identifyAnonymousUser,t.identifyAuthenticatedUser=r.identifyAuthenticatedUser,t.initializeSegment=o.initializeSegment,t.sendPageEvent=r.sendPageEvent,t.sendTrackEvent=r.sendTrackEvent,t.sendTrackingLogEvent=r.sendTrackingLogEvent},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sendTrackingLogEvent=t.sendTrackEvent=t.sendPageEvent=t.identifyAuthenticatedUser=t.identifyAnonymousUser=t.configureAnalytics=void 0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),o=n(3),i={},u=!1;function f(){if(!i.authApiClient)throw Error("You must configure the authApiClient.");return i.authApiClient}function c(){if(!i.loggingService)throw Error("You must configure the loggingService.");return i.loggingService}function a(){var e=c();u||e.logError("Identify must be called before other tracking events.")}t.configureAnalytics=function(e){u=!1,i={loggingService:e.loggingService,authApiClient:e.authApiClient,analyticsApiBaseUrl:e.analyticsApiBaseUrl}},t.identifyAnonymousUser=function(e){window.analytics.identify(e),u=!0},t.identifyAuthenticatedUser=function(e){var t=f().getAuthenticationState(),n=c();if(t.authentication&&t.authentication.userId)window.analytics.identify(t.authentication.userId,e),u=!0;else{var r="authState: "+JSON.stringify(t)+" cookies: "+document.cookie;n.logError("Failed to sendAuthenticatedIdentify. "+r)}},t.sendPageEvent=function(e,t,n){a(),window.analytics.page(e,t,n)},t.sendTrackEvent=function(e,t){a(),window.analytics.track(e,t)},t.sendTrackingLogEvent=function(e,t){var n=(0,o.snakeCaseObject)(t,{deep:!0}),u={event_type:e,event:JSON.stringify(n),page:window.location.href},a=c();return f().post(i.analyticsApiBaseUrl+"/event",(0,r.default)(u),{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).catch(function(e){a.logAPIErrorResponse(e)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Boolean(t.sorted),o=Boolean(t.skipIndex),i=Boolean(t.ignorenull),u=function(e){return String(e).replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,function(e){return"%"+e.charCodeAt().toString(16).slice(-2).toUpperCase()})},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(e);return n?t.sort():t},c=function(e){return e.filter(function(e){return e}).join("&")},a=function(e,t){return t.length?c(t.map(function(t,n){return l(o?e+"[]":e+"["+n+"]",t)})):u(e+"[]")},l=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0===t?"undefined":r(t),o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return t===o?o=i?o:u(e)+"="+o:/string|number|boolean/.test(n)?o=u(e)+"="+u(t):Array.isArray(t)?o=a(e,t):"object"===n&&(o=function(e,t){return c(f(t).map(function(n){return l(e+"["+n+"]",t[n])}))}(e,t)),o};return e&&c(f(e).map(function(t){return l(t,e[t])}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.snakeCaseObject=void 0;var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,f=e[Symbol.iterator]();!(r=(u=f.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&f.return&&f.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(e){return e&&e.__esModule?e:{default:e}}(n(4));t.snakeCaseObject=function(e){return function e(t,n){if(null==t||"object"!==(void 0===t?"undefined":o(t))&&!Array.isArray(t))return t;if(Array.isArray(t))return t.map(function(t){return e(t,n)});var i={};return Object.entries(t).forEach(function(t){var o=r(t,2),u=o[0],f=o[1];i[n(u)]=e(f,n)}),i}(e,i.default)}},function(e,t,n){(function(t){var n=1/0,r="[object Symbol]",o=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",f="["+u+"]",c="\\d+",a="[a-z\\xdf-\\xf6\\xf8-\\xff]",l="[^\\ud800-\\udfff"+u+c+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",y="[A-Z\\xc0-\\xd6\\xd8-\\xde]",p="(?:"+a+"|"+l+")",g="(?:"+y+"|"+l+")",v="(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?",b="[\\ufe0e\\ufe0f]?"+v+"(?:\\u200d(?:"+["[^\\ud800-\\udfff]",s,d].join("|")+")[\\ufe0e\\ufe0f]?"+v+")*",m="(?:"+["[\\u2700-\\u27bf]",s,d].join("|")+")"+b,x=RegExp("['’]","g"),h=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),A=RegExp([y+"?"+a+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[f,y,"$"].join("|")+")",g+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[f,y+p,"$"].join("|")+")",y+"?"+p+"+(?:['’](?:d|ll|m|re|s|t|ve))?",y+"+(?:['’](?:D|LL|M|RE|S|T|VE))?",c,m].join("|"),"g"),S=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,j="object"==typeof t&&t&&t.Object===Object&&t,E="object"==typeof self&&self&&self.Object===Object&&self,O=j||E||Function("return this")(),w=function(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"}),k=Object.prototype.toString,F=O.Symbol,U=F?F.prototype:void 0,_=U?U.toString:void 0;function C(e){return null==e?"":function(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&k.call(e)==r}(e))return _?_.call(e):"";var t=e+"";return"0"==t&&1/e==-n?"-0":t}(e)}var T=function(e){return function(t){return function(e,t,n,r){for(var o=-1,i=e?e.length:0;++o<i;)n=t(n,e[o],o,e);return n}(function(e,t,n){return e=C(e),void 0===(t=t)?function(e){return S.test(e)}(e)?function(e){return e.match(A)||[]}(e):function(e){return e.match(o)||[]}(e):e.match(t)||[]}(function(e){return(e=C(e))&&e.replace(i,w).replace(h,"")}(t).replace(x,"")),e,"")}}(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});e.exports=T}).call(this,n(5))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initializeSegment=function(e){var t=window.analytics=window.analytics||[];if(!t.initialize)if(t.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{t.invoked=!0,t.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"],t.factory=function(e){return function(){var n=Array.prototype.slice.call(arguments);return n.unshift(e),t.push(n),t}};for(var n=0;n<t.methods.length;n++){var r=t.methods[n];t[r]=t.factory(r)}t.load=function(e,n){var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.segment.com/analytics.js/v1/"+e+"/analytics.min.js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(r,o),t._loadOptions=n},t.SNIPPET_VERSION="4.1.0",t.load(e)}}}])}); | ||
//# sourceMappingURL=main.js.map |
{ | ||
"name": "@edx/frontend-analytics", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Frontend analytics client code for sending analytics events to Segment and (LMS) Tracking Logs.", | ||
@@ -65,5 +65,4 @@ "main": "dist/main.js", | ||
"form-urlencoded": "^3.0.0", | ||
"lodash.snakecase": "^4.1.1", | ||
"universal-cookie": "^3.1.0" | ||
"lodash.snakecase": "^4.1.1" | ||
} | ||
} |
import formurlencoded from 'form-urlencoded'; | ||
import Cookies from 'universal-cookie'; | ||
import { snakeCaseObject } from './utils'; | ||
@@ -92,5 +91,3 @@ | ||
} else { | ||
const cookies = new Cookies(); | ||
const accessToken = cookies.get(apiClient.accessTokenCookieName); | ||
const details = `authState: ${JSON.stringify(authState)} accessToken: ${accessToken}`; | ||
const details = `authState: ${JSON.stringify(authState)} cookies: ${document.cookie}`; | ||
loggingService.logError(`Failed to sendAuthenticatedIdentify. ${details}`); | ||
@@ -97,0 +94,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
114008
586
- Removeduniversal-cookie@^3.1.0
- Removed@types/cookie@0.3.3(transitive)
- Removed@types/object-assign@4.0.33(transitive)
- Removedcookie@0.3.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removeduniversal-cookie@3.1.0(transitive)