From 12a6b17917268715cf5571a9128b0c1aba498090 Mon Sep 17 00:00:00 2001 From: Deborah Femia Date: Fri, 16 Aug 2024 19:08:44 +0000 Subject: [PATCH] GITBOOK-418: Add connect_webview.login_failed/succeeded events --- docs/api-clients/events/README.md | 3 ++- .../verifying-successful-account-connection.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/api-clients/events/README.md b/docs/api-clients/events/README.md index ba2b51c0..3a3c7f00 100644 --- a/docs/api-clients/events/README.md +++ b/docs/api-clients/events/README.md @@ -103,10 +103,11 @@ Noise sensors emit an event whenever a predefined noise threshold has been excee | `access_code.unmanaged.removed` | An unmanaged `access_code` has been removed. | | `connected_account.created` | A connected account has been imported into your Seam workspace. | | `connected_account.connected` | Seam has established connection to or is reconnected to a connected account. | -| `connected_account.successful_login` | A webview login was successfully completed for a connected account. Sent even if the account was previously connected, and a separate webview login was completed. | | `connected_account.disconnected` | Seam has lost connection to a connected account. Please ask the account owner to sign in to their account through a new connect webview again. | | `connected_account.deleted` | A connected account has been deleted from your Seam workspace. | | `connected_account.completed_first_sync` | Seam has finished the first sync of a connected account and devices are now available. | +| `connect_webview.login_succeeded` |

A login using a Connect Webview was completed successfully.

Sent even if the account was previously connected and a separate Connect Webview login was completed.

| +| `connect_webview.login_failed` | A login using a Connect Webview failed. | | `device.accessory_keypad_connected` | An accessory keypad has been connected to a device. | | `device.accessory_keypad_disconnected` | An accessory keypad has been disconnected from a device. | | `device.connected` | A device has come online. | diff --git a/docs/ui-components/connect-webviews/verifying-successful-account-connection.md b/docs/ui-components/connect-webviews/verifying-successful-account-connection.md index ffbb6a3f..da06272e 100644 --- a/docs/ui-components/connect-webviews/verifying-successful-account-connection.md +++ b/docs/ui-components/connect-webviews/verifying-successful-account-connection.md @@ -251,7 +251,7 @@ For more information, see [Webhooks](../../core-concepts/webhooks.md). When you [host a Connect Webview in an HTML iframe](../../core-concepts/connect-webviews/embedding-a-connect-webview-in-your-app.md#embed-the-connect-webview-in-an-iframe), the [iframe](https://www.w3schools.com/html/html\_iframe.asp) uses `window.parent.postMessage` to send messages to the parent window that is hosting the iframe. `window.parent.postMessage` is a cross-origin communication mechanism available in web browsers. -Register an event listener for the parent window containing the iframe to monitor for `message` events. Specifically, listen for a `webview.login_successful` event. This event indicates that Seam has successfully established the connection to the user's device or ACS account. A `webview.login_failed` event indicates that the account connection did not complete successfully. Further, the `webview.login_failed` event contains an `error_code` and `error_message` to help you troubleshoot the issue. +Register an event listener for the parent window containing the iframe to monitor for `message` events. Specifically, listen for a `connect_webview.login_succeeded` event. This event indicates that Seam has successfully established the connection to the user's device or ACS account. A `connect_webview.login_failed` event indicates that the account connection did not complete successfully. For example: @@ -259,7 +259,7 @@ For example: window.addEventListener( "message", (event) => { - if (event.data?.event?.event_type === "webview.login_successful") { + if (event.data?.event?.event_type === "connect_webview.login_succeeded") { // Do something. } },