feat(mobile): gate publish behind subscription, surface free trial
Publishing (including re-publishing after a lapsed subscription — PRD §15) now checks Pro entitlement first; if inactive, prompts the owner to the paywall instead of calling the publish endpoint. The paywall also flags packages with an active introductory offer as "7 gün ücretsiz dene" (both plans now have a 7-day free trial configured in App Store Connect, Turkey territory).
This commit is contained in:
@@ -144,6 +144,11 @@ export default function SubscriptionScreen() {
|
||||
<Text style={{ fontSize: 13, color: "#78716C", marginTop: 2 }}>
|
||||
{pkg.product.priceString} / {pkg.packageType === "ANNUAL" ? "yıl" : "ay"}
|
||||
</Text>
|
||||
{pkg.product.introPrice ? (
|
||||
<Text style={{ fontSize: 12, color: "#059669", fontWeight: "700", marginTop: 2 }}>
|
||||
7 gün ücretsiz dene
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
{purchasingPackageId === pkg.identifier ? (
|
||||
<ActivityIndicator color="#C8A96B" />
|
||||
|
||||
@@ -16,6 +16,7 @@ import * as Haptics from "expo-haptics";
|
||||
import { api } from "@/lib/api";
|
||||
import { getActiveRestaurant, type ActiveRestaurant } from "@/lib/active-restaurant";
|
||||
import { getPublicMenuUrl, getPublicMenuDisplayUrl } from "@/lib/urls";
|
||||
import { getCustomerInfo, isProActive } from "@/lib/purchases";
|
||||
import { CategoryPillBar } from "@/components/menu/CategoryPillBar";
|
||||
import { MenuItemCard, type MenuItemData } from "@/components/menu/MenuItemCard";
|
||||
import { ItemDetailSheet } from "@/components/menu/ItemDetailSheet";
|
||||
@@ -250,6 +251,28 @@ export default function MenuEditorScreen() {
|
||||
// Publish
|
||||
async function onPublish() {
|
||||
if (!active) return;
|
||||
|
||||
// Publishing (and re-publishing after a lapsed subscription — PRD §15)
|
||||
// requires an active Pro entitlement or trial. RevenueCat's SDK starts
|
||||
// the trial automatically on first purchase if the customer is eligible.
|
||||
try {
|
||||
const info = await getCustomerInfo();
|
||||
if (!isProActive(info)) {
|
||||
Alert.alert(
|
||||
"Menünüzü yayınlamak için abone olun",
|
||||
"7 gün ücretsiz deneyin, istediğiniz zaman iptal edin.",
|
||||
[
|
||||
{ text: "Vazgeç", style: "cancel" },
|
||||
{ text: "Devam Et", onPress: () => router.push("/account/subscription") },
|
||||
],
|
||||
);
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
Alert.alert("Hata", err instanceof Error ? err.message : "Abonelik durumu kontrol edilemedi.");
|
||||
return;
|
||||
}
|
||||
|
||||
setPublishing(true);
|
||||
try {
|
||||
await api.post(`/menus/${active.menuId}/publish`);
|
||||
|
||||
Reference in New Issue
Block a user