Added Offers feature to Ghost

refs https://github.com/TryGhost/Team/issues/1115

This allows users to create Offers for Tier/Cadence pairs in order to
provide discounted subscriptions to Members! We have support for
percentage based discounts & fixed price discounts, either for the first
payment, all payments, or a number of monthly payments.

Offers also have a code, which can be used as an easy way to share them,
as visiting https://site.com/offer-code will automatically open Portal
with the Offer prepopulated.
This commit is contained in:
Fabien O'Carroll 2021-10-21 16:07:14 +02:00 committed by Fabien 'egg' O'Carroll
parent c3694c9903
commit f3bb6b43a5
3 changed files with 6 additions and 13 deletions

View File

@ -7,7 +7,6 @@ const urlUtils = require('../../../../shared/url-utils');
const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const redirectsService = require('../../../services/redirects');
const labsService = require('../../../../shared/labs');
const messages = {
customRedirectsRegistrationFailure: 'Could not register custom redirects.'
@ -27,13 +26,6 @@ let customRedirectsRouter;
_private.registerRoutes = (router, redirects) => {
debug('redirects loading');
if (labsService.isSet('offers')) {
redirects.unshift({
from: '/zimo50',
to: '/#/portal/offers/abcdefuckoff'
});
}
redirects.forEach((redirect) => {
/**
* Detect case insensitive modifier when regex is enclosed by

View File

@ -15,7 +15,8 @@ const messages = {
// flags in this list always return `true`, allows quick global enable prior to full flag removal
const GA_FEATURES = [
'customThemeSettings'
'customThemeSettings',
'offers'
];
// NOTE: this allowlist is meant to be used to filter out any unexpected
@ -27,8 +28,7 @@ const BETA_FEATURES = [
const ALPHA_FEATURES = [
'oauthLogin',
'membersActivity',
'offers'
'membersActivity'
];
module.exports.GA_KEYS = [...GA_FEATURES];
@ -86,7 +86,7 @@ module.exports.enabledHelper = function enabledHelper(options, callback) {
}
// Else, the helper is not active and we need to handle this as an error
errDetails.message = tpl(options.errorMessage || messages.errorMessage, {helperName: options.helperName}),
errDetails.message = tpl(options.errorMessage || messages.errorMessage, {helperName: options.helperName});
errDetails.context = tpl(options.errorContext || messages.errorContext, {
helperName: options.helperName,
flagName: options.flagName

View File

@ -55,7 +55,8 @@ describe('Themes middleware', function () {
// if we want to compare it
// we will need some unique content
members: true,
customThemeSettings: true
customThemeSettings: true,
offers: true
};
fakeCustomThemeSettingsData = {