mirror of
https://github.com/strapi/strapi.git
synced 2025-09-16 03:48:22 +00:00
Move properties to single event
This commit is contained in:
parent
cc95a75987
commit
ae7ddd8df1
@ -43,6 +43,7 @@ const apisRegistry = require('./core/registries/apis');
|
||||
const bootstrap = require('./core/bootstrap');
|
||||
const loaders = require('./core/loaders');
|
||||
const { destroyOnSignal } = require('./utils/signals');
|
||||
const getNumberOfDynamicZones = require('./services/utils/dynamic-zones');
|
||||
const sanitizersRegistry = require('./core/registries/sanitizers');
|
||||
const convertCustomFieldType = require('./utils/convert-custom-field-type');
|
||||
|
||||
@ -249,6 +250,9 @@ class Strapi {
|
||||
groupProperties: {
|
||||
database: strapi.config.get('database.connection.client'),
|
||||
plugins: Object.keys(strapi.plugins),
|
||||
numberOfAllContentTypes: _.size(this.contentTypes), // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.
|
||||
numberOfComponents: _.size(this.components),
|
||||
numberOfDynamicZones: getNumberOfDynamicZones(),
|
||||
// TODO: to add back
|
||||
// providers: this.config.installedProviders,
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ const defaultQueryOpts = {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
};
|
||||
|
||||
const ANALYTICS_URI = 'https://analytics.strapi.io';
|
||||
const ANALYTICS_URI = 'http://localhost:4000';
|
||||
|
||||
/**
|
||||
* Add properties from the package.json strapi key in the metadata
|
||||
@ -71,7 +71,9 @@ module.exports = (strapi) => {
|
||||
addPackageJsonStrapiMetadata(anonymousGroupProperties, strapi);
|
||||
|
||||
return async (event, payload = {}, opts = {}) => {
|
||||
console.log('event', event, payload);
|
||||
const userId = generateAdminUserHash(strapi);
|
||||
console.log('anonymousGroupProperties', anonymousGroupProperties);
|
||||
|
||||
const reqParams = {
|
||||
method: 'POST',
|
||||
@ -84,9 +86,6 @@ module.exports = (strapi) => {
|
||||
groupProperties: {
|
||||
...anonymousGroupProperties,
|
||||
projectType: strapi.EE ? 'Enterprise' : 'Community',
|
||||
numberOfAllContentTypes: _.size(strapi.contentTypes), // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.
|
||||
numberOfComponents: _.size(strapi.components),
|
||||
numberOfDynamicZones: getNumberOfDynamicZones(),
|
||||
...payload.groupProperties,
|
||||
},
|
||||
}),
|
||||
|
13
packages/core/strapi/lib/services/utils/dynamic-zones.js
Normal file
13
packages/core/strapi/lib/services/utils/dynamic-zones.js
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const { map, values, sumBy, pipe, flatMap, propEq } = require('lodash/fp');
|
||||
|
||||
const getNumberOfDynamicZones = () => {
|
||||
return pipe(
|
||||
map('attributes'),
|
||||
flatMap(values),
|
||||
sumBy(propEq('type', 'dynamiczone'))
|
||||
)(strapi.contentTypes);
|
||||
};
|
||||
|
||||
module.exports = getNumberOfDynamicZones;
|
Loading…
x
Reference in New Issue
Block a user