gtm-event-tracker
Advanced tools
Comparing version 1.7.0-beta.11 to 1.7.0-beta.12
@@ -1,10 +0,10 @@ | ||
"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. | ||
"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(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 C(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 T(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};L({contextName:o.options.name,currentProps:u,newProps:a}),c(a)}return C({contextName:o.options.name,properties:r()}),{context:o,setProps:n}}function N(){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 M(){throw new g(`The targetProperty is not defined. | ||
Make sure to only trigger events after your app is running on the client-side.`)}function k(){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 k(){throw new g(`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 M(){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 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; | ||
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()?N():i()?u()||M():k()}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,partialTrackEvent:o}}exports.configure=b,exports.createTrackerContext=T,exports.setLogger=v,exports.withTrackerContext=O; | ||
//# sourceMappingURL=index.js.map |
@@ -1,10 +0,10 @@ | ||
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. | ||
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 m(e){const t=Object.entries(e),o=([c,n])=>n!=null,r=t.filter(o);return Object.fromEntries(r)}function P(){const e=t();function t(){return{debugAll:!1,debugEvents:!1,debugContext:!1,targetProperty:()=>window.dataLayer}}function o(){return e}function r(n){const i=m(n);Object.assign(e,i)}function c(n){Boolean(n)||x(),r(n)}return{get:o,defaults:t,configure:c}}const f=P(),{configure:E}=f;function b(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=b();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 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 T(){throw new g(`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 I(){throw new g(`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 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}; | ||
Either you didn't installed Google Tag Manager correctly or you configured the targetProperty incorrectly.`)}function I(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()?T():i()?u()||k():M()}return{addEvent:r}}const j=I();function A(e){d.log({type:"event",properties:e})}function O({context:e}){function t(r){const c={...e.value,...r};j.addEvent(c),A(c)}function o(r){return c=>{t({...e.value,...r,...c})}}return{trackEvent:t,partialTrackEvent:o}}export{E as configure,N as createTrackerContext,v as setLogger,O as withTrackerContext}; | ||
//# sourceMappingURL=index.js.map |
@@ -158,3 +158,3 @@ /** | ||
* @example | ||
* const trackNewAccount = setRepeatedProps({ | ||
* const trackNewAccount = partialTrackEvent({ | ||
* action: 'new account' | ||
@@ -166,3 +166,3 @@ * }) | ||
*/ | ||
setRepeatedProps: <RepeatedProps extends Partial<CustomEventProperties>>(repeatedProps: RepeatedProps) => (remainingProps: SubtractEventProperties<CustomEventProperties, RepeatedProps>) => void; | ||
partialTrackEvent: <RepeatedProps extends Partial<CustomEventProperties>>(repeatedProps: RepeatedProps) => (remainingProps: SubtractEventProperties<CustomEventProperties, RepeatedProps>) => void; | ||
}; | ||
@@ -184,7 +184,7 @@ | ||
* // using the tracker context to track events | ||
* const Tracker = withTrackerContext(appTrackerContext) | ||
* const tracker = withTrackerContext(appTrackerContext) | ||
* | ||
* Tracker.trackEvent({ foo: 'bar', baz: 'qux', }) | ||
* tracker.trackEvent({ foo: 'bar', baz: 'qux', }) | ||
* | ||
* const trackMenuEvent = Tracker.setRepeatedProps({ category: 'menu' }) | ||
* const trackMenuEvent = tracker.partialTrackEvent({ category: 'menu' }) | ||
* trackMenuEvent({ action: 'log in' }) | ||
@@ -191,0 +191,0 @@ * trackMenuEvent({ action: 'log out' }) |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.24.2" | ||
"packageVersion": "7.28.4" | ||
} | ||
] | ||
} |
@@ -8,3 +8,3 @@ { | ||
"license": "MIT", | ||
"version": "1.7.0-beta.11", | ||
"version": "1.7.0-beta.12", | ||
"description": "A type-safe, reusable, and flexible way for triggering Google Tag Manager track events.", | ||
@@ -45,11 +45,11 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.18.2", | ||
"@babel/preset-typescript": "^7.17.12", | ||
"@commitlint/cli": "^17.0.2", | ||
"@commitlint/config-conventional": "^17.0.2", | ||
"@faker-js/faker": "^7.2.0", | ||
"@microsoft/api-extractor": "^7.24.2", | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@babel/preset-env": "^7.18.6", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@commitlint/cli": "^17.0.3", | ||
"@commitlint/config-conventional": "^17.0.3", | ||
"@faker-js/faker": "^7.3.0", | ||
"@microsoft/api-extractor": "^7.28.4", | ||
"@rollup/plugin-commonjs": "^22.0.1", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@rollup/plugin-typescript": "^8.3.2", | ||
"@rollup/plugin-typescript": "^8.3.3", | ||
"@semantic-release/changelog": "^6.0.1", | ||
@@ -60,29 +60,29 @@ "@semantic-release/commit-analyzer": "^9.0.2", | ||
"@semantic-release/release-notes-generator": "^10.0.3", | ||
"@types/jest": "^28.1.1", | ||
"@typescript-eslint/eslint-plugin": "^5.27.1", | ||
"@typescript-eslint/parser": "^5.27.1", | ||
"esbuild": "^0.14.42", | ||
"eslint": "^8.17.0", | ||
"@types/jest": "^28.1.4", | ||
"@typescript-eslint/eslint-plugin": "^5.30.6", | ||
"@typescript-eslint/parser": "^5.30.6", | ||
"esbuild": "^0.14.49", | ||
"eslint": "^8.19.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"eslint-import-resolver-typescript": "^2.7.1", | ||
"eslint-import-resolver-typescript": "^3.2.5", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-n": "^15.2.1", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-n": "^15.2.4", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.0", | ||
"jest-environment-jsdom": "^28.1.0", | ||
"lint-staged": "^13.0.0", | ||
"jest": "^28.1.2", | ||
"jest-environment-jsdom": "^28.1.2", | ||
"lint-staged": "^13.0.3", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.6.2", | ||
"prettier": "^2.7.1", | ||
"prettier-eslint": "^15.0.1", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.75.5", | ||
"rollup": "^2.76.0", | ||
"rollup-plugin-esbuild": "^4.9.1", | ||
"rollup-plugin-size": "^0.2.2", | ||
"semantic-release": "^19.0.2", | ||
"tsc-alias": "^1.6.9", | ||
"typescript": "^4.7.3" | ||
"semantic-release": "^19.0.3", | ||
"tsc-alias": "^1.6.11", | ||
"typescript": "^4.7.4" | ||
} | ||
} |
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
48947