-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajs-destination.bundle.35a8f6f19959bf2f455f.js
More file actions
2 lines (2 loc) · 10.1 KB
/
ajs-destination.bundle.35a8f6f19959bf2f455f.js
File metadata and controls
2 lines (2 loc) · 10.1 KB
1
2
(self.webpackChunk_segment_analytics_next=self.webpackChunk_segment_analytics_next||[]).push([[464,714],{9254:function(n,t,e){"use strict";function i(n,t){var e,i;return"boolean"==typeof(null==t?void 0:t.enabled)?t.enabled:null===(i=null===(e=null==n?void 0:n.__default)||void 0===e?void 0:e.enabled)||void 0===i||i}e.d(t,{n:function(){return i}})},1620:function(n,t,e){"use strict";e.r(t),e.d(t,{LegacyDestination:function(){return k},ajsDestinations:function(){return G}});var i=e(5163),r=e(4122),o=e(94),s=e(7547),a=e(204),u=e(1365),c=e(5346),l=e(9254),d=e(5944),h=e(8044),f=e(4443),v=e(3061),p=e(6338),g=e(2870),m=e(7566),y=e(7070);function w(n){return n.toLowerCase().replace(".","").replace(/\s+/g,"-")}function b(n,t){return void 0===t&&(t=!1),t?btoa(n).replace(/=/g,""):void 0}function _(n,t,e,r,o,s){return(0,i.mG)(this,void 0,Promise,(function(){var a,u,c,l,d,h,f,v;return(0,i.Jh)(this,(function(p){switch(p.label){case 0:a=w(e),u=b(a,s),c=(0,m.Kg)(),l="".concat(c,"/integrations/").concat(null!=u?u:a,"/").concat(r,"/").concat(null!=u?u:a,".dynamic.js.gz"),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,(0,y.v)(l)];case 2:return p.sent(),function(n,t,e){var r,o;try{var s=(null!==(o=null===(r=null===window||void 0===window?void 0:window.performance)||void 0===r?void 0:r.getEntriesByName(n,"resource"))&&void 0!==o?o:[])[0];s&&t.stats.gauge("legacy_destination_time",Math.round(s.duration),(0,i.ev)([e],s.duration<100?["cached"]:[],!0))}catch(n){}}(l,n,e),[3,4];case 3:throw d=p.sent(),n.stats.gauge("legacy_destination_time",-1,["plugin:".concat(e),"failed"]),d;case 4:return h=window["".concat(a,"Deps")],[4,Promise.all(h.map((function(n){return(0,y.v)(c+n+".gz")})))];case 5:return p.sent(),window["".concat(a,"Loader")](),(f=window["".concat(a,"Integration")]).Integration&&(f({user:function(){return t.user()},addIntegration:function(){}}),f=f.Integration),(v=new f(o)).analytics=t,[2,v]}}))}))}function P(n,t){return(0,i.mG)(this,void 0,Promise,(function(){var e,r=this;return(0,i.Jh)(this,(function(a){switch(a.label){case 0:return e=[],(0,o.s)()?[2,t]:[4,(0,h.x)((function(){return t.length>0&&(0,o.G)()}),(function(){return(0,i.mG)(r,void 0,void 0,(function(){var r,o;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return(r=t.pop())?[4,(0,u.a)(r,n)]:[2];case 1:return o=i.sent(),o instanceof s._||e.push(r),[2]}}))}))}))];case 1:return a.sent(),e.map((function(n){return t.pushWithBackoff(n)})),[2,t]}}))}))}var k=function(){function n(n,t,e,r){void 0===e&&(e={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=n,this.version=t,this.settings=(0,i.pi)({},e),this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=r,this.buffer=r.disableClientPersistence?new f.Z(4,[]):new v.$(4,"dest-".concat(n)),this.scheduleFlush()}return n.prototype.isLoaded=function(){return this._ready},n.prototype.ready=function(){var n;return null!==(n=this.onReady)&&void 0!==n?n:Promise.resolve()},n.prototype.load=function(n,t){return(0,i.mG)(this,void 0,Promise,(function(){var e,r=this;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return this._ready||void 0!==this.onReady?[2]:(e=this,[4,_(n,t,this.name,this.version,this.settings,this.options.obfuscate)]);case 1:e.integration=i.sent(),this.onReady=new Promise((function(n){r.integration.once("ready",(function(){r._ready=!0,n(!0)}))})),this.onInitialize=new Promise((function(n){r.integration.on("initialize",(function(){r._initialized=!0,n(!0)}))}));try{n.stats.increment("analytics_js.integration.invoke",1,["method:initialize","integration_name:".concat(this.name)]),this.integration.initialize()}catch(t){throw n.stats.increment("analytics_js.integration.invoke.error",1,["method:initialize","integration_name:".concat(this.name)]),t}return[2]}}))}))},n.prototype.unload=function(n,t){return function(n,t,e){return(0,i.mG)(this,void 0,Promise,(function(){var r,o,s,a;return(0,i.Jh)(this,(function(i){return r=(0,m.Kg)(),o=w(n),s=b(n,e),a="".concat(r,"/integrations/").concat(null!=s?s:o,"/").concat(t,"/").concat(null!=s?s:o,".dynamic.js.gz"),[2,(0,y.t)(a)]}))}))}(this.name,this.version,this.options.obfuscate)},n.prototype.addMiddleware=function(){for(var n,t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.middleware=(n=this.middleware).concat.apply(n,t)},n.prototype.shouldBuffer=function(n){return"page"!==n.event.type&&((0,o.s)()||!1===this._ready||!1===this._initialized)},n.prototype.send=function(n,t,e){var r,o;return(0,i.mG)(this,void 0,Promise,(function(){var a,u,d,h,f,v;return(0,i.Jh)(this,(function(g){switch(g.label){case 0:if(this.shouldBuffer(n))return this.buffer.push(n),this.scheduleFlush(),[2,n];if(a=null===(o=null===(r=this.options)||void 0===r?void 0:r.plan)||void 0===o?void 0:o.track,u=n.event.event,a&&u&&"Segment.io"!==this.name){if(d=a[u],!(0,l.n)(a,d))return n.updateEvent("integrations",(0,i.pi)((0,i.pi)({},n.event.integrations),{All:!1,"Segment.io":!0})),n.cancel(new s.Y({retry:!1,reason:"Event ".concat(u," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,n];if(n.updateEvent("integrations",(0,i.pi)((0,i.pi)({},n.event.integrations),null==d?void 0:d.integrations)),(null==d?void 0:d.enabled)&&!1===(null==d?void 0:d.integrations[this.name]))return n.cancel(new s.Y({retry:!1,reason:"Event ".concat(u," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,n]}return[4,(0,p.applyDestinationMiddleware)(this.name,(m=n.event,JSON.parse(JSON.stringify(m))),this.middleware)];case 1:if(null===(h=g.sent()))return[2,n];f=new t(h,{}),n.stats.increment("analytics_js.integration.invoke",1,["method:".concat(e),"integration_name:".concat(this.name)]),g.label=2;case 2:return g.trys.push([2,5,,6]),this.integration?[4,(0,c.O)(this.integration.invoke.call(this.integration,e,f))]:[3,4];case 3:g.sent(),g.label=4;case 4:return[3,6];case 5:throw v=g.sent(),n.stats.increment("analytics_js.integration.invoke.error",1,["method:".concat(e),"integration_name:".concat(this.name)]),v;case 6:return[2,n]}var m}))}))},n.prototype.track=function(n){return(0,i.mG)(this,void 0,Promise,(function(){return(0,i.Jh)(this,(function(t){return[2,this.send(n,r.Track,"track")]}))}))},n.prototype.page=function(n){var t;return(0,i.mG)(this,void 0,Promise,(function(){var e=this;return(0,i.Jh)(this,(function(i){return(null===(t=this.integration)||void 0===t?void 0:t._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return e.send(n,r.Page,"page")}))]}))}))},n.prototype.identify=function(n){return(0,i.mG)(this,void 0,Promise,(function(){return(0,i.Jh)(this,(function(t){return[2,this.send(n,r.Identify,"identify")]}))}))},n.prototype.alias=function(n){return(0,i.mG)(this,void 0,Promise,(function(){return(0,i.Jh)(this,(function(t){return[2,this.send(n,r.Alias,"alias")]}))}))},n.prototype.group=function(n){return(0,i.mG)(this,void 0,Promise,(function(){return(0,i.Jh)(this,(function(t){return[2,this.send(n,r.Group,"group")]}))}))},n.prototype.scheduleFlush=function(){var n=this;this.flushing||setTimeout((function(){return(0,i.mG)(n,void 0,void 0,(function(){var n;return(0,i.Jh)(this,(function(t){switch(t.label){case 0:return this.flushing=!0,n=this,[4,P(this,this.buffer)];case 1:return n.buffer=t.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},n}();function G(n,t,e){var i,r;if(void 0===t&&(t={}),void 0===e&&(e={}),(0,a.s)())return[];n.plan&&((e=null!=e?e:{}).plan=n.plan);var o,s=null!==(r=null===(i=n.middlewareSettings)||void 0===i?void 0:i.routingRules)&&void 0!==r?r:[],u=(o=s,function(n){var t=n.payload,e=n.integration,i=n.next;new g.Store(o).getRulesByDestinationName(e).forEach((function(n){for(var e=n.matchers,r=n.transformers,o=0;o<e.length;o++)if(g.matches(t.obj,e[o])&&(t.obj=g.transform(t.obj,r[o]),null===t.obj))return i(null)})),i(t)}),c=(0,d.o)(n,null!=e?e:{});return Object.entries(n.integrations).map((function(n){var i,r=n[0],o=n[1];if(!r.startsWith("Segment")){var a=!1===t.All&&void 0===t[r];if(!1!==t[r]&&!a){var l=o.type,d=o.bundlingStatus,h=o.versionSettings;if(("unbundled"!==d&&("browser"===l||(null===(i=null==h?void 0:h.componentTypes)||void 0===i?void 0:i.includes("browser")))||"Segment.io"===r)&&"Iterable"!==r){var f=function(n){var t,e,i,r;return null!==(r=null!==(e=null===(t=n.versionSettings)||void 0===t?void 0:t.override)&&void 0!==e?e:null===(i=n.versionSettings)||void 0===i?void 0:i.version)&&void 0!==r?r:"latest"}(o),v=new k(r,f,c[r],e);return s.filter((function(n){return n.destinationName===r})).length>0&&v.addMiddleware(u),v}}}})).filter((function(n){return void 0!==n}))}},6338:function(n,t,e){"use strict";e.r(t),e.d(t,{applyDestinationMiddleware:function(){return a},sourceMiddlewarePlugin:function(){return u}});var i=e(5163),r=e(7547),o=e(5346),s=e(9950);function a(n,t,e){return(0,i.mG)(this,void 0,Promise,(function(){function r(t,e){return(0,i.mG)(this,void 0,Promise,(function(){var r,a,u;return(0,i.Jh)(this,(function(c){switch(c.label){case 0:return r=!1,a=null,[4,(0,o.O)(e({payload:(0,s.D)(t,{clone:!0,traverse:!1}),integration:n,next:function(n){r=!0,null===n&&(a=null),n&&(a=n.obj)}}))];case 1:return c.sent(),r||null===a||((a=a).integrations=(0,i.pi)((0,i.pi)({},t.integrations),((u={})[n]=!1,u))),[2,a]}}))}))}var a,u,c,l;return(0,i.Jh)(this,(function(n){switch(n.label){case 0:a=0,u=e,n.label=1;case 1:return a<u.length?(c=u[a],[4,r(t,c)]):[3,4];case 2:if(null===(l=n.sent()))return[2,null];t=l,n.label=3;case 3:return a++,[3,1];case 4:return[2,t]}}))}))}function u(n,t){function e(e){return(0,i.mG)(this,void 0,Promise,(function(){var a;return(0,i.Jh)(this,(function(i){switch(i.label){case 0:return a=!1,[4,(0,o.O)(n({payload:(0,s.D)(e.event,{clone:!0,traverse:!1}),integrations:null!=t?t:{},next:function(n){a=!0,n&&(e.event=n.obj)}}))];case 1:if(i.sent(),!a)throw new r.Y({retry:!1,type:"middleware_cancellation",reason:"Middleware `next` function skipped"});return[2,e]}}))}))}return{name:"Source Middleware ".concat(n.name),type:"before",version:"0.1.0",isLoaded:function(){return!0},load:function(n){return Promise.resolve(n)},track:e,page:e,identify:e,alias:e,group:e}}}}]);
//# sourceMappingURL=ajs-destination.bundle.35a8f6f19959bf2f455f.js.map