|
2080 | 2080 | var planLabel = formatRewritePlanLabel(data.plan, data.planLabel); |
2081 | 2081 | var upgradeUrl = getRewriteUpgradeUrl(); |
2082 | 2082 | var cardClass = 'aeo-header-trial-offer'; |
2083 | | - var kicker = '$1 Starter Trial'; |
2084 | | - var title = 'Syncing starter trial status...'; |
2085 | | - var body = 'A one-time Stripe Checkout payment unlocks ' + starterArticles + ' AEO article credits for rewrites or new articles.'; |
| 2083 | + var kicker = 'Starter Trial'; |
| 2084 | + var title = 'Checking trial status...'; |
| 2085 | + var body = 'Unlock ' + starterArticles + ' AEO article credits for rewrites or new content.'; |
2086 | 2086 | var note = ''; |
2087 | 2087 | var actionHtml = ''; |
2088 | 2088 |
|
2089 | 2089 | if (rewriteAvailabilityState.phase === 'error') { |
2090 | 2090 | cardClass += ' is-error'; |
2091 | | - title = 'Starter trial is temporarily unavailable'; |
2092 | | - body = rewriteAvailabilityState.message || 'The plugin could not load article trial availability right now.'; |
2093 | | - note = canManagePlugin ? 'You can still open Studio to manage billing directly.' : 'A site administrator can manage billing in Studio.'; |
| 2091 | + title = 'Starter trial unavailable'; |
| 2092 | + body = rewriteAvailabilityState.message || 'Could not load trial availability right now.'; |
| 2093 | + note = canManagePlugin ? 'You can manage billing directly in Studio.' : 'A site administrator can manage billing in Studio.'; |
2094 | 2094 | if (canManagePlugin && upgradeUrl) { |
2095 | 2095 | actionHtml = '<a href="' + esc(upgradeUrl) + '" class="button button-secondary" target="_blank" rel="noopener">Manage in Studio</a>'; |
2096 | 2096 | } |
2097 | 2097 | } else if (available > 0) { |
2098 | 2098 | cardClass += ' is-active'; |
2099 | | - kicker = planLabel || 'AEO Article Credits'; |
2100 | | - title = available + ' of ' + (limit > 0 ? limit : starterArticles) + ' article credits remaining'; |
2101 | | - body = 'Use them on full rewrites or brand-new article runs in Studio.'; |
2102 | | - note = canManagePlugin ? ('The ' + (planLabel || 'active plan') + ' balance is attached to this connected account.') : 'A site administrator manages billing for this connected account.'; |
| 2099 | + kicker = planLabel || 'Article Credits'; |
| 2100 | + title = available + ' of ' + (limit > 0 ? limit : starterArticles) + ' credits remaining'; |
| 2101 | + body = 'Use them on rewrites or new articles in Studio.'; |
| 2102 | + note = canManagePlugin ? (planLabel || 'Active plan') + ' balance is attached to this account.' : 'A site administrator manages billing for this account.'; |
2103 | 2103 | if (canManagePlugin && upgradeUrl) { |
2104 | 2104 | actionHtml = '<a href="' + esc(upgradeUrl) + '" class="button button-secondary" target="_blank" rel="noopener">Manage in Studio</a>'; |
2105 | 2105 | } |
2106 | 2106 | } else if (data.checkoutEnabled && data.starterEligible) { |
2107 | | - title = starterArticles + ' AEO articles for ' + starterPrice; |
| 2107 | + kicker = starterPrice + ' Starter'; |
| 2108 | + title = 'Unlock ' + starterArticles + ' articles for rewrites and new content'; |
2108 | 2109 | if (canManagePlugin) { |
2109 | | - body = 'Move this account out of Free with a one-time Stripe Checkout payment. Use the credits on rewrites or new article creation in Studio.'; |
2110 | | - note = 'Stripe Checkout collects card details for the one-time starter payment.'; |
2111 | | - actionHtml = '<button type="button" class="button button-primary aeo-start-rewrite-checkout"' + (rewriteCheckoutState.loading ? ' disabled aria-disabled="true"' : '') + '>' + esc(rewriteCheckoutState.loading ? 'Opening Stripe checkout...' : ('Upgrade for ' + starterPrice)) + '</button>'; |
| 2110 | + body = 'One-time payment via Stripe Checkout. Credits work for both page rewrites and new article creation in Studio.'; |
| 2111 | + note = ''; |
| 2112 | + actionHtml = '<button type="button" class="button button-primary aeo-start-rewrite-checkout"' + (rewriteCheckoutState.loading ? ' disabled aria-disabled="true"' : '') + '>' + esc(rewriteCheckoutState.loading ? 'Opening checkout...' : ('Start for ' + starterPrice)) + '</button>'; |
2112 | 2113 | } else { |
2113 | | - body = 'No AEO article credits remain on this account.'; |
2114 | | - note = 'A site administrator must manage billing to unlock more article credits.'; |
| 2114 | + body = 'No article credits remain on this account.'; |
| 2115 | + note = 'A site administrator must manage billing to unlock credits.'; |
2115 | 2116 | } |
2116 | 2117 | } else { |
2117 | 2118 | cardClass += ' is-exhausted'; |
2118 | 2119 | kicker = planLabel || 'Starter Trial'; |
2119 | | - title = planLabel === '$1 Trial Plan' ? 'Your $1 trial is exhausted' : 'Starter trial unavailable'; |
2120 | | - body = canManagePlugin ? 'Upgrade in Studio to keep generating AEO rewrites and new articles after the trial credits are spent.' : 'No AEO article credits remain on this account.'; |
2121 | | - note = canManagePlugin ? 'Billing runs through Stripe Checkout as a one-time payment for the starter trial.' : 'A site administrator must manage billing to unlock more article credits.'; |
| 2120 | + title = (planLabel && planLabel !== 'Starter Trial') ? planLabel + ' credits exhausted' : 'Starter trial unavailable'; |
| 2121 | + body = canManagePlugin ? 'Upgrade in Studio to keep generating rewrites and new articles.' : 'No article credits remain on this account.'; |
| 2122 | + note = canManagePlugin ? 'Billing is handled via Stripe Checkout.' : 'A site administrator must manage billing to unlock credits.'; |
2122 | 2123 | if (canManagePlugin && upgradeUrl) { |
2123 | 2124 | actionHtml = '<a href="' + esc(upgradeUrl) + '" class="button button-secondary" target="_blank" rel="noopener">Upgrade in Studio</a>'; |
2124 | 2125 | } |
2125 | 2126 | } |
2126 | 2127 |
|
| 2128 | + var bannerClass = 'aeo-trial-banner'; |
| 2129 | + if (cardClass.indexOf('is-error') !== -1) bannerClass += ' is-error'; |
| 2130 | + else if (cardClass.indexOf('is-exhausted') !== -1) bannerClass += ' is-exhausted'; |
| 2131 | + |
2127 | 2132 | return '' |
2128 | | - + '<div id="aeo-header-trial-offer" class="' + esc(cardClass) + '">' |
| 2133 | + + '<div id="aeo-header-trial-offer" class="' + esc(bannerClass) + '">' |
2129 | 2134 | + '<span class="aeo-header-trial-kicker">' + esc(kicker) + '</span>' |
2130 | | - + '<h2 class="aeo-header-trial-title">' + esc(title) + '</h2>' |
2131 | | - + '<p class="aeo-header-trial-body">' + esc(body) + '</p>' |
2132 | | - + (note ? '<p class="aeo-header-trial-note"><strong>Billing:</strong> ' + esc(note) + '</p>' : '') |
| 2135 | + + '<span class="aeo-header-trial-title">' + esc(title) + '</span>' |
2133 | 2136 | + (actionHtml ? '<div class="aeo-header-trial-actions">' + actionHtml + '</div>' : '') |
2134 | 2137 | + '</div>'; |
2135 | 2138 | } |
|
2283 | 2286 | function formatRewritePlanLabel(plan, explicitLabel) { |
2284 | 2287 | if (explicitLabel) return explicitLabel; |
2285 | 2288 | if (!plan) return ''; |
2286 | | - if (plan === 'starter') return '$1 Trial Plan'; |
| 2289 | + if (plan === 'starter') return 'Starter Plan'; |
2287 | 2290 | if (plan === 'pro') return 'Pro Plan'; |
2288 | 2291 | return String(plan) |
2289 | 2292 | .replace(/[_-]+/g, ' ') |
|
2338 | 2341 | else body += '.'; |
2339 | 2342 | } else if (data.checkoutEnabled && data.starterEligible) { |
2340 | 2343 | if (canManagePlugin) { |
2341 | | - body = 'Unlock ' + starterArticles + ' AEO article credits for ' + starterPrice + '. Use them on rewrites or new articles in Studio.'; |
2342 | | - actionHtml = '<button type="button" class="button button-primary aeo-start-rewrite-checkout"' + (rewriteCheckoutState.loading ? ' disabled aria-disabled="true"' : '') + '>' + esc(rewriteCheckoutState.loading ? 'Opening checkout...' : ('Upgrade for ' + starterPrice)) + '</button>'; |
| 2344 | + body = 'Unlock ' + starterArticles + ' article credits for rewrites or new content in Studio.'; |
| 2345 | + actionHtml = '<button type="button" class="button button-primary aeo-start-rewrite-checkout"' + (rewriteCheckoutState.loading ? ' disabled aria-disabled="true"' : '') + '>' + esc(rewriteCheckoutState.loading ? 'Opening checkout...' : ('Start for ' + starterPrice)) + '</button>'; |
2343 | 2346 | } else { |
2344 | 2347 | body = 'No AEO article credits remain on this account. Ask a site administrator to manage billing.'; |
2345 | 2348 | } |
|
2568 | 2571 | return { kind: 'unavailable', label: 'Admin required', reason: 'A site administrator must manage billing for additional article credits.' }; |
2569 | 2572 | } |
2570 | 2573 | if (availability.checkoutEnabled && availability.starterEligible) { |
2571 | | - return { kind: 'starter', label: 'Unlock for $1' }; |
| 2574 | + return { kind: 'starter', label: 'Rewrite' }; |
2572 | 2575 | } |
2573 | 2576 | return { kind: 'upgrade', label: 'Upgrade', href: getRewriteUpgradeUrl() }; |
2574 | 2577 | } |
|
4281 | 4284 | + '</aside>'; |
4282 | 4285 | } |
4283 | 4286 |
|
4284 | | - function renderStageHero(stageId, context) { |
4285 | | - var stage = STAGE_BY_ID[stageId]; |
4286 | | - if (!stage) return ''; |
4287 | | - |
4288 | | - var state = getStageState(stageId, context); |
4289 | | - var action = getNextBestAction(stageId, context); |
4290 | | - |
4291 | | - return '' |
4292 | | - + '<div class="aeo-stage-hero-main">' |
4293 | | - + '<div class="aeo-stage-kicker">Step ' + stage.order + ' of ' + STAGE_CONFIGS.length + '</div>' |
4294 | | - + '<div class="aeo-stage-title-row">' |
4295 | | - + '<h2 class="aeo-stage-title">' + esc(stage.title) + '</h2>' |
4296 | | - + renderStatusChip(state.label, state.tone) |
4297 | | - + '</div>' |
4298 | | - + '<p class="aeo-stage-description">' + esc(getStageDescription(stageId)) + '</p>' |
4299 | | - + '<p class="aeo-stage-context">' + esc(getStageContextLine(stageId, context)) + '</p>' |
4300 | | - + '</div>' |
4301 | | - + renderNextActionCard(action); |
| 4287 | + function renderStageHero() { |
| 4288 | + // Hero removed to reduce vertical bloat. Stage state and next-best |
| 4289 | + // action are already visible in the compact workflow rail. |
| 4290 | + return ''; |
4302 | 4291 | } |
4303 | 4292 |
|
4304 | 4293 | function renderStageSummary(stageId, context) { |
|
4324 | 4313 | STAGE_CONFIGS.forEach(function (stage) { |
4325 | 4314 | var hero = document.getElementById('aeo-stage-hero-' + stage.id); |
4326 | 4315 | var summary = document.getElementById('aeo-stage-summary-' + stage.id); |
4327 | | - if (hero) hero.innerHTML = renderStageHero(stage.id, context); |
4328 | | - if (summary) summary.innerHTML = renderStageSummary(stage.id, context); |
| 4316 | + if (hero) { |
| 4317 | + hero.innerHTML = renderStageHero(stage.id, context); |
| 4318 | + hero.style.display = hero.innerHTML.trim() ? '' : 'none'; |
| 4319 | + } |
| 4320 | + if (summary) { |
| 4321 | + summary.innerHTML = renderStageSummary(stage.id, context); |
| 4322 | + summary.style.display = summary.innerHTML.trim() ? '' : 'none'; |
| 4323 | + } |
4329 | 4324 | applyWorkflowStepState(stage.id, getStageState(stage.id, context)); |
4330 | 4325 | }); |
4331 | 4326 | updateWorkflowBadges(context); |
|
0 commit comments