backend-manager 3.2.172 → 3.2.174

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.
Files changed (89) hide show
  1. package/package.json +3 -3
  2. package/src/cli/cli.js +27 -11
  3. package/src/manager/helpers/assistant.js +51 -76
  4. package/src/manager/index.js +22 -1
  5. package/dist/cli/cli.js +0 -1534
  6. package/dist/manager/functions/core/actions/api/admin/backup.js +0 -338
  7. package/dist/manager/functions/core/actions/api/admin/create-post.js +0 -388
  8. package/dist/manager/functions/core/actions/api/admin/cron.js +0 -37
  9. package/dist/manager/functions/core/actions/api/admin/database-read.js +0 -35
  10. package/dist/manager/functions/core/actions/api/admin/database-write.js +0 -39
  11. package/dist/manager/functions/core/actions/api/admin/edit-post.js +0 -158
  12. package/dist/manager/functions/core/actions/api/admin/firestore-query.js +0 -165
  13. package/dist/manager/functions/core/actions/api/admin/firestore-read.js +0 -38
  14. package/dist/manager/functions/core/actions/api/admin/firestore-write.js +0 -54
  15. package/dist/manager/functions/core/actions/api/admin/get-stats.js +0 -269
  16. package/dist/manager/functions/core/actions/api/admin/payment-processor.js +0 -57
  17. package/dist/manager/functions/core/actions/api/admin/run-hook.js +0 -95
  18. package/dist/manager/functions/core/actions/api/admin/send-notification.js +0 -197
  19. package/dist/manager/functions/core/actions/api/admin/sync-users.js +0 -125
  20. package/dist/manager/functions/core/actions/api/admin/templates/post.html +0 -16
  21. package/dist/manager/functions/core/actions/api/firebase/get-providers.js +0 -102
  22. package/dist/manager/functions/core/actions/api/general/emails/general:download-app-link.js +0 -21
  23. package/dist/manager/functions/core/actions/api/general/fetch-post.js +0 -99
  24. package/dist/manager/functions/core/actions/api/general/generate-uuid.js +0 -41
  25. package/dist/manager/functions/core/actions/api/general/send-email.js +0 -112
  26. package/dist/manager/functions/core/actions/api/handler/create-post.js +0 -146
  27. package/dist/manager/functions/core/actions/api/special/setup-electron-manager-client.js +0 -103
  28. package/dist/manager/functions/core/actions/api/template.js +0 -33
  29. package/dist/manager/functions/core/actions/api/test/authenticate.js +0 -22
  30. package/dist/manager/functions/core/actions/api/test/create-test-accounts.js +0 -27
  31. package/dist/manager/functions/core/actions/api/test/lab.js +0 -55
  32. package/dist/manager/functions/core/actions/api/test/redirect.js +0 -26
  33. package/dist/manager/functions/core/actions/api/test/webhook.js +0 -30
  34. package/dist/manager/functions/core/actions/api/user/create-custom-token.js +0 -32
  35. package/dist/manager/functions/core/actions/api/user/delete.js +0 -68
  36. package/dist/manager/functions/core/actions/api/user/get-active-sessions.js +0 -45
  37. package/dist/manager/functions/core/actions/api/user/get-subscription-info.js +0 -49
  38. package/dist/manager/functions/core/actions/api/user/oauth2/discord.js +0 -114
  39. package/dist/manager/functions/core/actions/api/user/oauth2/google.js +0 -99
  40. package/dist/manager/functions/core/actions/api/user/oauth2.js +0 -476
  41. package/dist/manager/functions/core/actions/api/user/regenerate-api-keys.js +0 -54
  42. package/dist/manager/functions/core/actions/api/user/resolve.js +0 -32
  43. package/dist/manager/functions/core/actions/api/user/sign-out-all-sessions.js +0 -118
  44. package/dist/manager/functions/core/actions/api/user/sign-up copy.js +0 -544
  45. package/dist/manager/functions/core/actions/api/user/sign-up.js +0 -99
  46. package/dist/manager/functions/core/actions/api/user/submit-feedback.js +0 -96
  47. package/dist/manager/functions/core/actions/api/user/validate-settings.js +0 -86
  48. package/dist/manager/functions/core/actions/api.js +0 -354
  49. package/dist/manager/functions/core/actions/create-post-handler.js +0 -184
  50. package/dist/manager/functions/core/actions/generate-uuid.js +0 -62
  51. package/dist/manager/functions/core/actions/sign-up-handler.js +0 -205
  52. package/dist/manager/functions/core/admin/create-post.js +0 -206
  53. package/dist/manager/functions/core/admin/firestore-write.js +0 -72
  54. package/dist/manager/functions/core/admin/get-stats.js +0 -218
  55. package/dist/manager/functions/core/admin/query.js +0 -198
  56. package/dist/manager/functions/core/admin/send-notification.js +0 -206
  57. package/dist/manager/functions/core/cron/daily/ghostii-auto-publisher.js +0 -377
  58. package/dist/manager/functions/core/cron/daily/reset-usage.js +0 -197
  59. package/dist/manager/functions/core/cron/daily.js +0 -114
  60. package/dist/manager/functions/core/events/auth/before-create.js +0 -124
  61. package/dist/manager/functions/core/events/auth/before-signin.js +0 -62
  62. package/dist/manager/functions/core/events/auth/on-create copy.js +0 -121
  63. package/dist/manager/functions/core/events/auth/on-create.js +0 -564
  64. package/dist/manager/functions/core/events/auth/on-delete.js +0 -72
  65. package/dist/manager/functions/core/events/firestore/on-subscription.js +0 -107
  66. package/dist/manager/functions/test/authenticate.js +0 -38
  67. package/dist/manager/functions/test/create-test-accounts.js +0 -144
  68. package/dist/manager/functions/test/webhook.js +0 -37
  69. package/dist/manager/functions/wrappers/mailchimp/addToList.js +0 -25
  70. package/dist/manager/helpers/analytics copy.js +0 -217
  71. package/dist/manager/helpers/analytics.js +0 -467
  72. package/dist/manager/helpers/api-manager.js +0 -324
  73. package/dist/manager/helpers/assistant.js +0 -1043
  74. package/dist/manager/helpers/metadata.js +0 -32
  75. package/dist/manager/helpers/middleware.js +0 -154
  76. package/dist/manager/helpers/roles.js +0 -69
  77. package/dist/manager/helpers/settings.js +0 -158
  78. package/dist/manager/helpers/subscription-resolver-new.js +0 -828
  79. package/dist/manager/helpers/subscription-resolver.js +0 -842
  80. package/dist/manager/helpers/usage.js +0 -381
  81. package/dist/manager/helpers/user.js +0 -198
  82. package/dist/manager/helpers/utilities.js +0 -292
  83. package/dist/manager/index.js +0 -1076
  84. package/dist/manager/libraries/openai.js +0 -460
  85. package/dist/manager/routes/restart/index.js +0 -52
  86. package/dist/manager/routes/test/index.js +0 -43
  87. package/dist/manager/schemas/restart.js +0 -13
  88. package/dist/manager/schemas/test.js +0 -13
  89. package/dist/require.js +0 -3
@@ -1,107 +0,0 @@
1
- function Module() {
2
- const self = this;
3
- }
4
-
5
- Module.prototype.init = function (Manager, payload) {
6
- const self = this;
7
- self.Manager = Manager;
8
- self.libraries = Manager.libraries;
9
- self.assistant = Manager.Assistant();
10
- self.change = payload.change
11
- self.context = payload.context
12
-
13
- return self;
14
- };
15
-
16
- Module.prototype.main = function () {
17
- const self = this;
18
- const libraries = self.libraries;
19
- const assistant = self.assistant;
20
- const change = self.change;
21
- const context = self.context;
22
-
23
- return new Promise(async function(resolve, reject) {
24
- const _ = self.Manager.require('lodash');
25
-
26
- const dataBefore = change.before.data();
27
- const dataAfter = change.after.data();
28
-
29
- let analytics;
30
- let eventType;
31
-
32
- if (dataAfter == undefined) {
33
- eventType = 'delete';
34
- } else if (dataBefore && dataAfter) {
35
- eventType = 'update';
36
- } else if (!dataBefore && dataAfter) {
37
- eventType = 'create';
38
- }
39
-
40
- assistant.log('Notification subscription write:', {
41
- after: dataAfter,
42
- before: dataBefore,
43
- eventType: eventType,
44
- resource: context.resource,
45
- params: context.params,
46
- });
47
-
48
- // Delete event
49
- if (eventType === 'delete') {
50
- await libraries.admin.firestore().doc(`meta/stats`)
51
- .update({
52
- 'subscriptions.total': libraries.admin.firestore.FieldValue.increment(-1),
53
- })
54
- .then(r => {
55
- analytics = self.Manager.Analytics({
56
- assistant: assistant,
57
- uuid: _.get(dataBefore, 'link.user.data.uid', undefined),
58
- })
59
- .event({
60
- name: 'notification-unsubscribe',
61
- params: {},
62
- });
63
-
64
- assistant.log('Notification subscription deleted:', dataBefore);
65
-
66
- return resolve(dataBefore);
67
- })
68
- .catch(e => {
69
- assistant.error(e);
70
- return reject(e);
71
- })
72
-
73
- // Update event
74
- } else if (eventType === 'update') {
75
- return resolve();
76
-
77
- // Create event
78
- } else if (eventType === 'create') {
79
- await libraries.admin.firestore().doc(`meta/stats`)
80
- .update({
81
- 'subscriptions.total': libraries.admin.firestore.FieldValue.increment(1),
82
- })
83
- .then(r => {
84
- analytics = self.Manager.Analytics({
85
- assistant: assistant,
86
- uuid: _.get(dataAfter, 'link.user.data.uid', undefined),
87
- })
88
- .event({
89
- name: 'notification-subscribe',
90
- params: {},
91
- });
92
-
93
- assistant.log('Notification subscription created:', dataAfter);
94
-
95
- return resolve(dataAfter);
96
- })
97
- .catch(e => {
98
- assistant.error(e);
99
- return reject(e);
100
- })
101
- }
102
-
103
- });
104
- };
105
-
106
-
107
- module.exports = Module;
@@ -1,38 +0,0 @@
1
- let Module = {
2
- init: async function (Manager, data) {
3
- this.Manager = Manager;
4
- this.libraries = Manager.libraries;
5
- this.req = data.req;
6
- this.res = data.res
7
- this.assistant = Manager.Assistant({req: data.req, res: data.res}, {accept: 'json'});
8
-
9
- return this;
10
- },
11
- main: async function() {
12
- let self = this;
13
- let req = self.req;
14
- let res = self.res;
15
- let libraries = self.libraries;
16
- let assistant = self.assistant;
17
-
18
- return libraries.cors(req, res, async () => {
19
- let user = await assistant.authenticate();
20
-
21
- // Analytics
22
- let analytics = self.Manager.Analytics({
23
- assistant: assistant,
24
- uuid: user.auth.uid,
25
- })
26
- .event({
27
- name: 'authenticate-test',
28
- params: {},
29
- });
30
-
31
- assistant.log('Request:', assistant.request.data);
32
- assistant.log('Result user:', user);
33
- return res.status(200).json({status: 200, user: user });
34
- });
35
- }
36
- }
37
-
38
- module.exports = Module;
@@ -1,144 +0,0 @@
1
- let Module = {
2
- init: async function (Manager, data) {
3
- this.Manager = Manager;
4
- this.libraries = Manager.libraries;
5
- this.req = data.req;
6
- this.res = data.res
7
- this.assistant = Manager.Assistant({req: data.req, res: data.res});
8
-
9
- return this;
10
- },
11
- main: async function() {
12
- let self = this;
13
- let uuid4;
14
- let req = self.req;
15
- let res = self.res;
16
- let libraries = self.libraries;
17
- let assistant = self.assistant;
18
-
19
- return libraries.cors(req, res, async () => {
20
- let user = await assistant.authenticate();
21
-
22
- // Analytics
23
- let analytics = self.Manager.Analytics({
24
- assistant: assistant,
25
- uuid: user.auth.uid,
26
- })
27
- .event({
28
- name: 'create-test-accounts',
29
- params: {},
30
- });
31
-
32
- let assistant = self.assistant;
33
-
34
- let response = {
35
- status: 200,
36
- data: {}
37
- }
38
-
39
- // await createUser('_test.admin@test.com', '_test.admin', {roles: {admin: true}})
40
- try {
41
- response.data = {
42
- regular: await createUser('_test.admin@test.com', '_test.admin', {roles: {admin: true}}),
43
- admin: await createUser('_test.regular@test.com', '_test.regular', {roles: {}, password: '123123'}),
44
- }
45
- } catch (e) {
46
- response.status = 500;
47
- response.error = e;
48
- assistant.log(e);
49
- return res.status(response.status).json(response);
50
- }
51
-
52
-
53
- if (assistant.isDevelopment()) {
54
- assistant.log(response);
55
- return res.status(response.status).json(response);
56
- } else {
57
- response.data = {};
58
- return res.status(response.status).json(response);
59
- }
60
-
61
- async function deleteUser(uid) {
62
- let currentUid;
63
- return new Promise(async function(resolve, reject) {
64
- // await libraries.admin.auth().getUserByEmail(email)
65
- // .then(function(userRecord) {
66
- // // See the UserRecord reference doc for the contents of userRecord.
67
- // currentUid = userRecord.toJSON().uid;
68
- // // assistant.log('Successfully fetched user data:', userRecord.toJSON());
69
- // })
70
- // .catch(function(error) {
71
- // // assistant.log('Error fetching user data:', error);
72
- // });
73
-
74
- await libraries.admin.auth().deleteUser(uid)
75
- .then(function() {
76
- // assistant.log('Successfully deleted user', currentUid);
77
- resolve();
78
- })
79
- .catch(function(error) {
80
- // assistant.log('Error deleting user:', currentUid, error);
81
- resolve();
82
- });
83
- });
84
- }
85
-
86
- async function createUser(email, uid, options) {
87
- uuid4 = uuid4 || require('uuid/v4');
88
- options = options || {};
89
- options.password = options.password || uuid4();
90
- options.roles = options.roles || {};
91
-
92
- let result = {};
93
- return new Promise(async function(resolve, reject) {
94
- await deleteUser(uid);
95
- libraries.admin.auth().createUser({
96
- uid: uid,
97
- email: email,
98
- password: options.password,
99
- })
100
- .then(async function(updatedUser) {
101
- // See the UserRecord reference doc for the contents of userRecord.
102
- result = {
103
- uid: uid,
104
- email: email,
105
- password: options.password
106
- };
107
-
108
- let SignUpHandler = require('../core/actions/sign-up-handler.js');
109
- SignUpHandler.init(Manager, {
110
- req: req,
111
- res: res,
112
- })
113
-
114
- SignUpHandler.signUp({
115
- auth: {
116
- uid: uid,
117
- email: email,
118
- },
119
- roles: options.roles,
120
- })
121
- .then(function(data) {
122
- assistant.log('Successfully created new user:', uid);
123
- resolve(result);
124
- })
125
- .catch(function(error) {
126
- assistant.log('Error adding to db:', error);
127
- reject(error);
128
- });
129
- })
130
- .catch(function(error) {
131
- assistant.log('Error creating new user:', error);
132
- reject(error);
133
- });
134
- });
135
- }
136
-
137
- });
138
-
139
- },
140
- other: async function () {
141
-
142
- }
143
- }
144
- module.exports = Module;
@@ -1,37 +0,0 @@
1
- let Module = {
2
- init: async function (Manager, data) {
3
- this.Manager = Manager;
4
- this.libraries = Manager.libraries;
5
- this.req = data.req;
6
- this.res = data.res
7
- this.assistant = Manager.Assistant({req: data.req, res: data.res});
8
-
9
- return this;
10
- },
11
- main: async function() {
12
- let self = this;
13
- let req = self.req;
14
- let res = self.res;
15
- let libraries = self.libraries;
16
- let assistant = self.assistant;
17
-
18
- return libraries.cors(req, res, async () => {
19
- let user = await assistant.authenticate();
20
-
21
- // Analytics
22
- let analytics = self.Manager.Analytics({
23
- assistant: assistant,
24
- uuid: user.auth.uid,
25
- })
26
- .event({
27
- name: 'webhook-test',
28
- params: {},
29
- });
30
-
31
- assistant.log(assistant.request);
32
- return res.status(200).json({status: 200, request: assistant.request.data});
33
- });
34
- }
35
- }
36
-
37
- module.exports = Module;
@@ -1,25 +0,0 @@
1
- let Module = {
2
- main: async function () {
3
-
4
- },
5
- addToList: async function () {
6
- return new Promise(function(resolve, reject) {
7
- // let Mailchimp = require('mailchimp-api-v3');
8
- // let mailchimp = new Mailchimp(this.ref.functions.config().mailchimp.key);
9
- // mailchimp.request({
10
- // method : 'get|post|put|patch|delete',
11
- // path : 'path for the call, see mailchimp documentation for possible calls',
12
- // path_params : {
13
- // //path parameters, see mailchimp documentation for each call
14
- // },
15
- // body : {
16
- // //body parameters, see mailchimp documentation for each call
17
- // },
18
- // query : {
19
- // //query string parameters, see mailchimp documentation for each call
20
- // }
21
- // }, callback)
22
- });
23
-
24
- }
25
- }
@@ -1,217 +0,0 @@
1
- // const ua = require('universal-analytics');
2
- const get = require('lodash/get');
3
- const fetch = require('wonderful-fetch');
4
-
5
- const uuidRegex = /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/;
6
- let uuidv5;
7
-
8
- const BLACKLISTED_USER_AGENTS = new RegExp([
9
- /(node-fetch)/,
10
- ].map(r => r.source).join(''));
11
-
12
- function Analytics(Manager, options) {
13
- let self = this;
14
- self.Manager = Manager;
15
- // self._request = self.Manager._inner || {};
16
-
17
- // Set id and secret
18
- // const analyticsId = get(self.Manager, 'config.google_analytics.id', undefined);
19
- self.analyticsId = self?.Manager?.config?.google_analytics?.id;
20
- self.analyticsSecret = self?.Manager?.config?.google_analytics?.secret;
21
-
22
- // Fix options
23
- options = options || {};
24
-
25
- // Set properties
26
- self._assistant = options.assistant || Manager.Assistant();
27
- self._request = {
28
- ip: get(self._assistant, 'request.geolocation.ip', '127.0.0.1'),
29
- country: get(self._assistant, 'request.geolocation.country', ''),
30
- referrer: get(self._assistant, 'request.referrer', ''),
31
- userAgent: get(self._assistant, 'request.client.userAgent', ''),
32
- name: get(self._assistant, 'meta.name', ''),
33
- }
34
-
35
- self._request.userAgent = self._request.userAgent.match(BLACKLISTED_USER_AGENTS) ? '' : self._request.userAgent;
36
-
37
- self._ds = 'app';
38
- self._uuid = options.uuid || self._request.ip || self.Manager.SERVER_UUID;
39
- self._uuid = self._uuid.match(uuidRegex) ? self._uuid : self.generateId(self._uuid);
40
- self._debug = typeof options.debug === 'undefined' ? (self.Manager.assistant.isDevelopment()) : options.debug;
41
- self._pageview = typeof options.pageview === 'undefined' ? true : options.pageview;
42
- self._version = self.Manager.package.version;
43
- self._initialized = false;
44
-
45
- if (!self.analyticsId) {
46
- console.log('Not initializing because missing analyticsId', self.analyticsId);
47
- return self;
48
- } else if (!self.analyticsSecret) {
49
- console.log('Not initializing because missing analyticsSecret', self.analyticsSecret);
50
- return self;
51
- }
52
-
53
- // self.user = ua(self.analyticsId, self._uuid, {
54
- // strictCidFormat: false, // https://analytics.google.com/analytics/web/#/report-home/a104885300w228822596p215709578
55
- // });
56
- // self.user.set('ds', 'app');
57
-
58
- // // https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#sc
59
- // if (self._uuid) {
60
- // self.user.set('uid', self._uuid);
61
- // }
62
- // if (self._request.ip) {
63
- // self.user.set('uip', encodeURIComponent(self._request.ip));
64
- // }
65
- // if (self._request.userAgent) {
66
- // self.user.set('ua', encodeURIComponent(self._request.userAgent));
67
- // }
68
- // if (self._request.referrer) {
69
- // self.user.set('dr', encodeURIComponent(self._request.referrer));
70
- // }
71
-
72
- self._initialized = true;
73
-
74
- if (self._pageview) {
75
- self.pageview({
76
- path: self._request.name,
77
- location: self._request.name,
78
- host: self._request.name,
79
- title: self._request.name,
80
- })
81
- }
82
-
83
- return self;
84
- }
85
-
86
- Analytics.prototype.generateId = function (id) {
87
- let self = this;
88
- uuidv5 = uuidv5 || require('uuid').v5;
89
- let namespace = get(self.Manager, 'config.backend_manager.namespace', undefined);
90
-
91
- return id && namespace ? uuidv5(id, namespace) : undefined;
92
- };
93
-
94
- Analytics.prototype.pageview = function (options) {
95
- let self = this;
96
- options = options || {};
97
- options.path = options.path || self._request.name;
98
- options.location = options.location || self._request.name;
99
- options.host = options.host || self._request.name;
100
- options.title = options.title || self._request.name;
101
-
102
- if (!self._initialized) {
103
- return self;
104
- } else if (self._debug) {
105
- console.log('Skipping Analytics.pageview() because in development', self._uuid, options);
106
- return self;
107
- }
108
-
109
- // self.user.pageview({
110
- // dp: options.path,
111
- // dl: options.location,
112
- // dh: options.host,
113
- // dt: options.title,
114
- // }).send();
115
-
116
- self.send();
117
-
118
- return self;
119
- };
120
-
121
- Analytics.prototype.event = function (options) {
122
- let self = this;
123
- options = options || {};
124
- options.category = options.category;
125
- options.action = options.action;
126
- options.label = options.label;
127
- options.value = options.value;
128
- options.path = options.path || self._request.name;
129
-
130
- if (!self._initialized) {
131
- return self;
132
- } else if (self._debug) {
133
- console.log('Skipping Analytics.event() because in development', self._uuid, options);
134
- return self;
135
- }
136
-
137
- // self.user.event({
138
- // ec: options.category,
139
- // ea: options.action,
140
- // el: options.label,
141
- // ev: options.value,
142
- // // dp: options.path || window.location.href,
143
- // }).send();
144
-
145
- self.send({
146
- name: 'tutorial_begin',
147
- params: {
148
- campaign_id: 'google_1234',
149
- campaign: 'Summer_fun',
150
- source: 'google',
151
- medium: 'cpc',
152
- term: 'summer+travel',
153
- content: 'logolink',
154
- session_id: '123',
155
- engagement_time_msec: '100',
156
- }
157
- });
158
-
159
- return self;
160
- };
161
-
162
- Analytics.prototype.send = function (event) {
163
- let self = this;
164
-
165
- if (!self._initialized) {
166
- return self;
167
- } else if (self._debug) {
168
- console.log('Skipping Analytics.event() because in development', self._uuid, options);
169
- return self;
170
- }
171
-
172
- // self.user = ua(self.analyticsId, self._uuid, {
173
- // strictCidFormat: false, // https://analytics.google.com/analytics/web/#/report-home/a104885300w228822596p215709578
174
- // });
175
- // self.user.set('ds', 'app');
176
-
177
- // // https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#sc
178
- // if (self._uuid) {
179
- // self.user.set('uid', self._uuid);
180
- // }
181
- // if (self._request.ip) {
182
- // self.user.set('uip', encodeURIComponent(self._request.ip));
183
- // }
184
- // if (self._request.userAgent) {
185
- // self.user.set('ua', encodeURIComponent(self._request.userAgent));
186
- // }
187
- // if (self._request.referrer) {
188
- // self.user.set('dr', encodeURIComponent(self._request.referrer));
189
- // }
190
-
191
- /*
192
- https://stackoverflow.com/questions/68773179/what-should-the-client-id-be-when-sending-events-to-google-analytics-4-using-the
193
- https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag
194
-
195
-
196
- */
197
-
198
- // Send event
199
- fetch(`https://www.google-analytics.com/mp/collect?measurement_id=${self.analyticsId}&api_secret=${self.analyticsSecret}`, {
200
- method: 'post',
201
- body: {
202
- client_id: self._uuid,
203
- user_id: self._uuid,
204
- events: [event],
205
- },
206
- })
207
- .then((r) => {
208
- console.log('Analytics.send(): Sent', r);
209
- })
210
- .catch((e) => {
211
- console.error('Analytics.send(): Error sending', e);
212
- });
213
-
214
- return self;
215
- };
216
-
217
- module.exports = Analytics;