@@ -88,7 +88,8 @@ function PricingTier({
8888 ctaText,
8989 popular = false ,
9090 productId = "" , // Add productId parameter
91- isIOS = false // Add iOS detection parameter
91+ isIOS = false , // Add iOS detection parameter
92+ externalBillingAllowed = true // Add external billing parameter with default to true
9293} : {
9394 name : string ;
9495 price : string ;
@@ -98,6 +99,7 @@ function PricingTier({
9899 popular ?: boolean ;
99100 productId ?: string ; // Add type for productId
100101 isIOS ?: boolean ; // Add type for iOS detection
102+ externalBillingAllowed ?: boolean ; // Add type for external billing
101103} ) {
102104 const isTeamPlan = name . toLowerCase ( ) . includes ( "team" ) ;
103105 const isFreeplan = name . toLowerCase ( ) . includes ( "free" ) ;
@@ -133,19 +135,49 @@ function PricingTier({
133135 </ div >
134136 ) ) }
135137 </ div >
136- { /* For iOS devices, disable paid plans with "Coming Soon" text */ }
138+ { /* For iOS devices, check if external billing is allowed */ }
137139 { isIOS && ! isFreeplan ? (
138- < button
139- disabled = { true }
140- className = "mt-auto py-3 px-6 rounded-lg text-center font-medium transition-all duration-300
141- dark:bg-white/90 dark:text-black dark:hover:bg-[hsl(var(--purple))]/80 dark:hover:text-[hsl(var(--foreground))] dark:active:bg-white/80
142- bg-background text-foreground hover:bg-[hsl(var(--purple))] hover:text-[hsl(var(--foreground))] active:bg-background/80
143- border border-[hsl(var(--purple))]/30 hover:border-[hsl(var(--purple))]
144- shadow-[0_0_15px_rgba(var(--purple-rgb),0.2)] hover:shadow-[0_0_25px_rgba(var(--purple-rgb),0.3)]
145- opacity-50 cursor-not-allowed"
146- >
147- Coming Soon
148- </ button >
140+ externalBillingAllowed ? (
141+ // If external billing is allowed, handle product selection normally
142+ productId ? (
143+ < button
144+ onClick = { ( ) => {
145+ window . location . href = `/signup?next=/pricing&selected_plan=${ productId } ` ;
146+ } }
147+ className = "mt-auto py-3 px-6 rounded-lg text-center font-medium transition-all duration-300
148+ dark:bg-white/90 dark:text-black dark:hover:bg-[hsl(var(--purple))]/80 dark:hover:text-[hsl(var(--foreground))] dark:active:bg-white/80
149+ bg-background text-foreground hover:bg-[hsl(var(--purple))] hover:text-[hsl(var(--foreground))] active:bg-background/80
150+ border border-[hsl(var(--purple))]/30 hover:border-[hsl(var(--purple))]
151+ shadow-[0_0_15px_rgba(var(--purple-rgb),0.2)] hover:shadow-[0_0_25px_rgba(var(--purple-rgb),0.3)]"
152+ >
153+ { ctaText }
154+ </ button >
155+ ) : (
156+ < Link
157+ to = "/signup"
158+ className = "mt-auto py-3 px-6 rounded-lg text-center font-medium transition-all duration-300
159+ dark:bg-white/90 dark:text-black dark:hover:bg-[hsl(var(--purple))]/80 dark:hover:text-[hsl(var(--foreground))] dark:active:bg-white/80
160+ bg-background text-foreground hover:bg-[hsl(var(--purple))] hover:text-[hsl(var(--foreground))] active:bg-background/80
161+ border border-[hsl(var(--purple))]/30 hover:border-[hsl(var(--purple))]
162+ shadow-[0_0_15px_rgba(var(--purple-rgb),0.2)] hover:shadow-[0_0_25px_rgba(var(--purple-rgb),0.3)]"
163+ >
164+ { ctaText }
165+ </ Link >
166+ )
167+ ) : (
168+ // If external billing is not allowed, show "Coming Soon" text
169+ < button
170+ disabled = { true }
171+ className = "mt-auto py-3 px-6 rounded-lg text-center font-medium transition-all duration-300
172+ dark:bg-white/90 dark:text-black dark:hover:bg-[hsl(var(--purple))]/80 dark:hover:text-[hsl(var(--foreground))] dark:active:bg-white/80
173+ bg-background text-foreground hover:bg-[hsl(var(--purple))] hover:text-[hsl(var(--foreground))] active:bg-background/80
174+ border border-[hsl(var(--purple))]/30 hover:border-[hsl(var(--purple))]
175+ shadow-[0_0_15px_rgba(var(--purple-rgb),0.2)] hover:shadow-[0_0_25px_rgba(var(--purple-rgb),0.3)]
176+ opacity-50 cursor-not-allowed"
177+ >
178+ Coming Soon
179+ </ button >
180+ )
149181 ) : isTeamPlan ? (
150182 // For team plans, add "Contact Us" button that opens email
151183 < button
@@ -195,8 +227,9 @@ function PricingTier({
195227
196228export function Marketing ( ) {
197229 const [ isIOS , setIsIOS ] = useState ( false ) ;
230+ const [ externalBillingAllowed , setExternalBillingAllowed ] = useState ( true ) ;
198231
199- // Check if the app is running on iOS
232+ // Check if the app is running on iOS and check if external billing is allowed
200233 useEffect ( ( ) => {
201234 const checkPlatform = async ( ) => {
202235 try {
@@ -208,7 +241,22 @@ export function Marketing() {
208241 if ( isTauriEnv ) {
209242 // Only check platform type if we're in a Tauri environment
210243 const platform = await type ( ) ;
211- setIsIOS ( platform === "ios" ) ;
244+ const isIosDevice = platform === "ios" ;
245+ setIsIOS ( isIosDevice ) ;
246+
247+ // If we're on iOS, check if external billing is allowed
248+ if ( isIosDevice ) {
249+ try {
250+ // Import dynamically to prevent issues on non-Tauri environments
251+ const { allowExternalBilling } = await import ( "@/utils/region-gate" ) ;
252+ const allowed = await allowExternalBilling ( ) ;
253+ setExternalBillingAllowed ( allowed ) ;
254+ console . log ( "External billing allowed (Marketing):" , allowed ) ;
255+ } catch ( err ) {
256+ console . error ( "Error checking store region:" , err ) ;
257+ setExternalBillingAllowed ( false ) ; // Default to false if there's an error
258+ }
259+ }
212260 } else {
213261 setIsIOS ( false ) ;
214262 }
@@ -661,6 +709,7 @@ export function Marketing() {
661709 ctaText = "Start Chatting"
662710 productId = { getProductId ( "Starter" ) }
663711 isIOS = { isIOS }
712+ externalBillingAllowed = { externalBillingAllowed }
664713 />
665714 < PricingTier
666715 name = "Pro"
@@ -676,6 +725,7 @@ export function Marketing() {
676725 popular = { true }
677726 productId = { getProductId ( "Pro" ) }
678727 isIOS = { isIOS }
728+ externalBillingAllowed = { externalBillingAllowed }
679729 />
680730 < PricingTier
681731 name = "Team"
@@ -690,6 +740,7 @@ export function Marketing() {
690740 ctaText = "Contact Us"
691741 productId = { getProductId ( "Team" ) }
692742 isIOS = { isIOS }
743+ externalBillingAllowed = { externalBillingAllowed }
693744 />
694745 </ div >
695746 </ div >
0 commit comments