Skip to Content
BBRICKSv0.7.4
BlocksBundles

BundleResultBanner

A bundle purchase's outcome as a banner; an unknown value draws nothing. Nothing charged twice says so in words.

import { BundleResultBanner } from '@ergasti/bricks';

Examples

Purchase outcomes

Bought, already bought, closed, pending or failed.

Code
import { BundleResultBanner } from '@ergasti/bricks';

function Results() {
  return (
    <div style={{ display: 'grid', gap: 10 }}>
      {(['ok', 'already', 'closed', 'pending', 'failed'] as const).map((result) => <BundleResultBanner key={result} result={result} onDismiss={() => {}} />)}
    </div>
  );
}

Props

Prop

Type

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key bundleResultBanner, or with the component's own prop where it has one. A {name} is a value the component fills in.

bundleResultBanner
KeyEnglishArabic
okUGC bundle bought. Its credits are in your wallet.باقة الـUGC اتشترت. الرصيد بتاعها في محفظتك.
alreadyYou already bought this bundle. Nothing was charged again.الباقة دي اتشترت قبل كده. مفيش حاجة اتخصمت تاني.
closedUGC bundles open when your wallet goes live.باقات الـUGC بتفتح لما محفظتك تشتغل.
pendingBundle payment sent. The credits arrive once Paymob confirms it.دفع الباقة اتبعت. الرصيد هيوصل أول ما Paymob تأكد الدفع.
failedThe bundle payment did not go through.دفع الباقة ماتمش.
dismissDismissاقفل

Design guidance

How the BRICKS design system uses BundleResultBanner. Written in docs/content/components/BundleResultBanner.md; the props above are read from the code, which wins where the two disagree.

A banner that reports the outcome of a UGC bundle purchase (bought, already bought, closed, payment pending, failed); show it on the page the purchase returns to.

It maps the server's bundle=ok|already|closed result (and the card path's pending / failed) to a kit Banner with the right tone, icon and sentence, so the words are the same everywhere. A repeat purchase says plainly that nothing was charged twice. An unknown or empty value draws nothing, so you can pass the URL parameter straight in. Bundles are not in the v3 mock; this block was built for the live console's bundle flow.

Anatomy

A kit Banner:

  1. Icon: kit icon by result.
  2. Message: the result's sentence.
  3. Dismiss (optional): small ghost button "Dismiss" when onDismiss is set.

Variants

resultTone / iconMessage (en)
'ok'lime / check"UGC bundle bought. Its credits are in your wallet."
'already'info / info"You already bought this bundle. Nothing was charged again."
'closed'warn / lock"UGC bundles open when your wallet goes live."
'pending'info / clock"Bundle payment sent. The credits arrive once Paymob confirms it."
'failed'bad / alert (role="alert")"The bundle payment did not go through."

States

StateTrigger
Hiddenresult is null or any other string.
Showna known result.
DismissibleonDismiss given.

Types

BundleResult (result): 'ok' | 'already' | 'closed' | 'pending' | 'failed'; anything else renders nothing.

Usage

const [params, setParams] = useSearchParams();

<BundleResultBanner result={params.get('bundle')} onDismiss={() => { params.delete('bundle'); setParams(params); }} />
<Card title="UGC bundles">
  <BundleGrid bundles={bundles} onBuy={openCheckout} />
</Card>

Where it appears

  • Library only: not in the v3 mocks (blocks inventory: built for the live console). Shown in the missing-brand gallery above the bundle grid.

Guidelines

Do

  • Show it once, at the top of the page the payment returns to, then let the user dismiss it.
  • Pass the server's value unchanged.

Don't

  • Don't also show a toast for the same result.
  • Don't rewrite the "already" message; it is the no-double-charge promise.

RTL and Arabic

  • Mirrors as Banner. Arabic: "باقة الـUGC اتشترت. الرصيد بتاعها في محفظتك.", "اقفل".

Tokens

Through Banner: --lime-50, --olive, --sky, --sky-ink, --butter, --butter-ink, --rasp-50, --rasp-ink.

Accessibility

  • Inherits Banner: role="status", or role="alert" for failed. The icon is decorative.

Found in the source

  • No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Banner · Button · useLanguage

Source

src/blocks/bundles/BundleResultBanner.tsx (line 55) on GitHub.

On this page