Ghost/ghost
Simon Backx da24d13601
Added member attribution events and storage (#15243)
refs https://github.com/TryGhost/Team/issues/1808
refs https://github.com/TryGhost/Team/issues/1809
refs https://github.com/TryGhost/Team/issues/1820
refs https://github.com/TryGhost/Team/issues/1814

### Changes in `member-events` package

- Added MemberCreatedEvent (event, not model)
- Added SubscriptionCreatedEvent (event, not model) 

### Added `member-attribution` package (new)

- Added the AttributionBuilder class which is able to convert a url history to an attribution object (exposed as getAttribution on the service itself, which handles the dependencies)
```
[{
    "path": "/",
    "time": 123
}]
```
to
```
{
    "url": "/",
    "id": null,
    "type": "url"
}
```

- event handler listens for MemberCreatedEvent and SubscriptionCreatedEvent and creates the corresponding models in the database.

### Changes in `members-api` package

- Added urlHistory to `sendMagicLink` endpoint body + convert the urlHistory to an attribution object that is stored in the tokenData of the magic link (sent by Portal in this PR: https://github.com/TryGhost/Portal/pull/256).
- Added urlHistory to `createCheckoutSession` endpoint + convert the urlHistory to attribution keys that are saved in the Stripe Session metadata (sent by Portal in this PR: https://github.com/TryGhost/Portal/pull/256).

- Added attribution data property to member repository's create method (when a member is created)
- Dispatch MemberCreatedEvent with attribution

###  Changes in `members-stripe-service` package (`ghost/stripe`)

- Dispatch SubscriptionCreatedEvent in WebhookController on subscription checkout (with attribution from session metadata)
2022-08-18 17:38:42 +02:00
..
adapter-manager Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
admin Revert "First iteration of adding in post and page columns to event tables" 2022-08-18 17:29:40 +02:00
api-framework Organized package dependencies 2022-08-18 11:55:49 +02:00
api-version-compatibility-service Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
bootstrap-socket Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
constants Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
core Added member attribution events and storage (#15243) 2022-08-18 17:38:42 +02:00
custom-theme-settings-service Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
domain-events Organized package dependencies 2022-08-18 11:55:49 +02:00
email-analytics-provider-mailgun Organized package dependencies 2022-08-18 11:55:49 +02:00
email-analytics-service Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
email-content-generator Organized package dependencies 2022-08-18 11:55:49 +02:00
express-dynamic-redirects Organized package dependencies 2022-08-18 11:55:49 +02:00
extract-api-key Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
html-to-plaintext Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
job-manager Update dependency date-fns to v2.29.2 2022-08-18 17:15:58 +02:00
magic-link Organized package dependencies 2022-08-18 11:55:49 +02:00
mailgun-client Organized package dependencies 2022-08-18 11:55:49 +02:00
member-analytics-service Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
member-attribution Added member attribution events and storage (#15243) 2022-08-18 17:38:42 +02:00
member-events Added member attribution events and storage (#15243) 2022-08-18 17:38:42 +02:00
members-analytics-ingress Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
members-api Added member attribution events and storage (#15243) 2022-08-18 17:38:42 +02:00
members-csv Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
members-events-service Update dependency @tryghost/errors to v1.2.15 2022-08-18 12:02:38 +02:00
members-importer Organized package dependencies 2022-08-18 11:55:49 +02:00
members-ssr Organized package dependencies 2022-08-18 11:55:49 +02:00
minifier Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
mw-api-version-mismatch Organized package dependencies 2022-08-18 11:55:49 +02:00
mw-cache-control Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
mw-error-handler Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
mw-session-from-token Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
mw-update-user-last-seen Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
mw-vhost Cleaned up unused test utils 2022-08-18 11:55:49 +02:00
oembed-service Organized package dependencies 2022-08-18 11:55:49 +02:00
offers Organized package dependencies 2022-08-18 11:55:49 +02:00
package-json Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
payments Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
security Organized package dependencies 2022-08-18 11:55:49 +02:00
session-service Fixed full Admin test suite running during unit tests 2022-08-15 15:34:52 +02:00
settings-path-manager Update dependency date-fns to v2.29.2 2022-08-18 17:15:58 +02:00
stripe Added member attribution events and storage (#15243) 2022-08-18 17:38:42 +02:00
update-check-service Organized package dependencies 2022-08-18 11:55:49 +02:00
verification-trigger Organized package dependencies 2022-08-18 11:55:49 +02:00
version-notifications-data-service Organized package dependencies 2022-08-18 11:55:49 +02:00