- Name
code- Kind
- property
- Type
string- Requirement
- required
DocsAPI referenceUI machinescoupon-input
coupon-input machine
The public state machine contract for @grassroot/ui-machines/coupon-input. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/coupon-input
Package
Service example
coupon-input.tsts
import { createService } from "@grassroot/statechart";import { couponInputMachine } from "@grassroot/ui-machines/coupon-input"; const service = createService(couponInputMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();11 of 11
Exports
CouponInputCommand
typeCouponInputCommandts
type CouponInputCommand = (CommandObject & { readonly type: "APPLY_REQUEST"; readonly code: string; readonly reason: CouponInputReason;}) | (CommandObject & { readonly type: "CODE_CHANGE_REQUEST"; readonly code: string; readonly reason: CouponInputReason;});CouponInputContext
typeCouponInputContextts
type CouponInputContext = { readonly code: string; readonly pending: boolean; readonly status: CouponInputStatus; readonly mode: "controlled" | "uncontrolled";};Name
Kind
Type
Requirement
codeproperty
stringrequired
modeproperty
"controlled" | "uncontrolled"required
pendingproperty
booleanrequired
statusproperty
CouponInputStatusrequired
- Name
mode- Kind
- property
- Type
"controlled" | "uncontrolled"- Requirement
- required
- Name
pending- Kind
- property
- Type
boolean- Requirement
- required
- Name
status- Kind
- property
- Type
CouponInputStatus- Requirement
- required
CouponInputDiagnosticCodests
export declare const CouponInputDiagnosticCodes: readonly DiagnosticCatalogueEntry[];CouponInputEvent
typeCouponInputEventts
type CouponInputEvent = { readonly type: "SET_CODE"; readonly code: string; readonly reason: CouponInputReason;} | { readonly type: "SUBMIT"; readonly reason: CouponInputReason;} | { readonly type: "APPLY_SUCCEEDED";} | { readonly type: "APPLY_FAILED";} | { readonly type: "RESET";};CouponInputInput
typeCouponInputInputts
type CouponInputInput = { readonly code?: string; readonly defaultCode?: string; readonly pending?: boolean; readonly status?: CouponInputStatus;};Name
Kind
Type
Requirement
codeproperty
stringoptional
defaultCodeproperty
stringoptional
pendingproperty
booleanoptional
statusproperty
CouponInputStatusoptional
- Name
code- Kind
- property
- Type
string- Requirement
- optional
- Name
defaultCode- Kind
- property
- Type
string- Requirement
- optional
- Name
pending- Kind
- property
- Type
boolean- Requirement
- optional
- Name
status- Kind
- property
- Type
CouponInputStatus- Requirement
- optional
couponInputMachine
valuecouponInputMachinets
export declare const couponInputMachine: Machine<CouponInputInput, "ready", CouponInputContext, CouponInputEvent, CouponInputCommand>;CouponInputReason
typeCouponInputReasonts
type CouponInputReason = "pointer" | "keyboard" | "programmatic";couponInputReplaySequencets
export declare const couponInputReplaySequence: readonly CouponInputEvent[];couponInputSelectors
valuecouponInputSelectorsts
export declare const couponInputSelectors: { code: (snapshot: CouponInputSnapshot) => string; pending: (snapshot: CouponInputSnapshot) => boolean;};Name
Kind
Type
Requirement
codeproperty
(snapshot: CouponInputSnapshot) => stringrequired
pendingproperty
(snapshot: CouponInputSnapshot) => booleanrequired
- Name
code- Kind
- property
- Type
(snapshot: CouponInputSnapshot) => string- Requirement
- required
- Name
pending- Kind
- property
- Type
(snapshot: CouponInputSnapshot) => boolean- Requirement
- required
CouponInputSnapshot
typeCouponInputSnapshotts
type CouponInputSnapshot = Snapshot<"ready", CouponInputContext>;CouponInputStatus
typeCouponInputStatusts
type CouponInputStatus = "idle" | "applying" | "applied" | "error";