diff --git a/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/product-page.jsx b/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/product-page.jsx index 5a8981407e29e..677e77b3f6d67 100644 --- a/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/product-page.jsx +++ b/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/product-page.jsx @@ -68,8 +68,8 @@ export default function () { } = aiAssistantFeature || {}; const isFree = currentTier?.value === 0; - const hasUnlimited = currentTier?.value === 1 || ( ! tierPlansEnabled && ! isFree ); - const hasPaidTier = ! isFree && ! hasUnlimited; + const hasUnlimited = currentTier?.value === 1; + const hasPaidTier = ( ! isFree && ! hasUnlimited ) || ( hasUnlimited && ! tierPlansEnabled ); const shouldContactUs = ! hasUnlimited && hasPaidTier && ! nextTier && currentTier; const freeRequestsLeft = isFree && 20 - allTimeRequests >= 0 ? 20 - allTimeRequests : 0; const showCurrentUsage = hasPaidTier && ! isFree && usage; @@ -100,10 +100,15 @@ export default function () { const showRenewalNotice = isOverLimit && hasPaidTier; const showUpgradeNotice = isOverLimit && isFree; - const currentTierValue = currentTier?.value || 0; - const currentUsage = usage?.[ 'requests-count' ] || 0; + const currentTierLimit = currentTier?.limit || 0; + const currentUsage = usage?.requestsCount || 0; + const tierRequestsLeft = - currentTierValue - currentUsage >= 0 ? currentTierValue - currentUsage : 0; + currentTierLimit - currentUsage >= 0 ? currentTierLimit - currentUsage : 0; + const requestCardNumber = tierPlansEnabled ? tierRequestsLeft : currentUsage; + + const currentUsageLabel = __( 'Requests this month', 'jetpack-my-jetpack' ); + const currentRemainingLabel = __( 'Requests for this month', 'jetpack-my-jetpack' ); const renewalNoticeTitle = __( "You've reached your request limit for this month", @@ -111,15 +116,21 @@ export default function () { ); const upgradeNoticeTitle = __( "You've used all your free requests", 'jetpack-my-jetpack' ); - const renewalNoticeBody = sprintf( + const renewalNoticeBodyInfo = sprintf( // translators: %d is the number of days left in the month. - __( - 'Wait for %d days to reset your limit, or upgrade now to a higher tier for additional requests and keep your work moving forward.', - 'jetpack-my-jetpack' - ), + __( 'Wait for %d days to reset your limit', 'jetpack-my-jetpack' ), Math.floor( ( new Date( usage?.nextStart || null ) - new Date() ) / ( 1000 * 60 * 60 * 24 ) ) ); + const renewalNoticeBodyTeaser = __( + ', or upgrade now to a higher tier for additional requests and keep your work moving forward.', + 'jetpack-my-jetpack' + ); + + const renewalNoticeBody = ! tierPlansEnabled + ? renewalNoticeBodyInfo + '.' + : renewalNoticeBodyInfo + renewalNoticeBodyTeaser; + const upgradeNoticeBody = __( 'Reach for More with Jetpack AI! Upgrade now for additional requests and keep your momentum going.', 'jetpack-my-jetpack' @@ -222,10 +233,10 @@ export default function () {
- { __( 'Requests for this month', 'jetpack-my-jetpack' ) } + { tierPlansEnabled ? currentRemainingLabel : currentUsageLabel }
- { tierRequestsLeft } + { requestCardNumber }
@@ -264,11 +275,15 @@ export default function () { { showNotice && (
- { showRenewalNotice ? renewalNoticeCta : upgradeNoticeCta } - , - ] } + actions={ + tierPlansEnabled + ? [ + , + ] + : {} + } onClose={ onNoticeClose } level={ showRenewalNotice ? 'warning' : 'error' } title={ showRenewalNotice ? renewalNoticeTitle : upgradeNoticeTitle } diff --git a/projects/packages/my-jetpack/changelog/change-jetpack-ai-product-page-limit-handling b/projects/packages/my-jetpack/changelog/change-jetpack-ai-product-page-limit-handling new file mode 100644 index 0000000000000..dee27e808c62e --- /dev/null +++ b/projects/packages/my-jetpack/changelog/change-jetpack-ai-product-page-limit-handling @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +My Jetpack: show over quota notice and period usage counter for unlimited plans