Added recommendations as suggestions to the Button, Header, Email CTA cards (#18293)

closes https://github.com/TryGhost/Product/issues/3933
This commit is contained in:
Sag 2023-09-22 11:58:44 +02:00 committed by GitHub
parent fd13712579
commit a04c691fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 34 deletions

View File

@ -287,14 +287,22 @@ export default class KoenigLexicalEditor extends Component {
};
const donationLink = () => {
// TODO: remove feature condition once Tips & Donations have been released
if (this.feature.tipsAndDonations) {
if (this.settings.donationsEnabled) {
return [{
label: 'Tip or donation',
value: '#/portal/support'
}];
}
if (this.feature.tipsAndDonations && this.settings.donationsEnabled) {
return [{
label: 'Tip or donation',
value: '#/portal/support'
}];
}
return [];
};
const recommendationLink = () => {
if (this.settings.recommendationsEnabled) {
return [{
label: 'Recommendations',
value: '#/portal/recommendations'
}];
}
return [];
@ -307,7 +315,7 @@ export default class KoenigLexicalEditor extends Component {
};
});
return [...defaults, ...memberLinks(), ...donationLink(), ...offersLinks];
return [...defaults, ...memberLinks(), ...donationLink(), ...recommendationLink(), ...offersLinks];
};
const fetchLabels = async () => {

View File

@ -55,7 +55,7 @@ export default class SettingsService extends Service.extend(ValidationEngine) {
_loadSettings() {
if (!this._loadingPromise) {
this._loadingPromise = this.store
.queryRecord('setting', {group: 'site,theme,private,members,portal,newsletter,email,amp,labs,slack,unsplash,views,firstpromoter,editor,comments,analytics,announcement,pintura,donations'})
.queryRecord('setting', {group: 'site,theme,private,members,portal,newsletter,email,amp,labs,slack,unsplash,views,firstpromoter,editor,comments,analytics,announcement,pintura,donations,recommendations'})
.then((settings) => {
this._loadingPromise = null;
return settings;

View File

@ -73,14 +73,18 @@ export default class KoenigCardButtonComponent extends Component {
}]);
}
// TODO: remove feature condition once Tips & Donations have been released
if (this.feature.tipsAndDonations) {
if (this.settings.donationsEnabled) {
urls.push({
name: 'Tip or donation',
url: '#/portal/support'
});
}
if (this.feature.tipsAndDonations && this.settings.donationsEnabled) {
urls.push({
name: 'Tip or donation',
url: '#/portal/support'
});
}
if (this.settings.recommendationsEnabled) {
urls.push({
name: 'Recommendations',
url: '#/portal/recommendations'
});
}
if (this.offers) {

View File

@ -97,14 +97,18 @@ export default class KoenigCardEmailCtaComponent extends Component {
}]);
}
// TODO: remove feature condition once Tips & Donations have been released
if (this.feature.tipsAndDonations) {
if (this.settings.donationsEnabled) {
urls.push({
name: 'Tip or donation',
url: '#/portal/support'
});
}
if (this.feature.tipsAndDonations && this.settings.donationsEnabled) {
urls.push({
name: 'Tip or donation',
url: '#/portal/support'
});
}
if (this.settings.recommendationsEnabled) {
urls.push({
name: 'Recommendations',
url: '#/portal/recommendations'
});
}
if (this.offers) {

View File

@ -86,14 +86,18 @@ export default class KoenigCardHeaderComponent extends Component {
}]);
}
// TODO: remove feature condition once Tips & Donations have been released
if (this.feature.tipsAndDonations) {
if (this.settings.donationsEnabled) {
urls.push({
name: 'Tip or donation',
url: '#/portal/support'
});
}
if (this.feature.tipsAndDonations && this.settings.donationsEnabled) {
urls.push({
name: 'Tip or donation',
url: '#/portal/support'
});
}
if (this.settings.recommendationsEnabled) {
urls.push({
name: 'Recommendations',
url: '#/portal/recommendations'
});
}
if (this.offers) {