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)
refs https://github.com/TryGhost/Toolbox/issues/356
- even though I was hiding the button, it's better to prevent going to
the route entirely by redirecting to the homepage if the labs flag is
not enabled
- this was due to the fact that we use the same model for pages as we do
for posts, so the hardcoded `post` key was not accurate
- this commit adds support for providing a function to return the key for the
action type
refs https://github.com/TryGhost/Toolbox/issues/356
- some resources don't have titles, like users, so we should optionally
see if they have a name
- this is starting to become unwieldy so I'll likely pull this logic out
in an upcoming commit
refs https://github.com/TryGhost/Toolbox/issues/356
- this allows you to click on the title and go to whatever resource was
acted upon
- if the resource has not be found, it'll just show the resource ID
- cleaned up unused dependencies
- adds missing dependencies that are used in the code
- this should help us be more explicit about the dependencies a package
uses
closes https://github.com/TryGhost/Team/issues/1715
refs https://github.com/TryGhost/Members/pull/407
- when comped boolean was brought back for backwards compatibility, it accidentally opened a path from admin to set comped stripe subscriptions on members on save, as Admin always sends back `comped` value
- since we don't allow stripe comped subscriptions anymore, this caused weird behavior with assigning the default tier on comped stripe subscription.
- this change removes the `json.comped` value to be sent up from Admin to avoid any weird comped changes to the member
no issue
- switched `parse-audit-log-event` to a class helper to get access to dependency injection
- added `get actor()` to the parsed event object
- uses the store to find the related user record, returning an already loaded record if it exists otherwise fetches the record
- allows use of `event.actor.*` in templates because they are promise-aware and will be filled in once the record is loaded
refs. https://github.com/TryGhost/Team/issues/1813
- All the groups of the Portal settings accordion was closed by default. Opening the first group when showing the modal makes the workflow faster.
- The top heading on the content area had a white background which made the screen visually a bit cluttered.
refs. https://github.com/TryGhost/Team/issues/1812
- The "Copy link" button on the Offer detail screen was only enabled once certain fields were filled. This makes unnecessary cognitive load on the end user.
refs https://github.com/TryGhost/Toolbox/issues/356
- we had a function called `getAction` in every model where we were
collecting CRUD actions to store in the DB
- this function has the same boilerplate code - make sure it's not
internal and then construct the object to return
- as we add more actions to more models, we probably want to pull this
out and just configure the things specific to the model
- this commit pulls out the function into the actions plugin and adds a
couple of keys to the models to indicate we'd like to store CRUD
actions, along with the model name
refs https://github.com/TryGhost/Toolbox/issues/363
- this commit switches us to using the official and maintained
`mailgun.js` SDK, and updates the `mailgun-client` code to reflect the
changes between the two
- some of the existing tests return `items` as an empty array
- the upcoming change to switch `mailgun-js` to `mailgun.js` means it's
more strict about requiring `paging` too
- this commit adds a new empty-response fixture so we can standardize
using that across tests
no issue
- we allowed line breaks to be created in the text-replacement html input used inside email cards but they were removed as soon as the card's edit mode was left
- fixed the clean-text-replacement-html routine so `<br>` atoms aren't stripped
- added the soft-return parser to the `<KoenigTextReplacementHtmlInput>` editor options so the `<br>` elements are correctly parsed back into atoms when entering edit mode