checkout(healthcare): collapse + reposition surrogate how-to when not granted

The order confirmation asked providers to optionally grant CMS I&A Surrogate
access, then showed the full how-to to everyone high up. Now it respects their
intake answer:
- Granted (surrogate_access=yes): keep the how-to prominent up top so they can
  complete the step they chose.
- Not granted / undecided: top block just confirms 'we're handling it, nothing
  else to do' (no nagging); the speed-it-up how-to moves lower and is collapsed
  behind a 'Show me how' <details> expander (still available, just out of the way).
This commit is contained in:
justin 2026-06-08 00:36:41 -05:00
parent 978b36ad92
commit ada9e01321

View file

@ -2271,21 +2271,14 @@ export async function sendComplianceIntakeEmail(
// us (fewer steps, lets us bulk-file). We never ask for their password.
const npiConfirmUrl = `${SITE_DOMAIN}/order/success?action=ia_surrogacy&order_id=${orderId}`;
const npiSection = hasNpiAccess ? `
<div style="background:#ccfbf1;border:1px solid #5eead4;border-radius:8px;padding:16px 20px;margin:20px 0;">
<p style="margin:0 0 10px;font-size:14px;font-weight:700;color:#115e59;">We're handling your filing</p>
<p style="margin:0 0 12px;font-size:13px;color:#134e4a;line-height:1.5;">
You're all set &mdash; we prepare and submit your filing and track it to
confirmation. The only thing we may need from you is a quick signature on
a secure link we'll send. Nothing to set up.
</p>
<p style="margin:0 0 6px;font-size:13px;font-weight:700;color:#115e59;">Optional: speed it up</p>
<p style="margin:0 0 12px;font-size:13px;color:#134e4a;line-height:1.5;">
If you can <strong>electronically grant us CMS I&amp;A Surrogate access</strong>,
we can file faster &mdash; it cuts steps on our end and lets us process your
filing right away. You never share your password; you simply authorize us
as a Surrogate for your NPI.
</p>
// Did the provider opt in to granting CMS I&A Surrogate access on the intake
// form? If yes, surface the how-to prominently (it confirms the step they
// committed to). If no / undecided, we still make it available, but collapsed
// behind a "Show me how" expander and placed lower so it doesn't nag someone
// who already chose to let us handle everything.
const grantedSurrogate = String(intake.surrogate_access || "").toLowerCase() === "yes";
const surrogateSteps = `
<ol style="margin:0 0 12px;padding-left:20px;font-size:13px;color:#134e4a;line-height:1.7;">
<li>Log in to <a href="https://nppes.cms.hhs.gov/IAWeb/login.do" style="color:#0f766e;">CMS Identity &amp; Access (I&amp;A)</a></li>
<li>Go to <strong>My Connections &rarr; Add Surrogate</strong></li>
@ -2296,11 +2289,51 @@ export async function sendComplianceIntakeEmail(
<a href="${npiConfirmUrl}" style="display:inline-block;background:#0f766e;color:#ffffff;font-weight:700;padding:12px 28px;border-radius:8px;text-decoration:none;font-size:14px;">
I've granted surrogate access &rarr;
</a>
</p>`;
const npiSection = !hasNpiAccess ? "" : grantedSurrogate ? `
<div style="background:#ccfbf1;border:1px solid #5eead4;border-radius:8px;padding:16px 20px;margin:20px 0;">
<p style="margin:0 0 10px;font-size:14px;font-weight:700;color:#115e59;">We're handling your filing</p>
<p style="margin:0 0 12px;font-size:13px;color:#134e4a;line-height:1.5;">
You're all set &mdash; we prepare and submit your filing and track it to
confirmation. The only thing we may need from you is a quick signature on
a secure link we'll send.
</p>
<p style="margin:0 0 6px;font-size:13px;font-weight:700;color:#115e59;">You chose to grant Surrogate access &mdash; here's how (takes ~2 minutes)</p>
<p style="margin:0 0 12px;font-size:13px;color:#134e4a;line-height:1.5;">
This lets us file faster. You never share your password; you simply
authorize us as a Surrogate for your NPI.
</p>
${surrogateSteps}
<p style="margin:8px 0 0;font-size:12px;color:#115e59;text-align:center;">
Can't do this step? No problem &mdash; we'll handle your filing without it.
There's nothing else you need to do.
Changed your mind? No problem &mdash; we'll handle your filing without it.
</p>
</div>` : `
<div style="background:#ccfbf1;border:1px solid #5eead4;border-radius:8px;padding:16px 20px;margin:20px 0;">
<p style="margin:0 0 10px;font-size:14px;font-weight:700;color:#115e59;">We're handling your filing</p>
<p style="margin:0;font-size:13px;color:#134e4a;line-height:1.5;">
You're all set &mdash; we prepare and submit your filing and track it to
confirmation. The only thing we may need from you is a quick signature on
a secure link we'll send. <strong>Nothing else to do.</strong>
</p>
</div>`;
// Optional speed-up block, shown lower in the email ONLY when they didn't
// already grant access. Collapsed behind a "Show me how" expander.
const npiSpeedupSection = (hasNpiAccess && !grantedSurrogate) ? `
<div style="background:#f0fdfa;border:1px solid #99f6e4;border-radius:8px;padding:16px 20px;margin:20px 0;">
<p style="margin:0 0 6px;font-size:13px;font-weight:700;color:#115e59;">Optional: want it filed even faster?</p>
<p style="margin:0 0 10px;font-size:13px;color:#134e4a;line-height:1.5;">
If you can electronically grant us <strong>CMS I&amp;A Surrogate access</strong>,
we can process your filing right away. It's never required &mdash; we'll file
it for you either way, at the same price. You never share your password.
</p>
<details style="margin:0;">
<summary style="cursor:pointer;color:#0f766e;font-weight:700;font-size:13px;">Show me how &rarr;</summary>
<div style="margin-top:10px;">
${surrogateSteps}
</div>
</details>
</div>` : "";
// Fully admin-assisted services with NO customer intake form. State-level
@ -2388,6 +2421,8 @@ export async function sendComplianceIntakeEmail(
${intakeSection}
${npiSpeedupSection}
<h2 style="margin:24px 0 8px;font-size:16px;font-weight:700;color:#111827;">What to Expect</h2>
${isDotOnly ? `
<p style="margin:0 0 4px;font-size:14px;color:#374151;"><span style="color:#1e3a5f;font-weight:600;">1.</span> Our team is already working on your filing.</p>