Skip to content

Commit 3a8c7f0

Browse files
docs: collection flow events docs update (#2821)
1 parent a4e1e74 commit 3a8c7f0

File tree

1 file changed

+40
-28
lines changed
  • websites/docs/src/content/docs/en/collection-flow

1 file changed

+40
-28
lines changed

websites/docs/src/content/docs/en/collection-flow/iframe.mdx

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,26 @@ To handle exit events from the Collection Flow app, you can use the following Ja
2525

2626
```javascript
2727
window.addEventListener('message', function(event) {
28-
if (event.data.type === 'ballerine.collection-flow.back-button-pressed') {
29-
// Handle "Back to Portal" button press from side menu
30-
console.log('Back button pressed');
31-
// Add your custom handling logic here
32-
} else if (event.data.type === 'ballerine.collection-flow.finish-button-pressed') {
33-
// Handle "Finish" button press from flow complete page
34-
console.log('Finish button pressed');
35-
// Add your custom handling logic here
36-
}
28+
if (event.data === 'ballerine.collection-flow.user-exited') {
29+
// Handle "Back to Portal" button press from side menu
30+
console.log('Back button pressed');
31+
// Add your custom handling logic here
32+
} else if (event.data === 'ballerine.collection-flow.flow-failed') {
33+
// Handle flow failure
34+
console.log('Flow completed successfully');
35+
// Add your custom handling logic here
36+
} else if (event.data === 'ballerine.collection-flow.flow-completed') {
37+
// Handle flow completion
38+
console.log('Flow completed successfully');
39+
// Add your custom handling logic here
40+
}
3741
});
3842
```
3943

4044
## Event Types
41-
- **ballerine.collection-flow.back-button-pressed**: Triggered when the user presses the "Back to Portal" button from the side menu.
42-
- **ballerine.collection-flow.finish-button-pressed**: Triggered when the user presses the "Finish" button from the flow completion page.
45+
- **ballerine.collection-flow.user-exited**: Triggered when the user presses the "Back to Portal" button from the side menu.
46+
- **ballerine.collection-flow.flow-completed**: Triggered when the user presses the "Finish" button from the flow completion page.
47+
- **ballerine.collection-flow.flow-failed**: Triggered when an unexpected error occured after the final submission of the flow.
4348

4449
By handling these events, you can implement custom logic to navigate users back to your main application or perform other actions based on their interactions within the Collection Flow iframe.
4550

@@ -50,26 +55,33 @@ Here is an example of how you might integrate the Collection Flow app as an ifra
5055
<!DOCTYPE html>
5156
<html lang="en">
5257
<head>
53-
<meta charset="UTF-8">
54-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
55-
<title>Collection Flow Iframe Integration</title>
58+
<meta charset="UTF-8">
59+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
60+
<title>Collection Flow Iframe Integration</title>
5661
</head>
5762
<body>
58-
<iframe src="https://your-collection-flow-url.com" style="width: 100%; height: 500px;" id="collection-flow-iframe"></iframe>
63+
<iframe
64+
src="https://your-collection-flow-url.com"
65+
style="width: 100%; height: 500px;" id="collection-flow-iframe">
66+
</iframe>
5967

60-
<script>
61-
window.addEventListener('message', function(event) {
62-
if (event.data.type === 'ballerine.collection-flow.back-button-pressed') {
63-
// Handle "Back to Portal" button press from side menu
64-
console.log('Back button pressed');
65-
// Add your custom handling logic here
66-
} else if (event.data.type === 'ballerine.collection-flow.finish-button-pressed') {
67-
// Handle "Finish" button press from flow complete page
68-
console.log('Finish button pressed');
69-
// Add your custom handling logic here
70-
}
71-
});
72-
</script>
68+
<script>
69+
window.addEventListener('message', function(event) {
70+
if (event.data === 'ballerine.collection-flow.user-exited') {
71+
// Handle "Back to Portal" button press from side menu
72+
console.log('Back button pressed');
73+
// Add your custom handling logic here
74+
} else if (event.data === 'ballerine.collection-flow.flow-failed') {
75+
// Handle flow failure
76+
console.log('Flow completed successfully');
77+
// Add your custom handling logic here
78+
} else if (event.data === 'ballerine.collection-flow.flow-completed') {
79+
// Handle flow completion
80+
console.log('Flow completed successfully');
81+
// Add your custom handling logic here
82+
}
83+
});
84+
</script>
7385
</body>
7486
</html>
7587
```

0 commit comments

Comments
 (0)