gtm-event-tracker
Advanced tools
Comparing version 1.7.0-beta.10 to 1.7.0-beta.11
@@ -1,10 +0,10 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function Tn(a={}){var u;const g=console;let d=(u=a.logger)!=null?u:g;function h(){return d}function p(_){d=_}return{getLogger:h,setLogger:p}}const Mt=Tn(),{setLogger:wn}=Mt,{getLogger:mn}=Mt;var H=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},nt={exports:{}};(function(a,u){var g=200,d="__lodash_hash_undefined__",h=800,p=16,_=9007199254740991,b="[object Arguments]",A="[object Array]",j="[object AsyncFunction]",$="[object Boolean]",Lt="[object Date]",Nt="[object Error]",at="[object Function]",zt="[object GeneratorFunction]",Ut="[object Map]",Dt="[object Number]",Ft="[object Null]",ut="[object Object]",Gt="[object Proxy]",Rt="[object RegExp]",Bt="[object Set]",Ht="[object String]",$t="[object Undefined]",Kt="[object WeakMap]",qt="[object ArrayBuffer]",Vt="[object DataView]",Wt="[object Float32Array]",Yt="[object Float64Array]",Jt="[object Int8Array]",Xt="[object Int16Array]",Zt="[object Int32Array]",Qt="[object Uint8Array]",kt="[object Uint8ClampedArray]",te="[object Uint16Array]",ee="[object Uint32Array]",ne=/[\\^$.*+?()[\]{}|]/g,re=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,c={};c[Wt]=c[Yt]=c[Jt]=c[Xt]=c[Zt]=c[Qt]=c[kt]=c[te]=c[ee]=!0,c[b]=c[A]=c[qt]=c[$]=c[Vt]=c[Lt]=c[Nt]=c[at]=c[Ut]=c[Dt]=c[ut]=c[Rt]=c[Bt]=c[Ht]=c[Kt]=!1;var st=typeof H=="object"&&H&&H.Object===Object&&H,ie=typeof self=="object"&&self&&self.Object===Object&&self,I=st||ie||Function("return this")(),ct=u&&!u.nodeType&&u,S=ct&&!0&&a&&!a.nodeType&&a,ft=S&&S.exports===ct,K=ft&&st.process,lt=function(){try{var t=S&&S.require&&S.require("util").types;return t||K&&K.binding&&K.binding("util")}catch(e){}}(),gt=lt&<.isTypedArray;function ae(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function ue(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function se(t){return function(e){return t(e)}}function ce(t,e){return t==null?void 0:t[e]}function fe(t,e){return function(n){return t(e(n))}}var le=Array.prototype,ge=Function.prototype,N=Object.prototype,q=I["__core-js_shared__"],z=ge.toString,T=N.hasOwnProperty,dt=function(){var t=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),pt=N.toString,de=z.call(Object),pe=RegExp("^"+z.call(T).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=ft?I.Buffer:void 0,ht=I.Symbol,_t=I.Uint8Array,yt=U?U.allocUnsafe:void 0,vt=fe(Object.getPrototypeOf,Object),bt=Object.create,he=N.propertyIsEnumerable,_e=le.splice,m=ht?ht.toStringTag:void 0,D=function(){try{var t=Y(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),ye=U?U.isBuffer:void 0,Tt=Math.max,ve=Date.now,wt=Y(I,"Map"),E=Y(Object,"create"),be=function(){function t(){}return function(e){if(!C(e))return{};if(bt)return bt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function x(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Te(){this.__data__=E?E(null):{},this.size=0}function we(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function me(t){var e=this.__data__;if(E){var n=e[t];return n===d?void 0:n}return T.call(e,t)?e[t]:void 0}function xe(t){var e=this.__data__;return E?e[t]!==void 0:T.call(e,t)}function Ce(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=E&&e===void 0?d:e,this}x.prototype.clear=Te,x.prototype.delete=we,x.prototype.get=me,x.prototype.has=xe,x.prototype.set=Ce;function w(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ae(){this.__data__=[],this.size=0}function Oe(t){var e=this.__data__,n=F(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():_e.call(e,n,1),--this.size,!0}function Pe(t){var e=this.__data__,n=F(e,t);return n<0?void 0:e[n][1]}function je(t){return F(this.__data__,t)>-1}function Ie(t,e){var n=this.__data__,r=F(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}w.prototype.clear=Ae,w.prototype.delete=Oe,w.prototype.get=Pe,w.prototype.has=je,w.prototype.set=Ie;function O(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Se(){this.size=0,this.__data__={hash:new x,map:new(wt||w),string:new x}}function Ee(t){var e=R(this,t).delete(t);return this.size-=e?1:0,e}function Me(t){return R(this,t).get(t)}function Le(t){return R(this,t).has(t)}function Ne(t,e){var n=R(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}O.prototype.clear=Se,O.prototype.delete=Ee,O.prototype.get=Me,O.prototype.has=Le,O.prototype.set=Ne;function P(t){var e=this.__data__=new w(t);this.size=e.size}function ze(){this.__data__=new w,this.size=0}function Ue(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function De(t){return this.__data__.get(t)}function Fe(t){return this.__data__.has(t)}function Ge(t,e){var n=this.__data__;if(n instanceof w){var r=n.__data__;if(!wt||r.length<g-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new O(r)}return n.set(t,e),this.size=n.size,this}P.prototype.clear=ze,P.prototype.delete=Ue,P.prototype.get=De,P.prototype.has=Fe,P.prototype.set=Ge;function Re(t,e){var n=Z(t),r=!n&&X(t),i=!n&&!r&&Ot(t),s=!n&&!r&&!i&&jt(t),f=n||r||i||s,o=f?ue(t.length,String):[],l=o.length;for(var v in t)(e||T.call(t,v))&&!(f&&(v=="length"||i&&(v=="offset"||v=="parent")||s&&(v=="buffer"||v=="byteLength"||v=="byteOffset")||Ct(v,l)))&&o.push(v);return o}function V(t,e,n){(n!==void 0&&!B(t[e],n)||n===void 0&&!(e in t))&&W(t,e,n)}function Be(t,e,n){var r=t[e];(!(T.call(t,e)&&B(r,n))||n===void 0&&!(e in t))&&W(t,e,n)}function F(t,e){for(var n=t.length;n--;)if(B(t[n][0],e))return n;return-1}function W(t,e,n){e=="__proto__"&&D?D(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var He=en();function G(t){return t==null?t===void 0?$t:Ft:m&&m in Object(t)?nn(t):cn(t)}function mt(t){return M(t)&&G(t)==b}function $e(t){if(!C(t)||un(t))return!1;var e=k(t)?pe:re;return e.test(dn(t))}function Ke(t){return M(t)&&Pt(t.length)&&!!c[G(t)]}function qe(t){if(!C(t))return sn(t);var e=At(t),n=[];for(var r in t)r=="constructor"&&(e||!T.call(t,r))||n.push(r);return n}function xt(t,e,n,r,i){t!==e&&He(e,function(s,f){if(i||(i=new P),C(s))Ve(t,e,f,n,xt,r,i);else{var o=r?r(J(t,f),s,f+"",t,e,i):void 0;o===void 0&&(o=s),V(t,f,o)}},It)}function Ve(t,e,n,r,i,s,f){var o=J(t,n),l=J(e,n),v=f.get(l);if(v){V(t,n,v);return}var y=s?s(o,l,n+"",t,e,f):void 0,L=y===void 0;if(L){var tt=Z(l),et=!tt&&Ot(l),Et=!tt&&!et&&jt(l);y=l,tt||et||Et?Z(o)?y=o:pn(o)?y=Qe(o):et?(L=!1,y=Je(l,!0)):Et?(L=!1,y=Ze(l,!0)):y=[]:hn(l)||X(l)?(y=o,X(o)?y=_n(o):(!C(o)||k(o))&&(y=rn(l))):L=!1}L&&(f.set(l,y),i(y,l,r,s,f),f.delete(l)),V(t,n,y)}function We(t,e){return ln(fn(t,e,St),t+"")}var Ye=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:vn(e),writable:!0})}:St;function Je(t,e){if(e)return t.slice();var n=t.length,r=yt?yt(n):new t.constructor(n);return t.copy(r),r}function Xe(t){var e=new t.constructor(t.byteLength);return new _t(e).set(new _t(t)),e}function Ze(t,e){var n=e?Xe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Qe(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function ke(t,e,n,r){var i=!n;n||(n={});for(var s=-1,f=e.length;++s<f;){var o=e[s],l=r?r(n[o],t[o],o,n,t):void 0;l===void 0&&(l=t[o]),i?W(n,o,l):Be(n,o,l)}return n}function tn(t){return We(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,f=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,f&&on(n[0],n[1],f)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,s)}return e})}function en(t){return function(e,n,r){for(var i=-1,s=Object(e),f=r(e),o=f.length;o--;){var l=f[t?o:++i];if(n(s[l],l,s)===!1)break}return e}}function R(t,e){var n=t.__data__;return an(e)?n[typeof e=="string"?"string":"hash"]:n.map}function Y(t,e){var n=ce(t,e);return $e(n)?n:void 0}function nn(t){var e=T.call(t,m),n=t[m];try{t[m]=void 0;var r=!0}catch(s){}var i=pt.call(t);return r&&(e?t[m]=n:delete t[m]),i}function rn(t){return typeof t.constructor=="function"&&!At(t)?be(vt(t)):{}}function Ct(t,e){var n=typeof t;return e=e==null?_:e,!!e&&(n=="number"||n!="symbol"&&oe.test(t))&&t>-1&&t%1==0&&t<e}function on(t,e,n){if(!C(n))return!1;var r=typeof e;return(r=="number"?Q(n)&&Ct(e,n.length):r=="string"&&e in n)?B(n[e],t):!1}function an(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function un(t){return!!dt&&dt in t}function At(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||N;return t===n}function sn(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}function cn(t){return pt.call(t)}function fn(t,e,n){return e=Tt(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=Tt(r.length-e,0),f=Array(s);++i<s;)f[i]=r[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=r[i];return o[e]=n(f),ae(t,this,o)}}function J(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var ln=gn(Ye);function gn(t){var e=0,n=0;return function(){var r=ve(),i=p-(r-n);if(n=r,i>0){if(++e>=h)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function dn(t){if(t!=null){try{return z.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function B(t,e){return t===e||t!==t&&e!==e}var X=mt(function(){return arguments}())?mt:function(t){return M(t)&&T.call(t,"callee")&&!he.call(t,"callee")},Z=Array.isArray;function Q(t){return t!=null&&Pt(t.length)&&!k(t)}function pn(t){return M(t)&&Q(t)}var Ot=ye||bn;function k(t){if(!C(t))return!1;var e=G(t);return e==at||e==zt||e==j||e==Gt}function Pt(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=_}function C(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function M(t){return t!=null&&typeof t=="object"}function hn(t){if(!M(t)||G(t)!=ut)return!1;var e=vt(t);if(e===null)return!0;var n=T.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&z.call(n)==de}var jt=gt?se(gt):Ke;function _n(t){return ke(t,It(t))}function It(t){return Q(t)?Re(t,!0):qe(t)}var yn=tn(function(t,e,n){xt(t,e,n)});function vn(t){return function(){return t}}function St(t){return t}function bn(){return!1}a.exports=yn})(nt,nt.exports);var xn=nt.exports;class rt extends Error{constructor(u){super(u),this.name="Warning"}}class Cn extends Error{constructor(u){super(u),this.name="InvalidConfiguration"}}function An(){throw new Cn("You've called configure function without a configuration object.")}function On(){const a=u();function u(){return{logger:{debugAll:!1,debugEvents:!1,debugContext:!1},events:{targetProperty:()=>window.dataLayer}}}function g(){return a}function d(h){Boolean(h)||An(),xn(a,h)}return{get:g,defaults:u,configure:d}}const ot=On(),{configure:Pn}=ot;function jn(a={}){function u(){var p;return(p=a.configurations)!=null?p:ot.get()}function g(){return a.getLogger?a.getLogger():mn()}function d({type:p}){const _=()=>u().logger.debugAll,b=()=>u().logger.debugContext,A=()=>u().logger.debugEvents,j=$=>_()||$();return new Map([["event",j(A)],["context-created",j(b)],["context-updated",j(b)]]).get(p)}function h(p){const _=g();d(p)&&_.log(p)}return{log:h}}const it=jn();function In(a){const{contextName:u,properties:g}=a;it.log({type:"context-created",contextName:u,properties:g})}function Sn(a){const{contextName:u,currentProps:g,newProps:d}=a;it.log({type:"context-updated",contextName:u,previousProperties:g,currentProperties:d})}function En(a={},u={}){const g={options:{...u},value:{...a}};function d(){return g.value}function h(_){const b={..._};g.value=b}function p(_){const b=d(),A={..._};Sn({contextName:g.options.name,currentProps:b,newProps:A}),h(A)}return In({contextName:g.options.name,properties:d()}),{context:g,setProps:p}}function Mn(){throw new rt(`Triggering events is not possible on server-side. | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});function y(e={}){var t;const o=console;let r=(t=e.logger)!=null?t:o;function c(){return r}function n(u){r=u}return{getLogger:c,setLogger:n}}const l=y(),{setLogger:v}=l,{getLogger:w}=l;class g extends Error{constructor(t){super(t),this.name="Warning"}}class h extends Error{constructor(t){super(t),this.name="InvalidConfiguration"}}function x(){throw new h("You've called configure function without a configuration object.")}function P(e){const t=Object.entries(e),o=([c,n])=>n!=null,r=t.filter(o);return Object.fromEntries(r)}function m(){const e=t();function t(){return{debugAll:!1,debugEvents:!1,debugContext:!1,targetProperty:()=>window.dataLayer}}function o(){return e}function r(n){const u=P(n);Object.assign(e,u)}function c(n){Boolean(n)||x(),r(n)}return{get:o,defaults:t,configure:c}}const f=m(),{configure:b}=f;function C(e={}){function t(){var n;return(n=e.configurations)!=null?n:f.get()}function o(){return e.getLogger?e.getLogger():w()}function r({type:n}){const u=()=>t().debugAll,i=()=>t().debugContext,a=()=>t().debugEvents,s=p=>u()||p();return new Map([["event",s(a)],["context-created",s(i)],["context-updated",s(i)]]).get(n)}function c(n){const u=o();r(n)&&u.log(n)}return{log:c}}const d=C();function E(e){const{contextName:t,properties:o}=e;d.log({type:"context-created",contextName:t,properties:o})}function L(e){const{contextName:t,currentProps:o,newProps:r}=e;d.log({type:"context-updated",contextName:t,previousProperties:o,currentProperties:r})}function N(e={},t={}){const o={options:{...t},value:{...e}};function r(){return o.value}function c(u){const i={...u};o.value=i}function n(u){const i=r(),a={...u};L({contextName:o.options.name,currentProps:i,newProps:a}),c(a)}return E({contextName:o.options.name,properties:r()}),{context:o,setProps:n}}function T(){throw new g(`Triggering events is not possible on server-side. | ||
Make sure to only trigger events after your app is running on the client-side.`)}function Ln(){throw new rt(`The targetProperty is not defined. | ||
Make sure to only trigger events after your app is running on the client-side.`)}function M(){throw new g(`The targetProperty is not defined. | ||
Make sure you didn't forget to add Google Tag Manager's script in your application. | ||
If you did but you don't use the default 'window.dataLayer' array, you can set your custom targetProperty with the configure function.`)}function Nn(){throw new rt(`The targetProperty is not an array. | ||
If you did but you don't use the default 'window.dataLayer' array, you can set your custom targetProperty with the configure function.`)}function k(){throw new g(`The targetProperty is not an array. | ||
Either you didn't installed Google Tag Manager correctly or you configured the targetProperty incorrectly.`)}function zn(a={}){function u(){var p;return(p=a.configurations)!=null?p:ot.get()}function g(){return u().events.targetProperty()}function d(p){h(),g().push(p)}function h(){const p=()=>typeof window=="undefined",_=()=>Boolean(g()),b=()=>Array.isArray(g());p()?Mn():_()?b()||Nn():Ln()}return{addEvent:d}}const Un=zn();function Dn(a){it.log({type:"event",properties:a})}function Fn({context:a}){function u(d){const h={...a.value,...d};Un.addEvent(h),Dn(h)}function g(d){return h=>{u({...a.value,...d,...h})}}return{trackEvent:u,setRepeatedProps:g}}exports.configure=Pn,exports.createTrackerContext=En,exports.setLogger=wn,exports.withTrackerContext=Fn; | ||
Either you didn't installed Google Tag Manager correctly or you configured the targetProperty incorrectly.`)}function j(e={}){function t(){var n;return(n=e.configurations)!=null?n:f.get()}function o(){return t().targetProperty()}function r(n){c(),o().push(n)}function c(){const n=()=>typeof window=="undefined",u=()=>Boolean(o()),i=()=>Array.isArray(o());n()?T():u()?i()||k():M()}return{addEvent:r}}const I=j();function A(e){d.log({type:"event",properties:e})}function O({context:e}){function t(r){const c={...e.value,...r};I.addEvent(c),A(c)}function o(r){return c=>{t({...e.value,...r,...c})}}return{trackEvent:t,setRepeatedProps:o}}exports.configure=b,exports.createTrackerContext=N,exports.setLogger=v,exports.withTrackerContext=O; | ||
//# sourceMappingURL=index.js.map |
@@ -1,10 +0,10 @@ | ||
function wn(a={}){var u;const g=console;let d=(u=a.logger)!=null?u:g;function h(){return d}function p(_){d=_}return{getLogger:h,setLogger:p}}const Mt=wn(),{setLogger:Tn}=Mt,{getLogger:mn}=Mt;var H=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},nt={exports:{}};(function(a,u){var g=200,d="__lodash_hash_undefined__",h=800,p=16,_=9007199254740991,b="[object Arguments]",C="[object Array]",j="[object AsyncFunction]",$="[object Boolean]",Lt="[object Date]",Nt="[object Error]",at="[object Function]",zt="[object GeneratorFunction]",Ut="[object Map]",Dt="[object Number]",Ft="[object Null]",ut="[object Object]",Gt="[object Proxy]",Rt="[object RegExp]",Bt="[object Set]",Ht="[object String]",$t="[object Undefined]",Kt="[object WeakMap]",qt="[object ArrayBuffer]",Vt="[object DataView]",Wt="[object Float32Array]",Yt="[object Float64Array]",Jt="[object Int8Array]",Xt="[object Int16Array]",Zt="[object Int32Array]",Qt="[object Uint8Array]",kt="[object Uint8ClampedArray]",te="[object Uint16Array]",ee="[object Uint32Array]",ne=/[\\^$.*+?()[\]{}|]/g,re=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,c={};c[Wt]=c[Yt]=c[Jt]=c[Xt]=c[Zt]=c[Qt]=c[kt]=c[te]=c[ee]=!0,c[b]=c[C]=c[qt]=c[$]=c[Vt]=c[Lt]=c[Nt]=c[at]=c[Ut]=c[Dt]=c[ut]=c[Rt]=c[Bt]=c[Ht]=c[Kt]=!1;var st=typeof H=="object"&&H&&H.Object===Object&&H,ie=typeof self=="object"&&self&&self.Object===Object&&self,I=st||ie||Function("return this")(),ct=u&&!u.nodeType&&u,S=ct&&!0&&a&&!a.nodeType&&a,ft=S&&S.exports===ct,K=ft&&st.process,lt=function(){try{var t=S&&S.require&&S.require("util").types;return t||K&&K.binding&&K.binding("util")}catch(e){}}(),gt=lt&<.isTypedArray;function ae(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function ue(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function se(t){return function(e){return t(e)}}function ce(t,e){return t==null?void 0:t[e]}function fe(t,e){return function(n){return t(e(n))}}var le=Array.prototype,ge=Function.prototype,N=Object.prototype,q=I["__core-js_shared__"],z=ge.toString,w=N.hasOwnProperty,dt=function(){var t=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),pt=N.toString,de=z.call(Object),pe=RegExp("^"+z.call(w).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=ft?I.Buffer:void 0,ht=I.Symbol,_t=I.Uint8Array,yt=U?U.allocUnsafe:void 0,vt=fe(Object.getPrototypeOf,Object),bt=Object.create,he=N.propertyIsEnumerable,_e=le.splice,m=ht?ht.toStringTag:void 0,D=function(){try{var t=Y(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),ye=U?U.isBuffer:void 0,wt=Math.max,ve=Date.now,Tt=Y(I,"Map"),E=Y(Object,"create"),be=function(){function t(){}return function(e){if(!A(e))return{};if(bt)return bt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function x(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function we(){this.__data__=E?E(null):{},this.size=0}function Te(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function me(t){var e=this.__data__;if(E){var n=e[t];return n===d?void 0:n}return w.call(e,t)?e[t]:void 0}function xe(t){var e=this.__data__;return E?e[t]!==void 0:w.call(e,t)}function Ae(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=E&&e===void 0?d:e,this}x.prototype.clear=we,x.prototype.delete=Te,x.prototype.get=me,x.prototype.has=xe,x.prototype.set=Ae;function T(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ce(){this.__data__=[],this.size=0}function Oe(t){var e=this.__data__,n=F(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():_e.call(e,n,1),--this.size,!0}function Pe(t){var e=this.__data__,n=F(e,t);return n<0?void 0:e[n][1]}function je(t){return F(this.__data__,t)>-1}function Ie(t,e){var n=this.__data__,r=F(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}T.prototype.clear=Ce,T.prototype.delete=Oe,T.prototype.get=Pe,T.prototype.has=je,T.prototype.set=Ie;function O(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Se(){this.size=0,this.__data__={hash:new x,map:new(Tt||T),string:new x}}function Ee(t){var e=R(this,t).delete(t);return this.size-=e?1:0,e}function Me(t){return R(this,t).get(t)}function Le(t){return R(this,t).has(t)}function Ne(t,e){var n=R(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}O.prototype.clear=Se,O.prototype.delete=Ee,O.prototype.get=Me,O.prototype.has=Le,O.prototype.set=Ne;function P(t){var e=this.__data__=new T(t);this.size=e.size}function ze(){this.__data__=new T,this.size=0}function Ue(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function De(t){return this.__data__.get(t)}function Fe(t){return this.__data__.has(t)}function Ge(t,e){var n=this.__data__;if(n instanceof T){var r=n.__data__;if(!Tt||r.length<g-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new O(r)}return n.set(t,e),this.size=n.size,this}P.prototype.clear=ze,P.prototype.delete=Ue,P.prototype.get=De,P.prototype.has=Fe,P.prototype.set=Ge;function Re(t,e){var n=Z(t),r=!n&&X(t),i=!n&&!r&&Ot(t),s=!n&&!r&&!i&&jt(t),f=n||r||i||s,o=f?ue(t.length,String):[],l=o.length;for(var v in t)(e||w.call(t,v))&&!(f&&(v=="length"||i&&(v=="offset"||v=="parent")||s&&(v=="buffer"||v=="byteLength"||v=="byteOffset")||At(v,l)))&&o.push(v);return o}function V(t,e,n){(n!==void 0&&!B(t[e],n)||n===void 0&&!(e in t))&&W(t,e,n)}function Be(t,e,n){var r=t[e];(!(w.call(t,e)&&B(r,n))||n===void 0&&!(e in t))&&W(t,e,n)}function F(t,e){for(var n=t.length;n--;)if(B(t[n][0],e))return n;return-1}function W(t,e,n){e=="__proto__"&&D?D(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var He=en();function G(t){return t==null?t===void 0?$t:Ft:m&&m in Object(t)?nn(t):cn(t)}function mt(t){return M(t)&&G(t)==b}function $e(t){if(!A(t)||un(t))return!1;var e=k(t)?pe:re;return e.test(dn(t))}function Ke(t){return M(t)&&Pt(t.length)&&!!c[G(t)]}function qe(t){if(!A(t))return sn(t);var e=Ct(t),n=[];for(var r in t)r=="constructor"&&(e||!w.call(t,r))||n.push(r);return n}function xt(t,e,n,r,i){t!==e&&He(e,function(s,f){if(i||(i=new P),A(s))Ve(t,e,f,n,xt,r,i);else{var o=r?r(J(t,f),s,f+"",t,e,i):void 0;o===void 0&&(o=s),V(t,f,o)}},It)}function Ve(t,e,n,r,i,s,f){var o=J(t,n),l=J(e,n),v=f.get(l);if(v){V(t,n,v);return}var y=s?s(o,l,n+"",t,e,f):void 0,L=y===void 0;if(L){var tt=Z(l),et=!tt&&Ot(l),Et=!tt&&!et&&jt(l);y=l,tt||et||Et?Z(o)?y=o:pn(o)?y=Qe(o):et?(L=!1,y=Je(l,!0)):Et?(L=!1,y=Ze(l,!0)):y=[]:hn(l)||X(l)?(y=o,X(o)?y=_n(o):(!A(o)||k(o))&&(y=rn(l))):L=!1}L&&(f.set(l,y),i(y,l,r,s,f),f.delete(l)),V(t,n,y)}function We(t,e){return ln(fn(t,e,St),t+"")}var Ye=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:vn(e),writable:!0})}:St;function Je(t,e){if(e)return t.slice();var n=t.length,r=yt?yt(n):new t.constructor(n);return t.copy(r),r}function Xe(t){var e=new t.constructor(t.byteLength);return new _t(e).set(new _t(t)),e}function Ze(t,e){var n=e?Xe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Qe(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function ke(t,e,n,r){var i=!n;n||(n={});for(var s=-1,f=e.length;++s<f;){var o=e[s],l=r?r(n[o],t[o],o,n,t):void 0;l===void 0&&(l=t[o]),i?W(n,o,l):Be(n,o,l)}return n}function tn(t){return We(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,f=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,f&&on(n[0],n[1],f)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,s)}return e})}function en(t){return function(e,n,r){for(var i=-1,s=Object(e),f=r(e),o=f.length;o--;){var l=f[t?o:++i];if(n(s[l],l,s)===!1)break}return e}}function R(t,e){var n=t.__data__;return an(e)?n[typeof e=="string"?"string":"hash"]:n.map}function Y(t,e){var n=ce(t,e);return $e(n)?n:void 0}function nn(t){var e=w.call(t,m),n=t[m];try{t[m]=void 0;var r=!0}catch(s){}var i=pt.call(t);return r&&(e?t[m]=n:delete t[m]),i}function rn(t){return typeof t.constructor=="function"&&!Ct(t)?be(vt(t)):{}}function At(t,e){var n=typeof t;return e=e==null?_:e,!!e&&(n=="number"||n!="symbol"&&oe.test(t))&&t>-1&&t%1==0&&t<e}function on(t,e,n){if(!A(n))return!1;var r=typeof e;return(r=="number"?Q(n)&&At(e,n.length):r=="string"&&e in n)?B(n[e],t):!1}function an(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function un(t){return!!dt&&dt in t}function Ct(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||N;return t===n}function sn(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}function cn(t){return pt.call(t)}function fn(t,e,n){return e=wt(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=wt(r.length-e,0),f=Array(s);++i<s;)f[i]=r[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=r[i];return o[e]=n(f),ae(t,this,o)}}function J(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var ln=gn(Ye);function gn(t){var e=0,n=0;return function(){var r=ve(),i=p-(r-n);if(n=r,i>0){if(++e>=h)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function dn(t){if(t!=null){try{return z.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function B(t,e){return t===e||t!==t&&e!==e}var X=mt(function(){return arguments}())?mt:function(t){return M(t)&&w.call(t,"callee")&&!he.call(t,"callee")},Z=Array.isArray;function Q(t){return t!=null&&Pt(t.length)&&!k(t)}function pn(t){return M(t)&&Q(t)}var Ot=ye||bn;function k(t){if(!A(t))return!1;var e=G(t);return e==at||e==zt||e==j||e==Gt}function Pt(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=_}function A(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function M(t){return t!=null&&typeof t=="object"}function hn(t){if(!M(t)||G(t)!=ut)return!1;var e=vt(t);if(e===null)return!0;var n=w.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&z.call(n)==de}var jt=gt?se(gt):Ke;function _n(t){return ke(t,It(t))}function It(t){return Q(t)?Re(t,!0):qe(t)}var yn=tn(function(t,e,n){xt(t,e,n)});function vn(t){return function(){return t}}function St(t){return t}function bn(){return!1}a.exports=yn})(nt,nt.exports);var xn=nt.exports;class rt extends Error{constructor(u){super(u),this.name="Warning"}}class An extends Error{constructor(u){super(u),this.name="InvalidConfiguration"}}function Cn(){throw new An("You've called configure function without a configuration object.")}function On(){const a=u();function u(){return{logger:{debugAll:!1,debugEvents:!1,debugContext:!1},events:{targetProperty:()=>window.dataLayer}}}function g(){return a}function d(h){Boolean(h)||Cn(),xn(a,h)}return{get:g,defaults:u,configure:d}}const ot=On(),{configure:Pn}=ot;function jn(a={}){function u(){var p;return(p=a.configurations)!=null?p:ot.get()}function g(){return a.getLogger?a.getLogger():mn()}function d({type:p}){const _=()=>u().logger.debugAll,b=()=>u().logger.debugContext,C=()=>u().logger.debugEvents,j=$=>_()||$();return new Map([["event",j(C)],["context-created",j(b)],["context-updated",j(b)]]).get(p)}function h(p){const _=g();d(p)&&_.log(p)}return{log:h}}const it=jn();function In(a){const{contextName:u,properties:g}=a;it.log({type:"context-created",contextName:u,properties:g})}function Sn(a){const{contextName:u,currentProps:g,newProps:d}=a;it.log({type:"context-updated",contextName:u,previousProperties:g,currentProperties:d})}function En(a={},u={}){const g={options:{...u},value:{...a}};function d(){return g.value}function h(_){const b={..._};g.value=b}function p(_){const b=d(),C={..._};Sn({contextName:g.options.name,currentProps:b,newProps:C}),h(C)}return In({contextName:g.options.name,properties:d()}),{context:g,setProps:p}}function Mn(){throw new rt(`Triggering events is not possible on server-side. | ||
function y(e={}){var t;const o=console;let r=(t=e.logger)!=null?t:o;function c(){return r}function n(i){r=i}return{getLogger:c,setLogger:n}}const l=y(),{setLogger:v}=l,{getLogger:w}=l;class g extends Error{constructor(t){super(t),this.name="Warning"}}class h extends Error{constructor(t){super(t),this.name="InvalidConfiguration"}}function x(){throw new h("You've called configure function without a configuration object.")}function P(e){const t=Object.entries(e),o=([c,n])=>n!=null,r=t.filter(o);return Object.fromEntries(r)}function m(){const e=t();function t(){return{debugAll:!1,debugEvents:!1,debugContext:!1,targetProperty:()=>window.dataLayer}}function o(){return e}function r(n){const i=P(n);Object.assign(e,i)}function c(n){Boolean(n)||x(),r(n)}return{get:o,defaults:t,configure:c}}const f=m(),{configure:b}=f;function E(e={}){function t(){var n;return(n=e.configurations)!=null?n:f.get()}function o(){return e.getLogger?e.getLogger():w()}function r({type:n}){const i=()=>t().debugAll,u=()=>t().debugContext,a=()=>t().debugEvents,s=p=>i()||p();return new Map([["event",s(a)],["context-created",s(u)],["context-updated",s(u)]]).get(n)}function c(n){const i=o();r(n)&&i.log(n)}return{log:c}}const d=E();function L(e){const{contextName:t,properties:o}=e;d.log({type:"context-created",contextName:t,properties:o})}function C(e){const{contextName:t,currentProps:o,newProps:r}=e;d.log({type:"context-updated",contextName:t,previousProperties:o,currentProperties:r})}function N(e={},t={}){const o={options:{...t},value:{...e}};function r(){return o.value}function c(i){const u={...i};o.value=u}function n(i){const u=r(),a={...i};C({contextName:o.options.name,currentProps:u,newProps:a}),c(a)}return L({contextName:o.options.name,properties:r()}),{context:o,setProps:n}}function M(){throw new g(`Triggering events is not possible on server-side. | ||
Make sure to only trigger events after your app is running on the client-side.`)}function Ln(){throw new rt(`The targetProperty is not defined. | ||
Make sure to only trigger events after your app is running on the client-side.`)}function T(){throw new g(`The targetProperty is not defined. | ||
Make sure you didn't forget to add Google Tag Manager's script in your application. | ||
If you did but you don't use the default 'window.dataLayer' array, you can set your custom targetProperty with the configure function.`)}function Nn(){throw new rt(`The targetProperty is not an array. | ||
If you did but you don't use the default 'window.dataLayer' array, you can set your custom targetProperty with the configure function.`)}function I(){throw new g(`The targetProperty is not an array. | ||
Either you didn't installed Google Tag Manager correctly or you configured the targetProperty incorrectly.`)}function zn(a={}){function u(){var p;return(p=a.configurations)!=null?p:ot.get()}function g(){return u().events.targetProperty()}function d(p){h(),g().push(p)}function h(){const p=()=>typeof window=="undefined",_=()=>Boolean(g()),b=()=>Array.isArray(g());p()?Mn():_()?b()||Nn():Ln()}return{addEvent:d}}const Un=zn();function Dn(a){it.log({type:"event",properties:a})}function Fn({context:a}){function u(d){const h={...a.value,...d};Un.addEvent(h),Dn(h)}function g(d){return h=>{u({...a.value,...d,...h})}}return{trackEvent:u,setRepeatedProps:g}}export{Pn as configure,En as createTrackerContext,Tn as setLogger,Fn as withTrackerContext}; | ||
Either you didn't installed Google Tag Manager correctly or you configured the targetProperty incorrectly.`)}function j(e={}){function t(){var n;return(n=e.configurations)!=null?n:f.get()}function o(){return t().targetProperty()}function r(n){c(),o().push(n)}function c(){const n=()=>typeof window=="undefined",i=()=>Boolean(o()),u=()=>Array.isArray(o());n()?M():i()?u()||I():T()}return{addEvent:r}}const k=j();function A(e){d.log({type:"event",properties:e})}function O({context:e}){function t(r){const c={...e.value,...r};k.addEvent(c),A(c)}function o(r){return c=>{t({...e.value,...r,...c})}}return{trackEvent:t,setRepeatedProps:o}}export{b as configure,N as createTrackerContext,v as setLogger,O as withTrackerContext}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,1 @@ | ||
import type { PartialDeep } from 'type-fest'; | ||
/** | ||
@@ -8,4 +6,23 @@ * All available configuration options. | ||
export declare type Configurations = { | ||
logger: LoggerConfigurations; | ||
events: EventsConfigurations; | ||
/** | ||
* It logs everything, is equivalent of setting all `debug` options to `true`. | ||
*/ | ||
debugAll: boolean; | ||
/** | ||
* It logs events. These events are logged when you call `trackEvent`. | ||
*/ | ||
debugEvents: boolean; | ||
/** | ||
* It logs context operations. | ||
* | ||
* These events are logged when you call `createTrackerContext`, | ||
* and when you call `setProps` in a created tracker context. | ||
*/ | ||
debugContext: boolean; | ||
/** | ||
* Array which events are going to be pushed into. | ||
* | ||
* The default value is `window.dataLayer`. | ||
*/ | ||
targetProperty: () => EventProperties[]; | ||
}; | ||
@@ -17,3 +34,3 @@ | ||
*/ | ||
export declare const configure: (customConfigs: PartialDeep<Configurations>) => void; | ||
export declare const configure: (customConfigs: Partial<Configurations>) => void; | ||
@@ -45,10 +62,2 @@ /** | ||
/** | ||
* Available options for events. | ||
* @public | ||
*/ | ||
export declare type EventsConfigurations = { | ||
targetProperty: () => EventProperties[]; | ||
}; | ||
/** | ||
* Available method for logs. | ||
@@ -80,12 +89,2 @@ * @public | ||
/** | ||
* Available options for the logger. | ||
* @public | ||
*/ | ||
export declare type LoggerConfigurations = { | ||
debugAll: boolean; | ||
debugEvents: boolean; | ||
debugContext: boolean; | ||
}; | ||
/** | ||
* Sets a custom logger. | ||
@@ -92,0 +91,0 @@ * @public |
@@ -8,3 +8,3 @@ { | ||
"license": "MIT", | ||
"version": "1.7.0-beta.10", | ||
"version": "1.7.0-beta.11", | ||
"description": "A type-safe, reusable, and flexible way for triggering Google Tag Manager track events.", | ||
@@ -44,5 +44,2 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"lodash.merge": "^4.6.2" | ||
}, | ||
"devDependencies": { | ||
@@ -64,4 +61,2 @@ "@babel/preset-env": "^7.18.2", | ||
"@types/jest": "^28.1.1", | ||
"@types/lodash-es": "^4.17.6", | ||
"@types/lodash.merge": "^4.6.7", | ||
"@typescript-eslint/eslint-plugin": "^5.27.1", | ||
@@ -91,5 +86,4 @@ "@typescript-eslint/parser": "^5.27.1", | ||
"tsc-alias": "^1.6.9", | ||
"type-fest": "^2.13.0", | ||
"typescript": "^4.7.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
0
40
48936
220
- Removedlodash.merge@^4.6.2
- Removedlodash.merge@4.6.2(transitive)