Saltar al contenido principal

Event Handling

The Web Low-Code SDK provides a set of custom browser events to allow developers to track the lifecycle of a flow, user interactions, and errors in real time. These events can be used to trigger application logic, analytics tracking, or debugging tools.


Tracking User Interactions

The SDK emits events at key points in the flow lifecycle, such as:

  • When the SDK has been successfully loaded and initialized
  • When the user completes or cancels the flow
  • When an error occurs at any step
  • When internal actions or transitions happen (e.g., moving between steps)

These events are dispatched from the window object and can be subscribed to using the standard addEventListener method.


Subscribing to SDK Events

Below is a list of the main events emitted by the SDK:

sdkStarted

Emitted when the SDK is fully initialized and ready to start.

window.addEventListener('sdkStarted', () => {
console.log('✅ SDK has started');
});

sdkFinished

Emitted when the flow is successfully completed.

window.addEventListener('sdkFinished', (event) => {
console.log('🎉 SDK flow finished', event.detail);
});

sdkError

Emitted when an error occurs at any point during the flow execution.

window.addEventListener('sdkError', (event) => {
console.error('❌ SDK encountered an error', event.detail);
});

sdkCanceled

Emitted when the user manually cancels the flow or navigates away.

window.addEventListener('sdkCanceled', () => {
console.warn('⚠️ SDK flow was canceled by the user');
});

sdkFinishStep

This event is emitted when one of the steps of the flow ends.

window.addEventListener('sdkFinishStep', () => {
console.warn('⚠️ SDK flow step finished');
});

Debugging and Logging

For development and troubleshooting, the SDK supports debug logging by appending the debug=true query parameter to the script:

<script type="module" src="sdk-loader.js?id=YOUR_INTEGRATION_ID&debug=true"></script>

This enables detailed logs in the browser console, including:

  • Loaded configuration
  • Step transitions
  • Validation results
  • Errors and stack traces

🔐 Important: Make sure to disable debug mode in production environments.


These event hooks make it easy to integrate the SDK into your app’s analytics, session monitoring, and user support systems.