Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

feat(subscription): add cross-platform subscription support for mobile IAP (#13413)

Tsuki17b3acead688
diff --git a/locales/ar/subscription.json b/locales/ar/subscription.json
index 3f2b46cd2a6..a3ac60cc5d3 100644
--- a/locales/ar/subscription.json
+++ b/locales/ar/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "الترقية إلى",
"credits.topUp.upgradeSuffix": "لتوفير ${{savings}}",
"credits.topUp.validityInfo": "صالح لمدة {{months}} أشهر",
+ "crossPlatform.desc": "تم شراء هذا الاشتراك من خلال تطبيق الهاتف المحمول ولا يمكن تعديله هنا. يرجى إدارة اشتراكك على جهازك المحمول.",
+ "crossPlatform.manageOnMobile": "إدارة على الجهاز المحمول",
+ "crossPlatform.title": "اشتراك عبر الأنظمة الأساسية",
"currentPlan.cancelAlert": "سيتم إلغاء الاشتراك بعد {{canceledAt}}. لا يزال بإمكانك استعادته من \"إدارة الاشتراك\" قبل ذلك",
"currentPlan.downgradeAlert": "سيتم تخفيض الخطة إلى {{plan}} بعد {{downgradedAt}}.",
"currentPlan.management": "إدارة الاشتراك",
diff --git a/locales/bg-BG/subscription.json b/locales/bg-BG/subscription.json
index 3a964d91903..1008ab8c6af 100644
--- a/locales/bg-BG/subscription.json
+++ b/locales/bg-BG/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Надстрой до",
"credits.topUp.upgradeSuffix": "за да спестиш ${{savings}}",
"credits.topUp.validityInfo": "Валидност: {{months}} месеца",
+ "crossPlatform.desc": "Този абонамент е закупен чрез мобилното приложение и не може да бъде променен тук. Моля, управлявайте абонамента си на мобилното устройство.",
+ "crossPlatform.manageOnMobile": "Управлявайте на мобилното устройство",
+ "crossPlatform.title": "Абонамент за различни платформи",
"currentPlan.cancelAlert": "Абонаментът ще бъде анулиран след {{canceledAt}}. Можете да го възстановите в \"Управление на абонамента\" преди това",
"currentPlan.downgradeAlert": "Ще бъде понижен до {{plan}} след {{downgradedAt}}.",
"currentPlan.management": "Управление на абонамента",
diff --git a/locales/de-DE/subscription.json b/locales/de-DE/subscription.json
index b80eb235ae2..9148ccc18f1 100644
--- a/locales/de-DE/subscription.json
+++ b/locales/de-DE/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Upgrade auf",
"credits.topUp.upgradeSuffix": "und spare ${{savings}}",
"credits.topUp.validityInfo": "{{months}} Monate gültig",
+ "crossPlatform.desc": "Dieses Abonnement wurde über die mobile App erworben und kann hier nicht geändert werden. Bitte verwalten Sie Ihr Abonnement auf Ihrem mobilen Gerät.",
+ "crossPlatform.manageOnMobile": "Auf mobilem Gerät verwalten",
+ "crossPlatform.title": "Plattformübergreifendes Abonnement",
"currentPlan.cancelAlert": "Das Abonnement wird nach dem {{canceledAt}} gekündigt. Du kannst es bis dahin unter „Abonnement verwalten“ wiederherstellen.",
"currentPlan.downgradeAlert": "Wird nach dem {{downgradedAt}} auf {{plan}} herabgestuft.",
"currentPlan.management": "Abonnement verwalten",
diff --git a/locales/en-US/subscription.json b/locales/en-US/subscription.json
index 2af2a274d14..9ea72b49bf5 100644
--- a/locales/en-US/subscription.json
+++ b/locales/en-US/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Upgrade to",
"credits.topUp.upgradeSuffix": "to save ${{savings}}",
"credits.topUp.validityInfo": "{{months}} months validity",
+ "crossPlatform.desc": "This subscription was purchased through the mobile app and cannot be modified here. Please manage your subscription on your mobile device.",
+ "crossPlatform.manageOnMobile": "Manage on mobile device",
+ "crossPlatform.title": "Cross-Platform Subscription",
"currentPlan.cancelAlert": "Subscription will be cancelled after {{canceledAt}}. You can still restore it in \"Manage Subscription\" before then",
"currentPlan.downgradeAlert": "Will be downgraded to {{plan}} after {{downgradedAt}}.",
"currentPlan.management": "Manage Subscription",
diff --git a/locales/es-ES/subscription.json b/locales/es-ES/subscription.json
index 1ce4d806142..6c02030dc08 100644
--- a/locales/es-ES/subscription.json
+++ b/locales/es-ES/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Mejorar a",
"credits.topUp.upgradeSuffix": "para ahorrar ${{savings}}",
"credits.topUp.validityInfo": "Validez de {{months}} meses",
+ "crossPlatform.desc": "Esta suscripción fue adquirida a través de la aplicación móvil y no se puede modificar aquí. Por favor, gestiona tu suscripción en tu dispositivo móvil.",
+ "crossPlatform.manageOnMobile": "Gestionar en el dispositivo móvil",
+ "crossPlatform.title": "Suscripción Multiplataforma",
"currentPlan.cancelAlert": "La suscripción se cancelará después del {{canceledAt}}. Aún puedes restaurarla en \"Gestionar Suscripción\" antes de esa fecha",
"currentPlan.downgradeAlert": "Se degradará a {{plan}} después del {{downgradedAt}}.",
"currentPlan.management": "Gestionar Suscripción",
diff --git a/locales/fa-IR/subscription.json b/locales/fa-IR/subscription.json
index 2029f7c12d6..244c0d26cb1 100644
--- a/locales/fa-IR/subscription.json
+++ b/locales/fa-IR/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "ارتقا به",
"credits.topUp.upgradeSuffix": "برای صرفه‌جویی ${{savings}}",
"credits.topUp.validityInfo": "اعتبار {{months}} ماهه",
+ "crossPlatform.desc": "این اشتراک از طریق اپلیکیشن موبایل خریداری شده است و نمی‌توان آن را در اینجا تغییر داد. لطفاً اشتراک خود را در دستگاه موبایل مدیریت کنید.",
+ "crossPlatform.manageOnMobile": "مدیریت در دستگاه موبایل",
+ "crossPlatform.title": "اشتراک چندپلتفرمی",
"currentPlan.cancelAlert": "اشتراک در تاریخ {{canceledAt}} لغو خواهد شد. تا آن زمان می‌توانید از طریق «مدیریت اشتراک» آن را بازیابی کنید",
"currentPlan.downgradeAlert": "در تاریخ {{downgradedAt}} به پلن {{plan}} تنزل خواهد یافت.",
"currentPlan.management": "مدیریت اشتراک",
diff --git a/locales/fr-FR/subscription.json b/locales/fr-FR/subscription.json
index 14171ea6548..184313ae314 100644
--- a/locales/fr-FR/subscription.json
+++ b/locales/fr-FR/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Passer à",
"credits.topUp.upgradeSuffix": "pour économiser ${{savings}}",
"credits.topUp.validityInfo": "Validité de {{months}} mois",
+ "crossPlatform.desc": "Cet abonnement a été acheté via l'application mobile et ne peut pas être modifié ici. Veuillez gérer votre abonnement sur votre appareil mobile.",
+ "crossPlatform.manageOnMobile": "Gérer sur l'appareil mobile",
+ "crossPlatform.title": "Abonnement Multi-Plateforme",
"currentPlan.cancelAlert": "L'abonnement sera annulé après le {{canceledAt}}. Vous pouvez encore le réactiver dans « Gérer l'abonnement » d'ici là",
"currentPlan.downgradeAlert": "Sera rétrogradé au forfait {{plan}} après le {{downgradedAt}}.",
"currentPlan.management": "Gérer l'abonnement",
diff --git a/locales/it-IT/subscription.json b/locales/it-IT/subscription.json
index d5b7d220726..08ae1e6e77a 100644
--- a/locales/it-IT/subscription.json
+++ b/locales/it-IT/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Passa a",
"credits.topUp.upgradeSuffix": "per risparmiare ${{savings}}",
"credits.topUp.validityInfo": "Validità di {{months}} mesi",
+ "crossPlatform.desc": "Questo abbonamento è stato acquistato tramite l'app mobile e non può essere modificato qui. Gestisci il tuo abbonamento sul tuo dispositivo mobile.",
+ "crossPlatform.manageOnMobile": "Gestisci sul dispositivo mobile",
+ "crossPlatform.title": "Abbonamento Cross-Platform",
"currentPlan.cancelAlert": "L'abbonamento verrà annullato dopo il {{canceledAt}}. Puoi ancora ripristinarlo in \"Gestisci Abbonamento\" prima di tale data",
"currentPlan.downgradeAlert": "Verrà effettuato il downgrade a {{plan}} dopo il {{downgradedAt}}.",
"currentPlan.management": "Gestisci Abbonamento",
diff --git a/locales/ja-JP/subscription.json b/locales/ja-JP/subscription.json
index 09eb8e59874..3fb96b69d11 100644
--- a/locales/ja-JP/subscription.json
+++ b/locales/ja-JP/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "アップグレードして",
"credits.topUp.upgradeSuffix": "${{savings}} 節約",
"credits.topUp.validityInfo": "{{months}} ヶ月の有効期間",
+ "crossPlatform.desc": "このサブスクリプションはモバイルアプリを通じて購入されたため、ここでは変更できません。モバイルデバイスでサブスクリプションを管理してください。",
+ "crossPlatform.manageOnMobile": "モバイルデバイスで管理",
+ "crossPlatform.title": "クロスプラットフォームサブスクリプション",
"currentPlan.cancelAlert": "{{canceledAt}} にサブスクリプションがキャンセルされます。それまでは「サブスクリプション管理」で復元可能です",
"currentPlan.downgradeAlert": "{{downgradedAt}} に {{plan}} にダウングレードされます。",
"currentPlan.management": "サブスクリプション管理",
diff --git a/locales/ko-KR/subscription.json b/locales/ko-KR/subscription.json
index 3f62c74e567..6f7e1c20f79 100644
--- a/locales/ko-KR/subscription.json
+++ b/locales/ko-KR/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "업그레이드하여",
"credits.topUp.upgradeSuffix": "${{savings}} 절약하기",
"credits.topUp.validityInfo": "{{months}}개월 유효",
+ "crossPlatform.desc": "이 구독은 모바일 앱을 통해 구매되었으며 여기에서 수정할 수 없습니다. 모바일 기기에서 구독을 관리해 주세요.",
+ "crossPlatform.manageOnMobile": "모바일 기기에서 관리",
+ "crossPlatform.title": "크로스 플랫폼 구독",
"currentPlan.cancelAlert": "{{canceledAt}} 이후 구독이 취소됩니다. 그 전까지는 \"구독 관리\"에서 복원할 수 있습니다",
"currentPlan.downgradeAlert": "{{downgradedAt}} 이후 {{plan}}으로 다운그레이드됩니다.",
"currentPlan.management": "구독 관리",
diff --git a/locales/nl-NL/subscription.json b/locales/nl-NL/subscription.json
index 60371faf323..064589d277c 100644
--- a/locales/nl-NL/subscription.json
+++ b/locales/nl-NL/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Upgrade naar",
"credits.topUp.upgradeSuffix": "om ${{savings}} te besparen",
"credits.topUp.validityInfo": "Geldig voor {{months}} maanden",
+ "crossPlatform.desc": "Dit abonnement is via de mobiele app aangeschaft en kan hier niet worden aangepast. Beheer uw abonnement op uw mobiele apparaat.",
+ "crossPlatform.manageOnMobile": "Beheer op mobiel apparaat",
+ "crossPlatform.title": "Platformoverschrijdend Abonnement",
"currentPlan.cancelAlert": "Abonnement wordt geannuleerd na {{canceledAt}}. Je kunt het tot die tijd herstellen via \"Abonnement Beheren\"",
"currentPlan.downgradeAlert": "Wordt teruggezet naar {{plan}} na {{downgradedAt}}.",
"currentPlan.management": "Abonnement Beheren",
diff --git a/locales/pl-PL/subscription.json b/locales/pl-PL/subscription.json
index a965526d05e..0c524987c28 100644
--- a/locales/pl-PL/subscription.json
+++ b/locales/pl-PL/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Ulepsz do",
"credits.topUp.upgradeSuffix": "aby zaoszczędzić ${{savings}}",
"credits.topUp.validityInfo": "Ważność: {{months}} miesięcy",
+ "crossPlatform.desc": "Ta subskrypcja została zakupiona za pośrednictwem aplikacji mobilnej i nie może być tutaj zmieniona. Proszę zarządzać subskrypcją na swoim urządzeniu mobilnym.",
+ "crossPlatform.manageOnMobile": "Zarządzaj na urządzeniu mobilnym",
+ "crossPlatform.title": "Subskrypcja międzyplatformowa",
"currentPlan.cancelAlert": "Subskrypcja zostanie anulowana po {{canceledAt}}. Do tego czasu możesz ją przywrócić w \"Zarządzaj subskrypcją\"",
"currentPlan.downgradeAlert": "Zostanie obniżony do {{plan}} po {{downgradedAt}}.",
"currentPlan.management": "Zarządzaj subskrypcją",
diff --git a/locales/pt-BR/subscription.json b/locales/pt-BR/subscription.json
index 20b8d8f3ab2..d986c6ee0b6 100644
--- a/locales/pt-BR/subscription.json
+++ b/locales/pt-BR/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Atualize para",
"credits.topUp.upgradeSuffix": "para economizar ${{savings}}",
"credits.topUp.validityInfo": "Validade de {{months}} meses",
+ "crossPlatform.desc": "Esta assinatura foi adquirida através do aplicativo móvel e não pode ser modificada aqui. Por favor, gerencie sua assinatura no seu dispositivo móvel.",
+ "crossPlatform.manageOnMobile": "Gerenciar no dispositivo móvel",
+ "crossPlatform.title": "Assinatura Multiplataforma",
"currentPlan.cancelAlert": "A assinatura será cancelada após {{canceledAt}}. Você ainda pode restaurá-la em \"Gerenciar Assinatura\" antes disso",
"currentPlan.downgradeAlert": "Será rebaixado para {{plan}} após {{downgradedAt}}.",
"currentPlan.management": "Gerenciar Assinatura",
diff --git a/locales/ru-RU/subscription.json b/locales/ru-RU/subscription.json
index 82b779ff00a..ea15868bf2f 100644
--- a/locales/ru-RU/subscription.json
+++ b/locales/ru-RU/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Обновите до",
"credits.topUp.upgradeSuffix": "и сэкономьте ${{savings}}",
"credits.topUp.validityInfo": "Срок действия {{months}} мес.",
+ "crossPlatform.desc": "Эта подписка была оформлена через мобильное приложение и не может быть изменена здесь. Пожалуйста, управляйте своей подпиской на мобильном устройстве.",
+ "crossPlatform.manageOnMobile": "Управлять на мобильном устройстве",
+ "crossPlatform.title": "Кроссплатформенная подписка",
"currentPlan.cancelAlert": "Подписка будет отменена после {{canceledAt}}. До этого момента вы можете восстановить её в разделе «Управление подпиской»",
"currentPlan.downgradeAlert": "Будет понижен до {{plan}} после {{downgradedAt}}.",
"currentPlan.management": "Управление подпиской",
diff --git a/locales/tr-TR/subscription.json b/locales/tr-TR/subscription.json
index c5d2041632c..f41d9e55400 100644
--- a/locales/tr-TR/subscription.json
+++ b/locales/tr-TR/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Yükselt",
"credits.topUp.upgradeSuffix": "ve ${{savings}} tasarruf et",
"credits.topUp.validityInfo": "{{months}} ay geçerlilik",
+ "crossPlatform.desc": "Bu abonelik mobil uygulama üzerinden satın alındı ve burada değiştirilemez. Lütfen aboneliğinizi mobil cihazınızdan yönetin.",
+ "crossPlatform.manageOnMobile": "Mobil cihazda yönet",
+ "crossPlatform.title": "Platformlar Arası Abonelik",
"currentPlan.cancelAlert": "Abonelik {{canceledAt}} tarihinde iptal edilecek. O zamana kadar \"Aboneliği Yönet\" bölümünden geri yükleyebilirsiniz",
"currentPlan.downgradeAlert": "{{downgradedAt}} tarihinden itibaren {{plan}} planına düşürülecek.",
"currentPlan.management": "Aboneliği Yönet",
diff --git a/locales/vi-VN/subscription.json b/locales/vi-VN/subscription.json
index 64adad0ae37..9e5e9abb604 100644
--- a/locales/vi-VN/subscription.json
+++ b/locales/vi-VN/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "Nâng cấp lên",
"credits.topUp.upgradeSuffix": "để tiết kiệm ${{savings}}",
"credits.topUp.validityInfo": "Hiệu lực {{months}} tháng",
+ "crossPlatform.desc": "Gói đăng ký này được mua thông qua ứng dụng di động và không thể chỉnh sửa tại đây. Vui lòng quản lý gói đăng ký của bạn trên thiết bị di động.",
+ "crossPlatform.manageOnMobile": "Quản lý trên thiết bị di động",
+ "crossPlatform.title": "Gói Đăng Ký Đa Nền Tảng",
"currentPlan.cancelAlert": "Đăng ký sẽ bị hủy sau {{canceledAt}}. Bạn vẫn có thể khôi phục trong \"Quản lý đăng ký\" trước thời điểm đó",
"currentPlan.downgradeAlert": "Sẽ bị hạ cấp xuống {{plan}} sau {{downgradedAt}}.",
"currentPlan.management": "Quản lý đăng ký",
diff --git a/locales/zh-CN/subscription.json b/locales/zh-CN/subscription.json
index 68ff244123d..b78179a316a 100644
--- a/locales/zh-CN/subscription.json
+++ b/locales/zh-CN/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "升级至",
"credits.topUp.upgradeSuffix": "可节省 ${{savings}}",
"credits.topUp.validityInfo": "有效期 {{months}} 个月",
+ "crossPlatform.desc": "此订阅通过移动端应用购买,无法在此修改。请在移动设备上管理您的订阅。",
+ "crossPlatform.manageOnMobile": "前往移动端管理",
+ "crossPlatform.title": "跨平台订阅",
"currentPlan.cancelAlert": "订阅将于 {{canceledAt}} 后取消。您仍可在“管理订阅”中恢复。",
"currentPlan.downgradeAlert": "将于 {{downgradedAt}} 降级为 {{plan}}。",
"currentPlan.management": "管理订阅",
diff --git a/locales/zh-TW/subscription.json b/locales/zh-TW/subscription.json
index 79fd248ec6a..c3aea62d1c4 100644
--- a/locales/zh-TW/subscription.json
+++ b/locales/zh-TW/subscription.json
@@ -97,6 +97,9 @@
"credits.topUp.upgradePrefix": "升級至",
"credits.topUp.upgradeSuffix": "可省下 ${{savings}}",
"credits.topUp.validityInfo": "有效期 {{months}} 個月",
+ "crossPlatform.desc": "此訂閱是通過行動應用程式購買的,無法在此修改。請在您的行動裝置上管理訂閱。",
+ "crossPlatform.manageOnMobile": "在行動裝置上管理",
+ "crossPlatform.title": "跨平台訂閱",
"currentPlan.cancelAlert": "訂閱將於 {{canceledAt}} 取消,您可在「管理訂閱」中恢復。",
"currentPlan.downgradeAlert": "將於 {{downgradedAt}} 降級為 {{plan}}。",
"currentPlan.management": "管理訂閱",
diff --git a/src/business/server/mobile-routers/mobileSubscription.ts b/src/business/server/mobile-routers/mobileSubscription.ts
new file mode 100644
index 00000000000..ccc38520d94
--- /dev/null
+++ b/src/business/server/mobile-routers/mobileSubscription.ts
@@ -0,0 +1,3 @@
+import { router } from '@/libs/trpc/lambda';
+
+export const mobileSubscriptionRouter = router({});
diff --git a/src/locales/default/subscription.ts b/src/locales/default/subscription.ts
index ecd294d0c60..4ee8ad602e2 100644
--- a/src/locales/default/subscription.ts
+++ b/src/locales/default/subscription.ts
@@ -27,6 +27,10 @@ export default {
'billing.subscriptionId': 'Subscription ID',
'billing.unpaid': 'Unpaid',
'billing.view': 'View',
+ 'crossPlatform.desc':
+ 'This subscription was purchased through the mobile app and cannot be modified here. Please manage your subscription on your mobile device.',
+ 'crossPlatform.manageOnMobile': 'Manage on mobile device',
+ 'crossPlatform.title': 'Cross-Platform Subscription',
'cancelPlan.alert':
'You will still enjoy the benefits until the current plan expires ({{date}}). You can resubscribe at any time before expiration.',
'cancelPlan.desc':
diff --git a/src/server/routers/mobile/index.ts b/src/server/routers/mobile/index.ts
index 083736e6845..70d1b04909f 100644
--- a/src/server/routers/mobile/index.ts
+++ b/src/server/routers/mobile/index.ts
@@ -2,6 +2,7 @@
* This file contains the root router of Lobe Chat tRPC-backend for Mobile App
* Only includes routers that are actually used by the mobile client
*/
+import { mobileSubscriptionRouter } from '@/business/server/mobile-routers/mobileSubscription';
import { publicProcedure, router } from '@/libs/trpc/lambda';
import { agentRouter } from '../lambda/agent';
@@ -36,6 +37,7 @@ export const mobileRouter = router({
message: messageRouter,
session: sessionRouter,
sessionGroup: sessionGroupRouter,
+ subscription: mobileSubscriptionRouter,
topic: topicRouter,
upload: uploadRouter,
user: userRouter,