mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
fix(self-hosting): use instance contacts and live product name (#3333)
This commit is contained in:
1 parent
454fefdb92
commit
a5c1362f4a
308 files changed
+16533
-13512
No files matched your search
@@ -4,6 +4,7 @@ import {Config} from '@app/api/Config';
|
||||
import {getContentMessage} from '@app/api/content_i18n/ContentI18n';
|
||||
import type {IDonationRepository} from '@app/api/donation/IDonationRepository';
|
||||
import type {IEmailDnsValidationService} from '@app/api/infrastructure/IEmailDnsValidationService';
|
||||
import {getInstanceProductName} from '@app/api/instance/ProductName';
|
||||
import {Logger} from '@app/api/Logger';
|
||||
import {getBillingRepository} from '@app/api/middleware/ServiceRegistry';
|
||||
import {shouldDisableAdaptivePricing} from '@app/api/utils/CurrencyUtils';
|
||||
@@ -21,8 +22,6 @@ type CheckoutSessionMode = CheckoutSessionCreateParams['mode'];
|
||||
type CheckoutSessionLineItem = NonNullable<CheckoutSessionCreateParams['line_items']>[number];
|
||||
type CheckoutSessionLocale = NonNullable<CheckoutSessionCreateParams['locale']>;
|
||||
|
||||
const PRODUCT_NAME = 'Fluxer';
|
||||
|
||||
const STRIPE_CHECKOUT_LOCALES: Record<string, CheckoutSessionLocale> = {
|
||||
bg: 'bg',
|
||||
cs: 'cs',
|
||||
@@ -76,21 +75,22 @@ function isMissingCustomerError(error: unknown): boolean {
|
||||
}
|
||||
|
||||
function getDonationProductData(interval: 'month' | 'year' | null, locale: string | null) {
|
||||
const variables = {product_name: getInstanceProductName()};
|
||||
if (interval === 'month') {
|
||||
return {
|
||||
name: getContentMessage('billing.donation_name_recurring', locale, {product_name: PRODUCT_NAME}),
|
||||
description: getContentMessage('billing.donation_description_monthly', locale, {product_name: PRODUCT_NAME}),
|
||||
name: getContentMessage('billing.donation_name_recurring', locale, variables),
|
||||
description: getContentMessage('billing.donation_description_monthly', locale, variables),
|
||||
};
|
||||
}
|
||||
if (interval === 'year') {
|
||||
return {
|
||||
name: getContentMessage('billing.donation_name_recurring', locale, {product_name: PRODUCT_NAME}),
|
||||
description: getContentMessage('billing.donation_description_yearly', locale, {product_name: PRODUCT_NAME}),
|
||||
name: getContentMessage('billing.donation_name_recurring', locale, variables),
|
||||
description: getContentMessage('billing.donation_description_yearly', locale, variables),
|
||||
};
|
||||
}
|
||||
return {
|
||||
name: getContentMessage('billing.donation_name_one_time', locale, {product_name: PRODUCT_NAME}),
|
||||
description: getContentMessage('billing.donation_description_one_time', locale, {product_name: PRODUCT_NAME}),
|
||||
name: getContentMessage('billing.donation_name_one_time', locale, variables),
|
||||
description: getContentMessage('billing.donation_description_one_time', locale, variables),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user