GiftClaimCheck
A gift claim's main card (the v3 mock's claim page): what the brand says it sent, and, while it is Expected or Arrived, the count: per product "All N OK" (fills good with the claim and damaged with 0) or the good and damaged units by hand, "Tick all as received in full", the boxes received while Expected, and "Confirm received quantities". Counted claims show good, damaged and missing (or "+N extra"); a difference gets the warning banner; an open problem report shows the brand's words with Keep the count / Recount.
Deprecated
Since 0.7.0: use GiftShipmentCard (shipmentId, brand, state, lines, claimedBoxes), which keeps a half-finished count by product as this card does, the 0.4.0 gift family. Kept working; removed in 1.0.
import { GiftClaimCheck } from '@ergasti/bricks';Examples
Counting what arrived
Deprecated since 0.7.0: use GiftShipmentCard with a shipmentId, which keeps a half-finished count by product the same way; this card keeps working. The claim is Arrived: tick "All N OK" for a product that came in full (it fills Good with the claim and Damaged with 0), or type the good and damaged units. "Confirm received quantities" checks every line is a whole number from 0 to 999 (or up to the claim, when the brand claimed more) and hands you the counts. Good starts empty with a "Count" hint and Damaged at 0, as in the mock: you count the good units, damage is the exception. Only good units become gift stock. Pass claimId so the count the user is typing survives your re-renders and resets only when the claim, its status or the expected boxes change.
Code
import { GiftClaimCheck } from '@ergasti/bricks';
import { claimLines } from './pr';
function Arrived() {
return <GiftClaimCheck claimId="GS-0016" brandName="Glow Lab" status="gift_arrived" lines={claimLines['GS-0016']} onConfirm={() => {}} />;
}Expected
Until it arrives, confirming also asks for the boxes received (1 to 99), with the brand's own number as the hint.
Code
import { GiftClaimCheck } from '@ergasti/bricks';
import { claimLines } from './pr';
function Expected() {
return <GiftClaimCheck brandName="Glow Lab" status="gift_expected" lines={claimLines['GS-0017']} expectedBoxes={2} onConfirm={() => {}} />;
}Counted with a difference
Good, damaged and missing per product (or "+N extra"), the warning about what is in stock, and the brand's problem report with Keep the count / Recount.
Code
import { GiftClaimCheck } from '@ergasti/bricks';
import { claimLines } from './pr';
function Difference() {
return (
<GiftClaimCheck
brandName="Glow Lab" status="gift_confirmed_diff" lines={claimLines['GS-0014']}
problem={{ date: '12 Nov', text: 'We packed 30 hand soaps in box 2. Please recount.' }}
onKeepCount={() => {}} onRecount={() => {}}
/>
);
}Confirming
While your request runs, pass busy: the button reads "Confirming…" and is disabled, and the count the user typed stays.
Code
import { GiftClaimCheck } from '@ergasti/bricks';
import { claimLines } from './pr';
function Busy() {
return <GiftClaimCheck claimId="GS-0016" brandName="Glow Lab" status="gift_arrived" lines={claimLines['GS-0016']} onConfirm={() => {}} busy />;
}Server error
When your request fails, pass its message as error: it is announced under the count, which stays so the user can try again.
Code
import { GiftClaimCheck } from '@ergasti/bricks';
import { claimLines } from './pr';
function ServerError() {
return (
<GiftClaimCheck
claimId="GS-0016" brandName="Glow Lab" status="gift_arrived" lines={claimLines['GS-0016']} onConfirm={() => {}}
error="We could not save the count. Check your connection and confirm again."
/>
);
}Confirmed
Every unit matched the claim: the counts per product and one line saying they are in the brand's gift stock.
Code
import { GiftClaimCheck } from '@ergasti/bricks';
function Confirmed() {
return <GiftClaimCheck brandName="Glow Lab" status="gift_confirmed" lines={[{ product: 'Face powder', claimed: 40, good: 40, damaged: 0 }]} />;
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prGifts, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
reference | Reference | الرقم |
brand | Brand | البراند |
for | For | لـ |
claimed | Units claimed | الوحدات المتبلّغ عنها |
confirmed | Units confirmed | الوحدات المتأكدة |
status | Status | الحالة |
sentOn | Sent {d} | اتبعت {d} |
stockUsed | Stock used | المستخدم من المخزون |
sent | Sent | اتبعت |
delivered | Delivered | اتسلم |
receivedVsClaimed | Received vs claimed | اللي وصل قصاد اللي اتقال |
state | State | الوضع |
ofTotal | {used} of {total} units used | {used} من {total} وحدة اتستخدمت |
claimsLabel | Gift stock claims | شحنات الهدايا |
byBrandLabel | Gift stock by brand | مخزون الهدايا لكل براند |
says | What {b} says it sent | {b} بيقول بعت إيه |
saysVs | What {b} says it sent vs what arrived | {b} بيقول بعت إيه قصاد اللي وصل |
product | Product | المنتج |
brandSays | Brand says sent | البراند بيقول بعت |
inFull | Arrived in full? | وصل كامل؟ |
good | Good | سليم |
damaged | Damaged | تالف |
missing | Missing | ناقص |
extra | +{n} extra | +{n} زيادة |
allOk | All {n} OK | الـ {n} كلهم تمام |
goodHint | Count | اعدّ |
goodOf | Good units of {p} | الوحدات السليمة من {p} |
damagedOf | Damaged units of {p} | الوحدات التالفة من {p} |
check | Check what arrived · {n} product | راجع اللي وصل · {n} منتج |
tickAll | Tick all as received in full | علّم على الكل إنه وصل كامل |
howTo | Tick each product that arrived in full and undamaged. If a count is off, leave it unticked and enter the good and damaged units you actually received. Units that can't be gifted go under Damaged. Only good units go into {b}'s gift stock. | علّم على كل منتج وصل كامل ومن غير تلف. لو العدد مش مظبوط، سيبه من غير علامة واكتب الوحدات السليمة والتالفة اللي وصلت فعلًا. الوحدات اللي متنفعش هدية تتكتب تحت تالف. الوحدات السليمة بس هي اللي بتدخل مخزون هدايا {b}. |
boxes | Boxes received | الكراتين اللي وصلت |
brandSaid | {b} said {n} | {b} قال {n} |
confirm | Confirm received quantities | أكّد الكميات اللي وصلت |
confirming | Confirming… | بنأكّد… |
boxesErr | Boxes received must be a whole number from 1 to 99. | عدد الكراتين لازم يكون رقم صحيح من 1 لـ 99. |
unitsErr | Enter the good and damaged units for every product (whole numbers, 0 or more). | اكتب الوحدات السليمة والتالفة لكل منتج (أرقام صحيحة، 0 أو أكتر). |
difference | You confirmed {good} of the {claimed} units {b} claimed. Only {good} are in stock. {b} sees the difference and can report a problem. | أكّدت {good} من الـ {claimed} وحدة اللي {b} قال عليها. {good} بس اللي في المخزون. {b} بيشوف الفرق ويقدر يبلّغ عن مشكلة. |
matched | All {good} units matched the claim and are in {b}'s gift stock. | الـ {good} وحدة طابقوا اللي اتقال ودخلوا مخزون هدايا {b}. |
problem | {b} reported a problem ({d}) | {b} بلّغ عن مشكلة ({d}) |
keep | Keep the count | سيب العدد زي ما هو |
recount | Recount | اعد العد |
cancelled | This claim was cancelled. Nothing was added to gift stock. | الشحنة دي اتلغت. مفيش حاجة اتضافت للمخزون. |
shipments | Shipments from brands | الشحنات من البراندات |
problems | {n} problem report open | {n} بلاغ مشكلة مفتوح |
Design guidance
How the BRICKS design system uses GiftClaimCheck. Written in docs/content/components/GiftClaimCheck.md; the props above are read from the code, which wins where the two disagree.
Deprecated since 0.7.0. Use GiftShipmentCard with shipmentId (MIGRATION.md part 11 maps the fields). It keeps working until 1.0.
An alternate of the shipment page's main card, built on DataTable: what the brand says it sent and, while Expected or Arrived, PR's count; use it when a screen follows the fidelity branch's gift claim API (gift_* statuses).
GiftClaimCheck covers the same job as GiftShipmentCard (the v3 mock's claim page) with a different data shape: its status is a statusTables.pr key (gift_expected … gift_cancelled) and each count is kept by product (productId, else name), so a refetch that reorders lines keeps what PR typed. Per product PR ticks "All N OK" or types good and damaged units, enters boxes while Expected, and confirms. Counted claims show Good, Damaged and Missing ("+N extra") with the matched line or a difference banner; an open problem report shows the brand's words with Keep the count / Recount. For a new screen use GiftShipmentCard; this card stays only for screens already on the 0.6.0 gift claim API.
Anatomy
- Card:
<section class="kit-card kit-pr-claim">labelled by its title; head with "What Glow Lab says it sent vs what arrived" and the status pill. - DataTable (label "Product"): Product, Brand says sent; counting: Arrived in full? (checkbox "All 20 OK"), Good, Damaged (72 × 42 numeric inputs, "Count" placeholder); counted: Good, Damaged, Missing.
- Footer: problem banner and Keep / Recount; "Check what arrived · 2 products" with "Tick all as received in full"; the how-to line; Boxes received (Expected, hint "Glow Lab said 2"); errors; "Confirm received quantities" ("Confirming…" while busy); difference banner, matched line or "This claim was cancelled…".
Variants
status | Shows |
|---|---|
gift_expected | Count + Boxes received |
gift_arrived | Count |
gift_confirmed | Counted table + matched line |
gift_confirmed_diff | Counted table + butter difference banner |
gift_cancelled | Claim only + cancelled line |
States
| State | Trigger |
|---|---|
| Ticked row | checkbox: good = claimed, damaged = 0, inputs read-only |
| Invalid | Confirm with bad numbers: aria-invalid inputs, "Enter the good and damaged units for every product (whole numbers, 0 or more)." |
| Bad boxes | not 1-99: field error |
| Empty claim | no lines: Confirm disabled |
| Busy | busy: buttons disabled, "Confirming…" |
| Error | error: alert |
| Reset | claimId, status or expected boxes change |
Types
Same file: giftClaimColumns(language, { onOpen? }, copy?) (the Gift stock list), giftAnalyticsColumns(language, copy?) (By brand), ShipmentSummary.
GiftClaimStatus (status): 'gift_expected' | 'gift_arrived' | 'gift_confirmed' | 'gift_confirmed_diff' | 'gift_cancelled'. GiftClaimLine (lines): { productId?, product, claimed, good?, damaged? }. GiftClaimCheckResult (onConfirm): { boxes: number | null, lines: [{ good, damaged }] }, valid only.
Usage
import { GiftClaimCheck } from '@ergasti/bricks';
<GiftClaimCheck
claimId="GS-0016"
brandName="Glow Lab"
status="gift_arrived"
lines={[{ productId: 'eye', product: 'Eyeshadow palette', claimed: 20 }, { productId: 'lip', product: 'Red lipstick', claimed: 10 }]}
onConfirm={({ lines }) => confirmClaim('GS-0016', lines)}
busy={saving}
error={saveError}
/>// The fidelity Gift stock list and its claim page
<DataTable label="Gift stock claims" rows={claims} rowKey={(c) => c.id} columns={giftClaimColumns('en', { onOpen: (c) => setClaim(c.id) })} />
{claim && (
<GiftClaimCheck claimId={claim.id} brandName={claim.brand.name} status={claim.status} lines={claim.lines}
expectedBoxes={claim.boxes} problem={claim.problem} onKeepCount={keep} onRecount={recount} onConfirm={confirmCount} />
)}Counted with a difference. Good, damaged and missing per product (or "+N extra"), the warning about what is in stock, and the brand's problem report with Keep the count / Recount. (docs example Difference)
import { GiftClaimCheck } from '@ergasti/bricks';
// claimLines: the docs' sample rows (docs/examples/_pr.ts)
export function Difference() {
return (
<GiftClaimCheck
brandName="Glow Lab" status="gift_confirmed_diff" lines={claimLines['GS-0014']}
problem={{ date: '12 Nov', text: 'We packed 30 hand soaps in box 2. Please recount.' }}
onKeepCount={() => {}} onRecount={() => {}}
/>
);
}Where it appears
- PR Portal › Gift stock › a shipment's page (fidelity compositions in
src/gallery/screens,PrScreens*), states Expected (GS-0017), Arrived (GS-0016), Confirmed with difference + problem (GS-0014). - Dashboard screen: PrGifts (the list it opens from).
Guidelines
Do
- Pass
claimId(or stableproductIds) so a refetch never wipes a half-finished count. - Use the same API family on one screen:
giftClaimColumns+GiftClaimCheck+ShipmentSummary.
Don't
- Don't mix it with
GiftShipmentCardon one page. - Don't treat claimed units as stock.
RTL and Arabic
Mirrors with the DataTable; Arabic-Indic digits are converted. Arabic words: "وصل كامل؟", "سليم", "تالف", "ناقص", "اعدّ", "أكّد الكميات اللي وصلت".
Tokens
--line, --card, --ink, --ink-2, --ink-3, --soft, --rasp, --bad, --focus-ring-field, --min-touch-target (kit-pr-num).
Accessibility
DataTable with named inputs ("Good units of Red lipstick"), aria-invalid on bad fields, alerts as role="alert", checkbox labels with the "All N OK" text.
Found in the source
- Roles in the markup:
alert. - ARIA attributes set:
aria-hidden,aria-label,aria-invalid.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
GiftShipmentCard: the primary shipment card.ShipmentSummary: the matching Shipments-from-brands card.GiftStatusPills: shipment state pills.
See also: Banner · Button · DataTable · FormField · useLanguage · BrandCell · PrStatusPill · BrandGiftStockCard · GiftAttentionList · GiftShipmentCounts
Source
src/pr/gifts/GiftClaims.tsx (line 279) on GitHub.