@@ -447,14 +447,29 @@ export function getDefaultPaywallText(contentType: string): {
447
447
export function renderPaywalledContent (
448
448
MdxContent : React . ComponentType ,
449
449
content : Content , // Use the processed Content type
450
- hasPurchased : boolean
450
+ hasPurchased : boolean ,
451
+ isSubscribed : boolean
451
452
) {
452
453
// Determine if we should show the full content
453
- const showFullContent = ! content . commerce ?. isPaid || hasPurchased ;
454
+ const showFullContent =
455
+ ( ! content . commerce ?. isPaid && ! content . commerce ?. requiresEmail ) ||
456
+ hasPurchased ||
457
+ ( content . commerce ?. requiresEmail && isSubscribed ) ;
454
458
455
459
// Get default paywall text based on content type
456
460
const defaultText = getDefaultPaywallText ( content . type ) ;
457
461
462
+ let paywallHeader = defaultText . header ;
463
+ let paywallBody = defaultText . body ;
464
+
465
+ if ( content . commerce ?. requiresEmail ) {
466
+ paywallHeader = content . commerce . paywallHeader || 'Sign in & subscribe to read for free' ;
467
+ paywallBody = content . commerce . paywallBody || 'Sign in to zackproser.com and subscribe to unlock this content.' ;
468
+ } else {
469
+ paywallHeader = content . commerce ?. paywallHeader || defaultText . header ;
470
+ paywallBody = content . commerce ?. paywallBody || defaultText . body ;
471
+ }
472
+
458
473
// Dynamically import ArticleContent to avoid circular dependencies if this file is imported in components
459
474
// Note: This file is marked 'server-only', but ArticleContent likely exists client-side,
460
475
// so dynamic import with `ssr: false` might be needed depending on ArticleContent's usage.
@@ -473,9 +488,11 @@ export function renderPaywalledContent(
473
488
title : content . title , // Use the processed title
474
489
previewLength : content . commerce ?. previewLength ,
475
490
previewElements : content . commerce ?. previewElements ,
476
- paywallHeader : content . commerce ?. paywallHeader || defaultText . header ,
477
- paywallBody : content . commerce ?. paywallBody || defaultText . body ,
491
+ paywallHeader : paywallHeader ,
492
+ paywallBody : paywallBody ,
478
493
buttonText : content . commerce ?. buttonText || defaultText . buttonText ,
494
+ requiresEmail : content . commerce ?. requiresEmail ,
495
+ isSubscribed : isSubscribed ,
479
496
// Pass content object itself if ArticleContent needs more data
480
497
content : content ,
481
498
}
0 commit comments