Postback Config
A server-to-server postback URL, validated against its macros. A postback missing {click_id} returns 200 and attributes nothing — this says so before it ships rather than in a reconciliation weeks later.
src/components/ui/postback-config.tsxAbout
From the component's own source, where it was written.
A server-to-server postback URL with its macros.
The available macros are listed and validated against the URL. A postback missing {click_id} silently attributes nothing — the requests arrive, they return 200, and no conversion is ever matched — so an unresolved or unknown macro is called out before it ships rather than discovered in a reconciliation weeks later.
http:// is flagged. Postbacks carry payout amounts and click identifiers, and sending them in the clear is a real leak, not a style preference.
Install
npx astralyx-ui add postback-config
Usage
import { PostbackConfig } from '@/components/ui/postback-config'
<PostbackConfig url={url} onUrlChange={setUrl} macros={macros} status="ok" />Composer
Change the props and the source below follows.
- Your click identifier. Without it nothing can be attributed.
- Commission for the conversion, in the campaign currency.
- ISO 4217 code for the payout.
- The offer the conversion belongs to.
- approved, pending or rejected.
- Advertiser's transaction reference, for deduplication.
<PostbackConfig url={url} onUrlChange={setUrl} macros={macros} status="ok" />API
Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.
PostbackConfig
Extends Omit<ComponentProps<'div'>, 'onChange'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| url | string | — | Controlled or uncontrolled. Uncontrolled is fine for a preview; a real config screen owns the value. |
| onUrlChange | (url: string) => void | — | Controlled or uncontrolled. Uncontrolled is fine for a preview; a real config screen owns the value. |
| macros | Macro[] | required | { token, description, required? }. Clicking one appends it to the URL, which beats retyping braces. |
| method | 'GET' | 'POST' | 'GET' | — |
| onMethodChange | (method: 'GET' | 'POST') => void | — | — |
| lastFired | ReactNode | — | Delivery health. "Firing, last 4 minutes ago" is the answer to the only question anyone opens this screen with. |
| status | 'ok' | 'failing' | 'untested' | — | Delivery health. "Firing, last 4 minutes ago" is the answer to the only question anyone opens this screen with. |
| urlLabel | ReactNode | 'Postback URL' | — |
| urlPlaceholder | string | 'https://tracker.example.com/pb?cid={click_id}&payout={payout}' | — |
| macrosLabel | ReactNode | 'Available macros' | — |
| requiredLabel | ReactNode | 'required' | Badge on a macro that must appear in the URL. |
| inUseLabel | string | 'in use' | Accessible name for the tick beside a macro already in the URL. |
| insecureNote | ReactNode | 'This posts click identifiers and payouts over plain HTTP.' | — |
| missingNote | (tokens: string[]) => ReactNode | DEFAULT_MISSING_NOTE | Warning for required macros absent from the URL. |
| unknownNote | (tokens: string[]) => ReactNode | DEFAULT_UNKNOWN_NOTE | — |
| statusLabels | { ok?: ReactNode; failing?: ReactNode; untested?: ReactNode } | { ok: 'Firing', failing: 'Failing', untested: 'Not tested' } | — |
| lastFiredLabel | ReactNode | 'last fired' | Precedes the last-fired time. |
Types
Macro
A server-to-server postback URL with its macros.
| Field | Type | Description |
|---|---|---|
| token | string | — |
| description | ReactNode | — |
| required? | boolean | — |
Behaviour
| Topic | Detail | Description |
|---|---|---|
| validation | live | Required macros that are missing, macros that are not in your list, and plain http:// are each called out separately. |