mirror of
https://github.com/strapi/strapi.git
synced 2025-09-16 12:02:41 +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 bootstrap = require('./core/bootstrap');
|
||||||
const loaders = require('./core/loaders');
|
const loaders = require('./core/loaders');
|
||||||
const { destroyOnSignal } = require('./utils/signals');
|
const { destroyOnSignal } = require('./utils/signals');
|
||||||
|
const getNumberOfDynamicZones = require('./services/utils/dynamic-zones');
|
||||||
const sanitizersRegistry = require('./core/registries/sanitizers');
|
const sanitizersRegistry = require('./core/registries/sanitizers');
|
||||||
const convertCustomFieldType = require('./utils/convert-custom-field-type');
|
const convertCustomFieldType = require('./utils/convert-custom-field-type');
|
||||||
|
|
||||||
@ -249,6 +250,9 @@ class Strapi {
|
|||||||
groupProperties: {
|
groupProperties: {
|
||||||
database: strapi.config.get('database.connection.client'),
|
database: strapi.config.get('database.connection.client'),
|
||||||
plugins: Object.keys(strapi.plugins),
|
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
|
// TODO: to add back
|
||||||
// providers: this.config.installedProviders,
|
// providers: this.config.installedProviders,
|
||||||
},
|
},
|
||||||
|
@ -17,7 +17,7 @@ const defaultQueryOpts = {
|
|||||||
headers: { 'Content-Type': 'application/json' },
|
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
|
* Add properties from the package.json strapi key in the metadata
|
||||||
@ -71,7 +71,9 @@ module.exports = (strapi) => {
|
|||||||
addPackageJsonStrapiMetadata(anonymousGroupProperties, strapi);
|
addPackageJsonStrapiMetadata(anonymousGroupProperties, strapi);
|
||||||
|
|
||||||
return async (event, payload = {}, opts = {}) => {
|
return async (event, payload = {}, opts = {}) => {
|
||||||
|
console.log('event', event, payload);
|
||||||
const userId = generateAdminUserHash(strapi);
|
const userId = generateAdminUserHash(strapi);
|
||||||
|
console.log('anonymousGroupProperties', anonymousGroupProperties);
|
||||||
|
|
||||||
const reqParams = {
|
const reqParams = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -84,9 +86,6 @@ module.exports = (strapi) => {
|
|||||||
groupProperties: {
|
groupProperties: {
|
||||||
...anonymousGroupProperties,
|
...anonymousGroupProperties,
|
||||||
projectType: strapi.EE ? 'Enterprise' : 'Community',
|
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,
|
...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