{"id":21743928,"url":"https://github.com/telefonica/webview-bridge","last_synced_at":"2025-07-06T20:05:52.723Z","repository":{"id":37702177,"uuid":"169111133","full_name":"Telefonica/webview-bridge","owner":"Telefonica","description":"Novum JavaScript Bridge","archived":false,"fork":false,"pushed_at":"2025-06-23T08:25:38.000Z","size":4450,"stargazers_count":29,"open_issues_count":6,"forks_count":10,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-06-23T09:31:07.914Z","etag":null,"topics":["cdco","managed","org-cdo","srv-novum"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Telefonica.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-04T16:39:37.000Z","updated_at":"2025-06-23T08:25:42.000Z","dependencies_parsed_at":"2024-04-24T14:41:47.029Z","dependency_job_id":"c7e617a7-1841-4bfd-8662-a118ad6af89c","html_url":"https://github.com/Telefonica/webview-bridge","commit_stats":null,"previous_names":["tef-dig/webview-bridge"],"tags_count":130,"template":false,"template_full_name":null,"purl":"pkg:github/Telefonica/webview-bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Fwebview-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Fwebview-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Fwebview-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Fwebview-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Telefonica","download_url":"https://codeload.github.com/Telefonica/webview-bridge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Fwebview-bridge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263966172,"owners_count":23536814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdco","managed","org-cdo","srv-novum"],"created_at":"2024-11-26T07:09:26.832Z","updated_at":"2025-07-06T20:05:52.712Z","avatar_url":"https://github.com/Telefonica.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"75%\" src=\"./doc/webview-bridge-logo.png\"/\u003e\n\u003c/p\u003e\n\n[![GitHub tag](https://img.shields.io/github/tag/tef-dig/webview-bridge.svg)](https://github.com/tef-dig/webview-bridge)\n[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/tef-dig/webview-bridge/blob/master/LICENSE)\n![CI status](https://github.com/tef-dig/webview-bridge/workflows/CI/badge.svg)\n\nJavaScript library to access to native functionality. Requires a webview with a\npostMessage bridge.\n\nLibrary size ~1.2 Kb (min + gzip)\n\n[AMD](https://github.com/amdjs/amdjs-api/wiki/AMD),\n[UMD](https://github.com/umdjs/umd),\n[IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE),\n[ES Module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)\nbuilds available (see\n[package dist folder](https://unpkg.com/@tef-novum/webview-bridge/dist/)). Open\nan issue if you need a different build.\n\n## Usage\n\n### NPM\n\nWe recommend to manage your dependencies using `npm` or `yarn` and use a bundler\nlike [webpack](https://webpack.js.org/) or [parcel](https://parceljs.org/). Once\nconfigured, you can use\n[ES imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).\n\nInstall using `npm`:\n\n```bash\nnpm i @tef-novum/webview-bridge\n```\n\nInstall using `yarn`:\n\n```bash\nyarn add @tef-novum/webview-bridge\n```\n\nImport required function and use it:\n\n```javascript\nimport {setWebViewTitle} from '@tef-novum/webview-bridge';\n\nsetWebViewTitle('Hello, world');\n```\n\n### CDN\n\nAlternatively, you can import the library directly from a CDN:\n\n```html\n\u003cscript src=\"https://unpkg.com/@tef-novum/webview-bridge/dist/webview-bridge-iife.min.js\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n    webviewBridge.setWebViewTitle('Hello, world');\n\u003c/script\u003e\n```\n\n## API\n\n### isWebViewBridgeAvailable\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nReturns true if WebView Bridge is available. Use this function to implement\nfallbacks in case the bridge is not available.\n\n```ts\nisWebViewBridgeAvailable: () =\u003e boolean;\n```\n\n#### Inside an `iframe`\n\nBy default, the bridge will be disabled inside an iframe. If you want to enable\nit, add a `data-enable-webview-bridge` attribute to the host `iframe` element.\n\n#### Example\n\n```javascript\nif (isWebViewBridgeAvailable()) {\n    nativeAlert('Hello'); // use bridge\n} else {\n    myCustomAlert('Hello'); // use alternative implementation\n}\n```\n\nYou may want to detect if the page is displayed inside a regular browser or an\nAndroid or iOS WebView.\n\n```javascript\n/** Returns true if application is running inside a Novum App WebView */\nconst isWebView = () =\u003e isWebViewBridgeAvailable();\n\n/** Returns true if application is running inside a Novum App WebView running on Android */\nconst isAndroidWebView = () =\u003e\n    isWebViewBridgeAvailable() \u0026\u0026 navigator.userAgent.includes('Android');\n\n/** Returns true if application is running inside a Novum App WebView running on iOS */\nconst isIOSWebView = () =\u003e\n    isWebViewBridgeAvailable() \u0026\u0026 !navigator.userAgent.includes('Android');\n```\n\n### requestContact\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=25.5\u003c/kbd\u003e\n\nShow native picker UI in order to let the user select a contact.\n\n-   Android only: picker UI elements can be filtered by available phones\n    (default) or emails. `filter` property is ignored by iOS devices\n\n-   If the user exists the flow without selecting a a contact, an error is\n    returned\n\n\u003cimg height=\"550\" src=\"doc/webview-bridge-contact-ios.png\"\u003e\u003cimg height=\"550\" src=\"doc/webview-bridge-contact-android.png\"\u003e\n\n```ts\nrequestContact: ({filter?: 'phone' | 'email'}) =\u003e Promise\u003c{\n    name?: string;\n    email?: string;\n    phoneNumber?: string;\n    address?: {\n        street?: string;\n        city?: string;\n        country?: string;\n        postalCode?: string;\n    };\n}\u003e;\n```\n\nAll fields in response object are optional\n\n#### Example\n\n```javascript\nrequestContact({filter: 'phone'}).then((contact) =\u003e {\n    console.log(contact);\n}).catch(err =\u003e {\n    console.error(err);\n};\n```\n\n### createCalendarEvent\n\nInserts an event in calendar\n\n\u003cimg height=\"550\" src=\"doc/webview-bridge-calendar-ios.png\"\u003e\u003cimg height=\"550\" src=\"doc/webview-bridge-calendar-android.png\"\u003e\n\n```ts\ncreateCalendarEvent: ({\n    beginTime: number,\n    endTime: number,\n    title: string\n}) =\u003e Promise\u003cvoid\u003e;\n```\n\n`beginTime` and `endTime` are timestamps with millisecond precision\n\n#### Example\n\n```javascript\ncreateCalendarEvent({\n    beginTime: new Date(2019, 10, 06).getTime(),\n    endTime: new Date(2019, 10, 07).getTime(),\n    title: \"Peter's birthday\",\n}).then(() =\u003e {\n    console.log('event created');\n}).catch(err =\u003e {\n    console.error(err);\n};\n```\n\n### share\n\n\u003ckbd\u003eApp version \u003e=10.7\u003c/kbd\u003e \u003ckbd\u003eAvailable in B2P App version \u003e=25.5\u003c/kbd\u003e\n\nInvokes the native sharing mechanism of the device.\n\n```ts\ntype ShareOptions =\n    | {\n          text: string;\n      }\n    | {\n          url: string;\n          fileName: string;\n          text?: string;\n      };\n\nshare: (options: ShareOptions) =\u003e Promise\u003cvoid\u003e;\n```\n\n-   If no `url` is present, `text` is used as item to share\n-   If `url` param is present, it contains the URL to the shared file\n-   `fileName` param is mandatory if `url` is set\n-   If `url` and `text` are set, `text` is used as `Intent BODY` (if platform\n    allows it)\n\n#### Example\n\n```javascript\n// sharing a text string\nshare({text: 'Hello, world!'});\n\n// sharing a file\nshare({url: 'https://path/to/file', fileName: 'lolcats.png'});\n```\n\n### shareBase64\n\n\u003ckbd\u003eApp version \u003e=24.6\u003c/kbd\u003e\n\nInvokes the native sharing mechanism of the device to share a file. The file is\nprovided as a base64 encoded string.\n\n```ts\nshareBase64: ({contentInBase64: string; fileName: string}) =\u003e Promise\u003cvoid\u003e;\n```\n\n-   The file type will be inferred from the `fileName` extension.\n\n#### Example\n\n```ts\nshareBase64({\n    contentInBase64: 'SGVsbG8sIHd(...)vcmxkCg==',\n    fileName: 'hello.pdf',\n});\n```\n\n### downloadBase64\n\n\u003ckbd\u003eApp version \u003e=24.10\u003c/kbd\u003e \u003ckbd\u003eApp version \u003e=24.9 in O2ES\u003c/kbd\u003e\n\nOpens the provided file using the download webview mode. The file is provided as\na base64 encoded string.\n\n```ts\ndownloadBase64: ({contentInBase64: string; fileName: string}) =\u003e Promise\u003cvoid\u003e;\n```\n\n-   The file type will be inferred from the `fileName` extension. The file\n    extension is mandatory. Take into account that iOS webview won't be able to\n    render file types not supported by Safari.\n\n#### Behaviour\n\n##### Android\n\n1. Once file is correctly processed, a \"Downloaded\" notification is shown in the\n   system notifications inbox. System will try to open the file when clicking on\n   it.\n2. Simultaneously, app will try to open the given file, this may result in 3\n   situations:\n    - No app that can handle this type of file is available\n        - Nothing will happen, user feedback will be just the previous generated\n          notification.\n    - Multiple apps can handle this type of file\n        - System will show a desambiguator window to select the app which will\n          be used to open the file.\n    - Single app can open this type of file (Or an app is set as default for\n      these kind of files)\n        - Downloaded content will be opened using the only available App that\n          supports its extension.\n\nhttps://github.com/user-attachments/assets/6feaed05-89f2-467b-b017-dc966bae1213\n\n##### iOS\n\nThe behavior will be similar to the current webview download mode but\ndownloading the file before showing it\n\n1.- Once the file is correctly procesed, it will be stored in a tmp directory\n2.- The app will open a modal webview presenting the local file in a web browser\nsimilar to the one used in download webview mode but hiding the \"Open in Safari\"\nbutton (due to no sense for a local file).\n\nhttps://github.com/user-attachments/assets/66726efd-4867-4c08-997e-a85f9cfb7c31\n\n#### Example\n\n```ts\ndownloadBase64({\n    contentInBase64: 'SGVsbG8sIHd(...)vcmxkCg==',\n    fileName: 'hello.pdf',\n});\n```\n\n### updateNavigationBar\n\n\u003ckbd\u003eApp version \u003e= 10.7: Partial support\u003c/kbd\u003e\u003cbr/\u003e \u003ckbd\u003eApp version \u003e= 11.8:\nexpandedTitle\u003c/kbd\u003e\u003cbr/\u003e \u003ckbd\u003eApp version \u003e= 14.8: Additional properties and\ndeprecations\u003c/kbd\u003e\u003cbr/\u003e \u003ckbd\u003ePartial support in B2P App version \u003c=24.10:\ntitle\u003c/kbd\u003e\u003cbr/\u003e \u003ckbd\u003ePartial support in B2P App version \u003e=24.11: right\nactions\u003c/kbd\u003e\u003cbr/\u003e\n\nCustomize WebView NavigationBar properties. You can set one or more properties\nin a single call\n\n```ts\ntype NavigationBarIcon = {\n    /** Identifier. The native side will notify the WebView when the icon is clicked using this id*/\n    id: string;\n    /** URL to be opened by the app as a deep-link if present */\n    url?: string;\n    /** Content description of the image used for accessibility */\n    name: string;\n    /**\n     * This is a string whose value will be mapped to a local resource that the app already knows.\n     * See https://void.tuenti.io/idl-server/files/TopNavbarIcon/1.1 for available values.\n     * A fallback icon will be used if the app doesn't recognize the value.\n     */\n    iconEnum?: string;\n    /**\n     * Set of urls that the app will use to render the icon.\n     * If both iconEnum and icon are received, the iconEnum should be used as a fallback in case there's some issue with the urls.\n     */\n    icon?: {\n        /**\n         * Those urls should be icons in PNG format.\n         * The icons will not be rendered until the image has been downloaded by the app.\n         * The URLs should be inmutable to allow the app to cache those icons for an arbitrary amount of time.\n         */\n        url: string;\n        /** To be used if present when dark mode is activated. */\n        urlDark?: string;\n    };\n    badge?: {\n        /**\n         * Boolean to determine if the badge should be shown\n         * If `show` is `true` and number and nativeLogic are not present, the badge will be shown as a dot\n         */\n        show: boolean;\n        /** Same logic and current same supported values as in nativeLogic field from API */\n        nativeLogic?: 'INBOX' | 'PROFILE';\n        /** Hardcoded value to set as the badge count. It will have more priority than nativeLogic. */\n        number?: number;\n    };\n    /**\n     * Tracking properties to be sent to analytics when the icon is clicked.\n     * These properties will be merged to the tracking event produced by the native side\n     */\n    trackingProperties?: Record\u003cstring, string\u003e;\n}\n\nupdateNavigationBar = ({\n    title?: string;\n    expandedTitle?: string;\n    showBackButton?: boolean;\n    showReloadButton?: boolean;\n    showProfileButton?: boolean; // deprecated in app version \u003e= 14.8\n    backgroundColor?: string;\n    leftActions?: ReadonlyArray\u003cNavigationBarIcon\u003e; // requires app version \u003e= 14.8\n    rightActions?: ReadonlyArray\u003cNavigationBarIcon\u003e; // requires app version \u003e= 14.8\n    colorVariant?: 'INVERSE' | 'REGULAR' | null; // requires app version \u003e= 14.8\n    resetToDefaultState?: boolean; // requires app version \u003e= 14.8\n}) =\u003e Promise\u003cvoid\u003e\n```\n\n-   `title`: updates NavigationBar title\n-   `expandedTitle`: updates NavigationBar expandedTitle. If the value is an\n    empty string, the expanded navigation bar will not be shown. Only available\n    in native app versions \u003e= 11.8\n-   `showBackButton`: shows or hides back icon in NavigationBar. On android, in\n    case window does not support showing a back button (currently internal with\n    modal presentation, which shows an X) this flag is ignored, as in these\n    cases back navigation is always performed with the native back button\n-   `showReloadButton`: shows or hides NavigationBar Reload button\n-   `showProfileButton`: **DEPRECATED**. New apps will ignore this field\n-   `backgroundColor`: change NavigationBar background color, use a hex color\n    string (for example: `'#FF128A'`)\n-   `leftActions`: array of icons to show in the left side\n-   `rightActions`: array of icons to show in the right side\n-   `colorVariant`: defines how the icons and the text of the top bar should be\n    tinted. If null or unknown value is received, the initial colors set by the\n    app or the last colorVariant set will be used\n-   `resetToDefaultState`: This is a flag used to indicate that the appearance\n    of the top bar should be restored to its original state. The other fields\n    that may come in the same bridge call will be applied after the reset\n\n#### Examples\n\n```javascript\n// updates WebView NavigationBar title\nupdateNavigationBar({title: 'Hello, World!'});\n\n// full featured example\nupdateNavigationBar({\n    title: 'Hello',\n    expandedTitle: 'Hello, World!',\n    showBackButton: true,\n    showReloadButton: false,\n    backgroundColor: '#FF0000',\n    leftActions: [\n        {\n            id: 'iconID',\n            name: 'icon name',\n            iconEnum: 'SOME_ICON',\n            badge: {\n                show: true,\n                nativeLogic: 'INBOX',\n            },\n        },\n    ],\n    rightActions: [\n        {\n            id: 'iconID',\n            name: 'icon name',\n            iconEnum: 'icon enum value',\n            icon: {\n                url: 'https://path/to/icon',\n                urlDark: 'https://path/to/icon/dark',\n            },\n            badge: {\n                show: true,\n                number: 1,\n            },\n        },\n    ],\n    resetToDefaultState: true,\n    trackingProperties?: {'name': 'some icon clicked'},\n});\n```\n\n### onNavigationBarIconClicked\n\n\u003ckbd\u003eApp version \u003e=14.8\u003c/kbd\u003e\n\nListen to navigation bar icon clicks and execute a callback function\n\n#### React example\n\n```tsx\nReact.useEffect(() =\u003e {\n    const unsubscribe = onNavigationBarIconClicked(({id}) =\u003e {\n        console.log(`Icon with id ${id} clicked`);\n    });\n\n    // Unsubscribe when the component is unmounted\n    return () =\u003e {\n        unsubscribe();\n    };\n}, []);\n```\n\n### isABTestingAvailable\n\n\u003ckbd\u003eApp version \u003e=10.8\u003c/kbd\u003e\n\nReturns true if A/B testing named with the key is available.\n\n```ts\nisABTestingAvailable: (key: string) =\u003e Promise\u003cboolean\u003e;\n```\n\n### nativeConfirm\n\n\u003ckbd\u003eApp version \u003e=24.6 `destructive` support.\u003c/kbd\u003e\n\nShow a native confirm dialog.\n\nIf the bridge is not present (eg. showing the page in browser), fallbacks to a\nbrowser confirm.\n\n\u003cimg height=\"550\" src=\"doc/webview-bridge-confirm-ios.png\"\u003e\u003cimg height=\"550\" src=\"doc/webview-bridge-confirm-android.png\"\u003e\n\n```ts\nnativeConfirm: ({\n    message: string;\n    title?: string;\n    acceptText: string;\n    cancelText: string;\n    destructive?: boolean;\n}) =\u003e Promise\u003cboolean\u003e;\n```\n\n#### Example\n\n```javascript\nnativeConfirm({\n    title: 'Confirm',\n    message: 'Send message?',\n    acceptText: 'Yes',\n    cancelText: 'No',\n}).then((res) =\u003e {\n    if (res) {\n        console.log('message sent');\n    }\n});\n```\n\n### nativeAlert\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nShow a native alert dialog.\n\nIf the bridge is not present (eg. showing the page in browser), fallbacks to a\nbrowser alert.\n\n\u003cimg height=\"550\" src=\"doc/webview-bridge-alert-ios.png\"\u003e\u003cimg height=\"550\" src=\"doc/webview-bridge-alert-android.png\"\u003e\n\n```ts\nnativeAlert: ({\n    message: string;\n    title?: string;\n    buttonText: string;\n}) =\u003e Promise\u003cvoid\u003e;\n```\n\n### nativeMessage\n\n\u003ckbd\u003eApp version \u003e=14.10 `withDismiss`, `duration` and `action` in\nresponse\u003c/kbd\u003e.\n\n\u003ckbd\u003eApp version \u003e=24.6 `buttonAccessibilityLabel` support\u003c/kbd\u003e.\n\nShow a native snackbar message. Use it to display feedback messages.\n\nIf the bridge is not present (eg. showing the page in browser), fallbacks to a\nbrowser alert.\n\n\u003cimg height=\"550\" src=\"doc/webview-bridge-message-ios.png\"\u003e\u003cimg height=\"550\" src=\"doc/webview-bridge-message-android.png\"\u003e\n\n```ts\nnativeMessage: ({\n        message: string;\n        duration?: 'PERSISTENT';\n        buttonText?: string;\n        buttonAccessibilityLabel?: string;\n        type?: 'INFORMATIVE' | 'CRITICAL' | 'SUCCESS';\n        withDismiss?: boolean;\n}) =\u003e Promise\u003c{\n    action: 'DISMISS' | 'BUTTON' | 'TIMEOUT' | 'CONSECUTIVE';\n}\u003e;\n```\n\n#### Example\n\nShow a native Snackbar with button\n\n```javascript\nnativeMessage({\n    message: 'Operation finished!',\n    buttonText: 'Ok',\n}).then((res) =\u003e {\n    if (res.action === 'BUTTON') {\n        console.log('Button clicked');\n    }\n    console.log('Snackbar closed');\n});\n```\n\n### logEvent\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nLog an event to firebase\n\n```ts\nlogEvent: ({\n    category: string; // Typically the object that was interacted with (e.g. 'Video')\n    action: string; // The type of interaction (e.g. 'play')\n    label?: string; // Useful for categorizing events (e.g. 'Fall Campaign')\n    value?: number; // A numeric value associated with the event (e.g. 43)\n}) =\u003e Promise\u003cvoid\u003e;\n```\n\nIf you want to use new Google Analytics 4 event format you can use this method\ntoo:\n\n```ts\nlogEvent: ({\n    name: string; // The event name is mandatory\n    [key: string]: any; // You can set any other event parameters\n}, {\n    sanitize?: boolean; // Whether to sanitize the event params, this only affects to FirebaseEvents. true by default.\n}) =\u003e Promise\u003cvoid\u003e;\n```\n\n#### Example\n\n```javascript\nlogEvent({\n    category: 'topup-flow',\n    action: 'topup',\n}).then(() =\u003e {\n    console.log('event logged');\n});\n\n// Or with GA4 format\nlogEvent({\n    name: 'user_interaction',\n    component_type: 'primary_button',\n    component_copy: 'topup',\n}).then(() =\u003e {\n    console.log('event logged');\n});\n```\n\n#### About event params sanitization\n\nBy default, GA4 event params are sanitized. The sanitization consists of\nremoving whitespaces and some special characters, lowercasing and trimming. This\nallows us having a consistent event format accross events.\n\nIn some cases you may want to disable this behavior. To do so, you can set the\n`sanitize` option to `false`:\n\n```javascript\nlogEvent(yourEvent, {sanitize: false});\n```\n\n### setScreenName\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nLog the current screen name (or page name) to firebase\n\n```ts\nsetScreenName: (\n  screenName: string,\n  params?: { [key: string]: any },\n  options?: { sanitize?: boolean }\n) =\u003e Promise\u003cvoid\u003e;\n```\n\nBy default, the screen name and params are sanitized (removing accents, special\ncharacters, lowercasing, etc). If you want to disable sanitization for the\nparams (for example, to send them exactly as provided), you can pass the\n`sanitize: false` option. Note that the screen name itself will always be\nsanitized.\n\n```javascript\nsetScreenName('My Screen Name', {}, {sanitize: false});\n```\n\nThis will send the params as-is, without any transformation.\n\n### setUserProperty\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nSet a user property to firebase\n\n```ts\nsetUserProperty: (name: string, value: string) =\u003e Promise\u003cvoid\u003e;\n```\n\n### reportStatus\n\n\u003ckbd\u003eApp version \u003e=11.2\u003c/kbd\u003e\n\nReport a given feature status\n\n```ts\nreportStatus: ({feature: 'ACCOUNT', status: 'CRITICAL' | 'GOOD' | 'BAD', reason: string}) =\u003e Promise\u003cvoid\u003e;\n```\n\n### onNativeEvent\n\n\u003ckbd\u003eApp version \u003e=11.3\u003c/kbd\u003e\n\nListens to native app events\n\n```ts\ntype NativeEventHandler = ({ event }: {event: string}) =\u003e {action: 'default'};\n\nonNativeEvent: (handler: NativeEventHandler) =\u003e () =\u003e void;\n```\n\n#### Example\n\n```ts\nonNativeEvent(({event}) =\u003e {\n    if (event === 'tappedNavigationBarBackButton') {\n        // do something\n    }\n    return {action: 'default'};\n});\n```\n\n#### Available events\n\n-   `tappedNavigationBarBackButton`: fired when the user taps on the back button\n    of the native Navigation Bar. Allowed response actions: `default`\n\n### checkPermissionStatus\n\n\u003ckbd\u003eApp version \u003e=11.4\u003c/kbd\u003e \u003ckbd\u003eAvailable in B2P App version \u003e=25.5\u003c/kbd\u003e\n\nReturns true if the app has the specific notifications permissions. You have to\npass feature and required params for this request.\n\nAvalaible features:\n\n-   `notifications`\n-   `read-contacts` (Available for app versions 13.10 and higher)\n-   `write-contacts` (Available for app versions 13.10 and higher)\n\n```ts\ncheckPermissionStatus: (feature: string, params?: {[key: string]: string}) =\u003e Promise\u003cboolean\u003e;\n```\n\n#### Example\n\n```javascript\ncheckPermissionStatus('notifications', {channelId: 'default'}).then(\n    (hasPermissions) =\u003e {\n        console.log(hasPermissions);\n    },\n);\n```\n\n### internalNavigation\n\n\u003ckbd\u003eApp version \u003e=11.4\u003c/kbd\u003e \u003ckbd\u003eAvailable in B2P App version \u003e=25.5\u003c/kbd\u003e\n\nInit an internal and native navigation to a device specific feature\n\nAvalaible features:\n\n-   `notification-settings`\n-   `contact-settings` \u003ckbd\u003eApp version \u003e=13.10 \u003c/kbd\u003e\n\n```ts\ninternalNavigation: (feature: string) =\u003e Promise\u003cvoid\u003e;\n```\n\n### dismiss\n\n\u003ckbd\u003eApp version \u003e=11.5\u003c/kbd\u003e \u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nDismiss the current webview if possible and optionally navigate to another URL.\nIf we can't do the dismiss, for example, if the webview is one of the main tabs,\nthe optional URL won't be opened.\n\n```ts\ndismiss: (onCompletionUrl?: string) =\u003e Promise\u003cvoid\u003e;\n```\n\n#### Error cases\n\n```ts\n{\n    code: 405;\n    reason: 'Webview is not allowed to dismiss because we only have one webview instance in the navigation stack.';\n}\n```\n\n### requestVibration\n\nRequests the phone to vibrate. Options are 'error' or 'success'.\n\n```javascript\nrequestVibration('error');\n```\n\n### fetchContactsByPhone\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=25.5\u003c/kbd\u003e\n\nReturns contacts info given an array of phone numbers.\n\n```javascript\nfetchContactsByPhone: (phoneNumbers: Array\u003cstring\u003e) =\u003e Promise\u003cArray\u003c{\n    phoneNumber: string;\n    firstName?: string;\n    middleName?: string;\n    lastName?: string;\n    encodedAvatar?: string;\n}\u003e\u003e;\n```\n\n### addOrEditContact\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=25.5\u003c/kbd\u003e\n\nOpens native UI to add or edit a contact in the device's phonebook.\n\n```ts\naddOrEditContact: (phoneNumber: string) =\u003e Promise\u003c{\n    phoneNumber?: string;\n    firstName?: string;\n    middleName?: string;\n    lastName?: string;\n    encodedAvatar?: string;\n}\u003e\n```\n\n-   If phoneNumber already exists in the device phonebook, the user will be able\n    to edit the information.\n-   If phoneNumber is saved under multiple names in the phonebook, when editing\n    it should choose the first one alphabetically\n-   If phoneNumber doesn't exist in the phonebook, the user will be able to add\n    it, providing the related info.\n-   If the user edits the phone number of the contact, the new value is returned\n    in the phoneNumber field\n-   If the user exists the flow without selecting a a contact, an error is\n    returned\n\nOnce the user has added or updated the contact, native returns the new\ninformation (all last values of every property).\n\n### getAppDomain\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=25.3\u003c/kbd\u003e\n\nReturn info about appDomain\n\n```ts\ngetAppDomain: () =\u003e Promise\u003c{domain: string}\u003e;\n```\n\n`domain`: the domain value of the environment that the app is pointing to.\n\n### getAppMetadata\n\n\u003ckbd\u003eApp version \u003e=11.8\u003c/kbd\u003e\n\nCheck if an app is installed in the phone\n\n```ts\ngetAppMetadata: (appToken: string) =\u003e Promise\u003c{\n    isInstalled: boolean;\n    marketUrl: string;\n    appUrl: string\n}\u003e;\n```\n\n-   `appToken`: token that refers to a \"friend\" application\n-   `isInstalled`: boolean to see if the app is installed\n-   `appUrl`: string url to launch an app installed on the phone\n-   `marketUrl`: string url to launch the store in a specific application\n\n### getDiskSpaceInfo\n\n\u003ckbd\u003eApp version \u003e=11.10\u003c/kbd\u003e\n\nReturn info about how much free disk space the device has\n\n```ts\ngetDiskSpaceInfo: () =\u003e Promise\u003c{availableBytes: number, totalBytes: number}\u003e;\n```\n\n-   `availableBytes`: number to see available bytes in the device\n-   `totalBytes`: number to see the total bytes in the device\n\n### getEsimInfo\n\n\u003ckbd\u003eApp version \u003e=12.3 `supportsEsim`\u003c/kbd\u003e\u003cbr/\u003e \u003ckbd\u003eApp version \u003e=14.8\n`eid`\u003c/kbd\u003e\n\nReturn info about the esim capabilities of the device\n\n```ts\ngetEsimInfo: () =\u003e Promise\u003c{supportsEsim: boolean, eid?: string | null}\u003e;\n```\n\n-   `supportsEsim`: tells if the device supports esim\n-   `eid`: \"Embedded Identity Document\". The serial number corresponding to the\n    eSIM installed in a device.\n\n### getDeviceModel\n\n\u003ckbd\u003eApp version \u003e=14.8\u003c/kbd\u003e\n\nReturns the device model, like `\"SAMSUNG-SM-G930A\"`, `\"iPhone9\"`, ...\n\n```ts\ngetDeviceModel: () =\u003e Promise\u003c{model: string} | null\u003e;\n```\n\n### setTrackingProperty\n\n\u003ckbd\u003eApp version \u003e=12.4\u003c/kbd\u003e\n\nSets a property related to some specific tracking system\n\n```ts\nsetTrackingProperty: (system: 'palitagem' | 'medallia', name: string, value?: string) =\u003e Promise\u003cvoid\u003e;\n```\n\n-   `system`: Tracking system that will handle the property\n-   `name`: name of the property\n-   `value`: value of the property (nullable)\n\n### setActionBehavior\n\n\u003ckbd\u003eApp version \u003e=12.7\u003c/kbd\u003e\n\nMethod that allows defining an specific behavior (such as showing a\nconfirmation) before the specific native actions are executed. This method also\nallows disabling any previous behaviors set.\n\n```ts\ntype ActionBehavior =\n    | {\n        behavior: 'confirm';\n        title: string;\n        message: string;\n        acceptText: string;\n        cancelText: string;\n    }\n    | {\n        behavior: 'default';\n    }\n    | {\n        behavior: 'cancel';\n    };\n\nsetActionBehavior: (actions: {webviewClose?: ActionBehavior, navigationBack?: ActionBehavior}) =\u003e Promise\u003cvoid\u003e;\n```\n\n`navigationBack` and `webviewClose` actions are currently available:\n\n-   `navigationBack`: Action bar back button pressed (also for physical back\n    button in android but not swipe back gesture in iOS, which will be\n    disabled).\n-   `webviewClose`: Action bar close button pressed. Includes both \"X\" and\n    \"Close\" buttons (but not swipe down gesture in iOS, which will be disabled).\n\nBoth have same allowed json parameters, and 3 allowed behaviors:\n\n-   `confirm` Show a confirmation dialog with the required title, message and\n    buttons.\n-   `cancel` Prevent action from being performed, just ignoring it.\n-   `default` Set default behavior for the action. (Usually to reset any\n    previously specified behavior).\n\nActions can be optionally included in the payload. Any not included action won’t\nchange its current behavior set.\n\nAll actions behaviors will be automatically set to default on full page loads.\n\n### renewSession\n\nTell the app to renew the session.\n\n```ts\nrenewSession = (\n    oldAccessToken: string | null,\n    options: {timeout?: number} = {},\n) =\u003e Promise\u003cstring\u003e\n```\n\n### onSessionRenewed\n\nDefines a callback that will be executed when the native app renews the session.\nReturns the unsubscribe function.\n\n```ts\nonSessionRenewed = (\n    handler: (newAccessToken: string) =\u003e void,\n) =\u003e (() =\u003e void)\n```\n\n### logout\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nA method that requests a user logout.\n\n```ts\nlogout = () =\u003e Promise\u003c{success: boolean}\u003e\n```\n\n### getTopazToken\n\nReturns the [Topaz](https://www.topaz.com.br/ofd/index.php) token.\n\n```ts\ngetTopazToken = (options: {timeout?: number} = {}) =\u003e Promise\u003c{token: string}\u003e\n```\n\n### getTopazValues\n\n\u003ckbd\u003eApp version \u003e=24.9\u003c/kbd\u003e\n\nReturns an object containing values from the\n[Topaz](https://www.topaz.com.br/ofd/index.php) SDK.\n\n```ts\ngetTopazValues = () =\u003e Promise\u003c{syncId?: string}\u003e\n```\n\n### showAppRating\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nShow native app rating dialog\n\n\u003cimg height=\"550\" src=\"doc/webview-bridge-app-rating-ios.png\"\u003e\u003cimg height=\"550\" src=\"doc/webview-bridge-alert-android.png\"\u003e\n\n```ts\nshowAppRating = () =\u003e Promise\u003cvoid\u003e\n```\n\n### increaseAppRatingTrigger\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=25.6\u003c/kbd\u003e\n\nApp rating flow in B2P apps is only launched if specific rules are fulfilled.\nSeveral of those rules are that X events of a given type have happened in the\nwebviews side.\n\nThis method is used to request native app to increase the appRating trigger\nvalue for a specific key.\n\n```ts\nincreaseAppRatingTrigger = (key: string) =\u003e Promise\u003cvoid\u003e\n```\n\n### resetAppRatingTrigger\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=25.6\u003c/kbd\u003e\n\nApp rating flow in B2P apps is only launched if specific rules are fulfilled.\nSeveral of those rules are that X events of a given type have happened in the\nwebviews side.\n\nThis method is used to request native app to reset the appRating trigger value\nfor a specific key\n\n```ts\nresetAppRatingTrigger = (key: string) =\u003e Promise\u003cvoid\u003e\n```\n\n### appRatingRemindMeLater\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=25.6 (Android only)\u003c/kbd\u003e\n\nNotify the native app that a user has selected \"Remind me later\" in the app\nrating flow\n\n```ts\nappRatingRemindMeLater = () =\u003e Promise\u003cvoid\u003e\n```\n\n### bottomSheet\n\n\u003ckbd\u003eApp version \u003e=13.8\u003c/kbd\u003e\n\nShow native bottom sheet UI.\n\nWe don't recommend using this method directly, instead use the\n[Mistica implementation](https://mistica-web.vercel.app/?path=/story/components-modals-sheet--show-sheet)\nwhich provides a more user-friendly interface with predefined cases and\nfallbacks to a web implementation when the native bridge is not available.\n\n\u003cimg height=\"460\" src=\"doc/webview-bridge-bottom-sheet.png\"\u003e\n\n```ts\nbottomSheet = (payload: SheetUI) =\u003e Promise\u003cSheetResponse\u003e\n// see SheetUI and SheetResponse types\n```\n\n:warning: If you try to call this method repeatedly while a sheet is already\nbeing opened (for example, user accidental double tap), it will throw an Error\nwith code `423` (Locked)\n\n### fetchPhoneNumbers\n\n\u003ckbd\u003eApp version \u003e=13.10\u003c/kbd\u003e\n\nFetch all the phone numbers of the native phonebook\n\n```ts\nfetchPhoneNumbers:() =\u003e Promise\u003cArray\u003c{\n    id: string;\n    value: string;\n}\u003e\u003e;\n```\n\n### updatePhoneNumbers\n\n\u003ckbd\u003eApp version \u003e=13.10\u003c/kbd\u003e\n\nUpdates the given phone numbers in the native phonebook\n\n```ts\nupdatePhoneNumbers:(Array\u003c{\n    id: string;\n    value: string;\n}\u003e) =\u003e Promise\u003cVoid\u003e;\n```\n\n### highlightNavigationTab\n\nMethod that allows WebView to highlight a home tab bar setting a badge (numeric\nor not)\n\n```ts\nhighlightNavigationTab: ({\n    tab: string,\n    highlight: boolean,\n    count?: number\n}) =\u003e Promise\u003cvoid\u003e;\n```\n\n-   If `highlight` is `false`: no badge is shown\n-   If `highlight` is `true`:\n    -   If `count` is not `null`, it will show a numeric badge with `count`value\n    -   If `count` is `null`, it will show a non-numeric badge\n\n### getAttStatus\n\n\u003ckbd\u003eApp version \u003e=14.7 (iOS)\u003c/kbd\u003e\n\nMethod that allows a WebView to ask an iOS app user about the authorization\nstatus of his ATT\n([App Tracking Transparency](https://developer.apple.com/documentation/apptrackingtransparency))\npermission.\n\nResolves to `null` if the app is not running on iOS or if the method is not\navailable\n\n```ts\ngetAttStatus: () =\u003e Promise\u003c{status:'granted' | 'denied' | 'unknown'} | null\u003e;\n```\n\n### getNetworkConnectionInfo\n\n\u003ckbd\u003eApp version \u003e=14.11\u003c/kbd\u003e\n\nObtain metainformation about the current device data network connectivity\n\n```ts\ngetNetworkConnectionInfo: () =\u003e Promise\u003c{\n    connectionType: 'MOBILE' | 'WIFI ' | 'OTHER' | 'NONE';\n    mobileConnectionType?:\n        | '2G'\n        | '3G'\n        | '4G'\n        | '5G'\n        | 'OTHER'\n        | 'PERMISSION_REQUIRED'\n        | null;\n    mobileCarrier?: string | null;\n    mobileSignalStrength?:\n        | 'NONE'\n        | 'POOR'\n        | 'MODERATE'\n        | 'GOOD'\n        | 'GREAT'\n        | null;\n}\u003e;\n```\n\n-   `connectionType`: describes the network technology used currently for data\n-   `mobileConnectionType`: in case connectionType is 'MOBILE' gives further\n    details about the network technology used. PERMISSION_REQUIRED value will be\n    returned only in Android when READ_PHONE_STATE permission has not been\n    granted by the user. The permission request is already managed by the\n    Android implementation itself.\n-   `mobileCarrier`: identifies the carrier used for 'MOBILE' connectionType\n-   `mobileSignalStrength`: gives a measure of the current signal strength for\n    'MOBILE' connectionType.\n\n### getPincodeInfo\n\n\u003ckbd\u003eApp version \u003e=24.2\u003c/kbd\u003e\n\nCheck if the pincode is enabled or not\n\n```ts\ngetPincodeInfo: () =\u003e Promise\u003c{\n    status: 'enabled' | 'disabled'\n}\u003e;\n```\n\n### getProfileImage\n\n\u003ckbd\u003eApp version \u003e=14.9\u003c/kbd\u003e\n\nRead current profile picture\n\n```ts\ngetProfileImage: () =\u003e Promise\u003c{\n    image: string | null\n}\u003e;\n```\n\n-   `image`: base64 encoded image or null if there is no image\n\n### startProfileImageFlow\n\n\u003ckbd\u003eApp version \u003e=14.9\u003c/kbd\u003e\n\nStarts the native flow to change the profile picture\n\n```ts\nstartProfileImageFlow: () =\u003e Promise\u003c{\n    image: string | null;\n    isCancelled: boolean;\n}\u003e;\n```\n\n-   `image`: base64 encoded image or null if the image was removed or the flow\n    cancelled\n-   `isCancelled`: true if the user cancelled the flow\n\n### showLineSelector\n\n\u003ckbd\u003eApp version \u003e=25.x\u003c/kbd\u003e\n\nOpens the native line selector dialog\n\n#### Error cases\n\n-   405: line selector feature is not allowed (feature is disabled)\n-   409: line selector is already presented (Invoking the selector if there is\n    already one showing causes this error)\n\n### getDeviceTac\n\n\u003ckbd\u003eApp version \u003e=24.3\u003c/kbd\u003e\n\nGet device [TAC identifier](https://en.wikipedia.org/wiki/Type_Allocation_Code).\n\n```ts\ngetDeviceTac: () =\u003e Promise\u003c{\n    tac: string | null\n}\u003e;\n```\n\n-   `tac`: The TAC identifier is the first 8 digits of the IMEI. We already have\n    a method to get the IMEI but to obtain this value, we need carrier\n    privileges permission which in many cases we don't have. To get the TAC we\n    don't need any special permission because it only identifies the device\n    model, not the device itself. Will be `null` if it's not available (iOS\n    devices or Android \u003c 10).\n\n### triggerPinOrBiometricAuthentication\n\n\u003ckbd\u003eApp version \u003e=24.4\u003c/kbd\u003e\n\nTriggers pin/biometric authentication if necessary, taking into account 3\npossible scenarios:\n\n-   If user has pin/biometric already configured in the app:\n    -   If last previous authentication (or last pin/biometric setup) is still\n        valid, nothing will be presented to user and bridge method will succeed.\n    -   Otherwise, authentication will be required, blocking the user until it\n        is performed.\n-   In any other case, user will be taken directly to the screen where user can\n    introduce a new PIN and enable any other authentication methods. In case\n    user leaves the screen without providing an authentication method, bridge\n    method will fail with 401 code.\n\n```ts\ntriggerPinOrBiometricAuthentication: ({\n    maxSecondsSinceLastValidation: number\n}) =\u003e Promise\u003c{\n    result: 'USER_AUTHENTICATED' | 'USER_ENABLED_AUTHENTICATION' | 'LAST_AUTHENTICATION_STILL_VALID' | 'DEVICE_HAS_NO_AUTHENTICATION',\n}\u003e;\n```\n\n-   `maxSecondsSinceLastValidation`: if time elapsed since last authentication\n    is less than the number of seconds specified here authentication will\n    succeed without requesting it again.\n\n\u003ckbd\u003eApp version \u003e=25.5\u003c/kbd\u003e\n\nIf the new PIN \u0026 Biometrics 2.0 (device authentication) feature is enabled,\nthere are a couple of details to take into account:\n\n-   If the setting is not enabled by the user, the device authentication will be\n    asked and if it goes right, the setting will be enabled.\n-   If the device doesn't have any authentication configured, the method will\n    return `DEVICE_HAS_NO_AUTHENTICATION` as result.\n\n### focusNavbar\n\n\u003ckbd\u003eApp version \u003e= 24.9\u003c/kbd\u003e\n\nSets the screen reader focus on the native navigation bar. If the webview\ndoesn't have a native navbar, the native app will respond with\n`{focused: false}`.\n\nThis is useful for accessibility purposes. We need the focus to be set in the\nnavbar when we navigate to a new screen using client side navigation (React\nRouter).\n\n```ts\nfocusNavbar: () =\u003e Promise\u003c{\n    focused: boolean,\n}\u003e;\n```\n\n### openOnboarding\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=24.10\u003c/kbd\u003e\n\nOpens the app Onboarding (as if it where the first time the user logs in)\n\n```ts\nopenOnboarding = () =\u003e Promise\u003cvoid\u003e\n```\n\n### getBatteryInfo\n\n\u003ckbd\u003eApp version \u003e=24.10\u003c/kbd\u003e\n\nObtains information about the device battery status\n\n```ts\ngetBatteryInfo: () =\u003e Promise\u003c{\n    batteryLevel: number | null;\n    isPowerSafeMode: boolean;\n}\u003e;\n```\n\n-   `batteryLevel`: battery level in percentage (0 - 100). `null` if the battery\n    information is unavailable.\n-   `isPowerSafeMode`: true if the device is in power saving mode.\n\n### readTextFromClipboard\n\n\u003ckbd\u003eApp version \u003e=24.10\u003c/kbd\u003e\n\nReads the current text in the clipboard\n\n```ts\nreadTextFromClipboard: () =\u003e Promise\u003cstring\u003e;\n```\n\n### writeTextToClipboard\n\n\u003ckbd\u003eApp version \u003e=24.10\u003c/kbd\u003e\n\nWrites the given text to the clipboard\n\n```ts\nwriteTextToClipboard: (text: string) =\u003e Promise\u003cvoid\u003e;\n```\n\n### showLoadingOverlay / hideLoadingOverlay\n\n\u003ckbd\u003eApp version \u003e=24.10\u003c/kbd\u003e\n\nShows a loading overlay screen while a task is being performed. You can control\nwhen to hide it with the `hideLoadingOverlay` method.\n\nNote: Depending on the configuration used to show the overlay,\n`hideLoadingOverlay` won't immediately hide it, in all cases you should wait for\nits promise to be resolved in order to know when the native overlay is\neffectively closed.\n\n| Overlay Success Example                                                                       | Overlay Failure Example                                                                       |\n| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |\n| \u003cvideo src=\"https://github.com/user-attachments/assets/d46bb10c-e868-42d7-bed3-a171f34192e7\"\u003e | \u003cvideo src=\"https://github.com/user-attachments/assets/8f2f6a8e-0570-437b-8f98-c905bcb224fd\"\u003e |\n\n```ts\nshowLoadingOverlay: ({\n    /**\n     * Whether the in animation is enabled (false by default)\n     */\n    inAnimation?: boolean;\n    /**\n     * Whether the out animation is enabled (false by default)\n     */\n    outAnimation?: boolean;\n    /**\n     * Minimum duration of the loop animation in milliseconds (0 by default)\n     */\n    minimumLoopDurationMs?: number;\n    /**\n     * whether the loop animation should be stopped immediately or not (true by default)\n     */\n    stopAnimationCycle?: boolean;\n    /**\n     * List of description texts to be shown one after the other\n     */\n    descriptions?: Array\u003cstring\u003e;\n    /**\n     * Duration of each description in milliseconds (3000 by default)\n     */\n    descriptionDurationMs?: number;\n    /**\n     * After this timeout loading screen would be hidden automatically (20000 by default)\n     */\n    timeoutMs?: number;\n    /**\n     * (Only Android) If true, after loading screen has been hidden, if user presses android back button, webview window will close (true by default)\n     */\n    closeOnBackButtonPressAfterFinish?: boolean;\n}) =\u003e Promise\u003cvoid\u003e;\n\nhideLoadingOverlay: () =\u003e Promise\u003cvoid\u003e;\n```\n\n#### Example\n\n```ts\nawait showLoadingOverlay({\n    inAnimation: true,\n    outAnimation: true,\n    stopAnimationCycle: false,\n    descriptions: ['Loading...', 'Please wait...'],\n    descriptionDurationMs: 3000,\n});\nawait doExpensiveTask();\nawait hideLoadingOverlay();\n```\n\n#### Error cases\n\nIf `showLoadingOverlay` is called while the loading overlay is already being\nshown, the promise will be rejected with an error object with the following\ntype:\n\n```ts\n{\n    code: 503;\n    description: 'Loading screen already showing';\n}\n```\n\n### getInstallationId\n\n\u003ckbd\u003eApp version \u003e=24.11\u003c/kbd\u003e\n\nReturns the application installation id. A 32 hexadecimal characters long string\nthat represents one installation of the native app.\n\n```ts\ngetInstallationId: () =\u003e Promise\u003c{installationId: string}\u003e;\n```\n\n### getUnseenNotificationsBadge / setUnseenNotificationsBadge\n\n\u003ckbd\u003eApp version \u003e=24.12\u003c/kbd\u003e\n\nget/set the number of unseen notifications in the inbox and the last time the\ncounter was updated (timestamp in milliseconds).\n\n```ts\ngetUnseenNotificationsBadge: () =\u003e Promise\u003c{unseenNotificationCounter: number; lastUpdated: number}\u003e;\n```\n\n```ts\nsetUnseenNotificationsBadge: ({unseenNotificationCounter: number; lastUpdated: number}) =\u003e Promise\u003cvoid\u003e;\n```\n\nWhen the webview is opened, it will ask to the native app for the unseen\nnotifications badge (`getUnseenNotificationsBadge`). This allows the webview to\nknow if the native app has received any push while the webview was closed. The\nwebview will check the `lastUpdated` timestamp receibed from the native app with\nthe one persisted in the webview `localStorage`, if it's different, the webview\nwill fetch the inbox from server. When the webview updates their state, it will\npersist the lastUpdated timestamp in the localStorage and send it to the native\napp using the `setUnseenNotificationsBadge`. This way, the next time the webview\nuse the getter, it will know if the `lastUpdated` matches with the one persisted\nin `localStorage`.\n\n### requestDatamobDeviceAdmin\n\n\u003ckbd\u003eApp version \u003e=25.1\u003c/kbd\u003e\n\nDatamob is a native library that offer developers a way to integrate security\nand remote device control features into their applications.\n\nThe application that implements the Datamob library must be registered as a\nsystem management application (Device Admin). This configuration is essential to\nallow the application to have sufficient permissions to execute security\ncommands, such as screen lock and factory reset.\n\nThis method opens a setting screen asking the user to accept system management\npermissions for the application.\n\n```ts\nrequestDatamobDeviceAdmin: () =\u003e Promise\u003c{isAdmin: boolean}\u003e;\n```\n\n`isAdmin` is true if the permission was granted.\n\n#### Demo\n\nhttps://github.com/user-attachments/assets/28095f42-76db-4ac2-9586-e350acef7e1d\n\n### unregisterDatamobDeviceAdmin\n\nMethod to unregister the application as a system management application.\n\n```ts\nunregisterDatamobDeviceAdmin: () =\u003e Promise\u003cvoid\u003e;\n```\n\n### registerDatamobUser\n\n\u003ckbd\u003eApp version \u003e=25.1\u003c/kbd\u003e\n\nThe application that implements the Datamob should have an user registered. This\nmethod is used to register one.\n\n```ts\nregisterDatamobUser: ({phoneNumber: string, tokenPassword: string}) =\u003e Promise\u003cvoid\u003e;\n```\n\n-   `phoneNumber`: The phone number of the user.\n-   `tokenPassword`: When registering the device, datamob generate an accessKey\n    that is recorded in the Datamob device registry. By combining this attribute\n    with a hash that we keep in a password vault, generate this token.\n\n#### Error cases\n\nIf the registration fails, the promise will be rejected with an error object\nwith the following type:\n\n```ts\n{\n    code: 500;\n    reason: `Registration error: ${errorDescription}`;\n}\n```\n\n### validateDatamobRequirements\n\n\u003ckbd\u003eApp version \u003e=25.1 (Android only)\u003c/kbd\u003e\n\nDatamob sdk allows to send remote commands to the user device. These remote\ncommands include actions such as locking the device screen (lock screen) or even\nforcing a wipe (factory reset) of the device, providing additional security\ncontrol for the end user.\n\nThis method returns a map with the requirements. Each requirement is a boolean\nvalue where true is valid, false is not valid.\n\n```ts\nvalidateDatamobRequirements: ({phoneNumber: string, tokenPassword: string}) =\u003e Promise\u003c{\n    deviceAdmin: boolean;\n    lockPassword: boolean;\n    accessibilityOption: boolean;\n    invalidPhoneNumber: boolean;\n    invalidToken: boolean;\n}\u003e\n```\n\n-   `phoneNumber`: The phone number of the user.\n-   `tokenPassword`: When registering the device, datamob generate an accessKey\n    that is recorded in the Datamob device registry. By combining this attribute\n    with a hash that we keep in a password vault, generate this token.\n\n-   returns a map with the requirements.\n\n### displayQualtricsIntercept\n\n\u003ckbd\u003eApp version \u003e=24.12 (iOS only)\u003c/kbd\u003e\n\nUses the Qualtrics SDK to display a survey intercept to the user. It needs to be\nused in combination with `isQualtricsInterceptAvailableForUser`, ensuring\nintercept is available before requesting its display. Display result depends on\nthe last evaluation performed by that method.\n\nThe native app will try to show the survey related to the provided `interceptId`\n\nIt will return a boolean (`displayed`) indicating if the survey has been\ndisplayed or not.\n\n```ts\ndisplayQualtricsIntercept: ({interceptId: string}) =\u003e Promise\u003c{displayed: boolean}\u003e;\n```\n\n#### Error cases\n\n```ts\n{\n    code: 500;\n    reason: 'Internal Error'; // If an error occurred invoking the SDK;\n}\n```\n\n```ts\n{\n    code: 501;\n    reason: 'SDK not initialized';\n}\n```\n\n### setQualtricsProperties\n\n\u003ckbd\u003eApp version \u003e=24.12 (iOS only)\u003c/kbd\u003e\n\nMethod to set properties in Qualtrics SDK before displaying a survey.\n\n```ts\nsetQualtricsProperties: ({\n    stringProperties?: {[key: string]: string};\n    numberProperties?: {[key: string]: number};\n    dateTimePropertyKeys?: Array\u003cstring\u003e;\n}) =\u003e Promise\u003cvoid\u003e;\n```\n\n#### Error cases\n\n```ts\n{\n    code: 500;\n    reason: 'Internal Error'; // If an error occurred invoking the SDK;\n}\n```\n\n```ts\n{\n    code: 501;\n    reason: 'SDK not initialized';\n}\n```\n\n### isQualtricsInterceptAvailableForUser\n\n\u003ckbd\u003eApp version \u003e=24.12 (iOS only)\u003c/kbd\u003e\n\nCheck if a Qualtrics intercept is available for the user, performing its\nevaluation.\n\n```ts\nisQualtricsInterceptAvailableForUser: ({interceptId: string}) =\u003e Promise\u003c{isAvailable: boolean}\u003e;\n```\n\n#### Error cases\n\n```ts\n{\n    code: 500;\n    reason: 'Internal Error'; // If an error occurred invoking the SDK;\n}\n```\n\n```ts\n{\n    code: 501;\n    reason: 'SDK not initialized';\n}\n```\n\n### refreshNavBar\n\n\u003ckbd\u003eAvailable in B2P App version \u003e=25.3\u003c/kbd\u003e\n\nMethod that allows WebView to refresh the navigation bars that are retrieved by\nVisual Modules API\n\n```ts\nrefreshNavBar: ({\n    moduleId?: string,\n    productId?: string\n}) =\u003e Promise\u003cvoid\u003e;\n```\n\nwhere\n\n-   `moduleId` is an optional parameter\n    -   If it is not included, it means the app will refresh top and bottom bar\n    -   If it is included, it should be the same values used for Visual Modules\n        API and the app will request to refresh only the indicated bar\n-   `productId` is an optional parameter\n    -   If it is not included, visual modules is requested as it is today, just\n        with the userID as query param plus the `moduleId`\n    -   If it is included, visual modules will be requested for the current\n        userID and for the `productId`\n\n#### Example\n\n```ts\nrefreshNavBar({\n    moduleId: 'bottombar',\n    productId: 'ID_00fe00a87b2',\n});\n```\n\n### requestAllowMeBiometrics\n\n\u003ckbd\u003eApp version \u003e=25.3\u003c/kbd\u003e\n\nMethod to start the AllowMe native SDK biometrics flow.\n\n```ts\nrequestAllowMeBiometrics: () =\u003e Promise\u003c{\n    result?: string;\n    images: Array\u003cstring\u003e;\n}\u003e;\n```\n\n-   `result`: cryptographed payload containing safety information about the\n    image capture process.\n-   `images`: is an array of base64 encoded images captured during the process.\n\n#### Error cases\n\nThis SDK can return several errors, and they can be different between iOS and\nAndroid. Below you have the list of both platforms:\n\n| Error                                    | Android | iOS | Code    |\n| ---------------------------------------- | ------- | --- | ------- |\n| `AllowMeGenericError`                    | ❌      | ✅  | 500\\*   |\n| `AllowMeUnauthorizedError`               | ✅      | ✅  | 401\\*\\* |\n| `AllowMeSetupSdkError`                   | ✅      | ✅  | 1001    |\n| `AllowMeTimeoutProcessingError`          | ❌      | ✅  | 1002    |\n| `AllowMeApiKeyError`                     | ❌      | ✅  | 1003    |\n| `AllowMeInstanceCreationError`           | ❌      | ✅  | 1004    |\n| `AllowMeBiometricsTimeoutError`          | ✅      | ✅  | 1005    |\n| `AllowMeBiometricsSetupError`            | ✅      | ✅  | 1006    |\n| `AllowMeBiometricsCameraError`           | ✅      | ✅  | 1007    |\n| `AllowMeBiometricsCapturingError`        | ✅      | ✅  | 1008    |\n| `AllowMeBiometricsResultError`           | ✅      | ✅  | 1009    |\n| `AllowMeBiometricsCancelledByUserError`  | ✅      | ✅  | 1010    |\n| `AllowMeBiometricsInvalidImagesError`    | ❌      | ✅  | 1011    |\n| `AllowMeBiometricsCameraPermissionError` | ✅      | ✅  | 1012    |\n| `AllowMeCanNotOpenFrontCameraError`      | ✅      | ❌  | 1013    |\n| `AllowMeGooglePayServicesError`          | ✅      | ❌  | 1014    |\n| `AllowMeFaceDetectionError`              | ✅      | ❌  | 1015    |\n| `AllowMeProviderError`                   | ✅      | ✅  | 1016    |\n| `AllowMeCanNotSaveImageError`            | ✅      | ❌  | 1017    |\n\n\\*500: Generic error send by iOS with a descriptive error message\n\n\\*\\*401: Unauthorized error in case the bridge calls this method from an\nunsupported brand (any other than Vivo).\n\nWhen one of these errors occurs, the promise will be rejected with an error with\nthis shape:\n\n```ts\nexport type AllowMeError = {\n    code: AllowMeErrorCode;\n    description?: string;\n};\n```\n\n#### Example\n\n```ts\ntry {\n    const {result, images} = await requestAllowMeBiometrics();\n} catch (error: AllowMeError) {\n    switch (error.code) {\n        case AllowMeSetupSdkError:\n            console.log('Setup error');\n            break;\n        case AllowMeUnauthorizedError:\n            console.log('Unauthorized error');\n            break;\n        // etc\n    }\n}\n```\n\n### getBiometricsAuthenticationStatus\n\n\u003ckbd\u003eApp version \u003e=25.7\u003c/kbd\u003e\n\nRetrieve information about the availability of Biometrics\n\n```ts\ngetBiometricsAuthenticationStatus: () =\u003e Promise\u003c{\n    result: 'DISABLED' | 'ENABLED' | 'DEVICE_HAS_NO_AUTHENTICATION',\n}\u003e;\n```\n\n#### Result description\n\n-   `'DISABLED'`: The device has an authentication method (device PIN code at\n    least, and biometrics optionally) but it has the biometrics option disabled\n    in the app\n-   `'ENABLED'`: The device has an authentication method (device PIN code at\n    least, and biometrics optionally) and it has the biometrics option enabled\n    in the app (it requires authentication when launching the app)\n-   `'DEVICE_HAS_NO_AUTHENTICATION'`: The device has not any authentication\n    method (it has no device PIN code neither biometrics)\n\n#### Error cases\n\n-   `404`: The bridge implementation does not support this feature\n-   `500`: User is not logged in\n\n## Error handling\n\nIf an uncontrolled error occurs, promise will be rejected with an error object:\n\n```ts\n{code: number, description: string}\n```\n\n## Debugging\n\nTo inspect the bridge traffic, you can use the `setLogger` method:\n\n```ts\nsetLogger((...args) =\u003e console.log(...args));\n```\n\n## License\n\nThis project is licensed under the terms of the MIT license. See the\n[LICENSE](LICENSE) file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelefonica%2Fwebview-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelefonica%2Fwebview-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelefonica%2Fwebview-bridge/lists"}