Interface WebFlowInput

Hierarchy

  • WebFlowInput

Properties

startUrl: string

The URL to start navigation.

allowedDomains: string[]

A list of domains that are allowed to be accessed during the web flow.

If the user tries to navigate to a domain that is not in this list, the navigation will be stopped.

If this list is empty, no domain will be allowed.

Example:

 allowedDomains: ["domain1.com", "domain2.tech"]
allowedDomains: ["*"] // allows all domains. Use with caution.
stopPattern?: string

A substring matched against each URL the web flow navigates to. When a URL contains this value, the flow finishes successfully and start() resolves. An empty string matches the first navigation, so omit the property instead of passing one.

Matching is a plain substring test, not a regular expression — regex metacharacters are treated literally.

Optional. When omitted, the flow does not end on navigation: it ends when the user closes it, when the page calls window.close(), or when maxNavigationLimit is reached. Omit it for flows driven by eventCallback or closed manually, rather than passing a sentinel value that never matches.

Compatibility Control

  • API LEVEL 23 - Functionality added
  • API LEVEL 38 - Becomes optional
maxNavigationLimit?: number

The maximum number of navigations allowed before stopping the web flow.

If the navigation count reaches this limit, the web flow will be stopped.

Default value: 10

onLoadJsScript?: string

A js script to be executed when the startUrl completes loading.

keepLoadingScreenUntilDomainChange?: boolean

Shows a loading screen until the browser navigates away from the initial domain. This is useful to prevent the user from interacting with the app while the web flow is loading.

Use cases: Login with Google, Login with Facebook, etc. The loading screen will remain visible until the user is redirected to a different domain, typically triggered by onLoadJsScript.

Default value: false

userAgent?: string

Overrides the default User-Agent string sent by the web view.

Useful when the target website requires a specific browser identity or when the default desktop UA causes undesired behaviour (e.g., triggering bot-detection, forcing a desktop layout, or failing OAuth provider checks).

When omitted, the web view uses its built-in default User-Agent.

Example:

userAgent: "Mozilla/5.0 (Linux; Android 10; Mobile) AppleWebKit/537.36"
cookies?: WebFlowCookie[]

Cookies to inject into the WebView before the first navigation.

Each cookie requires a name and value. The domain and path are optional and default to the host derived from startUrl and "/" respectively. All cookies use a default expiration of 48 hours.

Example:

cookies: [
{ name: "session_id", value: "abc123" },
{ name: "auth_token", value: "xyz789", domain: ".example.com", path: "/api" }
]
headerStyle?: WebFlowHeaderStyle

When provided, the web flow interface will display a header with the specified style.

showCloseButton?: boolean

Whether the web flow shows a close button.

Defaults to true. When false, neither the floating close button nor the header close button is rendered.

Make sure the flow still has a way to finish before hiding it: a stopPattern, a maxNavigationLimit, or a page that calls window.close(). Without any of them the user has no way to leave the flow.

Compatibility Control

  • API LEVEL 38 - Functionality added
bridgeName?: string

Installs a JavaScript bridge with this exact name inside the web flow, allowing the page to send messages back to your eitri-app while the flow is running.

The page sends messages calling:

window.<bridgeName>.postMessage("any string")

Every message is delivered to eventCallback.

Must be a valid JavaScript identifier of up to 64 characters: only letters, digits, _ and $, not starting with a digit.

Must be provided together with eventCallback.

Compatibility Control

  • API LEVEL 38 - Functionality added
eventCallback?: ((message) => void)

Type declaration

    • (message): void
    • Invoked for every message the page sends on the bridge named by bridgeName.

      data is always a string and is never parsed. When the page sends a JSON string, data is that string, so parse it yourself.

      The page should send a string. If it sends an object, the object is serialized to its JSON text so both platforms deliver the same value.

      ⚠️ The web flow renders a page you do not control, so treat data as untrusted input: validate it before use, and never use it as an authenticated value without verifying it on your backend.

      Unsubscribed automatically when the web flow finishes.

      Must be provided together with bridgeName.

      Compatibility Control

      • API LEVEL 38 - Functionality added

      Parameters

      Returns void

Generated using TypeDoc