Handling Livble SDK Events

The Livble SDK emits events for key user actions,
allowing your frontend to respond in real time for a more integrated experience.

Your frontend implements the onEvent callback and passes it to the Livble SDK.
Inside this function, you can choose which events to handle based on your needs.

💻 Code Snippet

Example structure for an onEvent implementation:

function onEvent(eventType: string, data: any) => {
    switch (eventType) {
      case "USER_APPROVED":
        ...;
        break;
      case "SPLIT_RENT":
        ...;
        break;
      case "REPAY":
        ...
        break;
      case "EXPERIENCE_CLOSED":
        ...
        break;
    }
}

📋 Livble SDK Events Reference Table

🏷️ eventType ⏳ When You Get It? 📦 data
"EXPERIENCE_OPENED" The Livble Experience was opened {}
"USER_APPROVED" The user has completed underwriting and was approved {}
"USER_DECLINED" The user has completed underwriting and was declined {}
"SPLIT_RENT" The user has successfully split rent using the Livble Experience.

⚠️ This is a Key Event
🔗 Learn more about payment handling
{
    settlement_id: int,
    amount: int,
    charges_paid: string[],
    charges_and_amounts_paid: {
        charge_id: string,
        amount_in_cents: int
    }[],
}
"REPAY" The user successfully initiated a repayment to Livble {}
"EXPERIENCE_CLOSED" The Livble Experience was closed {}
"ERROR" An error occurred in the Livble Experience {code: int, msg: string}