Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 0 additions & 121 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ Alternatively, you can import the library directly from a CDN:

### isWebViewBridgeAvailable

<kbd>Available in B2P App version >=24.10</kbd>

Returns true if WebView Bridge is available. Use this function to implement
fallbacks in case the bridge is not available.

Expand Down Expand Up @@ -106,8 +104,6 @@ const isIOSWebView = () =>

### requestContact

<kbd>Available in B2P App version >=25.5</kbd>

Show native picker UI in order to let the user select a contact.

- Android only: picker UI elements can be filtered by available phones
Expand Down Expand Up @@ -176,8 +172,6 @@ createCalendarEvent({

### share

<kbd>App version >=10.7</kbd> <kbd>Available in B2P App version >=25.5</kbd>

Invokes the native sharing mechanism of the device.

```ts
Expand Down Expand Up @@ -295,8 +289,6 @@ downloadBase64({
<kbd>App version >= 10.7: Partial support</kbd><br/> <kbd>App version >= 11.8:
expandedTitle</kbd><br/> <kbd>App version >= 14.8: Additional properties and
deprecations</kbd><br/> <kbd>App version >= 25.12: isButton</kbd><br/>
<kbd>Partial support in B2P App version <=24.10: title</kbd><br/> <kbd>Partial
support in B2P App version >=24.11: right actions</kbd><br/>

Customize WebView NavigationBar properties. You can set one or more properties
in a single call
Expand Down Expand Up @@ -502,8 +494,6 @@ nativeConfirm({

### nativeAlert

<kbd>Available in B2P App version >=24.10</kbd>

Show a native alert dialog.

If the bridge is not present (eg. showing the page in browser), fallbacks to a
Expand Down Expand Up @@ -564,8 +554,6 @@ nativeMessage({

### logEvent

<kbd>Available in B2P App version >=24.10</kbd>

Log an event to firebase

```ts
Expand Down Expand Up @@ -624,8 +612,6 @@ logEvent(yourEvent, {sanitize: false});

### setScreenName

<kbd>Available in B2P App version >=24.10</kbd>

Log the current screen name (or page name) to firebase

```ts
Expand All @@ -650,8 +636,6 @@ This will send the params as-is, without any transformation.

### setUserProperty

<kbd>Available in B2P App version >=24.10</kbd>

Set a user property to firebase

```ts
Expand Down Expand Up @@ -698,8 +682,6 @@ onNativeEvent(({event}) => {

### checkPermissionStatus

<kbd>App version >=11.4</kbd> <kbd>Available in B2P App version >=25.5</kbd>

Returns true if the app has the specific notifications permissions. You have to
pass feature and required params for this request.

Expand All @@ -725,8 +707,6 @@ checkPermissionStatus('notifications', {channelId: 'default'}).then(

### internalNavigation

<kbd>App version >=11.4</kbd> <kbd>Available in B2P App version >=25.5</kbd>

Init an internal and native navigation to a device specific feature

Avalaible features:
Expand All @@ -743,8 +723,6 @@ internalNavigation: (feature: string) => Promise<void>;

### dismiss

<kbd>App version >=11.5</kbd> <kbd>Available in B2P App version >=24.10</kbd>

Dismiss the current webview if possible and optionally navigate to another URL.
If we can't do the dismiss, for example, if the webview is one of the main tabs,
the optional URL won't be opened.
Expand Down Expand Up @@ -772,8 +750,6 @@ requestVibration('error');

### fetchContactsByPhone

<kbd>Available in B2P App version >=25.5</kbd>

Returns contacts info given an array of phone numbers.

```javascript
Expand All @@ -788,8 +764,6 @@ fetchContactsByPhone: (phoneNumbers: Array<string>) => Promise<Array<{

### addOrEditContact

<kbd>Available in B2P App version >=25.5</kbd>

Opens native UI to add or edit a contact in the device's phonebook.

```ts
Expand All @@ -816,19 +790,6 @@ addOrEditContact: (phoneNumber: string) => Promise<{
Once the user has added or updated the contact, native returns the new
information (all last values of every property).

### getAppDomain

<kbd>Available in B2P App version >=25.3</kbd>

Return info about appDomain

```ts
getAppDomain: () => Promise<{domain: string}>;
```

`domain`: the domain value of the environment that the app uses for handling
deeplinks.

### getAppMetadata

<kbd>App version >=11.8</kbd>
Expand Down Expand Up @@ -972,8 +933,6 @@ onSessionRenewed = (

### logout

<kbd>Available in B2P App version >=24.10</kbd>

A method that requests a user logout.

```ts
Expand Down Expand Up @@ -1001,8 +960,6 @@ getTopazValues = () => Promise<{syncId?: string}>

### showAppRating

<kbd>Available in B2P App version >=24.10</kbd>

Show native app rating dialog

<img height="550" src="doc/webview-bridge-app-rating-ios.png"><img height="550" src="doc/webview-bridge-alert-android.png">
Expand All @@ -1011,47 +968,6 @@ Show native app rating dialog
showAppRating = () => Promise<void>
```

### increaseAppRatingTrigger

<kbd>Available in B2P App version >=25.6</kbd>

App rating flow in B2P apps is only launched if specific rules are fulfilled.
Several of those rules are that X events of a given type have happened in the
webviews side.

This method is used to request native app to increase the appRating trigger
value for a specific key.

```ts
increaseAppRatingTrigger = (key: string) => Promise<void>
```

### resetAppRatingTrigger

<kbd>Available in B2P App version >=25.6</kbd>

App rating flow in B2P apps is only launched if specific rules are fulfilled.
Several of those rules are that X events of a given type have happened in the
webviews side.

This method is used to request native app to reset the appRating trigger value
for a specific key

```ts
resetAppRatingTrigger = (key: string) => Promise<void>
```

### appRatingRemindMeLater

<kbd>Available in B2P App version >=25.6 (Android only)</kbd>

Notify the native app that a user has selected "Remind me later" in the app
rating flow

```ts
appRatingRemindMeLater = () => Promise<void>
```

### bottomSheet

<kbd>App version >=13.8</kbd>
Expand Down Expand Up @@ -1310,8 +1226,6 @@ focusNavbar: () => Promise<{

### openOnboarding

<kbd>Available in B2P App version >=24.10</kbd>

Opens the app Onboarding (as if it where the first time the user logs in)

```ts
Expand Down Expand Up @@ -1657,41 +1571,6 @@ isQualtricsInterceptAvailableForUser: ({interceptId: string}) => Promise<{isAvai
}
```

### refreshNavBar

<kbd>Available in B2P App version >=25.3</kbd>

Method that allows WebView to refresh the navigation bars that are retrieved by
Visual Modules API

```ts
refreshNavBar: ({
moduleId?: string,
productId?: string
}) => Promise<void>;
```

where

- `moduleId` is an optional parameter
- If it is not included, it means the app will refresh top and bottom bar
- If it is included, it should be the same values used for Visual Modules
API and the app will request to refresh only the indicated bar
- `productId` is an optional parameter
- If it is not included, visual modules is requested as it is today, just
with the userID as query param plus the `moduleId`
- If it is included, visual modules will be requested for the current
userID and for the `productId`

#### Example

```ts
refreshNavBar({
moduleId: 'bottombar',
productId: 'ID_00fe00a87b2',
});
```

### requestAllowMeBiometrics

<kbd>App version >=25.3</kbd>
Expand Down
10 changes: 2 additions & 8 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export {
downloadBase64,
getBatteryInfo,
getInstallationId,
getAppDomain,
getBiometricsAuthenticationStatus,
setBiometricsAuthenticationStatus,
openOcrScanner,
Expand Down Expand Up @@ -67,7 +66,7 @@ export {
addOrEditContact,
} from './src/contacts';

export {highlightNavigationTab, refreshNavBar} from './src/navigation-tabs';
export {highlightNavigationTab} from './src/navigation-tabs';

export {
logEvent,
Expand All @@ -86,12 +85,7 @@ export type {TrackingEvent, CustomDimensionIdx} from './src/analytics';

export {renewSession, onSessionRenewed, logout} from './src/sessions';

export {
showAppRating,
increaseAppRatingTrigger,
resetAppRatingTrigger,
appRatingRemindMeLater,
} from './src/app-rating';
export {showAppRating} from './src/app-rating';

export {
bottomSheet,
Expand Down
64 changes: 1 addition & 63 deletions src/__tests__/app-rating-test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import {
showAppRating,
increaseAppRatingTrigger,
resetAppRatingTrigger,
appRatingRemindMeLater,
} from '../app-rating';
import {showAppRating} from '../app-rating';
import {
createFakeAndroidPostMessage,
removeFakeAndroidPostMessage,
} from './fake-post-message';

const ANY_TRIGGER_KEY = 'topupSuccess';

Check warning on line 7 in src/__tests__/app-rating-test.ts

View workflow job for this annotation

GitHub Actions / CI on NodeJS v16 and windows-latest

'ANY_TRIGGER_KEY' is assigned a value but never used

Check warning on line 7 in src/__tests__/app-rating-test.ts

View workflow job for this annotation

GitHub Actions / CI on NodeJS v16 and ubuntu-latest

'ANY_TRIGGER_KEY' is assigned a value but never used

afterEach(() => {
removeFakeAndroidPostMessage();
Expand All @@ -31,60 +26,3 @@
done();
});
});

test('webapp requests to increase an app rating trigger', (done) => {
createFakeAndroidPostMessage({
checkMessage: (message) => {
expect(message.type).toBe('INCREASE_APP_RATING_TRIGGER');
expect(message.payload).toEqual({
key: ANY_TRIGGER_KEY,
});
},
getResponse: (message) => ({
type: message.type,
id: message.id,
}),
});

increaseAppRatingTrigger(ANY_TRIGGER_KEY).then((res) => {
expect(res).toBeUndefined();
done();
});
});

test('webapp requests to reset an app rating trigger', (done) => {
createFakeAndroidPostMessage({
checkMessage: (message) => {
expect(message.type).toBe('RESET_APP_RATING_TRIGGER');
expect(message.payload).toEqual({
key: ANY_TRIGGER_KEY,
});
},
getResponse: (message) => ({
type: message.type,
id: message.id,
}),
});

resetAppRatingTrigger(ANY_TRIGGER_KEY).then((res) => {
expect(res).toBeUndefined();
done();
});
});

test('webapp notifies user "Remind me later" on app rating', (done) => {
createFakeAndroidPostMessage({
checkMessage: (message) => {
expect(message.type).toBe('APP_RATING_REMIND_ME_LATER');
},
getResponse: (message) => ({
type: message.type,
id: message.id,
}),
});

appRatingRemindMeLater().then((res) => {
expect(res).toBeUndefined();
done();
});
});
22 changes: 0 additions & 22 deletions src/__tests__/device-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
getBatteryInfo,
} from '../../index';
import {
getAppDomain,
getBiometricsAuthenticationStatus,
getInstallationId,
setBiometricsAuthenticationStatus,
Expand Down Expand Up @@ -513,27 +512,6 @@ test('getInstallationId', async () => {
});
});

test('getAppDomain', async () => {
createFakeWebKitPostMessage({
checkMessage: (msg) => {
expect(msg.type).toBe('GET_APP_DOMAIN');
},
getResponse: (msg) => ({
type: 'GET_APP_DOMAIN',
id: msg.id,
payload: {
domain: 'https://example.com',
},
}),
});

const res = await getAppDomain();

expect(res).toEqual({
domain: 'https://example.com',
});
});

test('getBiometricsAuthenticationStatus', async () => {
createFakeWebKitPostMessage({
checkMessage: (msg) => {
Expand Down
Loading