diff --git a/composer.json b/composer.json index e0a3ea1..89d1967 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "source": "https://github.com/FriendsOfFlarum/analytics" }, "require": { - "flarum/core": "^0.1.0-beta.10" + "flarum/core": "^0.1.0-beta.14", + "fof/components": "^0.2.0" }, "extra": { "flarum-extension": { diff --git a/extend.php b/extend.php index 4f093ba..47a12c1 100644 --- a/extend.php +++ b/extend.php @@ -12,8 +12,10 @@ namespace FoF\Analytics; use Flarum\Extend; +use FoF\Components\Extend\AddFofComponents; return [ + (new AddFofComponents()), (new Extend\Frontend('forum')) ->js(__DIR__.'/js/dist/forum.js') ->content(Listeners\AddTrackingJs::class), diff --git a/js/dist/admin.js b/js/dist/admin.js index e227e9d..3c7f9fe 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(t){var n={};function a(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=t,a.c=n,a.d=function(t,n,i){a.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,n){if(1&n&&(t=a(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)a.d(i,o,function(n){return t[n]}.bind(null,o));return i},a.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(n,"a",n),n},a.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},a.p="",a(a.s=8)}([function(t,n){t.exports=flarum.core.compat["components/Switch"]},function(t,n){t.exports=flarum.core.compat.extend},,function(t,n){t.exports=flarum.core.compat["components/SettingsModal"]},function(t,n){t.exports=flarum.core.compat["components/Select"]},function(t,n){t.exports=flarum.core.compat["components/AdminNav"]},function(t,n){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,n){t.exports=flarum.core.compat.Component},function(t,n,a){"use strict";function i(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}a.r(n);var o=a(3),e=a.n(o),r=a(4),p=a.n(r),s=a(0),l=a.n(s),c="fof-analytics.",u=function(t){function n(){return t.apply(this,arguments)||this}i(n,t);var a=n.prototype;return a.className=function(){return"AnalyticsSettingsModal Modal--medium"},a.title=function(){return app.translator.trans("fof-analytics.admin.popup.title")},a.form=function(){var t=this.setting(c+"piwikTrackAccounts");return t()||t("none"),[m("h3",app.translator.trans("fof-analytics.admin.popup.section.googleAnalytics")),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"statusGoogle")()>0,onchange:this.setting(c+"statusGoogle"),children:app.translator.trans("fof-analytics.admin.popup.field.statusGoogle")}))]),this.setting(c+"statusGoogle")()>0?[m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.googleTrackingCode")),m("input.FormControl",{bidi:this.setting(c+"googleTrackingCode"),placeholder:"UA-XXXXXXXX-X"})]),m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.googleGTMCode")),m("input.FormControl",{bidi:this.setting(c+"googleGTMCode"),placeholder:"GTM-XXXXXXX"})]),m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.optTrackingCode")),m("input.FormControl",{bidi:this.setting(c+"optTrackingCode"),placeholder:"GTM-XXXXXX"})])]:null,m("h3",app.translator.trans("fof-analytics.admin.popup.section.piwik")),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"statusPiwik")()>0,onchange:this.setting(c+"statusPiwik"),children:app.translator.trans("fof-analytics.admin.popup.field.statusPiwik")}))]),this.setting(c+"statusPiwik")()>0?[m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikUrl")),m("input.FormControl",{bidi:this.setting(c+"piwikUrl"),placeholder:"piwik.example.com"})]),m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikSiteId")),m("input.FormControl",{bidi:this.setting(c+"piwikSiteId")})]),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"piwikTrackSubdomain")()>0,onchange:this.setting(c+"piwikTrackSubdomain"),children:app.translator.trans("fof-analytics.admin.popup.field.piwikTrackSubdomain")}))]),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"piwikPrependDomain")()>0,onchange:this.setting(c+"piwikPrependDomain"),children:app.translator.trans("fof-analytics.admin.popup.field.piwikPrependDomain")}))]),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"piwikHideAliasUrl")()>0,onchange:this.setting(c+"piwikHideAliasUrl"),children:app.translator.trans("fof-analytics.admin.popup.field.piwikHideAliasUrl")}))]),this.setting(c+"piwikHideAliasUrl")()>0?[m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikAliasUrl")),m("input.FormControl",{bidi:this.setting(c+"piwikAliasUrl")})])]:null,m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikTrackAccounts")),p.a.component({options:{none:app.translator.trans("fof-analytics.admin.popup.trackAccounts.none"),username:app.translator.trans("fof-analytics.admin.popup.trackAccounts.username"),email:app.translator.trans("fof-analytics.admin.popup.trackAccounts.email")},value:t(),onchange:t})]),m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikAuthToken")),m("input.FormControl",{bidi:this.setting(c+"piwikAuthToken"),placeholder:"00112233445566778899aabbccddeeff"}),m(".helpText",app.translator.trans("fof-analytics.admin.popup.placeholder.piwikAuthToken"))])]:null]},n}(e.a),f=a(1),d=a(5),g=a.n(d),h=a(6),y=a.n(h),k=a(7),b=function(t){function n(){return t.apply(this,arguments)||this}return i(n,t),n.prototype.view=function(){var t=app.data.settings["fof-analytics.piwikUrl"];return-1===t.indexOf("http://")&&-1===t.indexOf("https://")&&-1===t.indexOf("//")&&(t="//"+t),"/"!==t[t.length-1]&&(t+="/"),this.url=t+"index.php",this.url+="?idSite="+app.data.settings["fof-analytics.piwikSiteId"],this.url+="&token_auth="+app.data.settings["fof-analytics.piwikAuthToken"],this.url+="&module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&period=month&date=today",[m("div",{className:"AnalyticsPage"},m("div",{className:"piwik"},m("label",null,"Piwik"),m("iframe",{src:this.url,frameborder:"0"})))]},n}(a.n(k).a),w=function(){m.prop(app.data.settings["fof-analytics.statusPiwik"])()&&m.prop(app.data.settings["fof-analytics.piwikUrl"])()&&m.prop(app.data.settings["fof-analytics.piwikSiteId"])()&&m.prop(app.data.settings["fof-analytics.piwikAuthToken"])()&&(app.routes.analytics={path:"/analytics",component:b.component()},Object(f.extend)(g.a.prototype,"items",(function(t){t.add("analytics",y.a.component({href:app.route("analytics"),icon:"fas fa-chart-line",children:app.translator.trans("fof-analytics.admin.page.nav.title"),description:app.translator.trans("fof-analytics.admin.page.nav.description")}))})))};app.initializers.add("fof-analytics",(function(t){t.extensionSettings["fof-analytics"]=function(){return t.modal.show(new u)},w()}))}]); +module.exports=function(t){var a={};function n(i){if(a[i])return a[i].exports;var o=a[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=a,n.d=function(t,a,i){n.o(t,a)||Object.defineProperty(t,a,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,a){if(1&a&&(t=n(t)),8&a)return t;if(4&a&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&a&&"string"!=typeof t)for(var o in t)n.d(i,o,function(a){return t[a]}.bind(null,o));return i},n.n=function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(a,"a",a),a},n.o=function(t,a){return Object.prototype.hasOwnProperty.call(t,a)},n.p="",n(n.s=9)}([function(t,a){t.exports=flarum.core.compat["components/Switch"]},function(t,a){t.exports=flarum.core.compat.extend},function(t,a){t.exports=flarum.core.compat["utils/Stream"]},,function(t,a){t.exports=flarum.core.compat["components/SettingsModal"]},function(t,a){t.exports=flarum.core.compat["components/Select"]},function(t,a){t.exports=flarum.core.compat["components/AdminNav"]},function(t,a){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,a){t.exports=flarum.core.compat.Component},function(t,a,n){"use strict";function i(t,a){t.prototype=Object.create(a.prototype),t.prototype.constructor=t,t.__proto__=a}n.r(a);var o=n(4),e=n.n(o),r=n(5),p=n.n(r),s=n(0),l=n.n(s),c="fof-analytics.",u=function(t){function a(){return t.apply(this,arguments)||this}i(a,t);var n=a.prototype;return n.className=function(){return"AnalyticsSettingsModal Modal--medium"},n.title=function(){return app.translator.trans("fof-analytics.admin.popup.title")},n.form=function(){var t=this.setting(c+"piwikTrackAccounts");return t()||t("none"),[m("h3",app.translator.trans("fof-analytics.admin.popup.section.googleAnalytics")),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"statusGoogle")()>0,onchange:this.setting(c+"statusGoogle")},app.translator.trans("fof-analytics.admin.popup.field.statusGoogle")))]),this.setting(c+"statusGoogle")()>0?[m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.googleTrackingCode")),m("input.FormControl",{bidi:this.setting(c+"googleTrackingCode"),placeholder:"UA-XXXXXXXX-X"})]),m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.googleGTMCode")),m("input.FormControl",{bidi:this.setting(c+"googleGTMCode"),placeholder:"GTM-XXXXXXX"})]),m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.optTrackingCode")),m("input.FormControl",{bidi:this.setting(c+"optTrackingCode"),placeholder:"GTM-XXXXXX"})])]:null,m("h3",app.translator.trans("fof-analytics.admin.popup.section.piwik")),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"statusPiwik")()>0,onchange:this.setting(c+"statusPiwik")},app.translator.trans("fof-analytics.admin.popup.field.statusPiwik")))]),this.setting(c+"statusPiwik")()>0?[m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikUrl")),m("input.FormControl",{bidi:this.setting(c+"piwikUrl"),placeholder:"piwik.example.com"})]),m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikSiteId")),m("input.FormControl",{bidi:this.setting(c+"piwikSiteId")})]),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"piwikTrackSubdomain")()>0,onchange:this.setting(c+"piwikTrackSubdomain")},app.translator.trans("fof-analytics.admin.popup.field.piwikTrackSubdomain")))]),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"piwikPrependDomain")()>0,onchange:this.setting(c+"piwikPrependDomain")},app.translator.trans("fof-analytics.admin.popup.field.piwikPrependDomain")))]),m(".Form-group",[m("label",l.a.component({state:this.setting(c+"piwikHideAliasUrl")()>0,onchange:this.setting(c+"piwikHideAliasUrl")},app.translator.trans("fof-analytics.admin.popup.field.piwikHideAliasUrl")))]),this.setting(c+"piwikHideAliasUrl")()>0?[m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikAliasUrl")),m("input.FormControl",{bidi:this.setting(c+"piwikAliasUrl")})])]:null,m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikTrackAccounts")),p.a.component({options:{none:app.translator.trans("fof-analytics.admin.popup.trackAccounts.none"),username:app.translator.trans("fof-analytics.admin.popup.trackAccounts.username"),email:app.translator.trans("fof-analytics.admin.popup.trackAccounts.email")},value:t(),onchange:t})]),m(".Form-group",[m("label",app.translator.trans("fof-analytics.admin.popup.field.piwikAuthToken")),m("input.FormControl",{bidi:this.setting(c+"piwikAuthToken"),placeholder:"00112233445566778899aabbccddeeff"}),m(".helpText",app.translator.trans("fof-analytics.admin.popup.placeholder.piwikAuthToken"))])]:null]},a}(e.a),f=n(1),d=n(6),g=n.n(d),h=n(7),y=n.n(h),k=n(2),b=n.n(k),w=n(8),x=function(t){function a(){return t.apply(this,arguments)||this}return i(a,t),a.prototype.view=function(){var t=app.data.settings["fof-analytics.piwikUrl"];return-1===t.indexOf("http://")&&-1===t.indexOf("https://")&&-1===t.indexOf("//")&&(t="//"+t),"/"!==t[t.length-1]&&(t+="/"),this.url=t+"index.php",this.url+="?idSite="+app.data.settings["fof-analytics.piwikSiteId"],this.url+="&token_auth="+app.data.settings["fof-analytics.piwikAuthToken"],this.url+="&module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&period=month&date=today",[m("div",{className:"AnalyticsPage"},m("div",{className:"piwik"},m("label",null,"Piwik"),m("iframe",{src:this.url,frameborder:"0"})))]},a}(n.n(w).a),T=function(){b()(app.data.settings["fof-analytics.statusPiwik"])()&&b()(app.data.settings["fof-analytics.piwikUrl"])()&&b()(app.data.settings["fof-analytics.piwikSiteId"])()&&b()(app.data.settings["fof-analytics.piwikAuthToken"])()&&(app.routes.analytics={path:"/analytics",component:x},Object(f.extend)(g.a.prototype,"items",(function(t){t.add("analytics",y.a.component({href:app.route("analytics"),icon:"fas fa-chart-line",description:app.translator.trans("fof-analytics.admin.page.nav.description")},app.translator.trans("fof-analytics.admin.page.nav.title")))})))};app.initializers.add("fof-analytics",(function(t){t.extensionSettings["fof-analytics"]=function(){return t.modal.show(u)},T()}))}]); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index da19ce0..ba17fa0 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/analytics/webpack/bootstrap","webpack://@fof/analytics/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/analytics/external \"flarum.core.compat['extend']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/SettingsModal']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/Select']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/AdminNav']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/AdminLinkButton']\"","webpack://@fof/analytics/external \"flarum.core.compat['Component']\"","webpack://@fof/analytics/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/analytics/./src/admin/components/AnalyticsSettingsModal.js","webpack://@fof/analytics/./src/admin/components/AnalyticsPage.js","webpack://@fof/analytics/./src/admin/addAnalyticsPage.js","webpack://@fof/analytics/./src/admin/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","settingsPrefix","AnalyticsSettingsModal","className","title","app","translator","trans","form","piwikTrackAccountsSetting","this","setting","Switch","component","state","onchange","children","bidi","placeholder","Select","options","none","username","email","SettingsModal","AnalyticsPage","view","piwikUrl","data","settings","indexOf","length","url","src","frameborder","Component","prop","routes","path","extend","AdminNav","items","add","AdminLinkButton","href","route","icon","description","initializers","extensionSettings","modal","show","addAnalyticsPage"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL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AU,CAC7C+B,KAAMvC,IAAIwC,MAAM,aAChBC,KAAM,oBACN9B,SAAUX,IAAIC,WAAWC,MAAM,sCAC/BwC,YAAa1C,IAAIC,WAAWC,MAAM,oDCpBlDF,IAAI2C,aAAaN,IAAI,iBAAiB,SAAArC,GAClCA,EAAI4C,kBAAkB,iBAAmB,kBAAM5C,EAAI6C,MAAMC,KAAK,IAAIjD,IAClEkD","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/SettingsModal'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/AdminNav'];","module.exports = flarum.core.compat['components/AdminLinkButton'];","module.exports = flarum.core.compat['Component'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import SettingsModal from 'flarum/components/SettingsModal';\nimport Select from 'flarum/components/Select';\nimport Switch from 'flarum/components/Switch';\n\nconst settingsPrefix = 'fof-analytics.';\n\nexport default class AnalyticsSettingsModal extends SettingsModal {\n\n className() {\n\n return 'AnalyticsSettingsModal Modal--medium';\n }\n\n title() {\n return app.translator.trans('fof-analytics.admin.popup.title');\n }\n\n form() {\n const piwikTrackAccountsSetting = this.setting(settingsPrefix + 'piwikTrackAccounts');\n\n if (!piwikTrackAccountsSetting()) {\n piwikTrackAccountsSetting('none');\n }\n\n return [\n m('h3', app.translator.trans('fof-analytics.admin.popup.section.googleAnalytics')),\n m('.Form-group', [\n m('label', Switch.component({\n state: this.setting(settingsPrefix + 'statusGoogle')() > 0,\n onchange: this.setting(settingsPrefix + 'statusGoogle'),\n children: app.translator.trans('fof-analytics.admin.popup.field.statusGoogle'),\n })),\n ]),\n (this.setting(settingsPrefix + 'statusGoogle')() > 0 ? [\n m('.Form-group', [\n m('label', app.translator.trans('fof-analytics.admin.popup.field.googleTrackingCode')),\n m('input.FormControl', {\n bidi: this.setting(settingsPrefix + 'googleTrackingCode'),\n placeholder: 'UA-XXXXXXXX-X',\n }),\n ]),\n m('.Form-group', [\n m('label', app.translator.trans('fof-analytics.admin.popup.field.googleGTMCode')),\n m('input.FormControl', {\n bidi: this.setting(settingsPrefix + 'googleGTMCode'),\n placeholder: 'GTM-XXXXXXX',\n }),\n ]),\n m('.Form-group', [\n m('label', app.translator.trans('fof-analytics.admin.popup.field.optTrackingCode')),\n m('input.FormControl', {\n bidi: this.setting(settingsPrefix + 'optTrackingCode'),\n placeholder: 'GTM-XXXXXX',\n }),\n ]),\n ] : null),\n m('h3', app.translator.trans('fof-analytics.admin.popup.section.piwik')),\n m('.Form-group', [\n m('label', Switch.component({\n state: this.setting(settingsPrefix + 'statusPiwik')() > 0,\n onchange: this.setting(settingsPrefix + 'statusPiwik'),\n children: app.translator.trans('fof-analytics.admin.popup.field.statusPiwik'),\n })),\n ]),\n (this.setting(settingsPrefix + 'statusPiwik')() > 0 ? [\n m('.Form-group', [\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikUrl')),\n m('input.FormControl', {\n bidi: this.setting(settingsPrefix + 'piwikUrl'),\n placeholder: 'piwik.example.com',\n }),\n ]),\n m('.Form-group', [\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikSiteId')),\n m('input.FormControl', {\n bidi: this.setting(settingsPrefix + 'piwikSiteId'),\n }),\n ]),\n m('.Form-group', [\n m('label', Switch.component({\n state: this.setting(settingsPrefix + 'piwikTrackSubdomain')() > 0,\n onchange: this.setting(settingsPrefix + 'piwikTrackSubdomain'),\n children: app.translator.trans('fof-analytics.admin.popup.field.piwikTrackSubdomain'),\n })),\n ]),\n m('.Form-group', [\n m('label', Switch.component({\n state: this.setting(settingsPrefix + 'piwikPrependDomain')() > 0,\n onchange: this.setting(settingsPrefix + 'piwikPrependDomain'),\n children: app.translator.trans('fof-analytics.admin.popup.field.piwikPrependDomain'),\n })),\n ]),\n m('.Form-group', [\n m('label', Switch.component({\n state: this.setting(settingsPrefix + 'piwikHideAliasUrl')() > 0,\n onchange: this.setting(settingsPrefix + 'piwikHideAliasUrl'),\n children: app.translator.trans('fof-analytics.admin.popup.field.piwikHideAliasUrl'),\n })),\n ]),\n (this.setting(settingsPrefix + 'piwikHideAliasUrl')() > 0 ? [\n m('.Form-group', [\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikAliasUrl')),\n m('input.FormControl', {\n bidi: this.setting(settingsPrefix + 'piwikAliasUrl'),\n }),\n ]),\n ] : null),\n m('.Form-group', [\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikTrackAccounts')),\n Select.component({\n options: {\n none: app.translator.trans('fof-analytics.admin.popup.trackAccounts.none'),\n username: app.translator.trans('fof-analytics.admin.popup.trackAccounts.username'),\n email: app.translator.trans('fof-analytics.admin.popup.trackAccounts.email'),\n },\n value: piwikTrackAccountsSetting(),\n onchange: piwikTrackAccountsSetting,\n }),\n ]),\n m('.Form-group', [\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikAuthToken')),\n m('input.FormControl', {\n bidi: this.setting(settingsPrefix + 'piwikAuthToken'),\n placeholder: '00112233445566778899aabbccddeeff',\n }),\n m('.helpText', app.translator.trans('fof-analytics.admin.popup.placeholder.piwikAuthToken')),\n ]),\n ] : null),\n ];\n }\n}\n","import Component from 'flarum/Component';\n\nexport default class AnalyticsPage extends Component {\n\n view() {\n let piwikUrl = app.data.settings['fof-analytics.piwikUrl'];\n\n // Use protocol-relative url if the url contains no protocol\n if (piwikUrl.indexOf('http://') === -1 && piwikUrl.indexOf('https://') === -1 && piwikUrl.indexOf('//') === -1) {\n piwikUrl = '//' + piwikUrl;\n }\n\n // Add trailing slash if necessary\n if (piwikUrl[piwikUrl.length - 1] !== '/') {\n piwikUrl += '/';\n }\n\n //Call the piwik application\n this.url = piwikUrl + 'index.php';\n this.url += '?idSite=' + app.data.settings['fof-analytics.piwikSiteId'];\n this.url += '&token_auth=' + app.data.settings['fof-analytics.piwikAuthToken'];\n this.url += '&module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&period=month&date=today';\n\n return [\n
\n
\n \n \n
\n
\n ];\n }\n}\n","import {extend} from 'flarum/extend';\nimport AdminNav from 'flarum/components/AdminNav';\nimport AdminLinkButton from 'flarum/components/AdminLinkButton';\n\nimport AnalyticsPage from './components/AnalyticsPage';\n\nexport default function () {\n // add the Analytics tab to the admin navigation menu if piwik is enabled\n if (m.prop(app.data.settings['fof-analytics.statusPiwik'])() &&\n m.prop(app.data.settings['fof-analytics.piwikUrl'])() &&\n m.prop(app.data.settings['fof-analytics.piwikSiteId'])() &&\n m.prop(app.data.settings['fof-analytics.piwikAuthToken'])()) {\n\n app.routes['analytics'] = {\n path: '/analytics',\n component: AnalyticsPage.component(),\n };\n\n extend(AdminNav.prototype, 'items', items => {\n items.add('analytics', AdminLinkButton.component({\n href: app.route('analytics'),\n icon: 'fas fa-chart-line',\n children: app.translator.trans('fof-analytics.admin.page.nav.title'),\n description: app.translator.trans('fof-analytics.admin.page.nav.description'),\n }));\n });\n }\n}\n","import AnalyticsSettingsModal from './components/AnalyticsSettingsModal';\nimport addAnalyticsPage from './addAnalyticsPage';\n\napp.initializers.add('fof-analytics', app => {\n app.extensionSettings['fof-analytics'] = () => app.modal.show(new AnalyticsSettingsModal());\n addAnalyticsPage();\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/analytics/webpack/bootstrap","webpack://@fof/analytics/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/analytics/external \"flarum.core.compat['extend']\"","webpack://@fof/analytics/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/SettingsModal']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/Select']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/AdminNav']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/AdminLinkButton']\"","webpack://@fof/analytics/external \"flarum.core.compat['Component']\"","webpack://@fof/analytics/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/analytics/./src/admin/components/AnalyticsSettingsModal.js","webpack://@fof/analytics/./src/admin/components/AnalyticsPage.js","webpack://@fof/analytics/./src/admin/addAnalyticsPage.js","webpack://@fof/analytics/./src/admin/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","settingsPrefix","AnalyticsSettingsModal","className","title","app","translator","trans","form","piwikTrackAccountsSetting","this","setting","Switch","component","state","onchange","bidi","placeholder","Select","options","none","username","email","SettingsModal","AnalyticsPage","view","piwikUrl","data","settings","indexOf","length","url","src","frameborder","Component","Stream","routes","path","extend","AdminNav","items","add","AdminLinkButton","href","route","icon","description","initializers","extensionSettings","modal","show","addAnalyticsPage"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,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KAAKC,SAAS,gCAAzBO,KAEA9B,IAAI+B,OAAJ,UAA0B,CACtBC,KAAM,aACNxB,UAAWW,GAGfc,iBAAOC,IAASlD,UAAW,SAAS,SAAAmD,GAChCA,EAAMC,IAAI,YAAaC,IAAgB7B,UAAU,CAC7C8B,KAAMtC,IAAIuC,MAAM,aAChBC,KAAM,oBACNC,YAAazC,IAAIC,WAAWC,MAAM,6CACnCF,IAAIC,WAAWC,MAAM,6CCrBpCF,IAAI0C,aAAaN,IAAI,iBAAiB,SAAApC,GAClCA,EAAI2C,kBAAkB,iBAAmB,kBAAM3C,EAAI4C,MAAMC,KAAKhD,IAC9DiD","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['components/SettingsModal'];","module.exports = flarum.core.compat['components/Select'];","module.exports = flarum.core.compat['components/AdminNav'];","module.exports = flarum.core.compat['components/AdminLinkButton'];","module.exports = flarum.core.compat['Component'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import SettingsModal from 'flarum/components/SettingsModal';\r\nimport Select from 'flarum/components/Select';\r\nimport Switch from 'flarum/components/Switch';\r\n\r\nconst settingsPrefix = 'fof-analytics.';\r\n\r\nexport default class AnalyticsSettingsModal extends SettingsModal {\r\n\r\n className() {\r\n\r\n return 'AnalyticsSettingsModal Modal--medium';\r\n }\r\n\r\n title() {\r\n return app.translator.trans('fof-analytics.admin.popup.title');\r\n }\r\n\r\n form() {\r\n const piwikTrackAccountsSetting = this.setting(settingsPrefix + 'piwikTrackAccounts');\r\n\r\n if (!piwikTrackAccountsSetting()) {\r\n piwikTrackAccountsSetting('none');\r\n }\r\n\r\n return [\r\n m('h3', app.translator.trans('fof-analytics.admin.popup.section.googleAnalytics')),\r\n m('.Form-group', [\r\n m('label', Switch.component({\r\n state: this.setting(settingsPrefix + 'statusGoogle')() > 0,\r\n onchange: this.setting(settingsPrefix + 'statusGoogle'),\r\n }, app.translator.trans('fof-analytics.admin.popup.field.statusGoogle'))),\r\n ]),\r\n (this.setting(settingsPrefix + 'statusGoogle')() > 0 ? [\r\n m('.Form-group', [\r\n m('label', app.translator.trans('fof-analytics.admin.popup.field.googleTrackingCode')),\r\n m('input.FormControl', {\r\n bidi: this.setting(settingsPrefix + 'googleTrackingCode'),\r\n placeholder: 'UA-XXXXXXXX-X',\r\n }),\r\n ]),\r\n m('.Form-group', [\r\n m('label', app.translator.trans('fof-analytics.admin.popup.field.googleGTMCode')),\r\n m('input.FormControl', {\r\n bidi: this.setting(settingsPrefix + 'googleGTMCode'),\r\n placeholder: 'GTM-XXXXXXX',\r\n }),\r\n ]),\r\n m('.Form-group', [\r\n m('label', app.translator.trans('fof-analytics.admin.popup.field.optTrackingCode')),\r\n m('input.FormControl', {\r\n bidi: this.setting(settingsPrefix + 'optTrackingCode'),\r\n placeholder: 'GTM-XXXXXX',\r\n }),\r\n ]),\r\n ] : null),\r\n m('h3', app.translator.trans('fof-analytics.admin.popup.section.piwik')),\r\n m('.Form-group', [\r\n m('label', Switch.component({\r\n state: this.setting(settingsPrefix + 'statusPiwik')() > 0,\r\n onchange: this.setting(settingsPrefix + 'statusPiwik'),\r\n }, app.translator.trans('fof-analytics.admin.popup.field.statusPiwik'))),\r\n ]),\r\n (this.setting(settingsPrefix + 'statusPiwik')() > 0 ? [\r\n m('.Form-group', [\r\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikUrl')),\r\n m('input.FormControl', {\r\n bidi: this.setting(settingsPrefix + 'piwikUrl'),\r\n placeholder: 'piwik.example.com',\r\n }),\r\n ]),\r\n m('.Form-group', [\r\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikSiteId')),\r\n m('input.FormControl', {\r\n bidi: this.setting(settingsPrefix + 'piwikSiteId'),\r\n }),\r\n ]),\r\n m('.Form-group', [\r\n m('label', Switch.component({\r\n state: this.setting(settingsPrefix + 'piwikTrackSubdomain')() > 0,\r\n onchange: this.setting(settingsPrefix + 'piwikTrackSubdomain'),\r\n }, app.translator.trans('fof-analytics.admin.popup.field.piwikTrackSubdomain'))),\r\n ]),\r\n m('.Form-group', [\r\n m('label', Switch.component({\r\n state: this.setting(settingsPrefix + 'piwikPrependDomain')() > 0,\r\n onchange: this.setting(settingsPrefix + 'piwikPrependDomain'),\r\n }, app.translator.trans('fof-analytics.admin.popup.field.piwikPrependDomain'))),\r\n ]),\r\n m('.Form-group', [\r\n m('label', Switch.component({\r\n state: this.setting(settingsPrefix + 'piwikHideAliasUrl')() > 0,\r\n onchange: this.setting(settingsPrefix + 'piwikHideAliasUrl'),\r\n }, app.translator.trans('fof-analytics.admin.popup.field.piwikHideAliasUrl'))),\r\n ]),\r\n (this.setting(settingsPrefix + 'piwikHideAliasUrl')() > 0 ? [\r\n m('.Form-group', [\r\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikAliasUrl')),\r\n m('input.FormControl', {\r\n bidi: this.setting(settingsPrefix + 'piwikAliasUrl'),\r\n }),\r\n ]),\r\n ] : null),\r\n m('.Form-group', [\r\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikTrackAccounts')),\r\n Select.component({\r\n options: {\r\n none: app.translator.trans('fof-analytics.admin.popup.trackAccounts.none'),\r\n username: app.translator.trans('fof-analytics.admin.popup.trackAccounts.username'),\r\n email: app.translator.trans('fof-analytics.admin.popup.trackAccounts.email'),\r\n },\r\n value: piwikTrackAccountsSetting(),\r\n onchange: piwikTrackAccountsSetting,\r\n }),\r\n ]),\r\n m('.Form-group', [\r\n m('label', app.translator.trans('fof-analytics.admin.popup.field.piwikAuthToken')),\r\n m('input.FormControl', {\r\n bidi: this.setting(settingsPrefix + 'piwikAuthToken'),\r\n placeholder: '00112233445566778899aabbccddeeff',\r\n }),\r\n m('.helpText', app.translator.trans('fof-analytics.admin.popup.placeholder.piwikAuthToken')),\r\n ]),\r\n ] : null),\r\n ];\r\n }\r\n}\r\n","import Component from 'flarum/Component';\r\n\r\nexport default class AnalyticsPage extends Component {\r\n\r\n view() {\r\n let piwikUrl = app.data.settings['fof-analytics.piwikUrl'];\r\n\r\n // Use protocol-relative url if the url contains no protocol\r\n if (piwikUrl.indexOf('http://') === -1 && piwikUrl.indexOf('https://') === -1 && piwikUrl.indexOf('//') === -1) {\r\n piwikUrl = '//' + piwikUrl;\r\n }\r\n\r\n // Add trailing slash if necessary\r\n if (piwikUrl[piwikUrl.length - 1] !== '/') {\r\n piwikUrl += '/';\r\n }\r\n\r\n //Call the piwik application\r\n this.url = piwikUrl + 'index.php';\r\n this.url += '?idSite=' + app.data.settings['fof-analytics.piwikSiteId'];\r\n this.url += '&token_auth=' + app.data.settings['fof-analytics.piwikAuthToken'];\r\n this.url += '&module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&period=month&date=today';\r\n\r\n return [\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n ];\r\n }\r\n}\r\n","import {extend} from 'flarum/extend';\r\nimport AdminNav from 'flarum/components/AdminNav';\r\nimport AdminLinkButton from 'flarum/components/AdminLinkButton';\r\nimport Stream from 'flarum/utils/Stream';\r\n\r\nimport AnalyticsPage from './components/AnalyticsPage';\r\n\r\nexport default function () {\r\n // add the Analytics tab to the admin navigation menu if piwik is enabled\r\n if (Stream(app.data.settings['fof-analytics.statusPiwik'])() &&\r\n Stream(app.data.settings['fof-analytics.piwikUrl'])() &&\r\n Stream(app.data.settings['fof-analytics.piwikSiteId'])() &&\r\n Stream(app.data.settings['fof-analytics.piwikAuthToken'])()) {\r\n\r\n app.routes['analytics'] = {\r\n path: '/analytics',\r\n component: AnalyticsPage,\r\n };\r\n\r\n extend(AdminNav.prototype, 'items', items => {\r\n items.add('analytics', AdminLinkButton.component({\r\n href: app.route('analytics'),\r\n icon: 'fas fa-chart-line',\r\n description: app.translator.trans('fof-analytics.admin.page.nav.description'),\r\n }, app.translator.trans('fof-analytics.admin.page.nav.title')));\r\n });\r\n }\r\n}\r\n","import AnalyticsSettingsModal from './components/AnalyticsSettingsModal';\r\nimport addAnalyticsPage from './addAnalyticsPage';\r\n\r\napp.initializers.add('fof-analytics', app => {\r\n app.extensionSettings['fof-analytics'] = () => app.modal.show(AnalyticsSettingsModal);\r\n addAnalyticsPage();\r\n});\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 7933557..b5bf24b 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}({1:function(e,t){e.exports=flarum.core.compat.extend},2:function(e,t){e.exports=flarum.core.compat["components/Page"]},9:function(e,t,n){"use strict";n.r(t);var o=n(1),r=n(2),u=n.n(r);app.initializers.add("fof-analytics",(function(){Object(o.extend)(u.a.prototype,"init",(function(e){app.data.googleTrackingCode&&"undefined"!=typeof gtag&>ag("config",app.data.googleTrackingCode,{page_path:m.route()}),app.data.googleGTMCode&&"undefined"!=typeof gtagpush&>agpush({event:"custom_event",virtualpath:m.route()}),"undefined"!=typeof _paq&&(_paq.push(["setCustomUrl",m.route()]),_paq.push(["trackPageView"]))}))}))}}); +module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}({1:function(e,t){e.exports=flarum.core.compat.extend},10:function(e,t,n){"use strict";n.r(t);var o=n(1),r=n(3),u=n.n(r);app.initializers.add("fof-analytics",(function(){Object(o.extend)(u.a.prototype,"oninit",(function(e){app.data.googleTrackingCode&&"undefined"!=typeof gtag&>ag("config",app.data.googleTrackingCode,{page_path:m.route.get()}),app.data.googleGTMCode&&"undefined"!=typeof gtagpush&>agpush({event:"custom_event",virtualpath:m.route()}),"undefined"!=typeof _paq&&(_paq.push(["setCustomUrl",m.route()]),_paq.push(["trackPageView"]))}))}))},3:function(e,t){e.exports=flarum.core.compat["components/Page"]}}); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 60b4769..e303f39 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/analytics/webpack/bootstrap","webpack://@fof/analytics/external \"flarum.core.compat['extend']\"","webpack://@fof/analytics/external \"flarum.core.compat['components/Page']\"","webpack://@fof/analytics/./src/forum/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","app","initializers","add","extend","Page","vdom","data","googleTrackingCode","gtag","route","googleGTMCode","gtagpush","_paq","push"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0B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CACL,MAAS,eACT,YAAe1C,EAAEwC,UAGL,oBAATG,OACPA,KAAKC,KAAK,CAAC,eAAgB5C,EAAEwC,UAC7BG,KAAKC,KAAK,CAAC","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/Page'];","import { extend } from 'flarum/extend';\nimport Page from 'flarum/components/Page';\n\napp.initializers.add('fof-analytics', () => {\n extend(Page.prototype, 'init', function (vdom) {\n if (app.data.googleTrackingCode && typeof gtag !== 'undefined') {\n gtag('config', app.data.googleTrackingCode, {\n 'page_path': m.route()\n });\n }\n if (app.data.googleGTMCode && typeof gtagpush !== 'undefined') {\n gtagpush({\n 'event': 'custom_event',\n 'virtualpath': m.route()\n });\n }\n if (typeof _paq !== 'undefined') {\n _paq.push(['setCustomUrl', m.route()]);\n _paq.push(['trackPageView']);\n }\n });\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/analytics/webpack/bootstrap","webpack://@fof/analytics/external \"flarum.core.compat['extend']\"","webpack://@fof/analytics/./src/forum/index.js","webpack://@fof/analytics/external \"flarum.core.compat['components/Page']\""],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","app","initializers","add","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wB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,I,kBClFrDhC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAe,Q,kECG5CC,IAAIC,aAAaC,IAAI,iBAAiB,WAClCC,iBAAOC,IAAKX,UAAW,UAAU,SAAUY,GACnCL,IAAIM,KAAKC,oBAAsC,oBAATC,MACtCA,KAAK,SAAUR,IAAIM,KAAKC,mBAAoB,CACxC,UAAatC,EAAEwC,MAAM/B,QAGzBsB,IAAIM,KAAKI,eAAqC,oBAAbC,UACjCA,SAAS,CACL,MAAS,eACT,YAAe1C,EAAEwC,UAGL,oBAATG,OACPA,KAAKC,KAAK,CAAC,eAAgB5C,EAAEwC,UAC7BG,KAAKC,KAAK,CAAC,0B,gBClBvBjD,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 10);\n","module.exports = flarum.core.compat['extend'];","import { extend } from 'flarum/extend';\r\nimport Page from 'flarum/components/Page';\r\n\r\napp.initializers.add('fof-analytics', () => {\r\n extend(Page.prototype, 'oninit', function (vnode) {\r\n if (app.data.googleTrackingCode && typeof gtag !== 'undefined') {\r\n gtag('config', app.data.googleTrackingCode, {\r\n 'page_path': m.route.get()\r\n });\r\n }\r\n if (app.data.googleGTMCode && typeof gtagpush !== 'undefined') {\r\n gtagpush({\r\n 'event': 'custom_event',\r\n 'virtualpath': m.route()\r\n });\r\n }\r\n if (typeof _paq !== 'undefined') {\r\n _paq.push(['setCustomUrl', m.route()]);\r\n _paq.push(['trackPageView']);\r\n }\r\n });\r\n});\r\n","module.exports = flarum.core.compat['components/Page'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/package-lock.json b/js/package-lock.json index de98589..d69d705 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -2886,9 +2886,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" }, "loose-envify": { "version": "1.4.0", diff --git a/js/src/admin/addAnalyticsPage.js b/js/src/admin/addAnalyticsPage.js index 14915e8..b201c73 100644 --- a/js/src/admin/addAnalyticsPage.js +++ b/js/src/admin/addAnalyticsPage.js @@ -1,28 +1,28 @@ import {extend} from 'flarum/extend'; import AdminNav from 'flarum/components/AdminNav'; import AdminLinkButton from 'flarum/components/AdminLinkButton'; +import Stream from 'flarum/utils/Stream'; import AnalyticsPage from './components/AnalyticsPage'; export default function () { // add the Analytics tab to the admin navigation menu if piwik is enabled - if (m.prop(app.data.settings['fof-analytics.statusPiwik'])() && - m.prop(app.data.settings['fof-analytics.piwikUrl'])() && - m.prop(app.data.settings['fof-analytics.piwikSiteId'])() && - m.prop(app.data.settings['fof-analytics.piwikAuthToken'])()) { + if (Stream(app.data.settings['fof-analytics.statusPiwik'])() && + Stream(app.data.settings['fof-analytics.piwikUrl'])() && + Stream(app.data.settings['fof-analytics.piwikSiteId'])() && + Stream(app.data.settings['fof-analytics.piwikAuthToken'])()) { app.routes['analytics'] = { path: '/analytics', - component: AnalyticsPage.component(), + component: AnalyticsPage, }; extend(AdminNav.prototype, 'items', items => { items.add('analytics', AdminLinkButton.component({ href: app.route('analytics'), icon: 'fas fa-chart-line', - children: app.translator.trans('fof-analytics.admin.page.nav.title'), description: app.translator.trans('fof-analytics.admin.page.nav.description'), - })); + }, app.translator.trans('fof-analytics.admin.page.nav.title'))); }); } } diff --git a/js/src/admin/components/AnalyticsSettingsModal.js b/js/src/admin/components/AnalyticsSettingsModal.js index 6f09374..adb85d9 100644 --- a/js/src/admin/components/AnalyticsSettingsModal.js +++ b/js/src/admin/components/AnalyticsSettingsModal.js @@ -28,8 +28,7 @@ export default class AnalyticsSettingsModal extends SettingsModal { m('label', Switch.component({ state: this.setting(settingsPrefix + 'statusGoogle')() > 0, onchange: this.setting(settingsPrefix + 'statusGoogle'), - children: app.translator.trans('fof-analytics.admin.popup.field.statusGoogle'), - })), + }, app.translator.trans('fof-analytics.admin.popup.field.statusGoogle'))), ]), (this.setting(settingsPrefix + 'statusGoogle')() > 0 ? [ m('.Form-group', [ @@ -59,8 +58,7 @@ export default class AnalyticsSettingsModal extends SettingsModal { m('label', Switch.component({ state: this.setting(settingsPrefix + 'statusPiwik')() > 0, onchange: this.setting(settingsPrefix + 'statusPiwik'), - children: app.translator.trans('fof-analytics.admin.popup.field.statusPiwik'), - })), + }, app.translator.trans('fof-analytics.admin.popup.field.statusPiwik'))), ]), (this.setting(settingsPrefix + 'statusPiwik')() > 0 ? [ m('.Form-group', [ @@ -80,22 +78,19 @@ export default class AnalyticsSettingsModal extends SettingsModal { m('label', Switch.component({ state: this.setting(settingsPrefix + 'piwikTrackSubdomain')() > 0, onchange: this.setting(settingsPrefix + 'piwikTrackSubdomain'), - children: app.translator.trans('fof-analytics.admin.popup.field.piwikTrackSubdomain'), - })), + }, app.translator.trans('fof-analytics.admin.popup.field.piwikTrackSubdomain'))), ]), m('.Form-group', [ m('label', Switch.component({ state: this.setting(settingsPrefix + 'piwikPrependDomain')() > 0, onchange: this.setting(settingsPrefix + 'piwikPrependDomain'), - children: app.translator.trans('fof-analytics.admin.popup.field.piwikPrependDomain'), - })), + }, app.translator.trans('fof-analytics.admin.popup.field.piwikPrependDomain'))), ]), m('.Form-group', [ m('label', Switch.component({ state: this.setting(settingsPrefix + 'piwikHideAliasUrl')() > 0, onchange: this.setting(settingsPrefix + 'piwikHideAliasUrl'), - children: app.translator.trans('fof-analytics.admin.popup.field.piwikHideAliasUrl'), - })), + }, app.translator.trans('fof-analytics.admin.popup.field.piwikHideAliasUrl'))), ]), (this.setting(settingsPrefix + 'piwikHideAliasUrl')() > 0 ? [ m('.Form-group', [ diff --git a/js/src/admin/index.js b/js/src/admin/index.js index 70e81ef..c47fe5f 100644 --- a/js/src/admin/index.js +++ b/js/src/admin/index.js @@ -2,6 +2,6 @@ import AnalyticsSettingsModal from './components/AnalyticsSettingsModal'; import addAnalyticsPage from './addAnalyticsPage'; app.initializers.add('fof-analytics', app => { - app.extensionSettings['fof-analytics'] = () => app.modal.show(new AnalyticsSettingsModal()); + app.extensionSettings['fof-analytics'] = () => app.modal.show(AnalyticsSettingsModal); addAnalyticsPage(); }); diff --git a/js/src/forum/index.js b/js/src/forum/index.js index 4fcf6a2..ae83b66 100644 --- a/js/src/forum/index.js +++ b/js/src/forum/index.js @@ -2,10 +2,10 @@ import { extend } from 'flarum/extend'; import Page from 'flarum/components/Page'; app.initializers.add('fof-analytics', () => { - extend(Page.prototype, 'init', function (vdom) { + extend(Page.prototype, 'oninit', function (vnode) { if (app.data.googleTrackingCode && typeof gtag !== 'undefined') { gtag('config', app.data.googleTrackingCode, { - 'page_path': m.route() + 'page_path': m.route.get() }); } if (app.data.googleGTMCode && typeof gtagpush !== 'undefined') { diff --git a/migrations/2020_06_18_000000_migrate_extension_settings.php b/migrations/2020_06_18_000000_migrate_extension_settings.php index a2b08e0..0900407 100644 --- a/migrations/2020_06_18_000000_migrate_extension_settings.php +++ b/migrations/2020_06_18_000000_migrate_extension_settings.php @@ -41,4 +41,7 @@ } } }, + 'down' => function (Builder $schema) { + // Nothing + } ];