1 line
8.8 KiB
JavaScript
1 line
8.8 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["ajs-destination"],{"89df":function(t,n,e){"use strict";function i(t,n){var e,i;return"boolean"===typeof(null===n||void 0===n?void 0:n.enabled)?n.enabled:null===(i=null===(e=null===t||void 0===t?void 0:t.__default)||void 0===e?void 0:e.enabled)||void 0===i||i}e.d(n,"a",(function(){return i}))},"99ee":function(t,n,e){"use strict";e.r(n),e.d(n,"LegacyDestination",(function(){return z})),e.d(n,"ajsDestinations",(function(){return S}));var i=e("3b03"),o=e("c2e5"),r=e("a883"),a=e("56cb"),s=e("7a72"),c=e("1b55"),u=e("1aa1"),d=e("89df"),l=e("965e"),h=e("53eb"),v=e("4080"),f=e("05ca"),b=e("9883"),p=e("a7e1"),g=e("26fd");function y(t){return t.toLowerCase().replace(".","").replace(/\s+/g,"-")}function j(t,n){return void 0===n&&(n=!1),n?btoa(t).replace(/=/g,""):void 0}function m(t,n,e){var o,r;try{var a=(null!==(r=null===(o=null===window||void 0===window?void 0:window.performance)||void 0===o?void 0:o.getEntriesByName(t,"resource"))&&void 0!==r?r:[])[0];a&&n.stats.gauge("legacy_destination_time",Math.round(a.duration),Object(i["f"])([e],a.duration<100?["cached"]:[],!0))}catch(s){}}function w(t,n,e,o,r,a){return Object(i["b"])(this,void 0,void 0,(function(){var s,c,u,d,l,h,v,f,b;return Object(i["d"])(this,(function(i){switch(i.label){case 0:s=y(e),c=j(s,a),u=Object(p["b"])(),d="".concat(u,"/integrations/").concat(null!==c&&void 0!==c?c:s,"/").concat(o,"/").concat(null!==c&&void 0!==c?c:s,".dynamic.js.gz"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,Object(g["a"])(d)];case 2:return i.sent(),m(d,t,e),[3,4];case 3:throw l=i.sent(),t.stats.gauge("legacy_destination_time",-1,["plugin:".concat(e),"failed"]),l;case 4:return h=window["".concat(s,"Deps")],[4,Promise.all(h.map((function(t){return Object(g["a"])(u+t+".gz")})))];case 5:return i.sent(),window["".concat(s,"Loader")](),v=window["".concat(s,"Integration")],v.Integration&&(f={user:function(){return n.user()},addIntegration:function(){}},v(f),v=v.Integration),b=new v(r),b.analytics=n,[2,b]}}))}))}function O(t,n,e){return Object(i["b"])(this,void 0,void 0,(function(){var o,r,a,s;return Object(i["d"])(this,(function(i){return o=Object(p["b"])(),r=y(t),a=j(t,e),s="".concat(o,"/integrations/").concat(null!==a&&void 0!==a?a:r,"/").concat(n,"/").concat(null!==a&&void 0!==a?a:r,".dynamic.js.gz"),[2,Object(g["b"])(s)]}))}))}function _(t){var n,e,i,o;return null!==(o=null!==(e=null===(n=t.versionSettings)||void 0===n?void 0:n.override)&&void 0!==e?e:null===(i=t.versionSettings)||void 0===i?void 0:i.version)&&void 0!==o?o:"latest"}function k(t,n){return Object(i["b"])(this,void 0,void 0,(function(){var e,o=this;return Object(i["d"])(this,(function(s){switch(s.label){case 0:return e=[],Object(r["a"])()?[2,n]:[4,Object(h["a"])((function(){return n.length>0&&Object(r["b"])()}),(function(){return Object(i["b"])(o,void 0,void 0,(function(){var o,r,s;return Object(i["d"])(this,(function(i){switch(i.label){case 0:return o=n.pop(),o?[4,Object(c["a"])(o,t)]:[2];case 1:return r=i.sent(),s=r instanceof a["a"],s||e.push(o),[2]}}))}))}))];case 1:return s.sent(),e.map((function(t){return n.pushWithBackoff(t)})),[2,n]}}))}))}var z=function(){function t(t,n,e,o){void 0===e&&(e={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=t,this.version=n,this.settings=Object(i["a"])({},e),this.settings["type"]&&"browser"===this.settings["type"]&&delete this.settings["type"],this.options=o,this.buffer=o.disableClientPersistence?new v["b"](4,[]):new f["a"](4,"dest-".concat(t)),this.scheduleFlush()}return t.prototype.isLoaded=function(){return this._ready},t.prototype.ready=function(){var t;return null!==(t=this.onReady)&&void 0!==t?t:Promise.resolve()},t.prototype.load=function(t,n){return Object(i["b"])(this,void 0,void 0,(function(){var e,o=this;return Object(i["d"])(this,(function(i){switch(i.label){case 0:return this._ready||void 0!==this.onReady?[2]:(e=this,[4,w(t,n,this.name,this.version,this.settings,this.options.obfuscate)]);case 1:e.integration=i.sent(),this.onReady=new Promise((function(t){var n=function(){o._ready=!0,t(!0)};o.integration.once("ready",n)})),this.onInitialize=new Promise((function(t){var n=function(){o._initialized=!0,t(!0)};o.integration.on("initialize",n)}));try{t.stats.increment("analytics_js.integration.invoke",1,["method:initialize","integration_name:".concat(this.name)]),this.integration.initialize()}catch(r){throw t.stats.increment("analytics_js.integration.invoke.error",1,["method:initialize","integration_name:".concat(this.name)]),r}return[2]}}))}))},t.prototype.unload=function(t,n){return O(this.name,this.version,this.options.obfuscate)},t.prototype.addMiddleware=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.middleware=(t=this.middleware).concat.apply(t,n)},t.prototype.shouldBuffer=function(t){return"page"!==t.event.type&&(Object(r["a"])()||!1===this._ready||!1===this._initialized)},t.prototype.send=function(t,n,e){var o,r;return Object(i["b"])(this,void 0,void 0,(function(){var s,c,l,h,v,f;return Object(i["d"])(this,(function(p){switch(p.label){case 0:if(this.shouldBuffer(t))return this.buffer.push(t),this.scheduleFlush(),[2,t];if(s=null===(r=null===(o=this.options)||void 0===o?void 0:o.plan)||void 0===r?void 0:r.track,c=t.event.event,s&&c&&"Segment.io"!==this.name){if(l=s[c],!Object(d["a"])(s,l))return t.updateEvent("integrations",Object(i["a"])(Object(i["a"])({},t.event.integrations),{All:!1,"Segment.io":!0})),t.cancel(new a["b"]({retry:!1,reason:"Event ".concat(c," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,t];if(t.updateEvent("integrations",Object(i["a"])(Object(i["a"])({},t.event.integrations),null===l||void 0===l?void 0:l.integrations)),(null===l||void 0===l?void 0:l.enabled)&&!1===(null===l||void 0===l?void 0:l.integrations[this.name]))return t.cancel(new a["b"]({retry:!1,reason:"Event ".concat(c," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,t]}return[4,Object(b["applyDestinationMiddleware"])(this.name,t.event,this.middleware)];case 1:if(h=p.sent(),null===h)return[2,t];v=new n(h,{}),t.stats.increment("analytics_js.integration.invoke",1,["method:".concat(e),"integration_name:".concat(this.name)]),p.label=2;case 2:return p.trys.push([2,5,,6]),this.integration?[4,Object(u["a"])(this.integration.invoke.call(this.integration,e,v))]:[3,4];case 3:p.sent(),p.label=4;case 4:return[3,6];case 5:throw f=p.sent(),t.stats.increment("analytics_js.integration.invoke.error",1,["method:".concat(e),"integration_name:".concat(this.name)]),f;case 6:return[2,t]}}))}))},t.prototype.track=function(t){return Object(i["b"])(this,void 0,void 0,(function(){return Object(i["d"])(this,(function(n){return[2,this.send(t,o["Track"],"track")]}))}))},t.prototype.page=function(t){var n;return Object(i["b"])(this,void 0,void 0,(function(){var e=this;return Object(i["d"])(this,(function(i){return(null===(n=this.integration)||void 0===n?void 0:n._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return e.send(t,o["Page"],"page")}))]}))}))},t.prototype.identify=function(t){return Object(i["b"])(this,void 0,void 0,(function(){return Object(i["d"])(this,(function(n){return[2,this.send(t,o["Identify"],"identify")]}))}))},t.prototype.alias=function(t){return Object(i["b"])(this,void 0,void 0,(function(){return Object(i["d"])(this,(function(n){return[2,this.send(t,o["Alias"],"alias")]}))}))},t.prototype.group=function(t){return Object(i["b"])(this,void 0,void 0,(function(){return Object(i["d"])(this,(function(n){return[2,this.send(t,o["Group"],"group")]}))}))},t.prototype.scheduleFlush=function(){var t=this;this.flushing||setTimeout((function(){return Object(i["b"])(t,void 0,void 0,(function(){var t;return Object(i["d"])(this,(function(n){switch(n.label){case 0:return this.flushing=!0,t=this,[4,k(this,this.buffer)];case 1:return t.buffer=n.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},t}();function S(t,n,e,i){var o,r;if(void 0===n&&(n={}),void 0===e&&(e={}),Object(s["b"])())return[];t.plan&&(e=null!==e&&void 0!==e?e:{},e.plan=t.plan);var a=null!==(r=null===(o=t.middlewareSettings)||void 0===o?void 0:o.routingRules)&&void 0!==r?r:[],c=Object(l["a"])(t,null!==e&&void 0!==e?e:{});return Object.entries(t.integrations).map((function(t){var o,r=t[0],s=t[1];if(!r.startsWith("Segment")){var u=!1===n.All&&void 0===n[r];if(!1!==n[r]&&!u){var d=s.type,l=s.bundlingStatus,h=s.versionSettings,v="unbundled"!==l&&("browser"===d||(null===(o=null===h||void 0===h?void 0:h.componentTypes)||void 0===o?void 0:o.includes("browser")));if((v||"Segment.io"===r)&&"Iterable"!==r){var f=_(s),b=new z(r,f,c[r],e),p=a.filter((function(t){return t.destinationName===r}));return p.length>0&&i&&b.addMiddleware(i),b}}}})).filter((function(t){return void 0!==t}))}}}]); |