BDMG UI

Thank You

Reusable thank-you page content from @workspace/bdmg-component. Handles access (URL email/buyer, optional token or cookie validation), UTM cookies, optional welcome email, and an optional ads section with UTM substitution in links. Must be used inside Suspense because it uses useSearchParams.

Installation

tsx
import { ThankYouContent } from "@workspace/bdmg-component"
import type { ThankYouContentProps, ThankYouAd } from "@workspace/bdmg-component"

Basic usage

Render ThankYouContent inside Suspense. Access is granted when email (or buyer) is in the URL; otherwise the user is redirected to redirectPath.

tsx
import { Suspense } from "react"
import { ThankYouContent } from "@workspace/bdmg-component"

export default function ThankYouPage() {
  return (
    <Suspense fallback={<div>Loading...</div>}>
      <ThankYouContent
        title="Thank you!"
        subtitle="Your request has been received."
        redirectPath="/"
      />
    </Suspense>
  )
}

With custom copy and no ads

Pass copy via props. Use showBuyerLogo=false and ads=[] for a minimal thank-you page.

tsx
<ThankYouContent
  title={THANKYOU_CONTENT.title}
  subtitle={THANKYOU_CONTENT.subtitle}
  showBuyerLogo={false}
  confirmationTitle={THANKYOU_CONTENT.confirmationTitle}
  confirmationDescription={THANKYOU_CONTENT.confirmationDescription}
  contactTitle={THANKYOU_CONTENT.contactTitle}
  contactPhoneLabel={THANKYOU_CONTENT.contactPhoneLabel}
  contactPhoneHref={THANKYOU_CONTENT.contactPhoneHref}
  redirectPath="/"
  sendWelcomeEmail={false}
  ads={[]}
/>

Ads with UTM substitution

Pass an ads array. Each link can use placeholders {{utm_source}}, {{utm_id}}, {{utm_s1}}; they are replaced with values from the URL or cookies.

tsx
const ads = [
  {
    image: "/nerdwallet.png",
    link: "https://example.com/offer?sub1={{utm_source}}&sub2={{utm_id}}&sub3={{utm_s1}}",
  },
]
<ThankYouContent ads={ads} adSectionTitle="More offers for you" />

ThankYouContent props

PropTypeDefaultDescription
titlestring"Thank you!"Main heading.
subtitlestring(receipt message)Body text below the title.
showBuyerLogobooleantrueShow buyer logo when buyer param is in URL.
buyerLogoPath(buyer: string) => string(slugified path)Function to build buyer logo image path.
confirmationTitlestring(email sent title)Confirmation box title.
confirmationDescriptionstring(inbox/spam text)Confirmation box description.
contactTitlestring"For immediate assistance"Contact section heading.
contactPhoneLabelstring1-(866)-495-1543Display text for phone number.
contactPhoneHrefstringtel:+18664951543tel: link for the phone number.
redirectPathstring"/"Path to redirect when access is not authorized.
sendWelcomeEmailbooleanfalseCall send email API when page is authorized.
sendEmailApiPathstring"/api/send-email"API path for welcome email (POST with { email }).
validateAccessApiPathstring | nullnullOptional API to validate access (cookie or token). POST with credentials or body.
useLocalStorageTokenbooleanfalseCheck thankyou_token / thankyou_expires in localStorage for access.
adsThankYouAd[][]List of { image, link }. Use {{utm_source}}, {{utm_id}}, {{utm_s1}} in link.
adSectionTitlestring-Optional title for the ads section.
utmCookieNamesThankYouUtmCookieNamessubid1/subid2/subid3Cookie names for UTM source, id, s1.
formDataStorageKeystring"form_data"localStorage key for email fallback when sending welcome email.
loadingFallbackReactNode-Custom loading UI instead of default spinner.

Preview

Live preview (access is granted with ?email=test@example.com in the URL; add it to see content).

Loading...