|
|
@@ -8,22 +8,6 @@ enum PaywallPlan: String, CaseIterable, Identifiable {
|
|
|
|
|
|
var id: String { rawValue }
|
|
|
|
|
|
- var title: String {
|
|
|
- switch self {
|
|
|
- case .monthly: "Monthly"
|
|
|
- case .yearly: "Yearly"
|
|
|
- case .lifetime: "Lifetime"
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var subtitle: String {
|
|
|
- switch self {
|
|
|
- case .monthly: "Billed every month"
|
|
|
- case .yearly: "Save 42%. Billed once per year."
|
|
|
- case .lifetime: "One-time payment. All future updates."
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
var productID: String {
|
|
|
switch self {
|
|
|
case .monthly: SubscriptionProductID.monthly
|
|
|
@@ -32,55 +16,6 @@ enum PaywallPlan: String, CaseIterable, Identifiable {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var fallbackMainPrice: String {
|
|
|
- switch self {
|
|
|
- case .monthly: "$7.99"
|
|
|
- case .yearly: "$49.99"
|
|
|
- case .lifetime: "$79.99"
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var price: String { fallbackMainPrice }
|
|
|
-
|
|
|
- var priceSuffix: String? {
|
|
|
- switch self {
|
|
|
- case .monthly: "/mo"
|
|
|
- case .yearly: "/yr"
|
|
|
- case .lifetime: nil
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var ctaTitle: String {
|
|
|
- switch self {
|
|
|
- case .monthly: "Get Premium"
|
|
|
- case .yearly: "Get Premium"
|
|
|
- case .lifetime: "Unlock Lifetime"
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var fallbackBillingDescription: String {
|
|
|
- switch self {
|
|
|
- case .monthly:
|
|
|
- return "Billed at \(fallbackMainPrice) every month"
|
|
|
- case .yearly:
|
|
|
- return "Billed at \(fallbackMainPrice) every year"
|
|
|
- case .lifetime:
|
|
|
- return "One-time payment of \(fallbackMainPrice)"
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var isBestValue: Bool {
|
|
|
- self == .lifetime
|
|
|
- }
|
|
|
-
|
|
|
- var features: [String] {
|
|
|
- [
|
|
|
- "Unlimited AI Generations",
|
|
|
- "Post Generator & Title Optimizer",
|
|
|
- "Comment Writer with smart replies",
|
|
|
- ]
|
|
|
- }
|
|
|
-
|
|
|
func planCopy(from config: PaywallConfig) -> PaywallConfig.PlanCopy {
|
|
|
switch self {
|
|
|
case .monthly: config.plans.monthly
|
|
|
@@ -90,7 +25,7 @@ enum PaywallPlan: String, CaseIterable, Identifiable {
|
|
|
}
|
|
|
|
|
|
func localizedPrice(from product: Product?, config: PaywallConfig) -> String {
|
|
|
- product?.displayPrice ?? fallbackMainPrice
|
|
|
+ product?.displayPrice ?? planCopy(from: config).fallbackPrice
|
|
|
}
|
|
|
|
|
|
func localizedSubtitle(
|
|
|
@@ -156,32 +91,10 @@ enum PaywallPlan: String, CaseIterable, Identifiable {
|
|
|
.replacingOccurrences(of: "{period}", with: period)
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-struct PaywallFeature: Identifiable {
|
|
|
- let id = UUID()
|
|
|
- let title: String
|
|
|
- let systemImage: String
|
|
|
-}
|
|
|
-
|
|
|
-enum PaywallContent {
|
|
|
- static let title = "Unlock Full Pro Power"
|
|
|
- static let subtitle = "Generate unlimited posts, optimize titles, and craft smarter replies with advanced AI."
|
|
|
|
|
|
- static let includedSectionTitle = "Everything included in Premium"
|
|
|
-
|
|
|
- static let features: [PaywallFeature] = [
|
|
|
- PaywallFeature(title: "Unlimited AI Generations", systemImage: "sparkles"),
|
|
|
- PaywallFeature(title: "Post Generator", systemImage: "square.and.pencil"),
|
|
|
- PaywallFeature(title: "Title Optimizer", systemImage: "textformat.size"),
|
|
|
- PaywallFeature(title: "Comment Writer", systemImage: "bubble.left.and.bubble.right.fill"),
|
|
|
- PaywallFeature(title: "Custom AI Prompts", systemImage: "wand.and.stars"),
|
|
|
- PaywallFeature(title: "Post Analytics", systemImage: "chart.bar.fill"),
|
|
|
- ]
|
|
|
-
|
|
|
- static let continueWithFreePlan = "Continue with free plan"
|
|
|
- static let restorePurchases = "Restore Purchases"
|
|
|
- static let privacyPolicy = "Privacy Policy"
|
|
|
- static let support = "Support"
|
|
|
- static let termsOfService = "Terms of Services"
|
|
|
+ func fallbackBillingDescription(config: PaywallConfig) -> String {
|
|
|
+ let copy = planCopy(from: config)
|
|
|
+ return copy.fallbackBillingDescription
|
|
|
+ .replacingOccurrences(of: "{price}", with: copy.fallbackPrice)
|
|
|
+ }
|
|
|
}
|