Commit Graph

1232 Commits

Author SHA1 Message Date
Thibaut Patel
a0001df1ad Added the product name property in member reads
refs https://github.com/TryGhost/Team/issues/1141

- The goal is to retrieve the product name for canceled subscriptions
- The property is located at `member.subscriptions.price.product.name`
- We can't easily get the full product as products are retrieved using a join through `members_products`, and there is only a `members_products` row when the subscription is active
2022-03-10 09:50:10 +01:00
Fabien "egg" O'Carroll
688a5c9241 Published new versions
- @tryghost/members-api@5.1.2
 - @tryghost/members-stripe-service@0.9.0
2022-03-09 14:43:15 +00:00
Fabien 'egg' O'Carroll
633dc08c11 Added migration to update Stripe Product names (#376)
refs https://github.com/TryGhost/Team/issues/1289

We had a bug where Tiers would have a name of 'Default Product', and a
Stripe Product would be created with the same name. This migration will
fixes those broken Stripe Products
2022-03-09 14:41:59 +00:00
Renovate Bot
e45f85ce41 Update dependency @tryghost/errors to v1.2.4 2022-03-09 10:31:57 +00:00
Fabien "egg" O'Carroll
cc576bb130 Published new versions
- @tryghost/members-api@5.1.1
2022-03-07 14:09:51 +00:00
Fabien 'egg' O'Carroll
480a22d6ac Fixed visibility changes in product repository (#375)
refs https://github.com/TryGhost/Team/issues/1387

First, this default value didn't make sense as it was written when we
had a boolean visible column, second, we don't need to add defaults here
- this implementation is super tied to the models anyway, so we may as
well rely on the model defaults - if we do pull it out similar to
Offers, then it may make sense to add a default there.

We also update the JSDoc to match the updated data structure.
2022-03-07 14:09:07 +00:00
Fabien "egg" O'Carroll
f3c79ebc9d Published new versions
- @tryghost/members-api@5.1.0
2022-03-07 11:46:41 +00:00
Fabien "egg" O'Carroll
9658306a19 Allowed Tier visibility to be set via repository
refs https://github.com/TryGhost/Team/issues/1387

This will allow the API to set the visibility property for Tiers.
2022-03-07 11:42:51 +00:00
Thibaut Patel
64e2f49bab Published new versions
- @tryghost/members-events-service@0.3.1
2022-03-01 17:35:27 +01:00
Thibaut Patel
30681319b5 Fixed the model update method
refs https://github.com/TryGhost/Ghost/pull/14197

- Uses the right method to update a model (`edit`)
- Also fixes the `updateLastSeenAt` comment that wasn't reflecting the code
2022-03-01 17:35:02 +01:00
Thibaut Patel
0ad1e65ff6 Published new versions
- @tryghost/members-events-service@0.3.0
2022-03-01 17:20:14 +01:00
Thibaut Patel
c12c638974 Fixed typo in members-events-service dependency
refs https://github.com/TryGhost/Ghost/pull/14197

- `domainEvents` should be plural
2022-03-01 17:19:34 +01:00
Thibaut Patel
7f9e407d75 Published new versions
- @tryghost/members-events-service@0.2.0
2022-03-01 17:13:39 +01:00
Thibaut Patel
88f8b622f1 Moved the DomainEvents service as a dependency of members-events-service
refs https://github.com/TryGhost/Ghost/pull/14197

- Using the package directly was creating a second instance and was never triggering the subscriber
- Passing DomainEvents as a dependency solves this issue
2022-03-01 17:12:59 +01:00
Thibaut Patel
88fb84027c Published new versions
- @tryghost/members-events-service@0.1.2
2022-03-01 15:28:19 +01:00
Thibaut Patel
9fb03e8f09 Updated dependencies to an exact version
no issue

- The members-events-service dependencies where not pinned to an exact version, it's fixed.
2022-03-01 15:07:38 +01:00
Thibaut Patel
d7d29544ad Published new versions
- @tryghost/members-events-service@0.1.1
2022-03-01 13:08:12 +01:00
Thibaut Patel
36bb014fc0 Simplified time comparison in last-seen-at-updater
no issue

- The code had un-needed complexity
- Removing the extra complexity led to the same behavior, as validated by the unit tests
2022-03-01 13:07:37 +01:00
Thibaut Patel
dafda42e0a Published new versions
- @tryghost/domain-events@0.1.8
 - @tryghost/express-dynamic-redirects@0.2.6
 - @tryghost/magic-link@1.0.20
 - @tryghost/member-analytics-service@0.1.10
 - @tryghost/member-events@0.4.0
 - @tryghost/members-analytics-ingress@0.1.11
 - @tryghost/members-api@5.0.4
 - @tryghost/members-csv@1.2.6
 - @tryghost/members-events-service@0.1.0
 - @tryghost/members-importer@0.5.3
 - @tryghost/members-ssr@1.0.22
 - @tryghost/members-offers@0.10.8
 - @tryghost/members-payments@0.1.10
 - @tryghost/members-stripe-service@0.8.4
 - @tryghost/verification-trigger@0.1.5
2022-03-01 10:36:48 +01:00
Thibaut Patel
bc5b8109e6 Moved the last-seen-at-updater to use the publication timezone
refs https://github.com/TryGhost/Team/issues/1306

- This removes the limitation described in commit ff46449ad6
- The only edge case is that when a publication changes their timezone, it will have maximum 24 hours where the member last_seen_at could be incorrect
2022-03-01 10:28:45 +01:00
Thibaut Patel
d2d7fb3fe7 Moved from a floating 24h window to a UTC-aligned window
refs https://github.com/TryGhost/Ghost/pull/14197

- Moved from updating the last_seen_at value "at most every 24h" to "at most every UTC day".
- It will simplify explaining the following behavior: a publication is set in UTC-10, a user visits at 2pm on Monday and at 1pm on Tuesday, the last_seen_at value is still Monday.
- There is no way to go around the above issue due to the technical constraint of updating the `last_seen_at` value at most once a day.
- This might create database write spikes at midnight UTC
2022-02-28 14:42:17 +01:00
Thibaut Patel
161c0d7330 Added the members-events-service package
refs https://github.com/TryGhost/Team/issues/1306

- Contains all services that listen on member events
- Only contains the last-seen-at-updater service for now
- Listens for `MemberViewEvent` events to update the `member.last_seen_at` timestamp
- Updates after 24hours of the last timestamp to avoid too many writes
- Also updates when the value is NULL
- This is using the existing `last_seen_at` value to avoid an SQL query when no writes are required
2022-02-28 14:42:17 +01:00
Thibaut Patel
c6e98e67c0 Added the new MemberPageViewEvent event
refs https://github.com/TryGhost/Team/issues/1306

- This event will be triggered by logged-in members visiting any page of the publication (page, post, tag, author...)
2022-02-28 14:42:17 +01:00
Renovate Bot
9cc2cb8b87 Update dependency @tryghost/errors to v1.2.3 2022-02-21 17:48:55 +00:00
Daniel Lockyer
db696a9272 Added --all to c8 command
refs https://github.com/TryGhost/Toolbox/issues/203

- without `--all`, c8 ignores files that should be included in the
  coverage score but aren't used in tests
- this means we have artificially high scores in places where this isn't
  used
- this commit adds `--all` where previously missing
- where this fails `--check-coverage`, that has been removed for now
2022-02-21 13:08:55 +01:00
Renovate Bot
d813510a07 Update dependency mocha to v9.2.1 2022-02-21 00:05:27 +00:00
Naz
7fdd210739 Published new versions
- @tryghost/members-api@5.0.3
 - @tryghost/members-stripe-service@0.8.3
2022-02-18 16:23:21 +07:00
Naz
27fe7ed61c 🐛 Fixed StripeAPI disconnection
refs https://github.com/TryGhost/Toolbox/issues/214

- After disconnecting Stripe API the `_configured` flag stayed as `true`, causing behaviors as if Stripe was still connnected.
- The `api.configure` method was never reachable when disconnecting Stripe API, thus causes hanging "configured === false" state inside of the StripeAPI wrapper
2022-02-18 22:21:56 +13:00
Fabien "egg" O'Carroll
6c1081df23 Published new versions
- @tryghost/magic-link@1.0.19
 - @tryghost/members-api@5.0.2
 - @tryghost/members-csv@1.2.5
 - @tryghost/members-importer@0.5.2
 - @tryghost/members-ssr@1.0.21
 - @tryghost/members-stripe-service@0.8.2
2022-02-17 14:05:22 +02:00
Fabien "egg" O'Carroll
f452df7e92 Fixed error handling webhook for unknown member
refs https://github.com/TryGhost/Team/issues/1374

We cannot update payment details for members which we don't know about,
so returning and giving a successful response to Stripe is the correct
thing to do.
2022-02-17 13:51:47 +02:00
Renovate Bot
e400b4d8f4 Update dependency @tryghost/errors to v1.2.2 2022-02-17 03:05:28 +00:00
Daniel Lockyer
f229d1077d Fixed repository link in old packages
- these are some of our first packages here and use `master` in their
  repository link
- we've since switched the repo to use `main` but these links were not
  updated
- this commit updates the links
2022-02-16 09:32:32 +01:00
Daniel Lockyer
a0f716f475 Published new versions
- @tryghost/domain-events@0.1.7
 - @tryghost/express-dynamic-redirects@0.2.5
 - @tryghost/magic-link@1.0.18
 - @tryghost/member-analytics-service@0.1.9
 - @tryghost/member-events@0.3.5
 - @tryghost/members-analytics-ingress@0.1.10
 - @tryghost/members-api@5.0.1
 - @tryghost/members-csv@1.2.4
 - @tryghost/members-importer@0.5.1
 - @tryghost/members-ssr@1.0.20
 - @tryghost/members-offers@0.10.7
 - @tryghost/members-payments@0.1.9
 - @tryghost/members-stripe-service@0.8.1
 - @tryghost/verification-trigger@0.1.4
2022-02-15 13:42:23 +01:00
Renovate Bot
463317eb76 Update dependency sinon to v13 2022-02-15 13:39:43 +01:00
Renovate Bot
a0f9070b49 Update dependency @tryghost/errors to v1.2.1 2022-02-15 13:39:33 +01:00
Renovate Bot
5e91609abb Update Test & linting packages 2022-02-15 13:35:28 +01:00
Hannah Wolfe
3dcf85d5e4 Ensured correct usage of @tryghost/errors everywhere
refs: 23b383bedf

- @tryghost/error constructors take an object, not a string - the expectation is that message, context & help should all be set
- This does the bare minimum and just ensures message is set correctly
2022-02-15 12:30:36 +00:00
Hannah Wolfe
fbdbd7fd43 Removed @babel/eslint-parser, set ecmaVersion instead
refs: 3a1c51672c

- @babel/eslint-parser was added to enable support for static members on classes but this causes other problems as it fails on eslint ugprades etc
- a better solution is to set ecmaVersion to 2022, as our default is 2018 which does not support static, yet 2022 does
2022-02-15 12:30:17 +00:00
Renovate Bot
7c43b14f18 Update dependency @types/node to v16 2022-02-15 12:57:04 +01:00
Renovate Bot
ac0944f165 Update dependency @types/bookshelf to v1.2.7 2022-02-15 12:56:47 +01:00
Fabien "egg" O'Carroll
8993778f8b Published new versions
- @tryghost/members-api@5.0.0
 - @tryghost/members-stripe-service@0.8.0
2022-02-15 11:08:42 +02:00
Fabien "egg" O'Carroll
e672369311 Lowered codecoverage lines threshold for stripe
no-issue

The new tests added do not meet the default minimum of 90% and we do not
want to dedicate more time to writing tests for this package right now.
2022-02-15 10:57:40 +02:00
Fabien "egg" O'Carroll
6ce441f760 Moved the last of the Stripe config out of Members
refs https://github.com/TryGhost/Team/issues/1322

We no longer restart the Members service based on the Stripe service
being updated, which meant that if it was initially configured with
missing URL's and later Stripe connected, it would not get the new
config until a server restart. This moves the last of Stripe config into
the Stripe service, so that all things concerning Stripe can be handled
in one place and updated together.
2022-02-15 10:57:40 +02:00
Fabien "egg" O'Carroll
e5356117b4 Published new versions
- @tryghost/members-api@4.8.15
2022-02-09 11:35:22 +02:00
Fabien "egg" O'Carroll
a576326d0e Added test for isComplimentarySubscription
refs https://github.com/TryGhost/Members/commit/d7d7806d
2022-02-09 11:34:09 +02:00
Fabien "egg" O'Carroll
d7d7806dcf Protected against null value for subscription.plan
no-issue

This will only occur when Subscriptions have manually been modified in
Stripe to no longer have a single price.
2022-02-09 11:28:26 +02:00
Fabien "egg" O'Carroll
f0a3ddaf09 Published new versions
- @tryghost/members-api@4.8.14
2022-02-09 10:18:25 +02:00
Fabien "egg" O'Carroll
26045ecf24 Added validation to prices for Tiers
refs https://github.com/TryGhost/Team/issues/1319

Rather than allowing our code to attempt to speak with Stripe and error
there, we opt to fail fast and throw validation errors so that our API
will respond with a 422, the existing pattern for validation errors.
2022-02-09 10:16:24 +02:00
Hannah Wolfe
26adc6ac0e Added c8 --all to surface true members-api coverage
refs: https://github.com/TryGhost/Toolbox/issues/203

- Without the all flag only files touched by tests are counted
- This shows our unit-testing picture more clearly
- Will get this change rolled out across all repos and packages ASAP, but for now this one seemed most important
2022-02-04 16:58:31 +00:00
Rishabh
9f131fae23 Published new versions
- @tryghost/members-api@4.8.13
2022-02-04 18:24:47 +05:30