Commit Graph

22 Commits

Author SHA1 Message Date
Daniel Lockyer
08b786af3b Bumped TryGhost-owned dependencies and lockfile
- this was all getting terribly behind so I've done several things:
  - majority of `@tryghost/*` except Lexical packages
  - gscan + knex-migrator to remove old `@tryghost/errors` usage
  - bumped lockfile
2023-01-02 20:55:22 +01:00
Daniel Lockyer
6f4e663d74
Updated @tryghost dependencies (#16005)
- also includes `knex-migrator` with a simple `sqlite3` bump
2022-12-14 11:18:55 +07:00
renovate[bot]
13abcf6c9d
Update dependency mocha to v10.2.0 2022-12-12 13:20:22 +00:00
Fabien "egg" O'Carroll
80b766047e Added defaults for monthly and yearly price
refs https://github.com/TryGhost/Team/issues/2362

Rather than throwing when we encounter a Tier price of 0, we can instead default
to the standard yearly and monthly price.
2022-12-07 22:02:37 +07:00
renovate[bot]
e48072e471 Update dependency bson-objectid to v2.0.4 2022-11-24 11:24:07 +07:00
Fabien 'egg' O'Carroll
68c7a3c7e7
🐛 Fixed archiving Tiers (#15761)
refs https://github.com/TryGhost/Team/issues/2204

The TiersAPI was incorrectly using the `active` property rather than
`status` property when editing Tiers.
2022-11-03 16:51:19 +07:00
Fabien 'egg' O'Carroll
a0ebb9a6f3
🐛 Fixed Tier description not being set (#15741)
closes https://github.com/TryGhost/Ghost/issues/15740

The validation function for a Tier description was not returning the
validated value, which meant we were unable to set the Tier
description.
2022-11-01 16:25:55 +07:00
Naz
cdd65f25ac
Migrated members importer to use tiers
refs https://github.com/TryGhost/Team/issues/2077

- The "productRepository" methods have been deprecated in favor of "tiers" and "Tiers API".
- The changes migrated usages of  "productRepository.getDefaultProduct" to Tiers API's "readDefaultTier"
2022-10-26 14:26:21 +08:00
Fabien "egg" O'Carroll
df145797b3 Fixed toJSON method of Tier
This was returning an ObjectID object which is not a JSON primitive
2022-10-25 09:02:50 +07:00
Fabien "egg" O'Carroll
253c30c37a Improved price data access and setting for Tier
refs https://github.com/TryGhost/Team/issues/2078

We want to be able to easily get the price for a Tier based on the cadence for
use when creating Stripe Prices. We also want to be able to set the pricing data
to `null` for free Tiers, rather than erroring.
2022-10-25 09:01:39 +07:00
Fabien "egg" O'Carroll
b14b74315f Exported Tier events from tiers package
These are required to be exported so that external code can subscribe to the
events.
2022-10-20 17:40:37 +07:00
Fabien "egg" O'Carroll
5f928794c3 Added support for Tier events
refs https://github.com/TryGhost/Team/issues/2078

These events are all required for other parts of the Ghost system to stay in
sync. The events on each Tier object will be dispatched by the TierRepository
once they've been persisted.

TierCreatedEvent - generate Stripe Products & Prices
TierNameChangeEvent - update Stripe Products
TierPriceChangeEvent - update Stripe Products & Prices
TierArchivedEvent - update the Portal settings for visible tiers
                  - disable Stripe Products & Prices
TierActivatedEvent - enable Stripe Products & Prices
2022-10-20 17:31:33 +07:00
Fabien "egg" O'Carroll
6614aa9070 Fixed add method for TiersAPI
refs https://github.com/TryGhost/Team/issues/2078

The check for creating free Tiers needs to be explicit, rather than implicit
because the type is optional, we only want to error if it is explicitly passed
as "free", not if it is missing as "paid".
2022-10-20 11:56:46 +07:00
Fabien "egg" O'Carroll
9e7b009236 Fixed edit method to accept a string
refs https://github.com/TryGhost/Team/issues/2078

This fixes a bug with the edit method where we passed a raw string
rather than ObjectID
2022-10-20 11:55:21 +07:00
Fabien "egg" O'Carroll
93e392fac1 Added error messages for monthly & yearly price validation
refs https://github.com/TryGhost/Team/issues/2078

These were missing, and will be refactored into the correct
tpl(messages.prop) format
2022-10-20 11:55:09 +07:00
Fabien "egg" O'Carroll
dfa88360ea Fixed trialDays validation to default to 0
refs https://github.com/TryGhost/Team/issues/2078

This retains current functionality
2022-10-20 11:55:01 +07:00
Fabien "egg" O'Carroll
581164ed60 Updated Tier welcomePageURL to be a string rather than URL
refs https://github.com/TryGhost/Team/issues/2078

We allow passing in relative URLs for the welcome page, so we need to accept a
string for this property.
2022-10-20 11:54:49 +07:00
Fabien "egg" O'Carroll
b607bee27f Updated Tier to use camelCase property names
refs https://github.com/TryGhost/Team/issues/2078

Having to map between snake_case and camelCase was becoming confusing, so this
updates the Tier object to exclusively use camelCase, and the snake_case for the
API can be handled by the serializer/mapper or at the controller level.
2022-10-20 11:54:18 +07:00
Fabien "egg" O'Carroll
3811169d20 Fixed visibility property on Tiers
refs https://github.com/TryGhost/Team/issues/2078

This property should be settable to either 'public' or 'none'
2022-10-20 11:54:12 +07:00
Fabien "egg" O'Carroll
0978a808d6 Refactored TiersAPI to use core slug generation
refs https://github.com/TryGhost/Team/issues/2078

This removes the burden from the Tier object, and allows us to reuse
the existing slug generation implementation we have in our bookshelf
models.
2022-10-20 11:54:03 +07:00
renovate[bot]
93e999ec1c
Update dependency mocha to v10.1.0 2022-10-19 17:53:57 +00:00
Fabien "egg" O'Carroll
fbc23a624e Refactored Tiers logic into separate package
refs https://github.com/TryGhost/Team/issues/2078

This pulls the current Tiers logic into its own package, the persistence part of
the work has not been done yet, that will be handled in core, so all bookshelf
model specific stuff is kept together.
2022-10-19 11:05:09 +07:00