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.
| Key | English | Arabic |
|---|---|---|
ok | UGC bundle bought. Its credits are in your wallet. | باقة الـUGC اتشترت. الرصيد بتاعها في محفظتك. |
already | You already bought this bundle. Nothing was charged again. | الباقة دي اتشترت قبل كده. مفيش حاجة اتخصمت تاني. |
closed | UGC bundles open when your wallet goes live. | باقات الـUGC بتفتح لما محفظتك تشتغل. |
pending | Bundle payment sent. The credits arrive once Paymob confirms it. | دفع الباقة اتبعت. الرصيد هيوصل أول ما Paymob تأكد الدفع. |
failed | The bundle payment did not go through. | دفع الباقة ماتمش. |
dismiss | Dismiss | اقفل |
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:
- Icon: kit icon by result.
- Message: the result's sentence.
- Dismiss (optional): small ghost button "Dismiss" when
onDismissis set.
Variants
result | Tone / icon | Message (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
| State | Trigger |
|---|---|
| Hidden | result is null or any other string. |
| Shown | a known result. |
| Dismissible | onDismiss 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", orrole="alert"forfailed. 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.
Related
BundleGrid,BundleCard,BundlePurchaseSummary: the rest of the bundle flow.TopUpResultBanner: the same pattern for wallet top-ups.
See also: Banner · Button · useLanguage
Source
src/blocks/bundles/BundleResultBanner.tsx (line 55) on GitHub.