PeaxDocsv0.2.0
Reference

Consent v0.2.0

Events

Distinguish committed decisions from preference drafts and navigation.

All messages arrive through onMsg. The complete union is generated on the Banner API page.

TypeAdditional payloadApplication action
on_accept_allNoneConstruct allowed choices, persist, enforce, close
on_reject_allNoneRetain required choices, reject optional choices, persist, enforce, close
on_apply_preferencespreferencesCommit the selected category map and close
on_change_preferencesectionId, checkedObserve a draft edit; do not commit
on_open_preferencessourceSet isOpen to true when the source is floating-button
on_close_preferencessourceSet isOpen to false when the source is floating-button; do not commit

Apply includes disabled sections and can emit an unchanged selection. An empty section list produces an empty map. Decision messages leave the view open until the application updates isOpen.

Navigation messages identify their source as banner or floating-button. Navigation from the banner changes its internal view; floating-button navigation requests application-controlled visibility:

if (msg.type === 'on_open_preferences' && msg.source === 'floating-button') {
  setOpen(true)
}
if (msg.type === 'on_close_preferences' && msg.source === 'floating-button') {
  setOpen(false)
}

Keep handling Accept, Reject and Apply separately to commit choices. Close and Escape discard drafts without granting consent.

On this page

No Headings