backend-manager 3.2.99 → 3.2.100
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.
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ Module.prototype.main = function () {
|
|
|
11
11
|
|
|
12
12
|
return new Promise(async function(resolve, reject) {
|
|
13
13
|
// Log
|
|
14
|
-
assistant.log('
|
|
14
|
+
assistant.log('Manager.cwd', Manager.cwd)
|
|
15
15
|
|
|
16
16
|
// If not dev, quit
|
|
17
17
|
if (!assistant.isDevelopment()) {
|
|
@@ -26,16 +26,18 @@ Module.prototype.main = function () {
|
|
|
26
26
|
// Load the hook
|
|
27
27
|
let hook;
|
|
28
28
|
try {
|
|
29
|
-
hook = (new (require(pathify(`${
|
|
29
|
+
hook = (new (require(pathify(`${Manager.cwd}/${payload.data.payload.path}.js`)))());
|
|
30
30
|
} catch (e) {
|
|
31
|
-
hook = (new (require(pathify(`${
|
|
31
|
+
hook = (new (require(pathify(`${Manager.cwd}/methods/hooks/${payload.data.payload.path}.js`)))());
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
34
|
+
// Run the hook
|
|
35
|
+
try {
|
|
36
|
+
const result = await hook.main(Manager);
|
|
37
|
+
|
|
38
|
+
return resolve({data: result, status: 200});
|
|
39
|
+
} catch (e) {
|
|
40
|
+
return reject(assistant.errorify(e.message, {code: 500}));
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
43
|
};
|
|
@@ -195,8 +195,9 @@ Analytics.prototype.event = function (payload) {
|
|
|
195
195
|
// https://support.google.com/analytics/answer/13316687?hl=en#zippy=%2Cweb
|
|
196
196
|
// https://support.google.com/analytics/answer/9268042?sjid=4476481583372132143-NC
|
|
197
197
|
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference/events#screen_view
|
|
198
|
-
|
|
199
198
|
payload = payload || {};
|
|
199
|
+
|
|
200
|
+
// Fix event name
|
|
200
201
|
payload.name = (payload.name || '')
|
|
201
202
|
// Replace anything not a letter, number, or underscore with an underscore
|
|
202
203
|
.replace(/[^a-zA-Z0-9_]/g, '_')
|
|
@@ -204,6 +205,8 @@ Analytics.prototype.event = function (payload) {
|
|
|
204
205
|
.replace(/^_+|_+$/g, '')
|
|
205
206
|
// Remove multiple underscores
|
|
206
207
|
.replace(/_+/g, '_');
|
|
208
|
+
|
|
209
|
+
// Fix event params
|
|
207
210
|
payload.params = payload.params || {};
|
|
208
211
|
|
|
209
212
|
// Check if initialized
|