SDK
Events
Observe the dialog lifecycle through one strict discriminated union.
Use onEvent when you want one exhaustive analytics or product integration:
await domain0.connectDomain({
client,
connectionId,
onEvent: (event) => {
switch (event.type) {
case 'step_change':
case 'success':
case 'close':
case 'request_close':
case 'shared_flow_sent':
case 'manual_setup_documentation_click':
case 'dkim_setup_documentation_click':
analytics.track(`domain0_${event.type}`, event)
break
}
},
})Domain0ConnectEventSchema validates the union at runtime. Focused callbacks
such as onSuccess, onClose, and onStepChange are available when a host
does not need the full stream.
Close interception
await domain0.connectDomain({
client,
connectionId,
onRequestClose: async () => {
if (await confirmExit()) domain0.close()
},
})This intercepts the widget's Close button. Escape and host-driven destruction keep their native close reasons so your application can distinguish them.