ghost 5.50.4 → 5.51.1

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 (196) hide show
  1. package/components/tryghost-adapter-cache-memory-ttl-5.51.1.tgz +0 -0
  2. package/components/{tryghost-adapter-cache-redis-5.50.4.tgz → tryghost-adapter-cache-redis-5.51.1.tgz} +0 -0
  3. package/components/{tryghost-adapter-manager-5.50.4.tgz → tryghost-adapter-manager-5.51.1.tgz} +0 -0
  4. package/components/tryghost-announcement-bar-settings-5.51.1.tgz +0 -0
  5. package/components/{tryghost-api-framework-5.50.4.tgz → tryghost-api-framework-5.51.1.tgz} +0 -0
  6. package/components/{tryghost-api-version-compatibility-service-5.50.4.tgz → tryghost-api-version-compatibility-service-5.51.1.tgz} +0 -0
  7. package/components/{tryghost-audience-feedback-5.50.4.tgz → tryghost-audience-feedback-5.51.1.tgz} +0 -0
  8. package/components/{tryghost-bootstrap-socket-5.50.4.tgz → tryghost-bootstrap-socket-5.51.1.tgz} +0 -0
  9. package/components/tryghost-collections-5.51.1.tgz +0 -0
  10. package/components/{tryghost-constants-5.50.4.tgz → tryghost-constants-5.51.1.tgz} +0 -0
  11. package/components/{tryghost-custom-theme-settings-service-5.50.4.tgz → tryghost-custom-theme-settings-service-5.51.1.tgz} +0 -0
  12. package/components/{tryghost-data-generator-5.50.4.tgz → tryghost-data-generator-5.51.1.tgz} +0 -0
  13. package/components/tryghost-domain-events-5.51.1.tgz +0 -0
  14. package/components/tryghost-dynamic-routing-events-5.51.1.tgz +0 -0
  15. package/components/tryghost-email-analytics-provider-mailgun-5.51.1.tgz +0 -0
  16. package/components/{tryghost-email-analytics-service-5.50.4.tgz → tryghost-email-analytics-service-5.51.1.tgz} +0 -0
  17. package/components/tryghost-email-content-generator-5.51.1.tgz +0 -0
  18. package/components/{tryghost-email-events-5.50.4.tgz → tryghost-email-events-5.51.1.tgz} +0 -0
  19. package/components/tryghost-email-service-5.51.1.tgz +0 -0
  20. package/components/tryghost-email-suppression-list-5.51.1.tgz +0 -0
  21. package/components/tryghost-event-aware-cache-wrapper-5.51.1.tgz +0 -0
  22. package/components/{tryghost-express-dynamic-redirects-5.50.4.tgz → tryghost-express-dynamic-redirects-5.51.1.tgz} +0 -0
  23. package/components/{tryghost-external-media-inliner-5.50.4.tgz → tryghost-external-media-inliner-5.51.1.tgz} +0 -0
  24. package/components/tryghost-extract-api-key-5.51.1.tgz +0 -0
  25. package/components/{tryghost-html-to-plaintext-5.50.4.tgz → tryghost-html-to-plaintext-5.51.1.tgz} +0 -0
  26. package/components/tryghost-i18n-5.51.1.tgz +0 -0
  27. package/components/tryghost-importer-handler-content-files-5.51.1.tgz +0 -0
  28. package/components/{tryghost-importer-revue-5.50.4.tgz → tryghost-importer-revue-5.51.1.tgz} +0 -0
  29. package/components/tryghost-in-memory-repository-5.51.1.tgz +0 -0
  30. package/components/{tryghost-job-manager-5.50.4.tgz → tryghost-job-manager-5.51.1.tgz} +0 -0
  31. package/components/{tryghost-link-redirects-5.50.4.tgz → tryghost-link-redirects-5.51.1.tgz} +0 -0
  32. package/components/tryghost-link-replacer-5.51.1.tgz +0 -0
  33. package/components/{tryghost-link-tracking-5.50.4.tgz → tryghost-link-tracking-5.51.1.tgz} +0 -0
  34. package/components/{tryghost-magic-link-5.50.4.tgz → tryghost-magic-link-5.51.1.tgz} +0 -0
  35. package/components/tryghost-mailgun-client-5.51.1.tgz +0 -0
  36. package/components/{tryghost-member-attribution-5.50.4.tgz → tryghost-member-attribution-5.51.1.tgz} +0 -0
  37. package/components/tryghost-member-events-5.51.1.tgz +0 -0
  38. package/components/{tryghost-members-api-5.50.4.tgz → tryghost-members-api-5.51.1.tgz} +0 -0
  39. package/components/tryghost-members-csv-5.51.1.tgz +0 -0
  40. package/components/tryghost-members-events-service-5.51.1.tgz +0 -0
  41. package/components/tryghost-members-importer-5.51.1.tgz +0 -0
  42. package/components/tryghost-members-offers-5.51.1.tgz +0 -0
  43. package/components/tryghost-members-payments-5.51.1.tgz +0 -0
  44. package/components/{tryghost-members-ssr-5.50.4.tgz → tryghost-members-ssr-5.51.1.tgz} +0 -0
  45. package/components/tryghost-members-stripe-service-5.51.1.tgz +0 -0
  46. package/components/{tryghost-mentions-email-report-5.50.4.tgz → tryghost-mentions-email-report-5.51.1.tgz} +0 -0
  47. package/components/tryghost-milestones-5.51.1.tgz +0 -0
  48. package/components/tryghost-minifier-5.51.1.tgz +0 -0
  49. package/components/tryghost-mw-api-version-mismatch-5.51.1.tgz +0 -0
  50. package/components/tryghost-mw-cache-control-5.51.1.tgz +0 -0
  51. package/components/{tryghost-mw-error-handler-5.50.4.tgz → tryghost-mw-error-handler-5.51.1.tgz} +0 -0
  52. package/components/{tryghost-mw-session-from-token-5.50.4.tgz → tryghost-mw-session-from-token-5.51.1.tgz} +0 -0
  53. package/components/tryghost-mw-update-user-last-seen-5.51.1.tgz +0 -0
  54. package/components/tryghost-mw-version-match-5.51.1.tgz +0 -0
  55. package/components/tryghost-mw-vhost-5.51.1.tgz +0 -0
  56. package/components/tryghost-oembed-service-5.51.1.tgz +0 -0
  57. package/components/{tryghost-package-json-5.50.4.tgz → tryghost-package-json-5.51.1.tgz} +0 -0
  58. package/components/{tryghost-post-revisions-5.50.4.tgz → tryghost-post-revisions-5.51.1.tgz} +0 -0
  59. package/components/tryghost-posts-service-5.51.1.tgz +0 -0
  60. package/components/tryghost-referrers-5.51.1.tgz +0 -0
  61. package/components/{tryghost-security-5.50.4.tgz → tryghost-security-5.51.1.tgz} +0 -0
  62. package/components/{tryghost-session-service-5.50.4.tgz → tryghost-session-service-5.51.1.tgz} +0 -0
  63. package/components/tryghost-settings-path-manager-5.51.1.tgz +0 -0
  64. package/components/{tryghost-slack-notifications-5.50.4.tgz → tryghost-slack-notifications-5.51.1.tgz} +0 -0
  65. package/components/{tryghost-staff-service-5.50.4.tgz → tryghost-staff-service-5.51.1.tgz} +0 -0
  66. package/components/tryghost-stats-service-5.51.1.tgz +0 -0
  67. package/components/tryghost-tiers-5.51.1.tgz +0 -0
  68. package/components/{tryghost-update-check-service-5.50.4.tgz → tryghost-update-check-service-5.51.1.tgz} +0 -0
  69. package/components/tryghost-verification-trigger-5.51.1.tgz +0 -0
  70. package/components/tryghost-version-notifications-data-service-5.51.1.tgz +0 -0
  71. package/components/{tryghost-webmentions-5.50.4.tgz → tryghost-webmentions-5.51.1.tgz} +0 -0
  72. package/core/boot.js +2 -0
  73. package/core/built/admin/assets/{chunk.143.23853432ad84ee830e79.js → chunk.143.2abd91420b3fa24e7b4f.js} +5 -5
  74. package/core/built/admin/assets/{chunk.178.ba5d7ae82760044bc225.js → chunk.178.94ee303c70d2d9d12bc5.js} +4 -4
  75. package/core/built/admin/assets/{chunk.976.c3f393d6685c89bbaaca.js → chunk.976.1491bdc7009987ddde87.js} +4 -4
  76. package/core/built/admin/assets/{ghost-27882ad9ebdf26d6c539be33e8f8c9ed.js → ghost-22c9d9cef7aa0ff08294f8ea69c344dd.js} +3695 -3689
  77. package/core/built/admin/assets/ghost-dark-2ec2e32362fa867723379a286fd0f0bd.css +1 -0
  78. package/core/built/admin/assets/ghost-e6482a0a19b228a9b9e71a9c5ea134ba.css +1 -0
  79. package/core/built/admin/index.html +5 -5
  80. package/core/frontend/src/cards/css/signup.css +1 -1
  81. package/core/server/api/endpoints/actions.js +3 -0
  82. package/core/server/api/endpoints/announcements.js +3 -0
  83. package/core/server/api/endpoints/authentication.js +18 -0
  84. package/core/server/api/endpoints/authors-public.js +6 -0
  85. package/core/server/api/endpoints/collections.js +31 -25
  86. package/core/server/api/endpoints/comments-members.js +30 -1
  87. package/core/server/api/endpoints/comments.js +3 -0
  88. package/core/server/api/endpoints/config.js +3 -0
  89. package/core/server/api/endpoints/custom-theme-settings.js +3 -0
  90. package/core/server/api/endpoints/db.js +8 -1
  91. package/core/server/api/endpoints/email-post.js +3 -0
  92. package/core/server/api/endpoints/email-previews.js +6 -1
  93. package/core/server/api/endpoints/emails.js +24 -0
  94. package/core/server/api/endpoints/explore.js +3 -0
  95. package/core/server/api/endpoints/feedback-members.js +3 -0
  96. package/core/server/api/endpoints/files.js +3 -0
  97. package/core/server/api/endpoints/identities.js +3 -0
  98. package/core/server/api/endpoints/images.js +3 -0
  99. package/core/server/api/endpoints/integrations.js +15 -0
  100. package/core/server/api/endpoints/invites.js +12 -0
  101. package/core/server/api/endpoints/labels.js +12 -2
  102. package/core/server/api/endpoints/links.js +3 -0
  103. package/core/server/api/endpoints/mail.js +3 -0
  104. package/core/server/api/endpoints/media.js +6 -0
  105. package/core/server/api/endpoints/member-signin-urls.js +3 -0
  106. package/core/server/api/endpoints/members-stripe-connect.js +3 -0
  107. package/core/server/api/endpoints/members.js +41 -9
  108. package/core/server/api/endpoints/mentions.js +6 -1
  109. package/core/server/api/endpoints/newsletters-public.js +3 -0
  110. package/core/server/api/endpoints/newsletters.js +9 -0
  111. package/core/server/api/endpoints/notifications.js +12 -0
  112. package/core/server/api/endpoints/oembed.js +3 -0
  113. package/core/server/api/endpoints/offers-public.js +3 -0
  114. package/core/server/api/endpoints/offers.js +6 -0
  115. package/core/server/api/endpoints/pages-public.js +6 -0
  116. package/core/server/api/endpoints/pages.js +15 -6
  117. package/core/server/api/endpoints/posts-public.js +6 -0
  118. package/core/server/api/endpoints/posts.js +17 -20
  119. package/core/server/api/endpoints/previews.js +3 -0
  120. package/core/server/api/endpoints/redirects.js +2 -1
  121. package/core/server/api/endpoints/roles.js +3 -0
  122. package/core/server/api/endpoints/schedules.js +6 -1
  123. package/core/server/api/endpoints/settings-public.js +3 -0
  124. package/core/server/api/endpoints/settings.js +11 -1
  125. package/core/server/api/endpoints/site.js +3 -0
  126. package/core/server/api/endpoints/slack.js +3 -0
  127. package/core/server/api/endpoints/snippets.js +15 -4
  128. package/core/server/api/endpoints/stats.js +15 -0
  129. package/core/server/api/endpoints/tags-public.js +6 -0
  130. package/core/server/api/endpoints/tags.js +9 -1
  131. package/core/server/api/endpoints/themes.js +15 -2
  132. package/core/server/api/endpoints/tiers-public.js +3 -0
  133. package/core/server/api/endpoints/tiers.js +6 -0
  134. package/core/server/api/endpoints/users.js +21 -1
  135. package/core/server/api/endpoints/utils/serializers/output/mappers/posts.js +13 -1
  136. package/core/server/api/endpoints/utils/serializers/output/settings.js +1 -1
  137. package/core/server/api/endpoints/webhooks.js +8 -2
  138. package/core/server/data/migrations/versions/5.51/2023-05-30-19-03-update-pintura-setting.js +19 -0
  139. package/core/server/data/migrations/versions/5.51/2023-06-07-10-17-add-collections-crud-persmissions.js +54 -0
  140. package/core/server/data/schema/default-settings/default-settings.json +1 -1
  141. package/core/server/data/schema/fixtures/FixtureManager.js +1 -0
  142. package/core/server/data/schema/fixtures/fixtures.json +35 -5
  143. package/core/server/services/collections/built-in-collections.js +8 -0
  144. package/core/server/services/collections/index.js +34 -10
  145. package/core/server/services/collections/update-events.js +15 -0
  146. package/core/server/services/posts/posts-service.js +3 -1
  147. package/core/server/services/segment/DomainEventsAnalytics.js +83 -0
  148. package/core/server/services/segment/ModelEventsAnalytics.js +108 -0
  149. package/core/server/services/segment/index.js +26 -38
  150. package/core/server/web/api/endpoints/admin/middleware.js +4 -0
  151. package/core/shared/config/defaults.json +1 -1
  152. package/core/shared/config/overrides.json +1 -0
  153. package/core/shared/labs.js +3 -3
  154. package/package.json +139 -139
  155. package/yarn.lock +55 -40
  156. package/components/tryghost-adapter-cache-memory-ttl-5.50.4.tgz +0 -0
  157. package/components/tryghost-announcement-bar-settings-5.50.4.tgz +0 -0
  158. package/components/tryghost-collections-5.50.4.tgz +0 -0
  159. package/components/tryghost-domain-events-5.50.4.tgz +0 -0
  160. package/components/tryghost-dynamic-routing-events-5.50.4.tgz +0 -0
  161. package/components/tryghost-email-analytics-provider-mailgun-5.50.4.tgz +0 -0
  162. package/components/tryghost-email-content-generator-5.50.4.tgz +0 -0
  163. package/components/tryghost-email-service-5.50.4.tgz +0 -0
  164. package/components/tryghost-email-suppression-list-5.50.4.tgz +0 -0
  165. package/components/tryghost-event-aware-cache-wrapper-5.50.4.tgz +0 -0
  166. package/components/tryghost-extract-api-key-5.50.4.tgz +0 -0
  167. package/components/tryghost-i18n-5.50.4.tgz +0 -0
  168. package/components/tryghost-importer-handler-content-files-5.50.4.tgz +0 -0
  169. package/components/tryghost-in-memory-repository-5.50.4.tgz +0 -0
  170. package/components/tryghost-link-replacer-5.50.4.tgz +0 -0
  171. package/components/tryghost-mailgun-client-5.50.4.tgz +0 -0
  172. package/components/tryghost-member-events-5.50.4.tgz +0 -0
  173. package/components/tryghost-members-csv-5.50.4.tgz +0 -0
  174. package/components/tryghost-members-events-service-5.50.4.tgz +0 -0
  175. package/components/tryghost-members-importer-5.50.4.tgz +0 -0
  176. package/components/tryghost-members-offers-5.50.4.tgz +0 -0
  177. package/components/tryghost-members-payments-5.50.4.tgz +0 -0
  178. package/components/tryghost-members-stripe-service-5.50.4.tgz +0 -0
  179. package/components/tryghost-milestones-5.50.4.tgz +0 -0
  180. package/components/tryghost-minifier-5.50.4.tgz +0 -0
  181. package/components/tryghost-mw-api-version-mismatch-5.50.4.tgz +0 -0
  182. package/components/tryghost-mw-cache-control-5.50.4.tgz +0 -0
  183. package/components/tryghost-mw-update-user-last-seen-5.50.4.tgz +0 -0
  184. package/components/tryghost-mw-version-match-5.50.4.tgz +0 -0
  185. package/components/tryghost-mw-vhost-5.50.4.tgz +0 -0
  186. package/components/tryghost-oembed-service-5.50.4.tgz +0 -0
  187. package/components/tryghost-posts-service-5.50.4.tgz +0 -0
  188. package/components/tryghost-referrers-5.50.4.tgz +0 -0
  189. package/components/tryghost-settings-path-manager-5.50.4.tgz +0 -0
  190. package/components/tryghost-stats-service-5.50.4.tgz +0 -0
  191. package/components/tryghost-tiers-5.50.4.tgz +0 -0
  192. package/components/tryghost-verification-trigger-5.50.4.tgz +0 -0
  193. package/components/tryghost-version-notifications-data-service-5.50.4.tgz +0 -0
  194. package/core/built/admin/assets/ghost-01b4eb0cff8ee8478af9d4074a256756.css +0 -1
  195. package/core/built/admin/assets/ghost-dark-8dd7d236d17be6dbef26039409d0c34d.css +0 -1
  196. /package/core/built/admin/assets/{chunk.976.c3f393d6685c89bbaaca.js.LICENSE.txt → chunk.976.1491bdc7009987ddde87.js.LICENSE.txt} +0 -0
@@ -0,0 +1,83 @@
1
+ const {MilestoneCreatedEvent} = require('@tryghost/milestones');
2
+
3
+ /**
4
+ * @typedef {import('@tryghost/logging')} logging
5
+ */
6
+
7
+ /**
8
+ * @typedef {import('analytics-node')} analytics
9
+ */
10
+
11
+ /**
12
+ * @typedef {object} IExceptionHandler
13
+ * @prop {(err: Error) => void} captureException
14
+ */
15
+
16
+ /**
17
+ * @typedef {import('@tryghost/domain-events')} DomainEvents
18
+ */
19
+
20
+ /**
21
+ * @typedef {object} IDomainEventsAnalytics
22
+ * @param {analytics} analytics
23
+ * @param {logging} logging
24
+ * @param {object} trackDefaults
25
+ * @param {string} prefix
26
+ * @param {IExceptionHandler} exceptionHandler
27
+ * @param {DomainEvents} DomainEvents
28
+ * @prop {} subscribeToEvents
29
+ */
30
+
31
+ module.exports = class DomainEventsAnalytics {
32
+ /** @type {analytics} */
33
+ #analytics;
34
+ /** @type {object} */
35
+ #trackDefaults;
36
+ /** @type {string} */
37
+ #prefix;
38
+ /** @type {IExceptionHandler} */
39
+ #exceptionHandler;
40
+ /** @type {logging} */
41
+ #logging;
42
+ /** @type {DomainEvents} */
43
+ #DomainEvents;
44
+
45
+ constructor(deps) {
46
+ this.#analytics = deps.analytics;
47
+ this.#trackDefaults = deps.trackDefaults;
48
+ this.#prefix = deps.prefix;
49
+ this.#exceptionHandler = deps.exceptionHandler;
50
+ this.#logging = deps.logging;
51
+ this.#DomainEvents = deps.DomainEvents;
52
+ }
53
+
54
+ /**
55
+ *
56
+ * @param {object} event
57
+ * @param {object} event.data
58
+ * @param {object} event.data.milestone
59
+ * @param {number} event.data.milestone.value
60
+ * @param {string} event.data.milestone.type
61
+ * @returns {Promise<void>}
62
+ */
63
+ async #handleMilestoneCreatedEvent(event) {
64
+ if (event.data.milestone
65
+ && event.data.milestone.value === 100
66
+ ) {
67
+ const eventName = event.data.milestone.type === 'arr' ? '$100 MRR reached' : '100 Members reached';
68
+
69
+ try {
70
+ this.#analytics.track(Object.assign(this.#trackDefaults, {}, {event: this.#prefix + eventName}));
71
+ } catch (err) {
72
+ this.#logging.error(err);
73
+ this.#exceptionHandler.captureException(err);
74
+ }
75
+ }
76
+ }
77
+
78
+ subscribeToEvents() {
79
+ this.#DomainEvents.subscribe(MilestoneCreatedEvent, async (event) => {
80
+ await this.#handleMilestoneCreatedEvent(event);
81
+ });
82
+ }
83
+ };
@@ -0,0 +1,108 @@
1
+ const _ = require('lodash');
2
+
3
+ /**
4
+ * @typedef {import('@tryghost/logging')} logging
5
+ */
6
+
7
+ /**
8
+ * @typedef {import('analytics-node')} analytics
9
+ */
10
+
11
+ /**
12
+ * @typedef {object} IExceptionHandler
13
+ * @prop {(err: Error) => void} captureException
14
+ */
15
+
16
+ /**
17
+ * @typedef {import('../../lib/common/events')} events
18
+ */
19
+
20
+ /**
21
+ * @typedef {object} IModelEventsAnalytics
22
+ * @param {analytics} analytics
23
+ * @param {logging} logging
24
+ * @param {object} trackDefaults
25
+ * @param {string} prefix
26
+ * @param {IExceptionHandler} exceptionHandler
27
+ * @param {events} events
28
+ * @prop {} subscribeToEvents
29
+ */
30
+
31
+ /**
32
+ * Listens to model events to layer on analytics - also uses the "fake" theme.uploaded
33
+ * event from the theme API
34
+ */
35
+ module.exports = class ModelEventsAnalytics {
36
+ /** @type {analytics} */
37
+ #analytics;
38
+ /** @type {object} */
39
+ #trackDefaults;
40
+ /** @type {string} */
41
+ #prefix;
42
+ /** @type {IExceptionHandler} */
43
+ #exceptionHandler;
44
+ /** @type {events} */
45
+ #events;
46
+ /** @type {logging} */
47
+ #logging;
48
+
49
+ /**
50
+ * @type {Array<{event: string, name: string, data?: object}>}
51
+ */
52
+ #toTrack = [
53
+ {
54
+ event: 'post.published',
55
+ name: 'Post Published'
56
+ },
57
+ {
58
+ event: 'page.published',
59
+ name: 'Page Published'
60
+ },
61
+ {
62
+ event: 'theme.uploaded',
63
+ name: 'Theme Uploaded',
64
+ // {keyOnSuppliedEventData: keyOnTrackedEventData}
65
+ // - used to extract specific properties from event data and give them meaningful names
66
+ data: {name: 'name'}
67
+ },
68
+ {
69
+ event: 'integration.added',
70
+ name: 'Custom Integration Added'
71
+ }
72
+ ];
73
+
74
+ constructor(deps) {
75
+ this.#analytics = deps.analytics;
76
+ this.#trackDefaults = deps.trackDefaults;
77
+ this.#prefix = deps.prefix;
78
+ this.#exceptionHandler = deps.exceptionHandler;
79
+ this.#events = deps.events;
80
+ this.#logging = deps.logging;
81
+ }
82
+
83
+ async #handleEvent(event) {
84
+ try {
85
+ this.#analytics.track(event);
86
+ } catch (err) {
87
+ this.#logging.error(err);
88
+ this.#exceptionHandler.captureException(err);
89
+ }
90
+ }
91
+
92
+ subscribeToEvents() {
93
+ this.#toTrack.forEach(({event, name, data = {}}) => {
94
+ this.#events.on(event, async (eventData = {}) => {
95
+ // extract desired properties from eventData and rename keys if necessary
96
+ const mappedData = _.mapValues(data || {}, v => eventData[v]);
97
+
98
+ const eventToTrack = {
99
+ ...this.#trackDefaults,
100
+ event: this.#prefix + name,
101
+ ...mappedData
102
+ };
103
+
104
+ await this.#handleEvent(eventToTrack);
105
+ });
106
+ });
107
+ }
108
+ };
@@ -1,51 +1,39 @@
1
- const _ = require('lodash');
2
1
  const Analytics = require('analytics-node');
3
- const logging = require('@tryghost/logging');
4
-
5
2
  const config = require('../../../shared/config');
6
3
  const sentry = require('../../../shared/sentry');
7
-
8
- // Listens to model events to layer on analytics - also uses the "fake" theme.uploaded event from the theme API
4
+ const logging = require('@tryghost/logging');
5
+ const DomainEvents = require('@tryghost/domain-events');
9
6
  const events = require('../../lib/common/events');
10
7
 
8
+ const ModelEventsAnalytics = require('./ModelEventsAnalytics');
9
+ const DomainEventsAnalytics = require('./DomainEventsAnalytics');
10
+
11
11
  module.exports.init = function () {
12
12
  const analytics = new Analytics(config.get('segment:key'));
13
13
  const trackDefaults = config.get('segment:trackDefaults') || {};
14
14
  const prefix = config.get('segment:prefix') || '';
15
15
 
16
- const toTrack = [
17
- {
18
- event: 'post.published',
19
- name: 'Post Published'
20
- },
21
- {
22
- event: 'page.published',
23
- name: 'Page Published'
24
- },
25
- {
26
- event: 'theme.uploaded',
27
- name: 'Theme Uploaded',
28
- // {keyOnSuppliedEventData: keyOnTrackedEventData}
29
- // - used to extract specific properties from event data and give them meaningful names
30
- data: {name: 'name'}
31
- },
32
- {
33
- event: 'integration.added',
34
- name: 'Custom Integration Added'
35
- }
36
- ];
37
-
38
- _.each(toTrack, function (track) {
39
- events.on(track.event, function (eventData = {}) {
40
- // extract desired properties from eventData and rename keys if necessary
41
- const data = _.mapValues(track.data || {}, v => eventData[v]);
16
+ const subscribeToDomainEvents = new DomainEventsAnalytics({
17
+ analytics,
18
+ trackDefaults,
19
+ prefix,
20
+ exceptionHandler: sentry,
21
+ DomainEvents,
22
+ logging
23
+ });
42
24
 
43
- try {
44
- analytics.track(_.extend(trackDefaults, data, {event: prefix + track.name}));
45
- } catch (err) {
46
- logging.error(err);
47
- sentry.captureException(err);
48
- }
49
- });
25
+ const modelEventsAnalytics = new ModelEventsAnalytics({
26
+ analytics,
27
+ trackDefaults,
28
+ prefix,
29
+ exceptionHandler: sentry,
30
+ events,
31
+ logging
50
32
  });
33
+
34
+ // Listen to model events
35
+ modelEventsAnalytics.subscribeToEvents();
36
+
37
+ // Listen to domain events
38
+ subscribeToDomainEvents.subscribeToEvents();
51
39
  };
@@ -14,6 +14,10 @@ const notImplemented = function (req, res, next) {
14
14
  return next();
15
15
  }
16
16
 
17
+ if (req.query.god_mode === 'true' && process.env.NODE_ENV === 'development') {
18
+ return next();
19
+ }
20
+
17
21
  // @NOTE: integrations & staff tokens have limited access to the API
18
22
  const allowlisted = {
19
23
  site: ['GET'],
@@ -202,7 +202,7 @@
202
202
  },
203
203
  "signupForm": {
204
204
  "url": "https://cdn.jsdelivr.net/ghost/signup-form@~{version}/umd/signup-form.min.js",
205
- "version": "0"
205
+ "version": "0.1"
206
206
  },
207
207
  "tenor": {
208
208
  "googleApiKey": null,
@@ -121,6 +121,7 @@
121
121
  },
122
122
  "internalImageSizes": {
123
123
  "icon": {"width": 256, "height": 256},
124
+ "signup-form-icon": {"width": 192, "height": 192},
124
125
  "email-header-image": {"width": 1200},
125
126
  "email-latest-posts-image": {"width": 200, "height": 200},
126
127
  "email-latest-posts-image-mobile": {"width": 1200, "height": 960}
@@ -18,7 +18,8 @@ const GA_FEATURES = [
18
18
  'audienceFeedback',
19
19
  'themeErrorsNotification',
20
20
  'outboundLinkTagging',
21
- 'announcementBar'
21
+ 'announcementBar',
22
+ 'signupForm'
22
23
  ];
23
24
 
24
25
  // NOTE: this allowlist is meant to be used to filter out any unexpected
@@ -38,8 +39,7 @@ const ALPHA_FEATURES = [
38
39
  'emailCustomization',
39
40
  'signupCard',
40
41
  'collections',
41
- 'adminXSettings',
42
- 'signupForm'
42
+ 'adminXSettings'
43
43
  ];
44
44
 
45
45
  module.exports.GA_KEYS = [...GA_FEATURES];