@cronapp/framework-analytics-matomo 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ (()=>{var t={};(()=>{"use strict";var t=cronapp.configuration.IConfigurationService,e=cronapp.ioc.component,i=cronapp.ioc.qualifier,r=cronapp.ioc.bindSingleton,o=cronapp.analytics.IAnalyticsPluginFactory;class n{get name(){return"matomo"}get tracker(){return null==this._tracker&&(this._tracker=Matomo.getTracker(`${this.matomoUrl}/matomo.php`,this.siteId)),this._tracker}constructor(t,e){this.matomoUrl=t,this.siteId=e}page({payload:t}){this.tracker.deleteCustomVariables("page"),this.tracker.setCustomUrl(t.properties.path+t.properties.hash),this.tracker.trackPageView(t.properties.title)}identify({payload:t}){this.tracker.setUserId(t.userId)}track({payload:t}){if(t.properties){const e=t.properties,{category:i,value:r,action:o}=e,n=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(i[r[o]]=t[r[o]])}return i}(e,["category","value","action"]);this.tracker.trackEvent(i,o,t.event,r,n,void 0)}else this.tracker.trackEvent(t.event,t.event,void 0,void 0,void 0,void 0)}}let a=class{constructor(t){this.configurationService=t,this._initializationPromise=new Promise((t=>this._initializationComplete=t))}createAnalyticsPlugin(){return t=this,e=void 0,r=function*(){const t=((yield this.configurationService.getValue("cronapp.framework.matomo.url"))||"").replace(/\/$/,""),e=yield this.configurationService.getValue("cronapp.framework.matomo.siteId"),i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=`${t}/matomo.js`;const r=document.getElementsByTagName("script")[0];return r.parentNode.insertBefore(i,r),this.initialize(),yield this._initializationPromise,new n(t,e)},new((i=void 0)||(i=Promise))((function(o,n){function a(t){try{s(r.next(t))}catch(t){n(t)}}function c(t){try{s(r.throw(t))}catch(t){n(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}));var t,e,i,r}initialize(){"undefined"==typeof Matomo?setTimeout((()=>this.initialize()),100):this._initializationComplete()}};var c,s;a=function(t,e,i,r){var o,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}([e(),(c=0,s=i(t),function(t,e){s(t,e,c)}),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:paramtypes",[Object])],a),r(o,a)})();var e=cronapp="undefined"==typeof cronapp?{}:cronapp;for(var i in t)e[i]=t[i];t.__esModule&&Object.defineProperty(e,"__esModule",{value:!0})})();
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../tsconfig.packages.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src/main/browser",
5
+ "outDir": "target/browser",
6
+ "baseUrl": "src/main/browser"
7
+ },
8
+ "include": [
9
+ "../typings/@cronapp/framework-core.d.ts",
10
+ "../typings/@cronapp/framework-analytics.d.ts",
11
+ "src"
12
+ ]
13
+ }
@@ -0,0 +1,9 @@
1
+ const path = require('path');
2
+ const createConfig = require('../webpack.config.js');
3
+ const packageName = 'cronapp.framework.analytics.matomo';
4
+
5
+ module.exports = (env, options) => {
6
+ const ROOT = path.resolve(__dirname, 'src/main/browser');
7
+ const DESTINATION = path.resolve(__dirname, 'target/browser');
8
+ return createConfig(env, options, packageName, ROOT, DESTINATION);
9
+ };