Exit Button
In Hybrid Experience, your product owns the borrower journey until offer selection. After the borrower selects an offer, your back-end requests a Hosted URL and opens Hosted Experience for selected-offer execution.
The Hosted surface can show an Exit button after this handoff. This gives the borrower a clear way to leave the Aarthik Labs hosted step and return to your product.
Where It Applies
The Exit button applies after Hybrid has moved the borrower into Hosted Experience:
The returned hosted_url is short-lived and should be opened immediately in the borrower browser, webview, or app shell.
For Hybrid handoff URLs, the Hosted session is created with the exit action enabled. Your app should be ready to handle the exit event before opening the returned hosted_url.
Handoff Flow
What The Borrower Sees
When the borrower is inside the Hosted handoff surface, Hosted shows an Exit button in the header.
When the borrower selects it, Hosted:
- clears the borrower session from the Hosted browser surface
- clears the applied Hosted theme from the page
- sends an
aarthik-labs:exitevent to the parent web page or mobile bridge - attempts a best-effort browser close for Hybrid-to-Hosted sessions
The browser close is best-effort because browsers only allow window.close() in some contexts. Your app should still handle the exit event and close or hide the Hosted surface itself.
Web Handling
If your Hybrid UI opens Hosted in an iframe, modal, popup, or app-controlled browser surface, listen for the exit event.
The event payload looks like this:
Use the event to close the Hosted surface. Do not use it as a loan-status signal. Loan progress should still come from the Hybrid APIs and lifecycle web-hooks.
Mobile App Handling
If your Hybrid journey runs inside a mobile app, register the mobile bridge before opening the Hosted URL.
Hosted can send the exit event through the supported mobile bridge surfaces, including:
ReactNativeWebView.postMessagewebkit.messageHandlers.AarthikLabs.postMessageflutter_inappwebview.callHandler("onAarthikLabsExit", ...)AarthikLabs.postMessage
When your app receives aarthik-labs:exit, close the Hosted webview or route the borrower back to your Hybrid app screen.
Read Mobile App Bridge for the full bridge contract.
Recommended Behavior
For Hybrid integrations, we recommend:
- register the web or mobile message handler before opening
hosted_url - close or hide the Hosted surface after receiving
aarthik-labs:exit - return the borrower to your product home, loan dashboard, or offer-summary screen
- continue using lifecycle web-hooks and Hybrid APIs for actual journey status
- request a fresh
hosted_urlif the borrower chooses to continue the selected offer later
Do not reuse an old hosted_url as a resume link. It contains short-lived session material and may expire.
Testing Checklist
Before launch, test:
- the Hybrid offer-selection flow returns a
hosted_url - the Hosted URL opens immediately after offer selection
- the
Exitbutton is visible after handoff - clicking Exit sends
aarthik-labs:exit - your web page, webview, or app shell closes or hides Hosted
- the borrower lands on the intended Hybrid app screen
- reopening the selected offer requests a fresh
hosted_url - mobile bridge handling works on real Android and iOS devices, if applicable